mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Merged gsoc-ssh branch. Closes #910
This commit is contained in:
202
configure.ac
202
configure.ac
@@ -45,6 +45,12 @@ fi
|
||||
libpcapdir=libpcap
|
||||
AC_SUBST(libpcapdir)
|
||||
|
||||
LIBSSH2DIR=libssh2
|
||||
AC_SUBST(LIBSSH2DIR)
|
||||
|
||||
ZLIBDIR=libz
|
||||
AC_SUBST(ZLIBDIR)
|
||||
|
||||
pcredir=libpcre
|
||||
AC_SUBST(pcredir)
|
||||
|
||||
@@ -349,6 +355,7 @@ AC_HELP_STRING([--with-openssl=DIR],[Use optional openssl libs and includes from
|
||||
;;
|
||||
*)
|
||||
specialssldir="$with_openssl"
|
||||
ac_configure_args="$ac_configure_args '--with-libssl-prefix=$with_openssl'"
|
||||
CPPFLAGS="$CPPFLAGS -I$with_openssl/include"
|
||||
LDFLAGS="$LDFLAGS -L$with_openssl/lib"
|
||||
;;
|
||||
@@ -544,6 +551,197 @@ AC_SUBST(PCRE_BUILD)
|
||||
AC_SUBST(PCRE_CLEAN)
|
||||
AC_SUBST(PCRE_DIST_CLEAN)
|
||||
|
||||
|
||||
# We test whether desired libssh2 is specified explicitly
|
||||
|
||||
|
||||
use_libssh2="yes"
|
||||
have_libssh2="no"
|
||||
test "${with_libssh2+set}" != "set" && with_libssh2="yes"
|
||||
|
||||
AC_ARG_WITH(libssh2,
|
||||
AC_HELP_STRING([--with-libssh2=DIR], [Use specific copy of libssh2])
|
||||
AC_HELP_STRING([--with-libssh2=included], [Always use version included with Nmap])
|
||||
AC_HELP_STRING([--without-libssh2], [Compile without libssh2]),
|
||||
[ case "$with_libssh2" in
|
||||
yes)
|
||||
AC_CHECK_HEADER(libssh2.h,[
|
||||
AC_CHECK_LIB(ssh2, libssh2_version,
|
||||
[have_libssh2="yes"],,[-lm])
|
||||
])
|
||||
;;
|
||||
no)
|
||||
with_libssh2="no"
|
||||
use_libssh2="no"
|
||||
;;
|
||||
included)
|
||||
have_libssh2="no"
|
||||
;;
|
||||
*)
|
||||
_cppflags=$CPPFLAGS
|
||||
_ldflags=$LDFLAGS
|
||||
|
||||
CPPFLAGS="-I$with_libssh2/include $CPPFLAGS"
|
||||
LDFLAGS="-L$with_libssh2/lib $LDFLAGS"
|
||||
|
||||
AC_CHECK_HEADER(libssh2.h,[
|
||||
AC_CHECK_LIB(ssh2, libssh2_version,
|
||||
[have_libssh2=yes
|
||||
LIBSSH2_INC=$with_libssh2/include
|
||||
LIBSSH2_LIB=$with_libssh2/lib])],,[-lm])
|
||||
|
||||
LDFLAGS=$_ldflags
|
||||
CPPFLAGS=$_cppflags
|
||||
with_libssh2="yes"
|
||||
;;
|
||||
esac]
|
||||
)
|
||||
|
||||
|
||||
if test $use_libssh2 = yes -a $use_openssl = yes; then
|
||||
trace_use="$trace_use libssh2"
|
||||
|
||||
if test $have_libssh2 = yes; then
|
||||
if test "${LIBSSH2_LIB+set}" = "set"; then
|
||||
CPPFLAGS="-I$LIBSSH2_INC $CPPFLAGS"
|
||||
LDFLAGS="-L$LIBSSH2_LIB $LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $have_libssh2 != yes; then
|
||||
AC_CONFIG_SUBDIRS(libssh2)
|
||||
|
||||
if test "${LIBSSH2_INC+set}" = "set"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$LIBSSH2_INC"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/$LIBSSH2DIR/include"
|
||||
fi
|
||||
|
||||
LIBSSH2_LIBS="$LIBSSH2DIR/lib/libssh2.a"
|
||||
LIBSSH2_BUILD="build-libssh2"
|
||||
LIBSSH2_CLEAN="clean-libssh2"
|
||||
LIBSSH2_DIST_CLEAN="distclean-libssh2"
|
||||
AC_DEFINE(LIBSSH2_INCLUDED, 1, [Using included libssh2])
|
||||
with_libssh2="yes"
|
||||
else
|
||||
LIBSSH2_LIBS="-lssh2"
|
||||
LIBSSH2_BUILD=""
|
||||
LIBSSH2_CLEAN=""
|
||||
LIBSSH2_DIST_CLEAN=""
|
||||
fi
|
||||
|
||||
AC_DEFINE(HAVE_LIBSSH2, 1, [Have libssh2 library])
|
||||
else
|
||||
use_libssh2="no"
|
||||
trace_no_use="$trace_no_use libssh2"
|
||||
LIBSSH2_LIBS=""
|
||||
LIBSSH2_BUILD=""
|
||||
LIBSSH2_CLEAN=""
|
||||
LIBSSH2_DIST_CLEAN=""
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBSSH2_BUILD)
|
||||
AC_SUBST(LIBSSH2_CLEAN)
|
||||
AC_SUBST(LIBSSH2_DIST_CLEAN)
|
||||
AC_SUBST(LIBSSH2_LIBS)
|
||||
|
||||
|
||||
# We test whether desired libz is specified explicitly
|
||||
|
||||
have_libz="no"
|
||||
test "${with_libz+set}" != "set" && with_libz="no"
|
||||
|
||||
# Force use of included zlib if compiling with libssh2
|
||||
if test $use_libssh2 = "yes" -a $with_libz = "no"; then
|
||||
with_libz="yes"
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(libz,
|
||||
AC_HELP_STRING([--with-libz=DIR], [Use specific copy of libz])
|
||||
AC_HELP_STRING([--with-libz=included], [Always use version included with Nmap]),
|
||||
[
|
||||
case "$with_libz" in
|
||||
yes)
|
||||
AC_CHECK_HEADER(zlib.h,[
|
||||
AC_CHECK_LIB(z, gzread,
|
||||
[have_libz="yes"],,)
|
||||
])
|
||||
;;
|
||||
no)
|
||||
# Do nothing
|
||||
;;
|
||||
included)
|
||||
with_libz="yes"
|
||||
have_libz="no"
|
||||
;;
|
||||
*)
|
||||
_cppflags=$CPPFLAGS
|
||||
_ldflags=$LDFLAGS
|
||||
|
||||
CPPFLAGS="-I$with_libz/include $CPPFLAGS"
|
||||
LDFLAGS="-L$with_libz/lib $LDFLAGS"
|
||||
|
||||
AC_CHECK_HEADER(zlib.h,[
|
||||
AC_CHECK_LIB(z, gzread,
|
||||
[have_libz=yes
|
||||
ZLIB_INC=$with_libz/include
|
||||
ZLIB_LIB=$with_libz/lib])
|
||||
],,
|
||||
)
|
||||
|
||||
LDFLAGS=$_ldflags
|
||||
CPPFLAGS=$_cppflags
|
||||
with_libz="yes"
|
||||
;;
|
||||
esac
|
||||
]
|
||||
)
|
||||
|
||||
if test $with_libz = yes -a $with_libssh2 = yes; then
|
||||
trace_use="$trace_use zlib (libssh2 dependency)"
|
||||
|
||||
if test $have_libz = yes; then
|
||||
if test "${ZLIB_LIB+set}" = "set"; then
|
||||
CPPFLAGS="-I$ZLIB_INC $CPPFLAGS"
|
||||
LDFLAGS="-L$ZLIB_LIB $LDFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $have_libz != yes; then
|
||||
AC_CONFIG_SUBDIRS(libz)
|
||||
|
||||
if test "${ZLIB_INC+set}" = "set"; then
|
||||
CPPFLAGS="$CPPFLAGS -I$ZLIB_INC"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/$ZLIBDIR"
|
||||
fi
|
||||
|
||||
ZLIB_LIBS="$ZLIBDIR/libz.a"
|
||||
ZLIB_BUILD="build-zlib"
|
||||
ZLIB_CLEAN="clean-zlib"
|
||||
ZLIB_DIST_CLEAN="distclean-zlib"
|
||||
AC_DEFINE(ZLIB_INCLUDED, 1, [Using included zlib])
|
||||
else
|
||||
ZLIB_LIBS="-lz"
|
||||
ZLIB_BUILD=""
|
||||
ZLIB_CLEAN=""
|
||||
ZLIB_DIST_CLEAN=""
|
||||
fi
|
||||
AC_DEFINE(HAVE_LIBZ_V, 1, [Have zlib library for versioning])
|
||||
AC_DEFINE(have_libz, 1, [Have zlib library])
|
||||
else
|
||||
trace_no_use="$trace_no_use zlib (libssh2 dependency)"
|
||||
ZLIB_LIBS=""
|
||||
ZLIB_BUILD=""
|
||||
ZLIB_CLEAN=""
|
||||
ZLIB_DIST_CLEAN=""
|
||||
fi
|
||||
|
||||
AC_SUBST(ZLIB_BUILD)
|
||||
AC_SUBST(ZLIB_CLEAN)
|
||||
AC_SUBST(ZLIB_DIST_CLEAN)
|
||||
AC_SUBST(ZLIB_LIBS)
|
||||
|
||||
have_dnet=no
|
||||
requested_included_dnet=no
|
||||
LIBDNETDIR=libdnet-stripped
|
||||
@@ -1007,3 +1205,7 @@ echo "Type make (or gmake on some *BSD machines) to compile."
|
||||
if test "x$use_openssl" = "xno" && test "x$with_openssl" != "xno"; then
|
||||
echo "WARNING: You are compiling without OpenSSL"
|
||||
fi
|
||||
|
||||
if test "x$use_libssh2" != "xyes"; then
|
||||
echo "WARNING: You are compiling without LibSSH2"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user