configure.in
来自「TCPDUMP的C语言源代码,是在数据链路层的应用」· IN 代码 · 共 1,039 行 · 第 1/2 页
IN
1,039 行
AC_CHECK_FUNCS(setlinebuf alarm)needsnprintf=noAC_CHECK_FUNCS(vsnprintf snprintf,, [needsnprintf=yes])if test $needsnprintf = yes; then AC_LIBOBJ(snprintf)fiAC_LBL_TYPE_SIGNALAC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpcdnl Some platforms may need -lnsl for getrpcbynumber.AC_SEARCH_LIBS(getrpcbynumber, nsl, AC_DEFINE(HAVE_GETRPCBYNUMBER))dnl AC_CHECK_LIB(z, uncompress)dnl AC_CHECK_HEADERS(zlib.h)AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)## Check for these after AC_LBL_LIBPCAP, so we link with the appropriate# libraries (e.g., "-lsocket -lnsl" on Solaris).## We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which# use AC_CHECK_FUNC which doesn't let us specify the right #includes# to make this work on BSD/OS 4.x. BSD/OS 4.x ships with the BIND8# resolver, and the way it defines inet_{ntop,pton} is rather strange;# it does not ship with a libc symbol "inet_ntop()", it ships with# "_inet_ntop()", and has a #define macro in one of the system headers# to rename it.#dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)AC_MSG_CHECKING(for inet_ntop)AC_TRY_LINK([#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>], [char src[4], dst[128];inet_ntop(AF_INET, src, dst, sizeof(dst));], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) AC_LIBOBJ(inet_ntop)])AC_MSG_CHECKING(for inet_pton)AC_TRY_LINK([#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>], [char src[128], dst[4];inet_pton(AF_INET, src, dst);], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) AC_LIBOBJ(inet_pton)])AC_MSG_CHECKING(for inet_aton)AC_TRY_LINK([#include <sys/types.h>#include <netinet/in.h>#include <arpa/inet.h>], [char src[128];struct in_addr dst;inet_aton(src, &dst);], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) AC_LIBOBJ(inet_aton)])## Check for these after AC_LBL_LIBPCAP, for the same reason.## You are in a twisty little maze of UN*Xes, all different.# Some might not have ether_ntohost().# Some might have it, but not declare it in any header file.# Some might have it, but declare it in <netinet/if_ether.h>.# Some might have it, but declare it in <netinet/ether.h># (And some might have it but document it as something declared in# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)## Before you is a C compiler.#AC_CHECK_FUNCS(ether_ntohost, [ AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [ AC_TRY_RUN([ #include <netdb.h> #include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> int main(int argc, char **argv) { u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff }; char name[MAXHOSTNAMELEN]; ether_ntohost(name, (struct ether_addr *)ea); exit(0); } ], [ac_cv_buggy_ether_ntohost=no], [ac_cv_buggy_ether_ntohost=yes], [ac_cv_buggy_ether_ntohost="not while cross-compiling"])]) if test "$ac_cv_buggy_ether_ntohost" = "no"; then AC_DEFINE(USE_ETHER_NTOHOST) fi])if test "$ac_cv_func_ether_ntohost" = yes -a \ "$ac_cv_buggy_ether_ntohost" = "no"; then # # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>? # if test "$ac_cv_header_netinet_if_ether_h" = yes; then # # Yes. Does it declare ether_ntohost()? # AC_CHECK_DECL(ether_ntohost, [ AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,, [Define to 1 if netinet/if_ether.h declares `ether_ntohost']) ],, [#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>struct mbuf;struct rtentry;#include <net/if.h>#include <netinet/if_ether.h> ]) fi # # Did that succeed? # if test "$ac_cv_have_decl_ether_ntohost" != yes; then # # No, how about <netinet/ether.h>, as on Linux? # AC_CHECK_HEADERS(netinet/ether.h) if test "$ac_cv_header_netinet_ether_h" = yes; then # # We have it - does it declare ether_ntohost()? # Unset ac_cv_have_decl_ether_ntohost so we don't # treat the previous failure as a cached value and # suppress the next test. # unset ac_cv_have_decl_ether_ntohost AC_CHECK_DECL(ether_ntohost, [ AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,, [Define to 1 if netinet/ether.h declares `ether_ntohost']) ],, [#include <netinet/ether.h> ]) fi fi # # Is ether_ntohost() declared? # if test "$ac_cv_have_decl_ether_ntohost" != yes; then # # No, we'll have to declare it ourselves. # Do we have "struct ether_addr"? # AC_CHECK_TYPES(struct ether_addr,,, [#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>struct mbuf;struct rtentry;#include <net/if.h>#include <netinet/if_ether.h> ]) AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0, [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if youdon't.]) else AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1, [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if youdon't.]) fifi# libdlpi is needed for Solaris 11 and later.AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)dnl portability macros for getaddrinfo/getnameinfodnldnl Check for sa_lenAC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)if test "$ac_cv_sockaddr_has_sa_len" = no; then missing_includes=yesfi## Do we have the new open API? Check for pcap_create, and assume that,# if we do, we also have pcap_activate() and the other new routines.AC_CHECK_FUNCS(pcap_create)AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)if test $ac_cv_func_pcap_findalldevs = "yes" ; thendnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap maydnl be 0.8; this means that lib has pcap_findalldevs but header doesn'tdnl have pcap_if_t. savedppflags="$CPPLAGS" CPPFLAGS="$CPPFLAGS $V_INCLS" AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>]) CPPFLAGS="$savedcppflags"fiif test $ac_cv_func_pcap_lib_version = "no" ; then AC_MSG_CHECKING(whether pcap_version is defined by libpcap) AC_TRY_LINK([], [ extern char pcap_version[]; return (int)pcap_version; ], ac_lbl_cv_pcap_version_defined=yes, ac_lbl_cv_pcap_version_defined=no) if test "$ac_lbl_cv_pcap_version_defined" = yes ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PCAP_VERSION) else AC_MSG_RESULT(no) fifiAC_MSG_CHECKING(whether pcap_debug is defined by libpcap)AC_TRY_LINK([], [ extern int pcap_debug; return pcap_debug; ], ac_lbl_cv_pcap_debug_defined=yes, ac_lbl_cv_pcap_debug_defined=no)if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PCAP_DEBUG)else AC_MSG_RESULT(no) # # OK, what about "yydebug"? # AC_MSG_CHECKING(whether yydebug is defined by libpcap) AC_TRY_LINK([], [ extern int yydebug; return yydebug; ], ac_lbl_cv_yydebug_defined=yes, ac_lbl_cv_yydebug_defined=no) if test "$ac_lbl_cv_yydebug_defined" = yes ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_YYDEBUG) else AC_MSG_RESULT(no) fifiAC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6V_GROUP=0if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then V_GROUP=wheelficase "$host_os" inaix*) dnl Workaround to enable certain features AC_DEFINE(_SUN) ;;irix*) V_GROUP=sys ;;osf*) V_GROUP=system ;;solaris*) V_GROUP=sys ;;esacif test -f /dev/bpf0 ; then V_GROUP=bpffi## Check for some headers introduced in later versions of libpcap# and used by some printers.#savedcppflags="$CPPFLAGS"CPPFLAGS="$CPPFLAGS $V_INCLS"AC_CHECK_HEADERS(pcap/bluetooth.h)CPPFLAGS="$savedcppflags"AC_CHECK_HEADERS(sys/bitypes.h)AC_CHECK_TYPE([int8_t], , [AC_DEFINE([int8_t], [signed char], [Define to `signed char' if int8_t not defined.])])AC_CHECK_TYPE([u_int8_t], , [AC_DEFINE([u_int8_t], [unsigned char], [Define to `unsigned char' if u_int8_t not defined.])], [AC_INCLUDES_DEFAULT#ifdef HAVE_SYS_BITYPES_H#include <sys/bitypes.h>#endif])AC_CHECK_TYPE([int16_t], , [AC_DEFINE([int16_t], [short], [Define to `short' if int16_t not defined.])])AC_CHECK_TYPE([u_int16_t], , [AC_DEFINE([u_int16_t], [unsigned short], [Define to `unsigned short' if u_int16_t not defined.])], [AC_INCLUDES_DEFAULT#ifdef HAVE_SYS_BITYPES_H#include <sys/bitypes.h>#endif])AC_CHECK_TYPE([int32_t], , [AC_DEFINE([int32_t], [int], [Define to `int' if int32_t not defined.])])AC_CHECK_TYPE([u_int32_t], , [AC_DEFINE([u_int32_t], [unsigned int], [Define to `unsigned int' if u_int32_t not defined.])], [AC_INCLUDES_DEFAULT#ifdef HAVE_SYS_BITYPES_H#include <sys/bitypes.h>#endif])AC_CHECK_TYPE([int64_t], , [AC_DEFINE([int64_t], [long long], [Define to `long long' if int64_t not defined.])])AC_CHECK_TYPE([u_int64_t], , [AC_DEFINE([u_int64_t], [unsigned long long], [Define to `unsigned long long' if u_int64_t not defined.])], [AC_INCLUDES_DEFAULT#ifdef HAVE_SYS_BITYPES_H#include <sys/bitypes.h>#endif])## We can't just check for <inttypes.h> - some systems have one that# doesn't define all the PRI[doxu]64 macros.#AC_CHECK_HEADERS(inttypes.h, [ # # OK, we have inttypes.h, but does it define those macros? # AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]]) AC_COMPILE_IFELSE( [ AC_LANG_SOURCE( [[ #include <inttypes.h> #include <stdio.h> #include <sys/types.h> #ifdef HAVE_SYS_BITYPES_H #include <sys/bitypes.h> #endif main() { printf("%" PRId64 "\n", (u_int64_t)1); printf("%" PRIo64 "\n", (u_int64_t)1); printf("%" PRIx64 "\n", (u_int64_t)1); printf("%" PRIu64 "\n", (u_int64_t)1); } ]]) ], [ AC_MSG_RESULT(yes) ac_lbl_inttypes_h_defines_formats=yes ], [ AC_MSG_RESULT(no) ac_lbl_inttypes_h_defines_formats=no ]) ], [ # # We don't have inttypes.h, so it obviously can't define those # macros. # ac_lbl_inttypes_h_defines_formats=no ])if test "$ac_lbl_inttypes_h_defines_formats" = no; then AC_LBL_CHECK_64BIT_FORMAT(l, [ AC_LBL_CHECK_64BIT_FORMAT(ll, [ AC_LBL_CHECK_64BIT_FORMAT(L, [ AC_LBL_CHECK_64BIT_FORMAT(q, [ AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer]) ]) ]) ]) ])fiAC_PROG_RANLIBAC_LBL_DEVEL(V_CCOPT)AC_LBL_SOCKADDR_SA_LENAC_LBL_UNALIGNED_ACCESSAC_VAR_H_ERRNO# Check for SSLeayAC_MSG_CHECKING(whether to use SSLeay libcrypto)# Specify location for both includes and libraries.want_libcrypto=youmamaAC_ARG_WITH(crypto, AS_HELP_STRING([--with-crypto@<:@=PATH@:>@], [use SSLeay libcrypto (located in directory PATH, if supplied). @<:@default=yes, if available@:>@]),[ if test $withval = no then want_libcrypto=no AC_MSG_RESULT(no) elif test $withval = yes then want_libcrypto=yes AC_MSG_RESULT(yes) else want_libcrypto=yes AC_MSG_RESULT(yes) crypto_dir=$withval fi],[ # # Use libcrypto if it's present, otherwise don't. # want_libcrypto=ifavailable AC_MSG_RESULT([yes, if available])])if test "$want_libcrypto" != "no"; then ac_cv_ssleay_path=no incdir=no if test "x$crypto_dir" = x; then # # Location not specified; check the default locations. # AC_MSG_CHECKING(where SSLeay is located) dirs="/usr /usr/local /usr/local/ssl /usr/pkg" if test "x${host_alias}" != x; then dirs="/usr/${host_alias} $dirs" fi for dir in $dirs; do AC_LBL_SSLEAY($dir) if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then break; else ac_cv_ssleay_path=no incdir=no fi done if test "$ac_cv_ssleay_path" != no; then AC_MSG_RESULT($ac_cv_ssleay_path) fi else AC_MSG_CHECKING(for SSLeay in $crypto_dir) AC_LBL_SSLEAY($crypto_dir) if test "$ac_cv_ssleay_path" != no; then AC_MSG_RESULT(found) fi fi if test "$ac_cv_ssleay_path" != no; then V_INCLS="$V_INCLS $incdir" LDFLAGS="-L$dir/lib $LDFLAGS" if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then LIBS="$LIBS -lRSAglue" fi if test -f $ac_cv_ssleay_path/lib/librsaref.a; then LIBS="$LIBS -lrsaref" fi AC_CHECK_LIB(crypto, DES_cbc_encrypt) CPPFLAGS="$CPPFLAGS $V_INCLS" AC_CHECK_HEADERS(openssl/evp.h) else # # Not found. Did the user explicitly ask for it? # AC_MSG_RESULT(not found) if test "$want_libcrypto" = yes; then AC_MSG_ERROR(SSLeay not found) fi fifidnldnl set additional include path if necessaryif test "$missing_includes" = "yes"; then CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing" V_INCLS="$V_INCLS -I\$(srcdir)/missing"fiAC_SUBST(V_CCOPT)AC_SUBST(V_DEFS)AC_SUBST(V_GROUP)AC_SUBST(V_INCLS)AC_SUBST(V_PCAPDEP)AC_SUBST(LOCALSRC)AC_PROG_INSTALLAC_CONFIG_HEADER(config.h)AC_OUTPUT_COMMANDS([if test -f .devel; then echo timestamp > stamp-h cat Makefile-devel-adds >> Makefile make dependfi])AC_OUTPUT(Makefile)exit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?