1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00
Files
nmap/configure.ac
fyodor 9ca4041ec1 Merged -r13793:HEAD from nmap-exp/dev/nmap branch now that we're opening up trunk development
again.  Here are the items which were merged:

------------------------------------------------------------------------
r13971 | jah | 2009-06-29 14:30:27 -0700 (Mon, 29 Jun 2009) | 2 lines

Improved a pattern for matching HTTP status-line, tidy away some variables and
fix a typo.
------------------------------------------------------------------------
r13967 | daniel | 2009-06-29 13:47:04 -0700 (Mon, 29 Jun 2009) | 5 lines

o Added a convenience top-level BSD makefile redirecting BSD make
  to GNU make on BSD systems.  This should help prevent bogus
  error reports when users run "make" instead of "gmake" on BSD
  systems. [Daniel Roethlisberger]

------------------------------------------------------------------------
r13965 | batrick | 2009-06-29 06:50:11 -0700 (Mon, 29 Jun 2009) | 14 lines

[NSE] The NSE Nsock Library binding no longer relies on garbage collection to
monitor the use of socket "slots". A thread (script) attempting to connect must
first obtain one of a limited number of available socket locks (usually 10 or
--max-parallelism). The binding would use garbage collection of sockets to
determine when a thread has finished using its allocated sockets. This is
unfortunately slow and requires us to constantly run the garbage collector to
cause timely reallocation. I have changed the binding to now regularly inspect
allocated sockets in the nsock_loop function. Available sockets slots are now
immediately reallocated and done with far less execution time.

See [1] for benchmarks and further explanation.

[1] http://seclists.org/nmap-dev/2009/q2/0624.html

------------------------------------------------------------------------
r13964 | batrick | 2009-06-29 06:37:49 -0700 (Mon, 29 Jun 2009) | 10 lines

[NSE] Fixed a rare (and usually undetectable) bug that can cause a SEGFAULT.
The NSE nsock library binding may attempt to push values on the stack of
a thread that ended due to an error. It is possible that the internal
Lua stack was completely full and any further pushed values would result
in a segmentation memory violation.

This bug is very hard to reproduce with a SEGFAULT but is usually visible
when Lua assertion checks are turned on. A socket handler routine must be
called AFTER a thread has ended in error.

------------------------------------------------------------------------
r13963 | batrick | 2009-06-29 05:51:20 -0700 (Mon, 29 Jun 2009) | 3 lines

Fixed some global scoped variables to be local. This caused a many scripts to
overwrite each others' sockets, options, etc.

------------------------------------------------------------------------
r13939 | joao | 2009-06-27 16:07:35 -0700 (Sat, 27 Jun 2009) | 2 lines

Fixed port rule to include ssl pop3 port, now that pop3.lua supports SSL connections in function capabilities

------------------------------------------------------------------------
r13938 | joao | 2009-06-27 16:06:28 -0700 (Sat, 27 Jun 2009) | 2 lines

Added transparent SSL support using comm.tryssl

------------------------------------------------------------------------
r13937 | joao | 2009-06-27 16:05:19 -0700 (Sat, 27 Jun 2009) | 2 lines

Added transparent SSL support using comm.tryssl

------------------------------------------------------------------------
r13936 | joao | 2009-06-27 16:03:50 -0700 (Sat, 27 Jun 2009) | 2 lines

Added SSL transparent support using comm.tryssl

------------------------------------------------------------------------
r13935 | joao | 2009-06-27 16:02:39 -0700 (Sat, 27 Jun 2009) | 2 lines

Added SSL transparent support using comm.tryssl

------------------------------------------------------------------------
r13934 | joao | 2009-06-27 16:01:38 -0700 (Sat, 27 Jun 2009) | 2 lines

Added SSL transparent support using comm.tryssl

------------------------------------------------------------------------
r13933 | joao | 2009-06-27 16:00:27 -0700 (Sat, 27 Jun 2009) | 2 lines

SSL transparent support using comm.tryssl

------------------------------------------------------------------------
r13932 | joao | 2009-06-27 15:19:58 -0700 (Sat, 27 Jun 2009) | 2 lines

Included transparent ssl support to function pop3.capabilities using comm.tryssl

