diff options
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 438 |
1 files changed, 218 insertions, 220 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 823862ee539b..40b586648d5f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.113.2.3 2008-09-25 21:50:04 guy Exp $ (LBL) +dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.116 2008-09-25 21:45:50 guy Exp $ (LBL) dnl dnl Copyright (c) 1995, 1996, 1997, 1998 dnl The Regents of the University of California. All rights reserved. @@ -23,27 +23,23 @@ dnl LBL autoconf macros dnl dnl -dnl Determine which compiler we're using (cc or gcc) -dnl If using gcc, determine the version number -dnl If using cc, require that it support ansi prototypes -dnl If using gcc, use -O2 (otherwise use -O) -dnl If using cc, explicitly specify /usr/local/include -dnl -dnl usage: -dnl -dnl AC_LBL_C_INIT(copt, incls) +dnl Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC. dnl -dnl results: +dnl It appears that newer versions of autoconf (2.64 and later) will, +dnl if you use AC_TRY_COMPILE in a macro, stick AC_PROG_CC at the +dnl beginning of the macro, even if the macro itself calls AC_PROG_CC. +dnl See the "Prerequisite Macros" and "Expanded Before Required" sections +dnl in the Autoconf documentation. dnl -dnl $1 (copt set) -dnl $2 (incls set) -dnl CC -dnl LDFLAGS -dnl ac_cv_lbl_gcc_vers -dnl LBL_CFLAGS +dnl This causes a steaming heap of fail in our case, as we were, in +dnl AC_LBL_C_INIT, doing the tests we now do in AC_LBL_C_INIT_BEFORE_CC, +dnl calling AC_PROG_CC, and then doing the tests we now do in +dnl AC_LBL_C_INIT. Now, we run AC_LBL_C_INIT_BEFORE_CC, AC_PROG_CC, +dnl and AC_LBL_C_INIT at the top level. dnl -AC_DEFUN(AC_LBL_C_INIT, - [AC_PREREQ(2.12) +AC_DEFUN(AC_LBL_C_INIT_BEFORE_CC, + [AC_PREREQ(2.50) + AC_BEFORE([$0], [AC_LBL_C_INIT]) AC_BEFORE([$0], [AC_PROG_CC]) AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) AC_BEFORE([$0], [AC_LBL_DEVEL]) @@ -72,7 +68,33 @@ AC_DEFUN(AC_LBL_C_INIT, CC=cc export CC fi - AC_PROG_CC +]) + +dnl +dnl Determine which compiler we're using (cc or gcc) +dnl If using gcc, determine the version number +dnl If using cc, require that it support ansi prototypes +dnl If using gcc, use -O2 (otherwise use -O) +dnl If using cc, explicitly specify /usr/local/include +dnl +dnl usage: +dnl +dnl AC_LBL_C_INIT(copt, incls) +dnl +dnl results: +dnl +dnl $1 (copt set) +dnl $2 (incls set) +dnl CC +dnl LDFLAGS +dnl ac_cv_lbl_gcc_vers +dnl LBL_CFLAGS +dnl +AC_DEFUN(AC_LBL_C_INIT, + [AC_PREREQ(2.50) + AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) + AC_BEFORE([$0], [AC_LBL_DEVEL]) + AC_BEFORE([$0], [AC_LBL_SHLIBS_INIT]) if test "$GCC" = yes ; then if test "$SHLICC2" = yes ; then ac_cv_lbl_gcc_vers=2 @@ -117,8 +139,26 @@ AC_DEFUN(AC_LBL_C_INIT, AC_MSG_ERROR(see the INSTALL doc for more info) fi CFLAGS="$savedcflags" - V_CCOPT="-Aa $V_CCOPT" - AC_DEFINE(_HPUX_SOURCE) + $1="-Aa $$1" + AC_DEFINE(_HPUX_SOURCE,1,[needed on HP-UX]) + ;; + + osf*) + AC_MSG_CHECKING(for ansi mode in DEC compiler ($CC -std1)) + savedcflags="$CFLAGS" + CFLAGS="-std1" + AC_CACHE_VAL(ac_cv_lbl_cc_osf1_cc_std1, + AC_TRY_COMPILE( + [#include <sys/types.h>], + [int frob(int, char *)], + ac_cv_lbl_cc_osf1_cc_std1=yes, + ac_cv_lbl_cc_osf1_cc_std1=no)) + AC_MSG_RESULT($ac_cv_lbl_cc_osf1_cc_std1) + if test $ac_cv_lbl_cc_osf1_cc_std1 = no ; then + AC_MSG_ERROR(see the INSTALL doc for more info) + fi + CFLAGS="$savedcflags" + $1="-std1 $$1" ;; *) @@ -132,11 +172,15 @@ AC_DEFUN(AC_LBL_C_INIT, case "$host_os" in irix*) - V_CCOPT="$V_CCOPT -xansi -signed -O" + $1="$$1 -xansi -signed -O" ;; osf*) - V_CCOPT="$V_CCOPT -std1 -O" + # + # Presumed to be DEC OSF/1, Digital UNIX, or + # Tru64 UNIX. + # + $1="$$1 -O" ;; ultrix*) @@ -150,14 +194,14 @@ AC_DEFUN(AC_LBL_C_INIT, ac_cv_lbl_cc_const_proto=no)) AC_MSG_RESULT($ac_cv_lbl_cc_const_proto) if test $ac_cv_lbl_cc_const_proto = no ; then - AC_DEFINE(const,) + AC_DEFINE(const,[], + [to handle Ultrix compilers that don't support const in prototypes]) fi ;; esac fi ]) - # # Try compiling a sample of the type of code that appears in # gencode.c with "inline", "__inline__", and "__inline". @@ -167,8 +211,13 @@ AC_DEFUN(AC_LBL_C_INIT, # at least some versions of HP's C compiler can inline that, but can't # inline a function that returns a struct pointer. # +# Make sure we use the V_CCOPT flags, because some of those might +# disable inlining. +# AC_DEFUN(AC_LBL_C_INLINE, [AC_MSG_CHECKING(for inline) + save_CFLAGS="$CFLAGS" + CFLAGS="$V_CCOPT" AC_CACHE_VAL(ac_cv_lbl_inline, [ ac_cv_lbl_inline="" ac_lbl_cc_inline=no @@ -196,6 +245,7 @@ AC_DEFUN(AC_LBL_C_INLINE, if test "$ac_lbl_cc_inline" = yes ; then ac_cv_lbl_inline=$ac_lbl_inline fi]) + CFLAGS="$save_CFLAGS" if test ! -z "$ac_cv_lbl_inline" ; then AC_MSG_RESULT($ac_cv_lbl_inline) else @@ -238,9 +288,10 @@ AC_DEFUN(AC_LBL_LIBPCAP, libpcap=FAIL lastdir=FAIL places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \ - egrep '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'` + egrep '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT)?$'` for dir in $places $srcdir/../libpcap $srcdir/libpcap ; do - basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//'` + basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//' | \ + sed -e 's/-PRE-GIT$//' ` if test $lastdir = $basedir ; then dnl skip alphas when an actual release is present continue; @@ -254,43 +305,60 @@ AC_DEFUN(AC_LBL_LIBPCAP, done if test $libpcap = FAIL ; then AC_MSG_RESULT(not found) - AC_CHECK_LIB(pcap, main, libpcap="-lpcap") - if test $libpcap = FAIL ; then + + # + # Look for pcap-config. + # + AC_PATH_PROG(PCAP_CONFIG, pcap-config) + if test -n "$PCAP_CONFIG" ; then + # + # Found - use it to get the include flags for + # libpcap and the flags to link with libpcap. + # + $2="`\"$PCAP_CONFIG\" --cflags` $$2" + libpcap="`\"$PCAP_CONFIG\" --libs`" + else + # + # Not found; look for pcap. + # + AC_CHECK_LIB(pcap, main, libpcap="-lpcap") + if test $libpcap = FAIL ; then AC_MSG_ERROR(see the INSTALL doc for more info) - fi - dnl - dnl Some versions of Red Hat Linux put "pcap.h" in - dnl "/usr/include/pcap"; had the LBL folks done so, - dnl that would have been a good idea, but for - dnl the Red Hat folks to do so just breaks source - dnl compatibility with other systems. - dnl - dnl We work around this by assuming that, as we didn't - dnl find a local libpcap, libpcap is in /usr/lib or - dnl /usr/local/lib and that the corresponding header - dnl file is under one of those directories; if we don't - dnl find it in either of those directories, we check to - dnl see if it's in a "pcap" subdirectory of them and, - dnl if so, add that subdirectory to the "-I" list. - dnl - dnl (We now also put pcap.h in /usr/include/pcap, but we - dnl leave behind a /usr/include/pcap.h that includes it, - dnl so you can still just include <pcap.h>.) - dnl - AC_MSG_CHECKING(for extraneous pcap header directories) - if test \( ! -r /usr/local/include/pcap.h \) -a \ + fi + dnl + dnl Some versions of Red Hat Linux put "pcap.h" in + dnl "/usr/include/pcap"; had the LBL folks done so, + dnl that would have been a good idea, but for + dnl the Red Hat folks to do so just breaks source + dnl compatibility with other systems. + dnl + dnl We work around this by assuming that, as we didn't + dnl find a local libpcap, libpcap is in /usr/lib or + dnl /usr/local/lib and that the corresponding header + dnl file is under one of those directories; if we don't + dnl find it in either of those directories, we check to + dnl see if it's in a "pcap" subdirectory of them and, + dnl if so, add that subdirectory to the "-I" list. + dnl + dnl (We now also put pcap.h in /usr/include/pcap, but we + dnl leave behind a /usr/include/pcap.h that includes it, + dnl so you can still just include <pcap.h>.) + dnl + AC_MSG_CHECKING(for extraneous pcap header directories) + if test \( ! -r /usr/local/include/pcap.h \) -a \ \( ! -r /usr/include/pcap.h \); then - if test -r /usr/local/include/pcap/pcap.h; then - d="/usr/local/include/pcap" - elif test -r /usr/include/pcap/pcap.h; then - d="/usr/include/pcap" + if test -r /usr/local/include/pcap/pcap.h; then + d="/usr/local/include/pcap" + elif test -r /usr/include/pcap/pcap.h; then + d="/usr/include/pcap" + fi + fi + if test -z "$d" ; then + AC_MSG_RESULT(not found) + else + $2="-I$d $$2" + AC_MSG_RESULT(found -- -I$d added) fi - fi - if test -z "$d" ; then - AC_MSG_RESULT(not found) - else - $2="-I$d $$2" - AC_MSG_RESULT(found -- -I$d added) fi else $1=$libpcap @@ -304,26 +372,50 @@ AC_DEFUN(AC_LBL_LIBPCAP, AC_MSG_ERROR(cannot find pcap.h, see INSTALL) fi AC_MSG_RESULT($libpcap) + AC_PATH_PROG(PCAP_CONFIG, pcap-config,, $d) + if test -n "$PCAP_CONFIG"; then + # + # The libpcap directory has a pcap-config script. + # Use it to get any additioal libraries needed + # to link with the libpcap archive library in + # that directory + # + libpcap="$libpcap `\"$PCAP_CONFIG\" --additional-libs --static`" + fi fi LIBS="$libpcap $LIBS" - case "$host_os" in + if ! test -n "$PCAP_CONFIG" ; then + # + # We don't have pcap-config; find out any additional link flags + # we need. (If we have pcap-config, we assume it tells us what + # we need.) + # + case "$host_os" in - aix*) + aix*) + # + # If libpcap is DLPI-based, we have to use /lib/pse.exp if + # present, as we use the STREAMS routines. + # + # (XXX - true only if we're linking with a static libpcap?) + # pseexe="/lib/pse.exp" AC_MSG_CHECKING(for $pseexe) if test -f $pseexe ; then AC_MSG_RESULT(yes) LIBS="$LIBS -I:$pseexe" fi + + # + # If libpcap is BPF-based, we need "-lodm" and "-lcfg", as + # we use them to load the BPF module. # - # We need "-lodm" and "-lcfg", as libpcap requires them on - # AIX, and we just build a static libpcap.a and thus can't - # arrange that when you link with libpcap you automatically - # link with those libraries. + # (XXX - true only if we're linking with a static libpcap?) # LIBS="$LIBS -lodm -lcfg" ;; - esac + esac + fi dnl dnl Check for "pcap_list_datalinks()", "pcap_set_datalink()", @@ -383,14 +475,14 @@ AC_DEFUN(AC_LBL_TYPE_SIGNAL, [AC_BEFORE([$0], [AC_LBL_LIBPCAP]) AC_TYPE_SIGNAL if test "$ac_cv_type_signal" = void ; then - AC_DEFINE(RETSIGVAL,) + AC_DEFINE(RETSIGVAL,[],[return value of signal handlers]) else - AC_DEFINE(RETSIGVAL,(0)) + AC_DEFINE(RETSIGVAL,(0),[return value of signal handlers]) fi case "$host_os" in irix*) - AC_DEFINE(_BSD_SIGNALS) + AC_DEFINE(_BSD_SIGNALS,1,[get BSD semantics on Irix]) ;; *) @@ -439,65 +531,6 @@ AC_DEFUN(AC_LBL_FIXINCLUDES, fi]) dnl -dnl Check for flex, default to lex -dnl Require flex 2.4 or higher -dnl Check for bison, default to yacc -dnl Default to lex/yacc if both flex and bison are not available -dnl Define the yy prefix string if using flex and bison -dnl -dnl usage: -dnl -dnl AC_LBL_LEX_AND_YACC(lex, yacc, yyprefix) -dnl -dnl results: -dnl -dnl $1 (lex set) -dnl $2 (yacc appended) -dnl $3 (optional flex and bison -P prefix) -dnl -AC_DEFUN(AC_LBL_LEX_AND_YACC, - [AC_ARG_WITH(flex, [ --without-flex don't use flex]) - AC_ARG_WITH(bison, [ --without-bison don't use bison]) - if test "$with_flex" = no ; then - $1=lex - else - AC_CHECK_PROGS($1, flex, lex) - fi - if test "$$1" = flex ; then - # The -V flag was added in 2.4 - AC_MSG_CHECKING(for flex 2.4 or higher) - AC_CACHE_VAL(ac_cv_lbl_flex_v24, - if flex -V >/dev/null 2>&1; then - ac_cv_lbl_flex_v24=yes - else - ac_cv_lbl_flex_v24=no - fi) - AC_MSG_RESULT($ac_cv_lbl_flex_v24) - if test $ac_cv_lbl_flex_v24 = no ; then - s="2.4 or higher required" - AC_MSG_WARN(ignoring obsolete flex executable ($s)) - $1=lex - fi - fi - if test "$with_bison" = no ; then - $2=yacc - else - AC_CHECK_PROGS($2, bison, yacc) - fi - if test "$$2" = bison ; then - $2="$$2 -y" - fi - if test "$$1" != lex -a "$$2" = yacc -o "$$1" = lex -a "$$2" != yacc ; then - AC_MSG_WARN(don't have both flex and bison; reverting to lex/yacc) - $1=lex - $2=yacc - fi - if test "$$1" = flex -a -n "$3" ; then - $1="$$1 -P$3" - $2="$$2 -p $3" - fi]) - -dnl dnl Checks to see if union wait is used with WEXITSTATUS() dnl dnl usage: @@ -521,9 +554,9 @@ AC_DEFUN(AC_LBL_UNION_WAIT, ac_cv_lbl_union_wait=yes)) AC_MSG_RESULT($ac_cv_lbl_union_wait) if test $ac_cv_lbl_union_wait = yes ; then - AC_DEFINE(DECLWAITSTATUS,union wait) + AC_DEFINE(DECLWAITSTATUS,union wait,[type for wait]) else - AC_DEFINE(DECLWAITSTATUS,int) + AC_DEFINE(DECLWAITSTATUS,int,[type for wait]) fi]) dnl @@ -538,7 +571,7 @@ dnl dnl HAVE_SOCKADDR_SA_LEN (defined) dnl AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN, - [AC_MSG_CHECKING(if sockaddr struct has sa_len member) + [AC_MSG_CHECKING(if sockaddr struct has the sa_len member) AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len, AC_TRY_COMPILE([ # include <sys/types.h> @@ -548,7 +581,7 @@ AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN, ac_cv_lbl_sockaddr_has_sa_len=no)) AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len) if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then - AC_DEFINE(HAVE_SOCKADDR_SA_LEN) + AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[if struct sockaddr has the sa_len member]) fi]) dnl @@ -572,7 +605,7 @@ AC_DEFUN(AC_LBL_HAVE_RUN_PATH, else ac_cv_lbl_have_run_path=no fi - rm -f conftest*]) + rm -f -r conftest*]) AC_MSG_RESULT($ac_cv_lbl_have_run_path) ]) @@ -712,12 +745,12 @@ EOF ac_cv_lbl_unaligned_fail=no fi fi - rm -f conftest* core core.conftest + rm -f -r conftest* core core.conftest ;; esac]) AC_MSG_RESULT($ac_cv_lbl_unaligned_fail) if test $ac_cv_lbl_unaligned_fail = yes ; then - AC_DEFINE(LBL_ALIGN) + AC_DEFINE(LBL_ALIGN,1,[if unaligned access fails]) fi]) dnl @@ -768,7 +801,8 @@ AC_DEFUN(AC_LBL_DEVEL, name="lbl/os-$os.h" if test -f $name ; then ln -s $name os-proto.h - AC_DEFINE(HAVE_OS_PROTO_H) + AC_DEFINE(HAVE_OS_PROTO_H, 1, + [if there's an os_proto.h for this platform, to use additional prototypes]) else AC_MSG_WARN(can't find $name) fi @@ -954,83 +988,6 @@ AC_DEFUN(AC_CHECK_SA_LEN, [ ]) dnl -dnl Checks for portable prototype declaration macro -AC_DEFUN(AC_CHECK_PORTABLE_PROTO, [ - AC_MSG_CHECKING(for __P) - AC_CACHE_VAL($1, - AC_TRY_COMPILE([ -# include <unistd.h>], - [int f __P(())], - $1=yes, - $1=no)) - AC_MSG_RESULT($$1) - if test $$1 = yes; then - AC_DEFINE(HAVE_PORTABLE_PROTOTYPE) - fi -]) - -dnl checks for u_intXX_t -AC_DEFUN(AC_CHECK_BITTYPES, [ - $1=yes -dnl check for u_int8_t - AC_MSG_CHECKING(for u_int8_t) - AC_CACHE_VAL(ac_cv_u_int8_t, - AC_TRY_COMPILE([ -# include <sys/types.h>], - [u_int8_t i], - ac_cv_u_int8_t=yes, - ac_cv_u_int8_t=no)) - AC_MSG_RESULT($ac_cv_u_int8_t) - if test $ac_cv_u_int8_t = yes; then - AC_DEFINE(HAVE_U_INT8_T) - else - $1=no - fi -dnl check for u_int16_t - AC_MSG_CHECKING(for u_int16_t) - AC_CACHE_VAL(ac_cv_u_int16_t, - AC_TRY_COMPILE([ -# include <sys/types.h>], - [u_int16_t i], - ac_cv_u_int16_t=yes, - ac_cv_u_int16_t=no)) - AC_MSG_RESULT($ac_cv_u_int16_t) - if test $ac_cv_u_int16_t = yes; then - AC_DEFINE(HAVE_U_INT16_T) - else - $1=no - fi -dnl check for u_int32_t - AC_MSG_CHECKING(for u_int32_t) - AC_CACHE_VAL(ac_cv_u_int32_t, - AC_TRY_COMPILE([ -# include <sys/types.h>], - [u_int32_t i], - ac_cv_u_int32_t=yes, - ac_cv_u_int32_t=no)) - AC_MSG_RESULT($ac_cv_u_int32_t) - if test $ac_cv_u_int32_t = yes; then - AC_DEFINE(HAVE_U_INT32_T) - else - $1=no - fi -dnl check for u_int64_t - AC_MSG_CHECKING(for u_int64_t) - AC_CACHE_VAL(ac_cv_u_int64_t, - AC_TRY_COMPILE([ -# include <sys/types.h>], - [u_int64_t i], - ac_cv_u_int64_t=yes, - ac_cv_u_int64_t=no)) - AC_MSG_RESULT($ac_cv_u_int64_t) - if test $ac_cv_u_int64_t = yes; then - AC_DEFINE(HAVE_U_INT64_T) - else - $1=no - fi -]) - -dnl dnl Checks for addrinfo structure AC_DEFUN(AC_STRUCT_ADDRINFO, [ AC_MSG_CHECKING(for addrinfo) @@ -1259,9 +1216,50 @@ fi AC_MSG_RESULT($ac_cv___attribute__) ]) + +dnl +dnl Test whether __attribute__((format)) can be applied to function +dnl pointers +dnl + +AC_DEFUN(AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER, [ +AC_MSG_CHECKING([whether __attribute__((format)) can be applied to function pointers]) +AC_CACHE_VAL(ac_cv___attribute___format_function_pointer, [ +AC_COMPILE_IFELSE( + AC_LANG_SOURCE([[ +#include <stdlib.h> + +extern int (*foo)(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))); + +int +main(int argc, char **argv) +{ + (*foo)("%s", "test"); +} + ]]), +ac_cv___attribute___format_function_pointer=yes, +ac_cv___attribute___format_function_pointer=no)]) +if test "$ac_cv___attribute___format_function_pointer" = "yes"; then + AC_DEFINE(__ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS, 1, + [define if your compiler allows __attribute__((format)) to be applied to function pointers]) +fi +AC_MSG_RESULT($ac_cv___attribute___format_function_pointer) +]) + AC_DEFUN(AC_LBL_SSLEAY, [ # + # Find the last component of $libdir; it's not necessarily + # "lib" - it might be "lib64" on, for example, x86-64 + # Linux systems. + # + # We assume the directory in which we're looking for + # libcrypto has a subdirectory with that as its name. + # + tmplib=`echo "$libdir" | sed 's,.*/,,'` + + # # XXX - is there a better way to check if a given library is # in a given directory than checking each of the possible # shared library suffixes? @@ -1271,10 +1269,10 @@ AC_DEFUN(AC_LBL_SSLEAY, # # Or should we just look for "libcrypto.*"? # - if test -d "$1/lib" -a \( -f "$1/lib/libcrypto.a" -o \ - -f "$1/lib/libcrypto.so" -o \ - -f "$1/lib/libcrypto.sl" -o \ - -f "$1/lib/libcrypto.dylib" \); then + if test -d "$1/$tmplib" -a \( -f "$1/$tmplib/libcrypto.a" -o \ + -f "$1/$tmplib/libcrypto.so" -o \ + -f "$1/$tmplib/libcrypto.sl" -o \ + -f "$1/$tmplib/libcrypto.dylib" \); then ac_cv_ssleay_path="$1" fi |