1 dnl Autoconf macros for libprelude
4 # Modified for LIBPRELUDE -- Yoann Vandoorselaere
5 # Modified for LIBGNUTLS -- nmav
6 # Configure paths for LIBGCRYPT
7 # Shamelessly stolen from the one of XDELTA by Owen Taylor
10 dnl AM_PATH_LIBPRELUDE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
11 dnl Test for libprelude, and define LIBPRELUDE_PREFIX, LIBPRELUDE_CFLAGS, LIBPRELUDE_PTHREAD_CFLAGS,
12 dnl LIBPRELUDE_LDFLAGS, and LIBPRELUDE_LIBS
14 AC_DEFUN([AM_PATH_LIBPRELUDE],
16 dnl Get the cflags and libraries from the libprelude-config script
18 AC_ARG_WITH(libprelude-prefix, AC_HELP_STRING(--with-libprelude-prefix=PFX,
19 Prefix where libprelude is installed (optional)),
20 libprelude_config_prefix="$withval", libprelude_config_prefix="")
22 if test x$libprelude_config_prefix != x ; then
23 if test x${LIBPRELUDE_CONFIG+set} != xset ; then
24 LIBPRELUDE_CONFIG=$libprelude_config_prefix/bin/libprelude-config
28 AC_PATH_PROG(LIBPRELUDE_CONFIG, libprelude-config, no)
29 min_libprelude_version=ifelse([$1], ,0.1.0,$1)
30 AC_MSG_CHECKING(for libprelude - version >= $min_libprelude_version)
32 if test "$LIBPRELUDE_CONFIG" = "no" ; then
35 LIBPRELUDE_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --cflags`
36 LIBPRELUDE_PTHREAD_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --pthread-cflags`
37 LIBPRELUDE_LDFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --ldflags`
38 LIBPRELUDE_LIBS=`$LIBPRELUDE_CONFIG $libprelude_config_args --libs`
39 LIBPRELUDE_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --prefix`
40 LIBPRELUDE_CONFIG_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --config-prefix`
41 libprelude_config_version=`$LIBPRELUDE_CONFIG $libprelude_config_args --version`
44 ac_save_CFLAGS="$CFLAGS"
45 ac_save_LDFLAGS="$LDFLAGS"
47 CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
48 LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
49 LIBS="$LIBS $LIBPRELUDE_LIBS"
51 dnl Now check if the installed libprelude is sufficiently new. Also sanity
52 dnl checks the results of libprelude-config to some extent
54 rm -f conf.libpreludetest
59 #include <libprelude/prelude.h>
64 system ("touch conf.libpreludetest");
66 if( strcmp( prelude_check_version(NULL), "$libprelude_config_version" ) )
68 printf("\n*** 'libprelude-config --version' returned %s, but LIBPRELUDE (%s)\n",
69 "$libprelude_config_version", prelude_check_version(NULL) );
70 printf("*** was found! If libprelude-config was correct, then it is best\n");
71 printf("*** to remove the old version of LIBPRELUDE. You may also be able to fix the error\n");
72 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
73 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
74 printf("*** required on your system.\n");
75 printf("*** If libprelude-config was wrong, set the environment variable LIBPRELUDE_CONFIG\n");
76 printf("*** to point to the correct copy of libprelude-config, and remove the file config.cache\n");
77 printf("*** before re-running configure\n");
79 else if ( strcmp(prelude_check_version(NULL), LIBPRELUDE_VERSION ) )
81 printf("\n*** LIBPRELUDE header file (version %s) does not match\n", LIBPRELUDE_VERSION);
82 printf("*** library (version %s)\n", prelude_check_version(NULL) );
86 if ( prelude_check_version( "$min_libprelude_version" ) )
92 printf("no\n*** An old version of LIBPRELUDE (%s) was found.\n",
93 prelude_check_version(NULL) );
94 printf("*** You need a version of LIBPRELUDE newer than %s. The latest version of\n",
95 "$min_libprelude_version" );
96 printf("*** LIBPRELUDE is always available from http://www.prelude-ids.org/download/releases.\n");
98 printf("*** If you have already installed a sufficiently new version, this error\n");
99 printf("*** probably means that the wrong copy of the libprelude-config shell script is\n");
100 printf("*** being found. The easiest way to fix this is to remove the old version\n");
101 printf("*** of LIBPRELUDE, but you can also set the LIBPRELUDE_CONFIG environment to point to the\n");
102 printf("*** correct copy of libprelude-config. (In this case, you will have to\n");
103 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
104 printf("*** so that the correct libraries are found at run-time))\n");
109 ],, no_libprelude=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
110 CFLAGS="$ac_save_CFLAGS"
112 LDFLAGS="$ac_save_LDFLAGS"
115 if test "x$no_libprelude" = x ; then
117 ifelse([$2], , :, [$2])
119 if test -f conf.libpreludetest ; then
124 if test "$LIBPRELUDE_CONFIG" = "no" ; then
125 echo "*** The libprelude-config script installed by LIBPRELUDE could not be found"
126 echo "*** If LIBPRELUDE was installed in PREFIX, make sure PREFIX/bin is in"
127 echo "*** your path, or set the LIBPRELUDE_CONFIG environment variable to the"
128 echo "*** full path to libprelude-config."
130 if test -f conf.libpreludetest ; then
133 echo "*** Could not run libprelude test program, checking why..."
134 CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
135 LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
136 LIBS="$LIBS $LIBPRELUDE_LIBS"
141 #include <libprelude/prelude.h>
142 ], [ return !!prelude_check_version(NULL); ],
143 [ echo "*** The test program compiled, but did not run. This usually means"
144 echo "*** that the run-time linker is not finding LIBPRELUDE or finding the wrong"
145 echo "*** version of LIBPRELUDE. If it is not finding LIBPRELUDE, you'll need to set your"
146 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
147 echo "*** to the installed location Also, make sure you have run ldconfig if that"
148 echo "*** is required on your system"
150 echo "*** If you have an old version installed, it is best to remove it, although"
151 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
153 [ echo "*** The test program failed to compile or link. See the file config.log for the"
154 echo "*** exact error that occured. This usually means LIBPRELUDE was incorrectly installed"
155 echo "*** or that you have moved LIBPRELUDE since it was installed. In the latter case, you"
156 echo "*** may want to edit the libprelude-config script: $LIBPRELUDE_CONFIG" ])
157 CFLAGS="$ac_save_CFLAGS"
158 LDFLAGS="$ac_save_LDFLAGS"
163 LIBPRELUDE_LDFLAGS=""
165 ifelse([$3], , :, [$3])
167 rm -f conf.libpreludetest
168 AC_SUBST(LIBPRELUDE_CFLAGS)
169 AC_SUBST(LIBPRELUDE_PTHREAD_CFLAGS)
170 AC_SUBST(LIBPRELUDE_LDFLAGS)
171 AC_SUBST(LIBPRELUDE_LIBS)
172 AC_SUBST(LIBPRELUDE_PREFIX)
173 AC_SUBST(LIBPRELUDE_CONFIG_PREFIX)
176 dnl *-*wedit:notab*-* Please keep this as the last line.