configure.ac

来自「Ubuntu packages of security software。 相」· AC 代码 · 共 796 行 · 第 1/2 页

AC
796
字号
LIBPCAP_LIBS="-lpcap"if test $have_libpcap = yes; then  PCAP_DEPENDS=""  PCAP_CLEAN=""  PCAP_DIST_CLEAN=""  AC_DEFINE(HAVE_LIBPCAP)else  if test "${LIBPCAP_INC+set}" = "set"; then    LDFLAGS="-L$libpcapdir $_ldflags"    CXXFLAGS="$_cflags -I$LIBPCAP_INC"  else    LDFLAGS="-L$libpcapdir $LDFLAGS"    CXXFLAGS="$CXXFLAGS -I$libpcapdir"  fi  PCAP_DEPENDS='$(LIBPCAPDIR)/libpcap.a'  PCAP_CLEAN="pcap_clean"  PCAP_DIST_CLEAN="pcap_dist_clean"fiAC_SUBST(PCAP_DEPENDS)AC_SUBST(PCAP_CLEAN)AC_SUBST(PCAP_DIST_CLEAN)AC_SUBST(LIBPCAP_LIBS)have_pcre=norequested_included_pcre=noLIBPCREDIR=libpcre# First we test whether they specified libpcre explicitlyAC_ARG_WITH(libpcre,[  --with-libpcre=DIR    Use an existing (compiled) pcre lib from DIR/include and DIR/lib.  Specify --with-libpcre=included to always use the version included with Nmap],[  case "$with_libpcre" in  yes)    ;;  included)    requested_included_pcre=yes    ;;  *)    CXXFLAGS="-I$with_libpcre/include $CXXFLAGS"    LDFLAGS="-L$with_libpcre/lib $LDFLAGS"    have_pcre=yes    ;;  esac])# If they didn't specify it, we try to find itif test $have_pcre != yes -a $requested_included_pcre != yes ; then  AC_CHECK_HEADER(pcre.h,    AC_CHECK_LIB(pcre, pcre_version, [have_pcre=yes ]),    [AC_CHECK_HEADERS(pcre/pcre.h,       [AC_CHECK_LIB(pcre, pcre_version, [have_pcre=yes])]    )]  )fi# If we still don't have it, we use our ownif test $have_pcre != yes ; then  AC_CONFIG_SUBDIRS( libpcre )  CXXFLAGS="-I$LIBPCREDIR $CXXFLAGS"  LIBPCRE_LIBS="$LIBPCREDIR/libpcre.a"  PCRE_DEPENDS="$LIBPCREDIR/libpcre.a"  PCRE_CLEAN="pcre_clean"  PCRE_DIST_CLEAN="pcre_dist_clean"else  LIBPCRE_LIBS="-lpcre"  PCRE_DEPENDS=""  PCRE_CLEAN=""  PCRE_DIST_CLEAN=""fiAC_SUBST(LIBPCRE_LIBS)AC_SUBST(LIBPCREDIR)AC_SUBST(PCRE_DEPENDS)AC_SUBST(PCRE_CLEAN)AC_SUBST(PCRE_DIST_CLEAN)have_dnet=norequested_included_dnet=noLIBDNETDIR=libdnet-stripped# First we test whether they specified libdnet explicitlyAC_ARG_WITH(libdnet,[  --with-libdnet=DIR    Use an existing (compiled) dnet lib from DIR/include and DIR/lib.],[  case "$with_libdnet" in  yes)    ;;  included)    ;;  *)    CXXFLAGS="-I$with_libdnet/include $CXXFLAGS"    LDFLAGS="-L$with_libdnet/lib $LDFLAGS"    have_dnet=yes    ;;  esac])# If they didn't provide location, we use the included oneif test $have_dnet != yes ; then  AC_CONFIG_SUBDIRS( libdnet-stripped )  CXXFLAGS="-I$LIBDNETDIR/include $CXXFLAGS"  LIBDNET_LIBS="$LIBDNETDIR/src/.libs/libdnet.a"  DNET_DEPENDS="$LIBDNETDIR/src/.libs/libdnet.a"  DNET_CLEAN="dnet_clean"  DNET_DIST_CLEAN="dnet_dist_clean"else  LIBDNET_LIBS="-ldnet"  DNET_DEPENDS=""  DNET_CLEAN=""  DNET_DIST_CLEAN=""fiAC_SUBST(LIBDNET_LIBS)AC_SUBST(LIBDNETDIR)AC_SUBST(DNET_DEPENDS)AC_SUBST(DNET_CLEAN)AC_SUBST(DNET_DIST_CLEAN)dnl AC_HEADER_TIMEAC_MSG_CHECKING([struct ip])AC_TRY_COMPILE([#include <sys/types.h>#include <netinet/in.h>#include <netinet/in_systm.h>#include <netinet/ip.h>],               [struct ip ip;],               [AC_MSG_RESULT(yes); bsd_networking=yes],               [AC_MSG_RESULT(no); bsd_networking=no]);if test $bsd_networking = yes; then  AC_DEFINE(BSD_NETWORKING)  AC_MSG_CHECKING([ip_v in struct ip])  AC_TRY_COMPILE([#include <sys/types.h>#include <netinet/in.h>#include <netinet/in_systm.h>#include <netinet/ip.h>],                 [struct ip ip; ip.ip_v;],                 [AC_MSG_RESULT(yes); has_bitfields=yes],                 [AC_MSG_RESULT(no); has_bitfields=no])  if test $has_bitfields = no; then    SAVE_CXXFLAGS="$CXXFLAGS"    CXXFLAGS="-D__STDC__=2"    AC_MSG_CHECKING([if setting __STDC__=2 gives ip_v])    AC_TRY_COMPILE([#include <sys/types.h>#include <netinet/in.h>#include <netinet/in_systm.h>#include <netinet/ip.h>],                   [struct ip ip; ip.ip_v;],                   [AC_MSG_RESULT(yes); setting_stdc_helps=yes],                  [AC_MSG_RESULT(no); setting_stdc_helps=no])    CXXFLAGS="$SAVE_CXXFLAGS"    if test $setting_stdc_helps = yes; then      CXXFLAGS="$CXXFLAGS -D__STDC__=2"    else      AC_MSG_RESULT(Can't figure out how to get bitfields - configure failed)      exit 1    fi  fifiAC_SUBST(CXXFLAGS)dnl This test is from the configure.in of Unix Network Programming seconddnl edition example code by W. Richard Stevensdnl ##################################################################dnl Check if sockaddr{} has sa_len member.dnlAC_CACHE_CHECK(if sockaddr{} has sa_len member, ac_cv_sockaddr_has_sa_len,        AC_TRY_COMPILE([#               include <sys/types.h>#               include <sys/socket.h>],                [unsigned int i = sizeof(((struct sockaddr *)0)->sa_len)],        ac_cv_sockaddr_has_sa_len=yes,        ac_cv_sockaddr_has_sa_len=no))if test $ac_cv_sockaddr_has_sa_len = yes ; then        AC_DEFINE(HAVE_SOCKADDR_SA_LEN)fidnl check endednessAC_C_BIGENDIANAC_MSG_CHECKING([if struct in_addr is a wacky huge structure (some Sun boxes)])AC_TRY_COMPILE([#include <netinet/in.h>], struct in_addr i; i._S_un._S_addr;, \              AC_DEFINE(IN_ADDR_DEEPSTRUCT) \              AC_MSG_RESULT(yes) , \              AC_TRY_COMPILE([#include <sys/types.h>#include <netinet/in.h>], struct in_addr i; i.S_un.S_addr;, \                             AC_DEFINE(IN_ADDR_DEEPSTRUCT) \                             AC_MSG_RESULT(yes) , \                             AC_MSG_RESULT(no);))AC_CACHE_CHECK(if struct icmp exists, ac_cv_struct_icmp_exists,        AC_TRY_COMPILE([#               include <sys/types.h>#               include <sys/param.h>#               include <netinet/in_systm.h>#               include <netinet/in.h>               #               define __USE_BSD#               define __FAVOR_BSD#               define __BSD_SOURCE#               include <netinet/ip.h>#               include <netinet/ip_icmp.h>],                [unsigned int i = sizeof(struct icmp)],        ac_cv_struct_icmp_exists=yes,        ac_cv_struct_icmp_exists=no))if test $ac_cv_struct_icmp_exists = yes ; then        AC_DEFINE(HAVE_STRUCT_ICMP)fiAC_CACHE_CHECK(if struct ip exists, ac_cv_struct_ip_exists,        AC_TRY_COMPILE([#               include <sys/types.h>#               include <sys/param.h>#               include <netinet/in_systm.h>#               include <netinet/in.h>               #               define __USE_BSD#               define __FAVOR_BSD#               define __BSD_SOURCE#               include <netinet/ip.h>],                [unsigned int i = sizeof(struct ip)],        ac_cv_struct_ip_exists=yes,        ac_cv_struct_ip_exists=no))if test $ac_cv_struct_ip_exists = yes ; then        AC_DEFINE(HAVE_STRUCT_IP)fiAC_CACHE_CHECK(if struct ip has ip_sum member, ac_cv_ip_has_ip_sum,        AC_TRY_COMPILE([#               include <sys/types.h>#               include <sys/param.h>#               include <netinet/in_systm.h>#               include <netinet/in.h>#               define __USE_BSD#               define __FAVOR_BSD#               define __BSD_SOURCE#               include <netinet/ip.h>#               include <netinet/ip_icmp.h>],                [unsigned int i = sizeof(((struct ip *)0)->ip_sum)],        ac_cv_ip_has_ip_sum=yes,        ac_cv_ip_has_ip_sum=no))if test $ac_cv_ip_has_ip_sum = yes ; then        AC_DEFINE(HAVE_IP_IP_SUM)fidnl Checks for library functions.dnl AC_TYPE_SIGNALAC_CHECK_FUNCS(bzero memcpy nanosleep strerror \strcasestr getopt_long_only)AC_LANG_PUSH(C++)AC_MSG_CHECKING([for usleep])AC_TRY_LINK([#include <unistd.h>],[usleep (200);],[  AC_MSG_RESULT(yes)],[  AC_MSG_RESULT(no)  AC_MSG_CHECKING([if usleep needs custom prototype])  AC_TRY_LINK([#include <unistd.h>extern "C" int usleep (unsigned int);],[usleep (200);],[  AC_MSG_RESULT(yes)  AC_DEFINE(NEED_USLEEP_PROTO)],  AC_MSG_RESULT(not found))])AC_LANG_POP(C++)AC_LANG_PUSH(C++)AC_TRY_LINK([#include <stdlib.h>#include <unistd.h>],[char buffer[200];gethostname (buffer, 200);], ,[  AC_MSG_CHECKING([if gethostname needs custom prototype])  AC_TRY_LINK([#include <stdlib.h>#include <unistd.h>extern "C" int gethostname (char *, unsigned int);],[char buffer[200];gethostname (buffer, 200);],[  AC_MSG_RESULT(yes)  AC_DEFINE(NEED_GETHOSTNAME_PROTO)],  AC_MSG_RESULT(not found))])AC_LANG_POP(C++)RECVFROM_ARG6_TYPEdnl AC_CHECK_FUNCS(gethostname gettimeofday select socket strdup strstr )AC_ARG_WITH(libnbase,[  --with-libnbase=DIR     Look for nbase include/libs in DIR],[  case "$with_libnbase" in  yes)    ;;  *)    NBASEDIR="$with_libnbase"    ;;  esac],NBASEDIR="nbase")LDFLAGS="$LDFLAGS -L$NBASEDIR"CXXFLAGS="$CXXFLAGS -I$NBASEDIR"LIBNBASE_LIBS="-lnbase"AC_SUBST(NBASEDIR)AC_SUBST(LIBNBASE_LIBS)NSOCKDIR="nsock"AC_ARG_WITH(libnsock,[  --with-libnsock=DIR     Compile and link to libnsock in DIR],[  case "$with_nsock" in  yes)    ;;  *)    NSOCKDIR="$with_nsock"    ;;  esac])LDFLAGS="$LDFLAGS -L$NSOCKDIR/src/"CXXFLAGS="$CXXFLAGS -I$NSOCKDIR/include"LIBNSOCK_LIBS="-lnsock"AC_SUBST(NSOCKDIR)AC_SUBST(LIBNSOCK_LIBS)nmap_cfg_subdirs="$nmap_cfg_subdirs $NSOCKDIR/src"dnl I need to configure nmapfe and libpcap here since the user mightdnl have specified special options (such as --prefix )dnldnl But I only have to configure libpcap if I am going to use itif test $have_libpcap = yes ; then        nmap_cfg_subdirs="$NBASEDIR $nmap_cfg_subdirs"else        nmap_cfg_subdirs="$NBASEDIR $libpcapdir $nmap_cfg_subdirs"fiif test "${with_nmapfe}" = "yes"; thendnl Check for GTK+AC_PATH_PROG(GTK_CONFIG, pkg-config, no)AC_MSG_CHECKING(If you have GTK+ installed)if test "$GTK_CONFIG" = "no" ; then  AC_MSG_RESULT([no])  AC_MSG_WARN([Gtk+ has not been installed -> nmapfe will not be made])else  GTK_NEEDED_MAJOR=2  GTK_NEEDED_MINOR=4  GTK_NEEDED_MICRO=0  GTK_MINVERSION=$GTK_NEEDED_MAJOR.$GTK_NEEDED_MINOR.$GTK_NEEDED_MICRO  ver=`pkg-config --modversion gtk+-2.0`  dnl Extract the information.  major=`echo $ver|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`  minor=`echo $ver|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`  micro=`echo $ver|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`  AC_MSG_RESULT($ver)  if test $major -lt $GTK_NEEDED_MAJOR -o $major -eq $GTK_NEEDED_MAJOR \    -a $minor -lt $GTK_NEEDED_MINOR -o $minor -eq $GTK_NEEDED_MINOR \    -a $micro -lt $GTK_NEEDED_MICRO; then    AC_MSG_WARN([An old version of GTK+ ($major.$minor.$micro) was found.\n \                 You need at least version $GTK_MINVERSION.\n Subdir X-windows \                 will not be made])  else    nmap_cfg_subdirs="$nmap_cfg_subdirs nmapfe"    dnl Maybe also define the flags to compile and link GTK+    dnl GTK_CXXFLAGS=`gtk-config --cflags`    dnl GTK_LIBS=`gtk-config --libs`    dnl AC_SUBST(GTK_CXXFLAGS)    dnl AC_SUBST(GTK_LIBS)  fififidnl all hell broke loose when the variable was named $subdirsAC_CONFIG_SUBDIRS( $nmap_cfg_subdirs )dnl Configure libpcap if we need to since a lot of lamers don'tdnl already have it installed ...dnl if test $have_libpcap = nsadf ; thendnl    echo "Have libpcap is set to $have_libpcap ";dnl    asdfasdf sdsdf sfd sdfsddnl    AC_CONFIG_SUBDIRS( $libpcapdir )dnl fiAC_OUTPUT(Makefile)# Krad ASCII ART#!#@$!@#$if test -f docs/leet-nmap-ascii-art.txt; then	cat docs/leet-nmap-ascii-art.txtfiecho "Configuration complete.  Type make (or gmake on some *BSD machines) to compile."

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?