------------------------------------------------------------------------
r13931 | joao | 2009-06-27 15:19:06 -0700 (Sat, 27 Jun 2009) | 3 lines

New version of comm.lua with function tryssl, that transparently adds support to ssl connections


------------------------------------------------------------------------
r13930 | joao | 2009-06-27 14:50:38 -0700 (Sat, 27 Jun 2009) | 6 lines

Fixed buffering problem exposed by david on nmap-dev list.
The problem was solved using a buffer to receive the data, making the script work fine in cases where the ssh packets are fragmented.

A very similar solution was applied to ssh1.lua.


------------------------------------------------------------------------
r13928 | batrick | 2009-06-27 04:43:12 -0700 (Sat, 27 Jun 2009) | 18 lines

[NSE] We now propogate a NSE initiated yield on a script through all user
coroutines so that NSE may resume control. Previously, scripts that would yield
in a child coroutine (e.g. a script's child coroutine generated by Lua's
coroutine.create function) would give control back to the script. A script
would yield in this way by making a blocking socket operation. NSE would be
unable to correctly resume child coroutine when the socket operation is
finished processing.

By yielding the chain of coroutines a script has operating, we allow to NSE to
handle the socket operation properly. NSE would then resume the entire chain so
execution may correctly resume at the coroutine which initiated the socket
operation. This restores the "illusion" that a script executes without
interruption.

See [1] for more information, further explanation, and some use cases.

[1] http://seclists.org/nmap-dev/2009/q2/0586.html

------------------------------------------------------------------------
r13817 | david | 2009-06-18 15:57:29 -0700 (Thu, 18 Jun 2009) | 3 lines

Improve an OS fingerprint with a model number and broader matching.
Based on a follow-up report from a submitter.

------------------------------------------------------------------------
r13814 | josh | 2009-06-17 21:34:15 -0700 (Wed, 17 Jun 2009) | 3 lines

[zenmap] Added support to zenmap for the new SCTP options: -PY, -sY and -sZ


------------------------------------------------------------------------
r13797 | ron | 2009-06-17 11:02:18 -0700 (Wed, 17 Jun 2009) | 1 line

Applied a patch from Mak Kolibabi that enhances the output of smb-enum-processes. The output is now modeled after the output of the 'ps' tool for higher verbosity levels.
------------------------------------------------------------------------
r13795 | david | 2009-06-17 09:05:21 -0700 (Wed, 17 Jun 2009) | 6 lines

The configure script now allows cross-compiling by assuming that
libpcap is recent enough. Previously it would quit because a test
program could not be run. libpcap will always be recent enough when
the included copy is used. The patch was contributed by Mike
Frysinger.
2009-06-29 23:48:19 +00:00

795 lines
21 KiB
Plaintext

