2 dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present)
4 dnl From Japhar. Report changes to japhar@hungry.com
6 AC_DEFUN([JAPHAR_GREP_CFLAGS],
8 "$1" | "$1 "* | *" $1" | *" $1 "* )
9 ifelse($#, 3, [$3], [:])
18 dnl Test for __attribute__ ((unused))
19 dnl Based on code from the tcpdump version 3.7.2 source.
22 AC_DEFUN([AC_C___ATTRIBUTE__], [
23 AC_MSG_CHECKING(for __attribute__)
24 AC_CACHE_VAL(ac_cv___attribute__, [
27 static void foo (void) __attribute__ ((unused));
38 ac_cv___attribute__=yes,
39 ac_cv___attribute__=no)])
40 if test "$ac_cv___attribute__" = "yes"; then
41 AC_DEFINE(UNUSED, __attribute__ ((unused)), [define if your compiler has __att
46 AC_MSG_RESULT($ac_cv___attribute__)
49 dnl Autoconf macros for libprelude
52 # Modified for LIBPRELUDE -- Yoann Vandoorselaere
53 # Modified for LIBGNUTLS -- nmav
54 # Configure paths for LIBGCRYPT
55 # Shamelessly stolen from the one of XDELTA by Owen Taylor
56 # Werner Koch 99-12-09
58 dnl AM_PATH_LIBPRELUDE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
59 dnl Test for libprelude, and define LIBPRELUDE_PREFIX, LIBPRELUDE_CFLAGS, LIBPRELUDE_PTHREAD_CFLAGS,
60 dnl LIBPRELUDE_LDFLAGS, and LIBPRELUDE_LIBS
62 AC_DEFUN([AM_PATH_LIBPRELUDE],
64 dnl Get the cflags and libraries from the libprelude-config script
66 AC_ARG_WITH(libprelude-prefix,
67 [ --with-libprelude-prefix=PFX Prefix where libprelude is installed (optional)],
68 libprelude_config_prefix="$withval", libprelude_config_prefix="")
70 if test x$libprelude_config_prefix != x ; then
71 if test x${LIBPRELUDE_CONFIG+set} != xset ; then
72 LIBPRELUDE_CONFIG=$libprelude_config_prefix/bin/libprelude-config
76 AC_PATH_PROG(LIBPRELUDE_CONFIG, libprelude-config, no)
77 min_libprelude_version=ifelse([$1], ,0.1.0,$1)
78 AC_MSG_CHECKING(for libprelude - version >= $min_libprelude_version)
80 if test "$LIBPRELUDE_CONFIG" = "no" ; then
83 LIBPRELUDE_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --cflags`
84 LIBPRELUDE_PTHREAD_CFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --pthread-cflags`
85 LIBPRELUDE_LDFLAGS=`$LIBPRELUDE_CONFIG $libprelude_config_args --ldflags`
86 LIBPRELUDE_LIBS=`$LIBPRELUDE_CONFIG $libprelude_config_args --libs`
87 LIBPRELUDE_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --prefix`
88 LIBPRELUDE_CONFIG_PREFIX=`$LIBPRELUDE_CONFIG $libprelude_config_args --config-prefix`
89 libprelude_config_version=`$LIBPRELUDE_CONFIG $libprelude_config_args --version`
92 ac_save_CFLAGS="$CFLAGS"
93 ac_save_LDFLAGS="$LDFLAGS"
95 CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
96 LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
97 LIBS="$LIBS $LIBPRELUDE_LIBS"
99 dnl Now check if the installed libprelude is sufficiently new. Also sanity
100 dnl checks the results of libprelude-config to some extent
102 rm -f conf.libpreludetest
107 #include <libprelude/prelude.h>
112 system ("touch conf.libpreludetest");
114 if( strcmp( prelude_check_version(NULL), "$libprelude_config_version" ) )
116 printf("\n*** 'libprelude-config --version' returned %s, but LIBPRELUDE (%s)\n",
117 "$libprelude_config_version", prelude_check_version(NULL) );
118 printf("*** was found! If libprelude-config was correct, then it is best\n");
119 printf("*** to remove the old version of LIBPRELUDE. You may also be able to fix the error\n");
120 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
121 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
122 printf("*** required on your system.\n");
123 printf("*** If libprelude-config was wrong, set the environment variable LIBPRELUDE_CONFIG\n");
124 printf("*** to point to the correct copy of libprelude-config, and remove the file config.cache\n");
125 printf("*** before re-running configure\n");
127 else if ( strcmp(prelude_check_version(NULL), LIBPRELUDE_VERSION ) )
129 printf("\n*** LIBPRELUDE header file (version %s) does not match\n", LIBPRELUDE_VERSION);
130 printf("*** library (version %s)\n", prelude_check_version(NULL) );
134 if ( prelude_check_version( "$min_libprelude_version" ) )
140 printf("no\n*** An old version of LIBPRELUDE (%s) was found.\n",
141 prelude_check_version(NULL) );
142 printf("*** You need a version of LIBPRELUDE newer than %s. The latest version of\n",
143 "$min_libprelude_version" );
144 printf("*** LIBPRELUDE is always available from http://www.prelude-ids.org/download/releases.\n");
146 printf("*** If you have already installed a sufficiently new version, this error\n");
147 printf("*** probably means that the wrong copy of the libprelude-config shell script is\n");
148 printf("*** being found. The easiest way to fix this is to remove the old version\n");
149 printf("*** of LIBPRELUDE, but you can also set the LIBPRELUDE_CONFIG environment to point to the\n");
150 printf("*** correct copy of libprelude-config. (In this case, you will have to\n");
151 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
152 printf("*** so that the correct libraries are found at run-time))\n");
157 ],, no_libprelude=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
158 CFLAGS="$ac_save_CFLAGS"
160 LDFLAGS="$ac_save_LDFLAGS"
163 if test "x$no_libprelude" = x ; then
165 ifelse([$2], , :, [$2])
167 if test -f conf.libpreludetest ; then
172 if test "$LIBPRELUDE_CONFIG" = "no" ; then
173 echo "*** The libprelude-config script installed by LIBPRELUDE could not be found"
174 echo "*** If LIBPRELUDE was installed in PREFIX, make sure PREFIX/bin is in"
175 echo "*** your path, or set the LIBPRELUDE_CONFIG environment variable to the"
176 echo "*** full path to libprelude-config."
178 if test -f conf.libpreludetest ; then
181 echo "*** Could not run libprelude test program, checking why..."
182 CFLAGS="$CFLAGS $LIBPRELUDE_CFLAGS"
183 LDFLAGS="$LDFLAGS $LIBPRELUDE_LDFLAGS"
184 LIBS="$LIBS $LIBPRELUDE_LIBS"
189 #include <libprelude/prelude.h>
190 ], [ return !!prelude_check_version(NULL); ],
191 [ echo "*** The test program compiled, but did not run. This usually means"
192 echo "*** that the run-time linker is not finding LIBPRELUDE or finding the wrong"
193 echo "*** version of LIBPRELUDE. If it is not finding LIBPRELUDE, you'll need to set your"
194 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
195 echo "*** to the installed location Also, make sure you have run ldconfig if that"
196 echo "*** is required on your system"
198 echo "*** If you have an old version installed, it is best to remove it, although"
199 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
201 [ echo "*** The test program failed to compile or link. See the file config.log for the"
202 echo "*** exact error that occured. This usually means LIBPRELUDE was incorrectly installed"
203 echo "*** or that you have moved LIBPRELUDE since it was installed. In the latter case, you"
204 echo "*** may want to edit the libprelude-config script: $LIBPRELUDE_CONFIG" ])
205 CFLAGS="$ac_save_CFLAGS"
206 LDFLAGS="$ac_save_LDFLAGS"
211 LIBPRELUDE_LDFLAGS=""
213 ifelse([$3], , :, [$3])
215 rm -f conf.libpreludetest
216 AC_SUBST(LIBPRELUDE_CFLAGS)
217 AC_SUBST(LIBPRELUDE_PTHREAD_CFLAGS)
218 AC_SUBST(LIBPRELUDE_LDFLAGS)
219 AC_SUBST(LIBPRELUDE_LIBS)
220 AC_SUBST(LIBPRELUDE_PREFIX)
221 AC_SUBST(LIBPRELUDE_CONFIG_PREFIX)
224 dnl *-*wedit:notab*-* Please keep this as the last line.