Blame m4/libprelude.m4

Packit Service b29381
dnl Autoconf macros for libprelude
Packit Service b29381
dnl $id$
Packit Service b29381
Packit Service b29381
# Modified for LIBPRELUDE -- Yoann Vandoorselaere
Packit Service b29381
# Modified for LIBGNUTLS -- nmav
Packit Service b29381
# Configure paths for LIBGCRYPT
Packit Service b29381
# Shamelessly stolen from the one of XDELTA by Owen Taylor
Packit Service b29381
# Werner Koch   99-12-09
Packit Service b29381
Packit Service b29381
dnl AM_PATH_LIBPRELUDE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
Packit Service b29381
dnl Test for libprelude, and define LIBPRELUDE_PREFIX, LIBPRELUDE_CFLAGS, LIBPRELUDE_PTHREAD_CFLAGS,
Packit Service b29381
dnl LIBPRELUDE_LDFLAGS, and LIBPRELUDE_LIBS
Packit Service b29381
dnl
Packit Service b29381
AC_DEFUN([AM_PATH_LIBPRELUDE],
Packit Service b29381
[dnl
Packit Service b29381
dnl Get the cflags and libraries from the libprelude-config script
Packit Service b29381
dnl
Packit Service b29381
AC_ARG_WITH(libprelude-prefix, AC_HELP_STRING(--with-libprelude-prefix=PFX,
Packit Service b29381
	    Prefix where libprelude is installed (optional)),
Packit Service b29381
            libprelude_config_prefix="$withval", libprelude_config_prefix="")
Packit Service b29381
Packit Service b29381
  if test x$libprelude_config_prefix != x ; then
Packit Service b29381
     if test x${LIBPRELUDE_CONFIG+set} != xset ; then
Packit Service b29381
        LIBPRELUDE_CONFIG=$libprelude_config_prefix/bin/libprelude-config
Packit Service b29381
     fi
Packit Service b29381
  fi
Packit Service b29381
Packit Service b29381
  AC_PATH_PROG(LIBPRELUDE_CONFIG, libprelude-config, no)
Packit Service b29381
  min_libprelude_version=ifelse([$1], ,0.1.0,$1)
Packit Service b29381
  AC_MSG_CHECKING(for libprelude - version >= $min_libprelude_version)
Packit Service b29381
  no_libprelude=""
Packit Service b29381
  if test "$LIBPRELUDE_CONFIG" = "no" ; then
Packit Service b29381
    no_libprelude=yes
Packit Service b29381
  else
Packit Service b29381
    LIBPRELUDE_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --cflags`
Packit Service b29381
    LIBPRELUDE_PTHREAD_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --pthread-cflags`
Packit Service b29381
    LIBPRELUDE_LDFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --ldflags`
Packit Service b29381
    LIBPRELUDE_LIBS=`$LIBPRELUDE_CONFIG $libprelude_config_args --libs`
Packit Service b29381
    LIBPRELUDE_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --prefix`
Packit Service b29381
    LIBPRELUDE_CONFIG_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --config-prefix`
Packit Service b29381
    libprelude_config_version=`$LIBPRELUDE_CONFIG $libprelude_config_args --version`
Packit Service b29381
Packit Service b29381
Packit Service b29381
      ac_save_CFLAGS="$CFLAGS"
Packit Service b29381
      ac_save_LDFLAGS="$LDFLAGS"
Packit Service b29381
      ac_save_LIBS="$LIBS"
Packit Service b29381
      CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
Packit Service b29381
      LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
Packit Service b29381
      LIBS="$LIBS $LIBPRELUDE_LIBS"
Packit Service b29381
dnl
Packit Service b29381
dnl Now check if the installed libprelude is sufficiently new. Also sanity
Packit Service b29381
dnl checks the results of libprelude-config to some extent
Packit Service b29381
dnl
Packit Service b29381
      rm -f conf.libpreludetest
Packit Service b29381
      AC_TRY_RUN([
Packit Service b29381
#include <stdio.h>
Packit Service b29381
#include <stdlib.h>
Packit Service b29381
#include <string.h>
Packit Service b29381
#include <libprelude/prelude.h>
Packit Service b29381
Packit Service b29381
int
Packit Service b29381
main ()
Packit Service b29381
{
Packit Service b29381
    system ("touch conf.libpreludetest");
Packit Service b29381
Packit Service b29381
    if( strcmp( prelude_check_version(NULL), "$libprelude_config_version" ) )
Packit Service b29381
    {
Packit Service b29381
      printf("\n*** 'libprelude-config --version' returned %s, but LIBPRELUDE (%s)\n",
Packit Service b29381
             "$libprelude_config_version", prelude_check_version(NULL) );
Packit Service b29381
      printf("*** was found! If libprelude-config was correct, then it is best\n");
Packit Service b29381
      printf("*** to remove the old version of LIBPRELUDE. You may also be able to fix the error\n");
Packit Service b29381
      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
Packit Service b29381
      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
Packit Service b29381
      printf("*** required on your system.\n");
Packit Service b29381
      printf("*** If libprelude-config was wrong, set the environment variable LIBPRELUDE_CONFIG\n");
Packit Service b29381
      printf("*** to point to the correct copy of libprelude-config, and remove the file config.cache\n");
Packit Service b29381
      printf("*** before re-running configure\n");
Packit Service b29381
    }
Packit Service b29381
    else if ( strcmp(prelude_check_version(NULL), LIBPRELUDE_VERSION ) )
Packit Service b29381
    {
Packit Service b29381
      printf("\n*** LIBPRELUDE header file (version %s) does not match\n", LIBPRELUDE_VERSION);
Packit Service b29381
      printf("*** library (version %s)\n", prelude_check_version(NULL) );
Packit Service b29381
    }
Packit Service b29381
    else
Packit Service b29381
    {
Packit Service b29381
      if ( prelude_check_version( "$min_libprelude_version" ) )
Packit Service b29381
      {
Packit Service b29381
        return 0;
Packit Service b29381
      }
Packit Service b29381
     else
Packit Service b29381
      {
Packit Service b29381
        printf("no\n*** An old version of LIBPRELUDE (%s) was found.\n",
Packit Service b29381
                prelude_check_version(NULL) );
Packit Service b29381
        printf("*** You need a version of LIBPRELUDE newer than %s. The latest version of\n",
Packit Service b29381
               "$min_libprelude_version" );
Packit Service b29381
        printf("*** LIBPRELUDE is always available from http://www.prelude-ids.org/download/releases.\n");
Packit Service b29381
        printf("*** \n");
Packit Service b29381
        printf("*** If you have already installed a sufficiently new version, this error\n");
Packit Service b29381
        printf("*** probably means that the wrong copy of the libprelude-config shell script is\n");
Packit Service b29381
        printf("*** being found. The easiest way to fix this is to remove the old version\n");
Packit Service b29381
        printf("*** of LIBPRELUDE, but you can also set the LIBPRELUDE_CONFIG environment to point to the\n");
Packit Service b29381
        printf("*** correct copy of libprelude-config. (In this case, you will have to\n");
Packit Service b29381
        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
Packit Service b29381
        printf("*** so that the correct libraries are found at run-time))\n");
Packit Service b29381
      }
Packit Service b29381
    }
Packit Service b29381
  return 1;
Packit Service b29381
}
Packit Service b29381
],, no_libprelude=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
Packit Service b29381
       CFLAGS="$ac_save_CFLAGS"
Packit Service b29381
       LIBS="$ac_save_LIBS"
Packit Service b29381
       LDFLAGS="$ac_save_LDFLAGS"
Packit Service b29381
  fi
Packit Service b29381
Packit Service b29381
  if test "x$no_libprelude" = x ; then
Packit Service b29381
     AC_MSG_RESULT(yes)
Packit Service b29381
     ifelse([$2], , :, [$2])
Packit Service b29381
  else
Packit Service b29381
     if test -f conf.libpreludetest ; then
Packit Service b29381
        :
Packit Service b29381
     else
Packit Service b29381
        AC_MSG_RESULT(no)
Packit Service b29381
     fi
Packit Service b29381
     if test "$LIBPRELUDE_CONFIG" = "no" ; then
Packit Service b29381
       echo "*** The libprelude-config script installed by LIBPRELUDE could not be found"
Packit Service b29381
       echo "*** If LIBPRELUDE was installed in PREFIX, make sure PREFIX/bin is in"
Packit Service b29381
       echo "*** your path, or set the LIBPRELUDE_CONFIG environment variable to the"
Packit Service b29381
       echo "*** full path to libprelude-config."
Packit Service b29381
     else
Packit Service b29381
       if test -f conf.libpreludetest ; then
Packit Service b29381
        :
Packit Service b29381
       else
Packit Service b29381
          echo "*** Could not run libprelude test program, checking why..."
Packit Service b29381
          CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
Packit Service b29381
	  LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
Packit Service b29381
          LIBS="$LIBS $LIBPRELUDE_LIBS"
Packit Service b29381
          AC_TRY_LINK([
Packit Service b29381
#include <stdio.h>
Packit Service b29381
#include <stdlib.h>
Packit Service b29381
#include <string.h>
Packit Service b29381
#include <libprelude/prelude.h>
Packit Service b29381
],      [ return !!prelude_check_version(NULL); ],
Packit Service b29381
        [ echo "*** The test program compiled, but did not run. This usually means"
Packit Service b29381
          echo "*** that the run-time linker is not finding LIBPRELUDE or finding the wrong"
Packit Service b29381
          echo "*** version of LIBPRELUDE. If it is not finding LIBPRELUDE, you'll need to set your"
Packit Service b29381
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
Packit Service b29381
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
Packit Service b29381
          echo "*** is required on your system"
Packit Service b29381
          echo "***"
Packit Service b29381
          echo "*** If you have an old version installed, it is best to remove it, although"
Packit Service b29381
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
Packit Service b29381
          echo "***" ],
Packit Service b29381
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
Packit Service b29381
          echo "*** exact error that occured. This usually means LIBPRELUDE was incorrectly installed"
Packit Service b29381
          echo "*** or that you have moved LIBPRELUDE since it was installed. In the latter case, you"
Packit Service b29381
          echo "*** may want to edit the libprelude-config script: $LIBPRELUDE_CONFIG" ])
Packit Service b29381
          CFLAGS="$ac_save_CFLAGS"
Packit Service b29381
	  LDFLAGS="$ac_save_LDFLAGS"
Packit Service b29381
          LIBS="$ac_save_LIBS"
Packit Service b29381
       fi
Packit Service b29381
     fi
Packit Service b29381
     LIBPRELUDE_CFLAGS=""
Packit Service b29381
     LIBPRELUDE_LDFLAGS=""
Packit Service b29381
     LIBPRELUDE_LIBS=""
Packit Service b29381
     ifelse([$3], , :, [$3])
Packit Service b29381
  fi
Packit Service b29381
  rm -f conf.libpreludetest
Packit Service b29381
  AC_SUBST(LIBPRELUDE_CFLAGS)
Packit Service b29381
  AC_SUBST(LIBPRELUDE_PTHREAD_CFLAGS)
Packit Service b29381
  AC_SUBST(LIBPRELUDE_LDFLAGS)
Packit Service b29381
  AC_SUBST(LIBPRELUDE_LIBS)
Packit Service b29381
  AC_SUBST(LIBPRELUDE_PREFIX)
Packit Service b29381
  AC_SUBST(LIBPRELUDE_CONFIG_PREFIX)
Packit Service b29381
])
Packit Service b29381
Packit Service b29381
dnl *-*wedit:notab*-*  Please keep this as the last line.