# Require autoconf 2.13 -*- mode: fundamental; -*-
AC_PREREQ(2.13)
dnl Process this file with autoconf to produce a configure script.
AC_INIT(nmap.cc)
AC_ARG_WITH(localdirs,
AC_HELP_STRING([--with-localdirs], [Explicitly ask compiler to use /usr/local/{include,libs} if they exist ]),
[ case "$with_localdirs" in
yes)
user_localdirs=1
;;
no)
user_localdirs=0
;;
esac
],
[ user_localdirs=0 ] )
if test "$user_localdirs" = 1; then
if test -d /usr/local/lib; then
LDFLAGS="$LDFLAGS -L/usr/local/lib"
fi
if test -d /usr/local/include; then
CFLAGS="$CFLAGS -I/usr/local/include"
CXXFLAGS="$CFLAGS -I/usr/local/include"
fi
fi
libpcapdir=libpcap
AC_SUBST(libpcapdir)
pcredir=libpcre
AC_SUBST(pcredir)
dnl use nmap_config.h instead of -D macros
AC_CONFIG_HEADER(nmap_config.h)
dnl Host specific hacks
AC_CANONICAL_HOST
AC_C_INLINE
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
if test -n "$GXX"; then
CXXFLAGS="$CXXFLAGS -Wall "
fi
AC_MSG_CHECKING([whether the compiler is gcc 4 or greater])
if test x"$GXX" = xno; then
AC_MSG_RESULT([no])
else
# On some distros, there are snapshots available as gcc4
if test -z "$ac_cv_prog_CC" || test x"$CC" = xgcc4; then
our_gcc="$CC"
else
our_gcc="$ac_cv_prog_CC"
fi
nmap_gcc_major_version=0
case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
*4.)
nmap_gcc_major_version=4
;;
esac
if test 4 -ge $nmap_gcc_major_version; then
AC_MSG_RESULT([yes])
CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
else
AC_MSG_RESULT([no])
fi
fi
# Remember that all following tests will run with this CXXFLAGS by default
AC_MSG_CHECKING(for __func__)
AC_TRY_COMPILE([
#include <stdio.h>
],[printf ("%s", __func__);],
have_func=yes, have_func=no)
if test "x$have_func" = "xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for __FUNCTION__)
AC_TRY_COMPILE([
#include <stdio.h>
],[printf ("%s", __FUNCTION__);],
have_function=yes, have_function=no)
if test "x$have_function" = "xyes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(__func__, __FUNCTION__)
else
AC_MSG_RESULT(no)
AC_DEFINE(__func__, __FILE__)
fi
fi
AC_SUBST(COMPAT_OBJS)
AC_SUBST(COMPAT_SRCS)
AC_PATH_TOOL([STRIP], [strip], [/bin/true])
needs_cpp_precomp=no
LUA_CFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN"
case "$host" in
*alpha-dec-osf*)
AC_DEFINE(DEC)
;;
*-netbsd* | *-knetbsd*-gnu)
AC_DEFINE(NETBSD)
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-openbsd*)
AC_DEFINE(OPENBSD)
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-freebsd* | *-kfreebsd*-gnu | *-dragonfly*)
AC_DEFINE(FREEBSD)
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-bsdi*)
AC_DEFINE(BSDI)
;;
*-sgi-irix5* | *-sgi-irix6*)
AC_DEFINE(IRIX)
;;
*-hpux*)
AC_DEFINE(HPUX)
# 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*)
# use some AIX specific libraries
AC_CHECK_LIB(odm, odm_initialize)
AC_CHECK_LIB(cfg, _system_configuration)
;;
*-solaris2.0*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
;;
*-solaris2.[[1-9]][[0-9]]*)
AC_DEFINE(SOLARIS)
;;
*-solaris2.1*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
;;
*-solaris2.2*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
;;
*-solaris2.3*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
;;
*-solaris2.4*)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
;;
*-solaris2.5.1)
AC_DEFINE(STUPID_SOLARIS_CHECKSUM_BUG)
AC_DEFINE(SOLARIS)
;;
*-solaris*)
AC_DEFINE(SOLARIS)
;;
*-sunos4*)
AC_DEFINE(SUNOS)
AC_DEFINE(SPRINTF_RETURNS_STRING)
;;
*-linux*)
AC_DEFINE(LINUX)
LDFLAGS="-Wl,-E $LDFLAGS" # needed for nse-C-module support
;;
*-apple-darwin*)
AC_DEFINE(MACOSX)
dnl on Mac OSX the math library seems to contain unwanted getopt cruft
AC_CHECK_LIB(m, main)
LUA_CFLAGS="-DLUA_USE_MACOSX"
needs_cpp_precomp=yes
;;
esac
AC_SUBST(LUA_CFLAGS)
dnl Checks for header files.
AC_CHECK_HEADERS(pwd.h termios.h sys/sockio.h)
dnl If any socket libraries needed
AC_SEARCH_LIBS(setsockopt, socket)
AC_SEARCH_LIBS(gethostbyname, nsl)
# Do they want Ndiff?
AC_ARG_WITH(ndiff, AC_HELP_STRING([--without-ndiff], [Skip installation of the Ndiff utility]), [], [with_ndiff=check])
if test "$with_ndiff" != "no"; then
AM_PATH_PYTHON([2.4], [],
[if test "$with_ndiff" = "check"; then
AC_MSG_WARN([Not building Ndiff because Python 2.4 or later was not found])
else
AC_MSG_FAILURE([--with-ndiff requires Python 2.4 or later])
fi
with_ndiff=no])
fi
if test "$with_ndiff" = "no"; then
BUILDNDIFF=""
INSTALLNDIFF=""
NDIFF_CLEAN=""
NDIFF_DIST_CLEAN=""
else
BUILDNDIFF=build-ndiff
INSTALLNDIFF=install-ndiff
NDIFF_CLEAN=ndiff_clean
NDIFF_DIST_CLEAN=ndiff_dist_clean
fi
AC_SUBST(BUILDNDIFF)
AC_SUBST(INSTALLNDIFF)
AC_SUBST(NDIFF_CLEAN)
AC_SUBST(NDIFF_DIST_CLEAN)
# Do they want Zenmap?
AC_ARG_WITH(zenmap, AC_HELP_STRING([--without-zenmap], [Skip installation of the Zenmap graphical frontend]), [], [with_zenmap=check])
if test "$with_zenmap" != "no"; then
AM_PATH_PYTHON([2.4], [],
[if test "$with_zenmap" = "check"; then
AC_MSG_WARN([Not building Zenmap because Python 2.4 or later was not found])
else
AC_MSG_FAILURE([--with-zenmap requires Python 2.4 or later])
fi
with_zenmap=no])
fi
if test "$with_zenmap" = "no"; then
BUILDZENMAP=""
INSTALLZENMAP=""
UNINSTALLZENMAP=""
ZENMAP_CLEAN=""
ZENMAP_DIST_CLEAN=""
else
BUILDZENMAP=build-zenmap
INSTALLZENMAP=install-zenmap
UNINSTALLZENMAP=uninstall-zenmap
ZENMAP_CLEAN=zenmap_clean
ZENMAP_DIST_CLEAN=zenmap_dist_clean
fi
AC_SUBST(BUILDZENMAP)
AC_SUBST(INSTALLZENMAP)
AC_SUBST(UNINSTALLZENMAP)
AC_SUBST(ZENMAP_CLEAN)
AC_SUBST(ZENMAP_DIST_CLEAN)
# We test whether they specified openssl desires explicitly
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/)]),
[ case "$with_openssl" in
yes)
;;
no)
use_openssl="no"
;;
*)
specialssldir="$with_openssl"
CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
LDFLAGS="$LDFLAGS -L$with_openssl/lib"
;;
esac]
)
# 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,,
[ 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.])
fi
AC_MSG_WARN([Failed to find openssl/ssl.h so OpenSSL will not be used. If it is installed you can try the --with-openssl=DIR argument])
])
# use_openssl="yes" given explicitly in next 2 rules to avoid adding lib to $LIBS
if test "$use_openssl" = "yes"; then
AC_CHECK_LIB(crypto, BIO_int_ctrl,
[ use_openssl="yes"],
[ use_openssl="no"
if test "$with_openssl" = "yes"; then
AC_MSG_ERROR([OpenSSL was explicitly requested but libcrypto was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl.])
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
AC_CHECK_LIB(ssl, SSL_new,
[ use_openssl="yes" ],
[ use_openssl="no"
if test "$with_openssl" = "yes"; then
AC_MSG_ERROR([OpenSSL was explicitly requested but libssl was not found. Try the --with-openssl=DIR argument to give the location of OpenSSL or run configure with --without-openssl.])
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
AC_DEFINE(HAVE_OPENSSL)
OPENSSL_LIBS="-lssl -lcrypto"
fi
AC_SUBST(OPENSSL_LIBS)
dnl Check whether libpcap is already available
have_libpcap=no
# By default, search for pcap library
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]),
[ case "$with_libpcap" in
yes)
AC_CHECK_HEADER(pcap.h,[
AC_CHECK_LIB(pcap, pcap_datalink,
[have_libpcap=yes ])])
;;
included)
have_libpcap=no
;;
*)
_cppflags=$CXXFLAGS
_ldflags=$LDFLAGS
CPPFLAGS="-I$with_libpcap/include $CPPFLAGS"
LDFLAGS="-L$with_libpcap/lib $LDFLAGS"
AC_CHECK_HEADER(pcap.h,[
AC_CHECK_LIB(pcap, pcap_datalink,
[have_libpcap=yes
LIBPCAP_INC=$with_libpcap/include
LIBPCAP_LIB=$with_libpcap/lib])])
LDFLAGS=$_ldflags
CXXFLAGS=$_cppflags
;;
esac]
)
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
_cflags=$CXXFLAGS
_ldflags=$LDFLAGS
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_MSG_CHECKING(if libpcap version is recent enough)
AC_TRY_RUN([
#include <stdio.h>
extern char pcap_version[];
int main() {
int major, minor1, minor2;
sscanf(pcap_version,"%d.%d.%d", &major, &minor1, &minor2);
if (major > 0)
exit(0);
if (minor1 < 9)
exit(1);
if (minor2 < 4)
exit(1);
exit(0);
}],
[AC_MSG_RESULT(yes); have_libpcap=yes],
[AC_MSG_RESULT(no); have_libpcap=no],
[AC_MSG_RESULT(cross-compiling -- assuming yes); have_libpcap=yes])
LIBS="$LIBS_OLD"
fi
LIBPCAP_LIBS="-lpcap"
if test $have_libpcap = yes; then
PCAP_DEPENDS=""
PCAP_BUILD=""
PCAP_CLEAN=""
PCAP_DIST_CLEAN=""
AC_DEFINE(HAVE_LIBPCAP)
else
if test "${LIBPCAP_INC+set}" = "set"; then
LDFLAGS="-L$libpcapdir $_ldflags"
CPPFLAGS="$CPPFLAGS -I$LIBPCAP_INC"
else
LDFLAGS="-L$libpcapdir $LDFLAGS"
CPPFLAGS="$CPPFLAGS -I$libpcapdir"
fi
PCAP_DEPENDS='$(LIBPCAPDIR)/libpcap.a'
PCAP_BUILD="pcap_build"
PCAP_CLEAN="pcap_clean"
PCAP_DIST_CLEAN="pcap_dist_clean"
fi
AC_SUBST(PCAP_DEPENDS)
AC_SUBST(PCAP_BUILD)
AC_SUBST(PCAP_CLEAN)
AC_SUBST(PCAP_DIST_CLEAN)
AC_SUBST(LIBPCAP_LIBS)
if test $have_libpcap != yes ; then
AC_CONFIG_SUBDIRS(libpcap)
fi
have_pcre=no
requested_included_pcre=no
LIBPCREDIR=libpcre
# First we test whether they specified libpcre explicitly
AC_ARG_WITH(libpcre,
AC_HELP_STRING([--with-libpcre=DIR], [Use an existing (compiled) pcre lib from DIR/include and DIR/lib.])
AC_HELP_STRING([--with-libpcre=included], [Always use the version included with Nmap]),
[ case "$with_libpcre" in
yes)
;;
included)
requested_included_pcre=yes
;;
*)
CPPFLAGS="-I$with_libpcre/include $CPPFLAGS"
LDFLAGS="-L$with_libpcre/lib $LDFLAGS"
have_pcre=yes
;;
esac]
)
# If they didn't specify it, we try to find it
if 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_HEADER(pcre/pcre.h,
[AC_CHECK_LIB(pcre, pcre_version, [have_pcre=yes])]
)]
)
fi
# If we still don't have it, we use our own
if test $have_pcre != yes ; then
AC_CONFIG_SUBDIRS( libpcre )
CPPFLAGS="-I$LIBPCREDIR $CPPFLAGS"
LIBPCRE_LIBS="$LIBPCREDIR/libpcre.a"
PCRE_DEPENDS="$LIBPCREDIR/libpcre.a"
PCRE_BUILD="pcre_build"
PCRE_CLEAN="pcre_clean"
PCRE_DIST_CLEAN="pcre_dist_clean"
else
# We only need to check for and use this if we are NOT using included pcre
AC_CHECK_HEADERS(pcre/pcre.h)
LIBPCRE_LIBS="-lpcre"
PCRE_DEPENDS=""
PCRE_BUILD=""
PCRE_CLEAN=""
PCRE_DIST_CLEAN=""
fi
AC_SUBST(LIBPCRE_LIBS)
AC_SUBST(LIBPCREDIR)
AC_SUBST(PCRE_DEPENDS)
AC_SUBST(PCRE_BUILD)
AC_SUBST(PCRE_CLEAN)
AC_SUBST(PCRE_DIST_CLEAN)
have_dnet=no
requested_included_dnet=no
LIBDNETDIR=libdnet-stripped
# First we test whether they specified libdnet explicitly.
# Unlike the other included libraries (pcap, pcre, lua), we prefer our local
# copy of libdnet. That is, with the other libraries we check for a system
# 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)]),
[ case "$with_libdnet" in
yes)
;;
included)
;;
*)
CPPFLAGS="-I$with_libdnet/include $CPPFLAGS"
LDFLAGS="-L$with_libdnet/lib $LDFLAGS"
have_dnet=yes
;;
esac]
)
# If they didn't provide location, we use the included one
if test $have_dnet != yes ; then
AC_CONFIG_SUBDIRS( libdnet-stripped )
CPPFLAGS="-I$LIBDNETDIR/include $CPPFLAGS"
LIBDNET_LIBS="$LIBDNETDIR/src/.libs/libdnet.a"
DNET_DEPENDS="$LIBDNETDIR/src/.libs/libdnet.a"
DNET_BUILD="dnet_build"
DNET_CLEAN="dnet_clean"
DNET_DIST_CLEAN="dnet_dist_clean"
else
LIBDNET_LIBS="-ldnet"
DNET_DEPENDS=""
DNET_BUILD=""
DNET_CLEAN=""
DNET_DIST_CLEAN=""
fi
AC_SUBST(LIBDNET_LIBS)
AC_SUBST(LIBDNETDIR)
AC_SUBST(DNET_DEPENDS)
AC_SUBST(DNET_BUILD)
AC_SUBST(DNET_CLEAN)
AC_SUBST(DNET_DIST_CLEAN)
LIBLUADIR=liblua
have_lua=no
requested_included_lua=no
no_lua=no
# First we test whether they specified liblua explicitly
AC_ARG_WITH(liblua,
AC_HELP_STRING([--with-liblua=DIR], [Use an existing (compiled) lua lib from DIR/include and DIR/lib.])
AC_HELP_STRING([--with-liblua=included], [Use the liblua version included with Nmap])
AC_HELP_STRING([--without-liblua], [Compile without lua (this will exclude all of NSE from compilation)]),
[ case "$with_liblua" in
yes)
;;
included)
CPPFLAGS="-I$LIBLUADIR $CPPFLAGS"
LIBLUA_LIBS="$LIBLUADIR/liblua.a"
LUA_DEPENDS="$LIBLUADIR/liblua.a"
LUA_BUILD="lua_build"
LUA_CLEAN="lua_clean"
LUA_DIST_CLEAN="lua_dist_clean"
have_lua="yes"
;;
no)
no_lua="yes"
;;
*)
CPPFLAGS="-I$with_liblua/include $CPPFLAGS"
LDFLAGS="-L$with_liblua/lib $LDFLAGS"
;;
esac]
)
# OpenSSL and NSE C modules can require dlopen
AC_SEARCH_LIBS(dlopen, dl)
# They don't want lua
if test "$no_lua" = "yes"; then
CPPFLAGS="-DNOLUA $CPPFLAGS"
LIBLUA_LIBS=""
LUA_DEPENDS=""
LUA_BUILD=""
LUA_CLEAN=""
LUA_DIST_CLEAN=""
INSTALLNSE=""
else
# If they didn't specify it, we try to find it
if test $have_lua != yes; then
AC_CHECK_HEADERS([lua.h lua/lua.h lua5.1/lua.h],
AC_CHECK_LIB(lua, lua_call, [have_lua=yes; LIBLUA_LIBS="-llua"; CPPFLAGS="-I/usr/include/lua $CPPFLAGS"; break],, [-lm])
AC_CHECK_LIB(lua5.1, lua_call, [have_lua=yes; LIBLUA_LIBS="-llua5.1"; CPPFLAGS="-I/usr/include/lua5.1 $CPPFLAGS"; break],, [-lm])
)
AC_LANG_PUSH(C++)
AC_MSG_CHECKING([for lua version >= 501])
AC_RUN_IFELSE([ AC_LANG_PROGRAM(
[[#include <lua.h>]],
[[if(LUA_VERSION_NUM < 501) return 1;]])],
have_lua=yes, have_lua=no)
AC_LANG_POP(C++)
LUA_DEPENDS=""
LUA_BUILD=""
LUA_CLEAN=""
LUA_DIST_CLEAN=""
fi
# if we didn't find we use our own
if test $have_lua != yes; then
AC_MSG_RESULT(no)
CPPFLAGS="-I$LIBLUADIR $CPPFLAGS"
LIBLUA_LIBS="$LIBLUADIR/liblua.a"
LUA_DEPENDS="$LIBLUADIR/liblua.a"
LUA_BUILD="lua_build"
LUA_CLEAN="lua_clean"
LUA_DIST_CLEAN="lua_dist_clean"
else
AC_MSG_RESULT(yes)
fi
INSTALLNSE="install-nse"
fi
AC_SUBST(LIBLUA_LIBS)
AC_SUBST(LIBLUADIR)
AC_SUBST(LUA_DEPENDS)
AC_SUBST(LUA_BUILD)
AC_SUBST(LUA_CLEAN)
AC_SUBST(LUA_DIST_CLEAN)
AC_SUBST(INSTALLNSE)
AC_SUBST(CXXFLAGS)
dnl This test is from the configure.in of Unix Network Programming second
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([
#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)
fi
#dnl check endedness
AC_C_BIGENDIAN
AC_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)
fi
AC_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)
fi
AC_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)
fi
dnl Checks for library functions.
AC_CHECK_FUNCS(strerror)
RECVFROM_ARG6_TYPE
AC_ARG_WITH(libnbase,
AC_HELP_STRING([--with-libnbase=DIR], [Look for nbase include/libs in DIR]),
[ case "$with_libnbase" in
yes)
;;
*)
NBASEDIR="$with_libnbase"
NBASE_BUILD=""
;;
esac],
NBASE_BUILD="nbase_build"
NBASEDIR="nbase"
)
LDFLAGS="$LDFLAGS -L$NBASEDIR"
CPPFLAGS="$CPPFLAGS -I$NBASEDIR"
LIBNBASE_LIBS="-lnbase"
AC_SUBST(NBASEDIR)
AC_SUBST(NBASE_BUILD)
AC_SUBST(LIBNBASE_LIBS)
AC_CONFIG_SUBDIRS(nbase)
NSOCKDIR="nsock"
NSOCK_BUILD="nsock_build"
AC_ARG_WITH(libnsock,
AC_HELP_STRING([--with-libnsock=DIR], [Compile and link to libnsock in DIR]),
[ case "$with_libnsock" in
yes)
;;
*)
NSOCKDIR="$with_libnsock"
NSOCK_BUILD=""
;;
esac]
)
LDFLAGS="$LDFLAGS -L$NSOCKDIR/src/"
CPPFLAGS="$CPPFLAGS -I$NSOCKDIR/include"
LIBNSOCK_LIBS="-lnsock"
AC_SUBST(NSOCKDIR)
AC_SUBST(NSOCK_BUILD)
AC_SUBST(LIBNSOCK_LIBS)
AC_CONFIG_SUBDIRS(nsock/src)
NCATDIR="ncat"
AC_ARG_WITH(ncat,
AC_HELP_STRING([--without-ncat], [Skip build and installation of Ncat]), [], [with_ncat=check])
if test "$with_ncat" = "no"; then
NCAT_BUILD=""
NCAT_INSTALL=""
NCAT_UNINSTALL=""
NCAT_CLEAN=""
NCAT_DIST_CLEAN=""
else
NCAT_BUILD="ncat_build"
NCAT_INSTALL="install-ncat"
NCAT_UNINSTALL="uninstall-ncat"
NCAT_CLEAN="ncat_clean"
NCAT_DIST_CLEAN="ncat_dist_clean"
AC_CONFIG_SUBDIRS(ncat)
fi
AC_SUBST(NCATDIR)
AC_SUBST(NCAT_BUILD)
AC_SUBST(NCAT_INSTALL)
AC_SUBST(NCAT_UNINSTALL)
AC_SUBST(NCAT_CLEAN)
AC_SUBST(NCAT_DIST_CLEAN)
AC_OUTPUT(Makefile)
# Krad ASCII ART#!#@$!@#$
if test -f docs/leet-nmap-ascii-art.txt; then
cat docs/leet-nmap-ascii-art.txt
fi
echo "Configuration complete. Type make (or gmake on some *BSD machines) to compile."