From 8c74077140bc5d5ead64b0bec73a2f6b17e8e663 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 14 Aug 2026 17:16:12 +0000 Subject: [PATCH] Update Nping's configure.ac to use modern macros --- nping/configure | 313 ++++++++++++++++++++++++++------------------ nping/configure.ac | 316 ++++++++++++++++++++++----------------------- 2 files changed, 337 insertions(+), 292 deletions(-) diff --git a/nping/configure b/nping/configure index a10aa568e..f54bedc3c 100755 --- a/nping/configure +++ b/nping/configure @@ -5255,15 +5255,18 @@ printf %s "checking for __func__... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + #include int main (void) { -printf ("%s", __func__); + + printf ("%s", __func__); + ; return 0; } + _ACEOF if ac_fn_c_try_compile "$LINENO" then : @@ -5272,10 +5275,14 @@ else $as_nop have_func=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -if test "x$have_func" = "xyes"; then +if test "x$have_func" = "xyes" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } -else + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __FUNCTION__" >&5 @@ -5283,12 +5290,14 @@ printf %s "checking for __FUNCTION__... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + #include int main (void) { -printf ("%s", __FUNCTION__); + + printf ("%s", __FUNCTION__); + ; return 0; } @@ -5300,19 +5309,26 @@ else $as_nop have_function=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - if test "x$have_function" = "xyes"; then + if test "x$have_function" = "xyes" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } printf "%s\n" "#define __func__ __FUNCTION__" >>confdefs.h - else + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } printf "%s\n" "#define __func__ __FILE__" >>confdefs.h - fi + fi +fi + + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 @@ -5861,7 +5877,9 @@ fi # If they didn't specify it, we try to find it -if test "$use_openssl" = "yes" -a -z "$specialssldir"; then +if test "x$use_openssl" = "xyes" -a -z "$specialssldir" +then : + ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default" if test "x$ac_cv_header_openssl_ssl_h" = xyes then : @@ -5878,7 +5896,9 @@ fi # use_openssl="yes" given explicitly in next 2 rules to avoid adding lib to $LIBS - if test "$use_openssl" = "yes"; then + if test "x$use_openssl" = "xyes" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BIO_int_ctrl in -lcrypto" >&5 printf %s "checking for BIO_int_ctrl in -lcrypto... " >&6; } if test ${ac_cv_lib_crypto_BIO_int_ctrl+y} @@ -5927,9 +5947,12 @@ printf "%s\n" "$as_me: WARNING: Failed to find libcrypto so OpenSSL will not be fi - fi - if test "$use_openssl" = "yes"; then +fi + + if test "x$use_openssl" = "xyes" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5 printf %s "checking for SSL_new in -lssl... " >&6; } if test ${ac_cv_lib_ssl_SSL_new+y} @@ -5977,11 +6000,15 @@ else $as_nop printf "%s\n" "$as_me: WARNING: Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument" >&2;} fi - fi + +fi + fi OPENSSL_LIBS= -if test "$use_openssl" = "yes"; then +if test "x$use_openssl" = "xyes" +then : + printf "%s\n" "#define HAVE_OPENSSL 1" >>confdefs.h @@ -5998,6 +6025,7 @@ else $as_nop fi LIBS="$LIBS_TMP" + fi @@ -6131,16 +6159,7 @@ if test $needs_cpp_precomp = yes; then CXXFLAGS="-no-cpp-precomp $CXXFLAGS" fi -if test $have_libpcap = yes; then - if test "${LIBPCAP_INC+set}" = "set"; then - CPPFLAGS="-I$LIBPCAP_INC $CPPFLAGS" - LDFLAGS="-L$LIBPCAP_LIB $LDFLAGS" - fi - - # link with -lpcap for the purposes of this test - LIBS_OLD="$LIBS" - LIBS="$LIBS -lpcap" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } if test ${ac_cv_c_undeclared_builtin_options+y} then : @@ -6220,6 +6239,17 @@ See \`config.log' for more details" "$LINENO" 5; } ;; #( ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; esac +if test x$have_libpcap = xyes +then : + + if test "${LIBPCAP_INC+set}" = "set"; then + CPPFLAGS="-I$LIBPCAP_INC $CPPFLAGS" + LDFLAGS="-L$LIBPCAP_LIB $LDFLAGS" + fi + + # link with -lpcap for the purposes of this test + LIBS_OLD="$LIBS" + LIBS="$LIBS -lpcap" ac_fn_c_check_header_compile "$LINENO" "sys/ioccom.h" "ac_cv_header_sys_ioccom_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ioccom_h" = xyes @@ -6348,9 +6378,12 @@ fi LIBS="$LIBS_OLD" + fi -if test $have_libpcap != yes; then +if test x$have_libpcap != xyes +then : + if test "${LIBPCAP_INC+set}" = "set"; then LDFLAGS="-L$libpcapdir $_ldflags" CPPFLAGS="$CPPFLAGS -I$LIBPCAP_INC" @@ -6363,7 +6396,9 @@ if test $have_libpcap != yes; then PCAP_BUILD="build-pcap" PCAP_CLEAN="clean-pcap" PCAP_DIST_CLEAN="distclean-pcap" -else + +else $as_nop + printf "%s\n" "#define HAVE_LIBPCAP 1" >>confdefs.h @@ -6372,6 +6407,7 @@ printf "%s\n" "#define HAVE_LIBPCAP 1" >>confdefs.h PCAP_BUILD="" PCAP_CLEAN="" PCAP_DIST_CLEAN="" + fi @@ -6380,12 +6416,15 @@ fi -if test $have_libpcap != yes ; then + + +if test x$have_libpcap != xyes +then : + ac_configure_args="$ac_configure_args '--disable-dbus' '--disable-rdma'" + subdirs="$subdirs libpcap" -subdirs="$subdirs libpcap" - fi @@ -6418,7 +6457,9 @@ fi # If they didn't provide location, we use the included one -if test $have_dnet != yes ; then +if test x$have_dnet != xyes +then : + subdirs="$subdirs libdnet-stripped" CPPFLAGS="-I$LIBDNETDIR/include $CPPFLAGS" @@ -6427,12 +6468,15 @@ if test $have_dnet != yes ; then DNET_BUILD="build-dnet" DNET_CLEAN="clean-dnet" DNET_DIST_CLEAN="distclean-dnet" -else + +else $as_nop + LIBDNET_LIBS="-ldnet" DNET_DEPENDS="" DNET_BUILD="" DNET_CLEAN="" DNET_DIST_CLEAN="" + fi @@ -6472,10 +6516,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sockaddr_has_sa_len" >&5 printf "%s\n" "$ac_cv_sockaddr_has_sa_len" >&6; } -if test $ac_cv_sockaddr_has_sa_len = yes ; then +if test x$ac_cv_sockaddr_has_sa_len = xyes +then : + printf "%s\n" "#define HAVE_SOCKADDR_SA_LEN 1" >>confdefs.h + fi @@ -6509,10 +6556,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sockaddr_in_has_sin_len" >&5 printf "%s\n" "$ac_cv_sockaddr_in_has_sin_len" >&6; } -if test $ac_cv_sockaddr_in_has_sin_len = yes ; then +if test x$ac_cv_sockaddr_in_has_sin_len = xyes +then : + printf "%s\n" "#define HAVE_SOCKADDR_IN_SIN_LEN 1" >>confdefs.h + fi @@ -6546,10 +6596,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sockaddr_in6_has_sin6_len" >&5 printf "%s\n" "$ac_cv_sockaddr_in6_has_sin6_len" >&6; } -if test $ac_cv_sockaddr_in6_has_sin6_len = yes ; then +if test x$ac_cv_sockaddr_in6_has_sin6_len = xyes +then : + printf "%s\n" "#define HAVE_SOCKADDR_IN6_SIN6_LEN 1" >>confdefs.h + fi @@ -6794,7 +6847,9 @@ printf %s "checking if struct in_addr is a wacky huge structure (some Sun boxes) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + + #include + int main (void) { @@ -6802,20 +6857,24 @@ struct in_addr i; i._S_un._S_addr; ; return 0; } + _ACEOF if ac_fn_c_try_compile "$LINENO" then : - \ - printf "%s\n" "#define IN_ADDR_DEEPSTRUCT 1" >>confdefs.h - \ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + printf "%s\n" "#define IN_ADDR_DEEPSTRUCT 1" >>confdefs.h + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } + else $as_nop - \ - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include + + #include + #include + int main (void) { @@ -6823,57 +6882,26 @@ struct in_addr i; i.S_un.S_addr; ; return 0; } + _ACEOF if ac_fn_c_try_compile "$LINENO" then : - \ - printf "%s\n" "#define IN_ADDR_DEEPSTRUCT 1" >>confdefs.h - \ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + + printf "%s\n" "#define IN_ADDR_DEEPSTRUCT 1" >>confdefs.h + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } + else $as_nop - \ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; }; -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -#AC_CACHE_CHECK(if struct icmp exists, ac_cv_struct_icmp_exists, - #AC_TRY_COMPILE([ - ##include - ##include - ##include - ##include - ##define __USE_BSD - ##define __FAVOR_BSD - ##define _BSD_SOURCE - ##include - ##include ], - #[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) -#fi - -#AC_CACHE_CHECK(if struct ip exists, ac_cv_struct_ip_exists, - #AC_TRY_COMPILE([ - ##include - ##include - ##include - ##include - ##define __USE_BSD - ##define __FAVOR_BSD - ##define _BSD_SOURCE - ##include ], - #[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) -#fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if struct ip has ip_sum member" >&5 printf %s "checking if struct ip has ip_sum member... " >&6; } @@ -6911,10 +6939,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ip_has_ip_sum" >&5 printf "%s\n" "$ac_cv_ip_has_ip_sum" >&6; } -if test $ac_cv_ip_has_ip_sum = yes ; then +if test x$ac_cv_ip_has_ip_sum = xyes +then : + printf "%s\n" "#define HAVE_IP_IP_SUM 1" >>confdefs.h + fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if function signal is accessible" >&5 @@ -6955,10 +6986,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_signal" >&5 printf "%s\n" "$ac_cv_have_signal" >&6; } -if test $ac_cv_have_signal = yes ; then +if test x$ac_cv_have_signal = xyes +then : + printf "%s\n" "#define HAVE_SIGNAL 1" >>confdefs.h + fi @@ -6966,38 +7000,45 @@ fi -case "$host" in - *alpha-dec-osf*) +case "$host" in #( + *alpha-dec-osf*) : + printf "%s\n" "#define DEC 1" >>confdefs.h - ;; - *-netbsd* | *-knetbsd*-gnu) + ;; #( + *-netbsd* | *-knetbsd*-gnu) : + printf "%s\n" "#define NETBSD 1" >>confdefs.h - ;; - *-openbsd*) + ;; #( + *-openbsd*) : + printf "%s\n" "#define OPENBSD 1" >>confdefs.h - ;; - *-freebsd* | *-kfreebsd*-gnu | *-dragonfly*) + ;; #( + *-freebsd* | *-kfreebsd*-gnu | *-dragonfly*) : + printf "%s\n" "#define FREEBSD 1" >>confdefs.h - ;; - *-bsdi*) + ;; #( + *-bsdi*) : + printf "%s\n" "#define BSDI 1" >>confdefs.h - ;; - *-sgi-irix5* | *-sgi-irix6*) + ;; #( + *-sgi-irix5* | *-sgi-irix6*) : + printf "%s\n" "#define IRIX 1" >>confdefs.h - ;; - *-hpux*) + ;; #( + *-hpux*) : + printf "%s\n" "#define HPUX 1" >>confdefs.h @@ -7046,8 +7087,9 @@ then : fi - ;; - *-aix*) + ;; #( + *-aix*) : + # use some AIX specific libraries { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for odm_initialize in -lodm" >&5 printf %s "checking for odm_initialize in -lodm... " >&6; } @@ -7178,65 +7220,76 @@ then : fi - ;; - *-solaris2.0*) + ;; #( + *-solaris2.0*) : + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h printf "%s\n" "#define SOLARIS 1" >>confdefs.h - ;; - *-solaris2.[1-9][0-9]*) + ;; #( + *-solaris2.[1-9][0-9]*) : + printf "%s\n" "#define SOLARIS 1" >>confdefs.h - ;; - *-solaris2.1*) + ;; #( + *-solaris2.1*) : + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h printf "%s\n" "#define SOLARIS 1" >>confdefs.h - ;; - *-solaris2.2*) + ;; #( + *-solaris2.2*) : + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h printf "%s\n" "#define SOLARIS 1" >>confdefs.h - ;; - *-solaris2.3*) + ;; #( + *-solaris2.3*) : + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h printf "%s\n" "#define SOLARIS 1" >>confdefs.h - ;; - *-solaris2.4*) + ;; #( + *-solaris2.4*) : + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h printf "%s\n" "#define SOLARIS 1" >>confdefs.h - ;; - *-solaris2.5.1) + ;; #( + *-solaris2.5.1) : + printf "%s\n" "#define STUPID_SOLARIS_CHECKSUM_BUG 1" >>confdefs.h printf "%s\n" "#define SOLARIS 1" >>confdefs.h - ;; - *-solaris*) + ;; #( + *-solaris*) : + printf "%s\n" "#define SOLARIS 1" >>confdefs.h - ;; - *-sunos4*) + ;; #( + *-sunos4*) : + printf "%s\n" "#define SUNOS 1" >>confdefs.h printf "%s\n" "#define SPRINTF_RETURNS_STRING 1" >>confdefs.h - ;; - *-linux*) + ;; #( + *-linux*) : + printf "%s\n" "#define LINUX 1" >>confdefs.h - ;; - *-apple-darwin*) + ;; #( + *-apple-darwin*) : + printf "%s\n" "#define MACOSX 1" >>confdefs.h @@ -7281,7 +7334,10 @@ then : fi needs_cpp_precomp=yes - ;; + + ;; #( + *) : + ;; esac @@ -8718,6 +8774,7 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + # Some ASCII ART#!#@$!@#$ if test -f docs/leet-nping-ascii-art.txt; then cat docs/leet-nping-ascii-art.txt diff --git a/nping/configure.ac b/nping/configure.ac index fe18afdca..4062eb672 100644 --- a/nping/configure.ac +++ b/nping/configure.ac @@ -9,7 +9,7 @@ m4_include([../m4/ax_check_compile_flag.m4]) m4_include([../acinclude.m4]) AC_ARG_WITH(localdirs, -AC_HELP_STRING([--with-localdirs], [Explicitly ask compiler to use /usr/local/{include,libs} if they exist ]), +AS_HELP_STRING([--with-localdirs], [Explicitly ask compiler to use /usr/local/{include,libs} if they exist ]), [ case "$with_localdirs" in yes) user_localdirs=1 @@ -37,7 +37,7 @@ pcredir=libpcre AC_SUBST(pcredir) dnl use nping_config.h instead of -D macros -AC_CONFIG_HEADER(nping_config.h) +AC_CONFIG_HEADERS([nping_config.h]) dnl Host specific hacks AC_CANONICAL_HOST @@ -80,28 +80,36 @@ fi # Remember that all following tests will run with this CXXFLAGS by default AC_MSG_CHECKING(for __func__) -AH_TEMPLATE(__func__, [C99-specified function identifier]) -AC_TRY_COMPILE([ -#include -],[printf ("%s", __func__);], -have_func=yes, have_func=no) -if test "x$have_func" = "xyes"; then +AH_TEMPLATE([__func__], [C99-specified function identifier]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #include + ], [ + printf ("%s", __func__); + ]) + ], + [have_func=yes], [have_func=no]) +AS_IF([test "x$have_func" = "xyes"], [ AC_MSG_RESULT(yes) -else +], [ AC_MSG_RESULT(no) - AC_MSG_CHECKING(for __FUNCTION__) - AC_TRY_COMPILE([ -#include -],[printf ("%s", __FUNCTION__);], -have_function=yes, have_function=no) - if test "x$have_function" = "xyes"; then + AC_MSG_CHECKING([for __FUNCTION__]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #include + ], [ + printf ("%s", __FUNCTION__); + ])], + [have_function=yes], [have_function=no]) + AS_IF([test "x$have_function" = "xyes"], [ AC_MSG_RESULT(yes) - AC_DEFINE(__func__, __FUNCTION__) - else + AC_DEFINE([__func__], [__FUNCTION__]) + ], [ AC_MSG_RESULT(no) - AC_DEFINE(__func__, __FILE__) - fi -fi + AC_DEFINE([__func__], [__FILE__]) + ]) +]) + AC_PATH_TOOL([STRIP], [strip], [/bin/true]) @@ -148,7 +156,7 @@ AC_SUBST([ENABLE_FUZZING], [$enable_fuzzing]) use_openssl="yes" specialssldir="" AC_ARG_WITH(openssl, -AC_HELP_STRING([--with-openssl=DIR],[Use optional openssl libs and includes from [DIR]/lib/ and [DIR]/include/openssl/)]), +AS_HELP_STRING([--with-openssl=DIR],[Use optional openssl libs and includes from [DIR]/lib/ and [DIR]/include/openssl/)]), [ case "$with_openssl" in yes) ;; @@ -164,8 +172,8 @@ AC_HELP_STRING([--with-openssl=DIR],[Use optional openssl libs and includes from ) # If they didn't specify it, we try to find it -if test "$use_openssl" = "yes" -a -z "$specialssldir"; then - AC_CHECK_HEADER(openssl/ssl.h,, +AS_IF([test "x$use_openssl" = "xyes" -a -z "$specialssldir"], [ + AC_CHECK_HEADER(openssl/ssl.h,[], [ use_openssl="no" if test "$with_openssl" = "yes"; then AC_MSG_ERROR([OpenSSL was explicitly requested but openssl/ssl.h was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl.]) @@ -174,7 +182,7 @@ if test "$use_openssl" = "yes" -a -z "$specialssldir"; then ]) # use_openssl="yes" given explicitly in next 2 rules to avoid adding lib to $LIBS - if test "$use_openssl" = "yes"; then + AS_IF([test "x$use_openssl" = "xyes"], [ AC_CHECK_LIB(crypto, BIO_int_ctrl, [ use_openssl="yes"], [ use_openssl="no" @@ -183,9 +191,9 @@ if test "$use_openssl" = "yes" -a -z "$specialssldir"; then fi AC_MSG_WARN([Failed to find libcrypto so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument]) ]) - fi + ]) - if test "$use_openssl" = "yes"; then + AS_IF([test "x$use_openssl" = "xyes"], [ AC_CHECK_LIB(ssl, SSL_new, [ use_openssl="yes" ], [ use_openssl="no" @@ -194,11 +202,11 @@ if test "$use_openssl" = "yes" -a -z "$specialssldir"; then fi AC_MSG_WARN([Failed to find libssl so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument]) ], [ -lcrypto ]) - fi -fi + ]) +]) OPENSSL_LIBS= -if test "$use_openssl" = "yes"; then +AS_IF([test "x$use_openssl" = "xyes"], [ AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL library]) OPENSSL_LIBS="-lssl -lcrypto" LIBS_TMP="$LIBS" @@ -206,7 +214,7 @@ if test "$use_openssl" = "yes"; then # Check whether the installed OpenSSL supports SHA-256 (ver 0.9.8 or later). AC_CHECK_FUNC(EVP_sha256,, AC_MSG_ERROR([Your version of OpenSSL does not support SHA-256. Please install OpenSSL 0.9.8 or later.])) LIBS="$LIBS_TMP" -fi +]) AC_SUBST(OPENSSL_LIBS) @@ -217,8 +225,8 @@ have_libpcap=no test "${with_libpcap+set}" != "set" && with_libpcap=yes AC_ARG_WITH(libpcap, -AC_HELP_STRING([--with-libpcap=DIR], [Look for pcap in DIR/include and DIR/libs.]) -AC_HELP_STRING([--with-libpcap=included], [Always use version included with Nmap]), +AS_HELP_STRING([--with-libpcap=DIR], [Look for pcap in DIR/include and DIR/libs.]) +AS_HELP_STRING([--with-libpcap=included], [Always use version included with Nmap]), [ case "$with_libpcap" in yes) AC_CHECK_HEADER(pcap.h,[ @@ -251,7 +259,7 @@ if test $needs_cpp_precomp = yes; then CXXFLAGS="-no-cpp-precomp $CXXFLAGS" fi -if test $have_libpcap = yes; then +AS_IF([test x$have_libpcap = xyes], [ if test "${LIBPCAP_INC+set}" = "set"; then CPPFLAGS="-I$LIBPCAP_INC $CPPFLAGS" LDFLAGS="-L$LIBPCAP_LIB $LDFLAGS" @@ -262,9 +270,9 @@ if test $have_libpcap = yes; then LIBS="$LIBS -lpcap" PCAP_IS_SUITABLE([have_libpcap=yes], [have_libpcap=no], [have_libpcap=yes]) LIBS="$LIBS_OLD" -fi +]) -if test $have_libpcap != yes; then +AS_IF([test x$have_libpcap != xyes], [ if test "${LIBPCAP_INC+set}" = "set"; then LDFLAGS="-L$libpcapdir $_ldflags" CPPFLAGS="$CPPFLAGS -I$LIBPCAP_INC" @@ -277,14 +285,14 @@ if test $have_libpcap != yes; then PCAP_BUILD="build-pcap" PCAP_CLEAN="clean-pcap" PCAP_DIST_CLEAN="distclean-pcap" -else +], [ AC_DEFINE(HAVE_LIBPCAP, 1, [Have libpcap library]) LIBPCAP_LIBS="-lpcap" PCAP_DEPENDS="" PCAP_BUILD="" PCAP_CLEAN="" PCAP_DIST_CLEAN="" -fi +]) AC_SUBST(PCAP_DEPENDS) AC_SUBST(PCAP_BUILD) @@ -292,10 +300,10 @@ AC_SUBST(PCAP_CLEAN) AC_SUBST(PCAP_DIST_CLEAN) AC_SUBST(LIBPCAP_LIBS) -if test $have_libpcap != yes ; then +AS_IF([test x$have_libpcap != xyes], [ ac_configure_args="$ac_configure_args '--disable-dbus' '--disable-rdma'" AC_CONFIG_SUBDIRS(libpcap) -fi +]) have_dnet=no @@ -308,8 +316,8 @@ LIBDNETDIR=../libdnet-stripped # version by default, whereas with dnet we use the local version unless # specifically asked to use a system version. AC_ARG_WITH(libdnet, -AC_HELP_STRING([--with-libdnet=DIR], [Use an existing (compiled) dnet lib from DIR/include and DIR/lib.]) -AC_HELP_STRING([--with-libdnet=included], [Use the libdnet version included with Nmap (default)]), +AS_HELP_STRING([--with-libdnet=DIR], [Use an existing (compiled) dnet lib from DIR/include and DIR/lib.]) +AS_HELP_STRING([--with-libdnet=included], [Use the libdnet version included with Nmap (default)]), [ case "$with_libdnet" in yes) ;; @@ -324,7 +332,7 @@ AC_HELP_STRING([--with-libdnet=included], [Use the libdnet version included with ) # If they didn't provide location, we use the included one -if test $have_dnet != yes ; then +AS_IF([test x$have_dnet != xyes], [ AC_CONFIG_SUBDIRS( libdnet-stripped ) CPPFLAGS="-I$LIBDNETDIR/include $CPPFLAGS" LIBDNET_LIBS="$LIBDNETDIR/src/.libs/libdnet.a" @@ -332,13 +340,13 @@ if test $have_dnet != yes ; then DNET_BUILD="build-dnet" DNET_CLEAN="clean-dnet" DNET_DIST_CLEAN="distclean-dnet" -else +], [ LIBDNET_LIBS="-ldnet" DNET_DEPENDS="" DNET_BUILD="" DNET_CLEAN="" DNET_DIST_CLEAN="" -fi +]) AC_SUBST(LIBDNET_LIBS) AC_SUBST(LIBDNETDIR) @@ -353,50 +361,50 @@ dnl edition example code by W. Richard Stevens dnl ################################################################## dnl Check if sockaddr{} has sa_len member. dnl -AC_CACHE_CHECK(if sockaddr{} has sa_len member, ac_cv_sockaddr_has_sa_len, - AC_TRY_COMPILE([ +AC_CACHE_CHECK([if sockaddr{} has sa_len member], [ac_cv_sockaddr_has_sa_len], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include ], - [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 + [unsigned int i = sizeof(((struct sockaddr *)0)->sa_len)])], + [ac_cv_sockaddr_has_sa_len=yes], + [ac_cv_sockaddr_has_sa_len=no])) +AS_IF([test x$ac_cv_sockaddr_has_sa_len = xyes], [ AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [struct sockaddr has sa_len member]) -fi +]) dnl Check if the sockaddr_in implementation has member sin_len dnl ################################################################## dnl Check if sockaddr_in{} has sin_len member. dnl -AC_CACHE_CHECK(if sockaddr_in{} has sin_len member, ac_cv_sockaddr_in_has_sin_len, - AC_TRY_COMPILE([ +AC_CACHE_CHECK([if sockaddr_in{} has sin_len member], [ac_cv_sockaddr_in_has_sin_len], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include #include ], - [unsigned int i = sizeof(((struct sockaddr_in *)0)->sin_len)], - ac_cv_sockaddr_in_has_sin_len=yes, - ac_cv_sockaddr_in_has_sin_len=no)) -if test $ac_cv_sockaddr_in_has_sin_len = yes ; then + [unsigned int i = sizeof(((struct sockaddr_in *)0)->sin_len)])], + [ac_cv_sockaddr_in_has_sin_len=yes], + [ac_cv_sockaddr_in_has_sin_len=no])) +AS_IF([test x$ac_cv_sockaddr_in_has_sin_len = xyes], [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [struct sockaddr_in has sin_len member]) -fi +]) dnl Check if the sockaddr_in6 implementation has member sin6_len dnl ################################################################## dnl Check if sockaddr_in6{} has sin6_len member. dnl -AC_CACHE_CHECK(if sockaddr_in6{} has sin6_len member, ac_cv_sockaddr_in6_has_sin6_len, - AC_TRY_COMPILE([ +AC_CACHE_CHECK([if sockaddr_in6{} has sin6_len member], [ac_cv_sockaddr_in6_has_sin6_len], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include #include ], - [unsigned int i = sizeof(((struct sockaddr_in6 *)0)->sin6_len)], - ac_cv_sockaddr_in6_has_sin6_len=yes, - ac_cv_sockaddr_in6_has_sin6_len=no)) -if test $ac_cv_sockaddr_in6_has_sin6_len = yes ; then + [unsigned int i = sizeof(((struct sockaddr_in6 *)0)->sin6_len)])], + [ac_cv_sockaddr_in6_has_sin6_len=yes], + [ac_cv_sockaddr_in6_has_sin6_len=no])) +AS_IF([test x$ac_cv_sockaddr_in6_has_sin6_len = xyes], [ AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_LEN, 1, [struct sockaddr_in6 has sin6_len member]) -fi +]) #dnl check endedness @@ -405,52 +413,31 @@ AC_C_BIGENDIAN AC_MSG_CHECKING([if struct in_addr is a wacky huge structure (some Sun boxes)]) AH_TEMPLATE(IN_ADDR_DEEPSTRUCT, [], [struct in_addr is a wacky huge structure (some Sun boxes)]) -AC_TRY_COMPILE([#include ], struct in_addr i; i._S_un._S_addr;, \ - AC_DEFINE(IN_ADDR_DEEPSTRUCT) \ - AC_MSG_RESULT(yes) , \ - AC_TRY_COMPILE([#include -#include ], struct in_addr i; i.S_un.S_addr;, \ - AC_DEFINE(IN_ADDR_DEEPSTRUCT) \ - AC_MSG_RESULT(yes) , \ - AC_MSG_RESULT(no);)) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #include + ], + [struct in_addr i; i._S_un._S_addr;]) + ], [ + AC_DEFINE(IN_ADDR_DEEPSTRUCT) + AC_MSG_RESULT(yes) + ], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + #include + #include + ], + [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 - ##include - ##include - ##include - ##define __USE_BSD - ##define __FAVOR_BSD - ##define _BSD_SOURCE - ##include - ##include ], - #[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) -#fi - -#AC_CACHE_CHECK(if struct ip exists, ac_cv_struct_ip_exists, - #AC_TRY_COMPILE([ - ##include - ##include - ##include - ##include - ##define __USE_BSD - ##define __FAVOR_BSD - ##define _BSD_SOURCE - ##include ], - #[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) -#fi - -AC_CACHE_CHECK(if struct ip has ip_sum member, ac_cv_ip_has_ip_sum, - AC_TRY_COMPILE([ +AC_CACHE_CHECK([if struct ip has ip_sum member], [ac_cv_ip_has_ip_sum], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include #include #include @@ -460,16 +447,15 @@ AC_CACHE_CHECK(if struct ip has ip_sum member, ac_cv_ip_has_ip_sum, #define _BSD_SOURCE #include #include ], - [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 + [unsigned int i = sizeof(((struct ip *)0)->ip_sum)])], + [ac_cv_ip_has_ip_sum=yes], + [ac_cv_ip_has_ip_sum=no])) +AS_IF([test x$ac_cv_ip_has_ip_sum = xyes], [ AC_DEFINE(HAVE_IP_IP_SUM, 1, [struct ip has ip_sum member]) -fi +]) -AC_CACHE_CHECK(if function signal is accessible, ac_cv_have_signal, - AC_TRY_COMPILE( - [ +AC_CACHE_CHECK([if function signal is accessible], [ac_cv_have_signal], + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include ], [ @@ -481,12 +467,12 @@ AC_CACHE_CHECK(if function signal is accessible, ac_cv_have_signal, ssignal(SIGINT, handler); return 0; } - ], - ac_cv_have_signal=yes, - ac_cv_have_signal=no)) -if test $ac_cv_have_signal = yes ; then + ])], + [ac_cv_have_signal=yes], + [ac_cv_have_signal=no])) +AS_IF([test x$ac_cv_have_signal = xyes], [ AC_DEFINE(HAVE_SIGNAL, 1, [ssignal function is accessible]) -fi +]) @@ -494,82 +480,82 @@ fi AH_TEMPLATE(SOLARIS, [Sun/Oracle Solaris]) AH_TEMPLATE(STUPID_SOLARIS_CHECKSUM_BUG, [], [A bug in Solaris causing incorrect IP checksums]) -case "$host" in - *alpha-dec-osf*) +AS_CASE(["$host"], + [*alpha-dec-osf*], [ AC_DEFINE(DEC, 1, [DEC Alpha]) - ;; - *-netbsd* | *-knetbsd*-gnu) + ], + [*-netbsd* | *-knetbsd*-gnu], [ AC_DEFINE(NETBSD, 1, [NetBSD]) - ;; - *-openbsd*) + ], + [*-openbsd*], [ AC_DEFINE(OPENBSD, 1, [OpenBSD]) - ;; - *-freebsd* | *-kfreebsd*-gnu | *-dragonfly*) + ], + [*-freebsd* | *-kfreebsd*-gnu | *-dragonfly*], [ AC_DEFINE(FREEBSD, 1, [FreeBSD]) - ;; - *-bsdi*) + ], + [*-bsdi*], [ AC_DEFINE(BSDI, 1, [BSD/OS]) - ;; - *-sgi-irix5* | *-sgi-irix6*) + ], + [*-sgi-irix5* | *-sgi-irix6*], [ AC_DEFINE(IRIX, 1, [IRIX]) - ;; - *-hpux*) + ], + [*-hpux*], [ AC_DEFINE(HPUX, 1, [HP-UX]) # To link with libnet and NM (/usr/lib/libnm.sl) library # on HP-UX 11.11 (other versions?) Mikhail Zakharov (zmey20000@yahoo.com) AC_CHECK_LIB(nm, open_mib) - ;; - *-aix*) + ], + [*-aix*], [ # use some AIX specific libraries AC_CHECK_LIB(odm, odm_initialize) AC_CHECK_LIB(cfg, _system_configuration) AC_CHECK_LIB(crypt, crypt_r) - ;; - *-solaris2.0*) + ], + [*-solaris2.0*], [ AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) AC_DEFINE(SOLARIS) - ;; - *-solaris2.[[1-9]][[0-9]]*) + ], + [*-solaris2.[[1-9]][[0-9]]*], [ AC_DEFINE(SOLARIS) - ;; - *-solaris2.1*) + ], + [*-solaris2.1*], [ AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) AC_DEFINE(SOLARIS) - ;; - *-solaris2.2*) + ], + [*-solaris2.2*], [ AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) AC_DEFINE(SOLARIS) - ;; - *-solaris2.3*) + ], + [*-solaris2.3*], [ AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) AC_DEFINE(SOLARIS) - ;; - *-solaris2.4*) + ], + [*-solaris2.4*], [ AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) AC_DEFINE(SOLARIS) - ;; - *-solaris2.5.1) + ], + [*-solaris2.5.1], [ AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG) AC_DEFINE(SOLARIS) - ;; - *-solaris*) + ], + [*-solaris*], [ AC_DEFINE(SOLARIS) - ;; - *-sunos4*) + ], + [*-sunos4*], [ AC_DEFINE(SUNOS, 1, [SunOS 4]) AC_DEFINE(SPRINTF_RETURNS_STRING, 1, [sprintf(9f) returns its first argument, not the number of characters printed]) - ;; - *-linux*) + ], + [*-linux*], [ AC_DEFINE(LINUX, 1, [Linux]) - ;; - *-apple-darwin*) + ], + [*-apple-darwin*], [ AC_DEFINE(MACOSX, 1, [Apple OS X]) dnl on Mac OSX the math library seems to contain unwanted getopt cruft AC_CHECK_LIB(m, main) needs_cpp_precomp=yes - ;; -esac + ] +) @@ -581,7 +567,9 @@ dnl Checks for library functions. AC_CHECK_FUNCS(strerror) #RECVFROM_ARG6_TYPE -AC_OUTPUT(Makefile) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT + # Some ASCII ART#!#@$!@#$ if test -f docs/leet-nping-ascii-art.txt; then cat docs/leet-nping-ascii-art.txt