From 011ebd731becb5dee29614c68d84236ce88afe8f Mon Sep 17 00:00:00 2001 From: dmiller Date: Mon, 31 Jul 2017 16:56:48 +0000 Subject: [PATCH] Fixes to configure for libssh2+libz --- configure | 455 +++++++++++++++++++--------------------- configure.ac | 217 +++++++++---------- nbase/nbase_winconfig.h | 2 - nmap.cc | 4 +- nmap_config.h.in | 2 +- nmap_winconfig.h | 4 + 6 files changed, 323 insertions(+), 361 deletions(-) diff --git a/configure b/configure index 81f010095..d31b5fd2a 100755 --- a/configure +++ b/configure @@ -658,14 +658,14 @@ DNET_CLEAN DNET_BUILD LIBDNETDIR LIBDNET_LIBS -ZLIB_LIBS -ZLIB_DIST_CLEAN -ZLIB_CLEAN -ZLIB_BUILD LIBSSH2_LIBS LIBSSH2_DIST_CLEAN LIBSSH2_CLEAN LIBSSH2_BUILD +ZLIB_LIBS +ZLIB_DIST_CLEAN +ZLIB_CLEAN +ZLIB_BUILD PCRE_DIST_CLEAN PCRE_CLEAN PCRE_BUILD @@ -789,8 +789,8 @@ with_nping with_openssl with_libpcap with_libpcre -with_libssh2 with_libz +with_libssh2 with_libdnet with_liblua with_liblinear @@ -817,8 +817,8 @@ PYTHON' ac_subdirs_all='nping libpcap libpcre -libssh2 libz +libssh2 libdnet-stripped nbase nsock/src @@ -1462,11 +1462,11 @@ Optional Packages: --with-libpcre=DIR Use an existing (compiled) pcre lib from DIR/include and DIR/lib. --with-libpcre=included Always use the version included with Nmap + --with-libz=DIR Use specific copy of libz + --with-libz=included Always use version included with Nmap --with-libssh2=DIR Use specific copy of libssh2 --with-libssh2=included Always use version included with Nmap --without-libssh2 Compile without libssh2 - --with-libz=DIR Use specific copy of libz - --with-libz=included Always use version included with Nmap --with-libdnet=DIR Use an existing (compiled) dnet lib from DIR/include and DIR/lib. This is NOT RECOMMENDED because we have made many important fixes to our included libdnet, @@ -6592,28 +6592,49 @@ fi -# We test whether desired libssh2 is specified explicitly +# We test whether desired libz is specified explicitly +# Since this is a libssh2 dependency, we have to do it first. + +have_libz="no" +requested_included_libz="no" +test "${with_libz+set}" != "set" && with_libz="yes" +# For now, libz is a libssh2 dependency. +# If we end up using it for something else, we'll have to change this line. +if test "x${with_libssh2}" = "xno"; then + with_libz=no +fi -use_libssh2="yes" -have_libssh2="no" -test "${with_libssh2+set}" != "set" && with_libssh2="yes" - - -# Check whether --with-libssh2 was given. -if test "${with_libssh2+set}" = set; then : - withval=$with_libssh2; case "$with_libssh2" in +# Check whether --with-libz was given. +if test "${with_libz+set}" = set; then : + withval=$with_libz; + case "$with_libz" in yes) - ac_fn_c_check_header_mongrel "$LINENO" "libssh2.h" "ac_cv_header_libssh2_h" "$ac_includes_default" -if test "x$ac_cv_header_libssh2_h" = xyes; then : + ;; + no) + # Do nothing + ;; + included) + requested_included_libz="yes" + ;; + *) + _cppflags=$CPPFLAGS + _ldflags=$LDFLAGS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2_version in -lssh2" >&5 -$as_echo_n "checking for libssh2_version in -lssh2... " >&6; } -if ${ac_cv_lib_ssh2_libssh2_version+:} false; then : + CPPFLAGS="-I$with_libz/include $CPPFLAGS" + LDFLAGS="-L$with_libz/lib $LDFLAGS" + + ac_configure_args="$ac_configure_args '--with-libz-prefix=$with_libz'" + ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +if test "x$ac_cv_header_zlib_h" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 +$as_echo_n "checking for gzread in -lz... " >&6; } +if ${ac_cv_lib_z_gzread+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lssh2 -lm $LIBS" +LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6623,41 +6644,152 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char libssh2_version (); +char gzread (); int main () { -return libssh2_version (); +return gzread (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ssh2_libssh2_version=yes + ac_cv_lib_z_gzread=yes else - ac_cv_lib_ssh2_libssh2_version=no + ac_cv_lib_z_gzread=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssh2_libssh2_version" >&5 -$as_echo "$ac_cv_lib_ssh2_libssh2_version" >&6; } -if test "x$ac_cv_lib_ssh2_libssh2_version" = xyes; then : - have_libssh2="yes" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 +$as_echo "$ac_cv_lib_z_gzread" >&6; } +if test "x$ac_cv_lib_z_gzread" = xyes; then : + have_libz=yes + ZLIB_INC=$with_libz/include + ZLIB_LIB=$with_libz/lib fi fi + + LDFLAGS=$_ldflags + CPPFLAGS=$_cppflags + ;; + esac + + +fi + + +if test $with_libz != no; then + trace_use="$trace_use zlib" + + # If they didn't specify it, we try to find it + if test $have_libz != yes -a $requested_included_libz != yes; then + ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +if test "x$ac_cv_header_zlib_h" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 +$as_echo_n "checking for gzread in -lz... " >&6; } +if ${ac_cv_lib_z_gzread+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gzread (); +int +main () +{ +return gzread (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_z_gzread=yes +else + ac_cv_lib_z_gzread=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 +$as_echo "$ac_cv_lib_z_gzread" >&6; } +if test "x$ac_cv_lib_z_gzread" = xyes; then : + have_libz="yes" +fi + + +fi + + + fi + + if test $have_libz != yes; then + subdirs="$subdirs libz" + + ac_configure_args="$ac_configure_args '--with-libz-prefix=\$(top_srcdir)/$ZLIBDIR'" + CPPFLAGS="-I\$(top_srcdir)/$ZLIBDIR $CPPFLAGS" + ZLIB_LIBS="$ZLIBDIR/libz.a" + ZLIB_BUILD="build-zlib" + ZLIB_CLEAN="clean-zlib" + ZLIB_DIST_CLEAN="distclean-zlib" + +$as_echo "#define ZLIB_INCLUDED 1" >>confdefs.h + + else + ZLIB_LIBS="-lz" + ZLIB_BUILD="" + ZLIB_CLEAN="" + ZLIB_DIST_CLEAN="" + fi + +$as_echo "#define HAVE_LIBZ 1" >>confdefs.h + +else + trace_no_use="$trace_no_use zlib" + ZLIB_LIBS="" + ZLIB_BUILD="" + ZLIB_CLEAN="" + ZLIB_DIST_CLEAN="" +fi + + + + + + +# We test whether desired libssh2 is specified explicitly + +use_libssh2="yes" +have_libssh2="no" +requested_included_libssh2="no" +test "${with_libssh2+set}" != "set" && with_libssh2="yes" + + +# Check whether --with-libssh2 was given. +if test "${with_libssh2+set}" = set; then : + withval=$with_libssh2; case "$with_libssh2" in + yes) ;; no) - with_libssh2="no" use_libssh2="no" ;; included) - have_libssh2="no" + requested_included_libssh2="yes" ;; *) _cppflags=$CPPFLAGS @@ -6718,7 +6850,6 @@ fi LDFLAGS=$_ldflags CPPFLAGS=$_cppflags - with_libssh2="yes" ;; esac @@ -6729,23 +6860,63 @@ fi 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 + # If they didn't specify it, we try to find it + if test $have_libssh2 != yes -a $requested_included_libssh2 != yes; then + ac_fn_c_check_header_mongrel "$LINENO" "libssh2.h" "ac_cv_header_libssh2_h" "$ac_includes_default" +if test "x$ac_cv_header_libssh2_h" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libssh2_version in -lssh2" >&5 +$as_echo_n "checking for libssh2_version in -lssh2... " >&6; } +if ${ac_cv_lib_ssh2_libssh2_version+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssh2 -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char libssh2_version (); +int +main () +{ +return libssh2_version (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ssh2_libssh2_version=yes +else + ac_cv_lib_ssh2_libssh2_version=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssh2_libssh2_version" >&5 +$as_echo "$ac_cv_lib_ssh2_libssh2_version" >&6; } +if test "x$ac_cv_lib_ssh2_libssh2_version" = xyes; then : + have_libssh2="yes" +fi + + +fi + + fi + # If we still don't have it, we use our own if test $have_libssh2 != yes; then + have_libssh2=yes subdirs="$subdirs libssh2" - - if test "${LIBSSH2_INC+set}" = "set"; then - CPPFLAGS="$CPPFLAGS -I$LIBSSH2_INC" - else - CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/$LIBSSH2DIR/include" - fi - + CPPFLAGS="-I\$(top_srcdir)/$LIBSSH2DIR/include $CPPFLAGS" LIBSSH2_LIBS="$LIBSSH2DIR/lib/libssh2.a" LIBSSH2_BUILD="build-libssh2" LIBSSH2_CLEAN="clean-libssh2" @@ -6753,7 +6924,6 @@ if test $use_libssh2 = yes -a $use_openssl = yes; then $as_echo "#define LIBSSH2_INCLUDED 1" >>confdefs.h - with_libssh2="yes" else LIBSSH2_LIBS="-lssh2" LIBSSH2_BUILD="" @@ -6761,7 +6931,6 @@ $as_echo "#define LIBSSH2_INCLUDED 1" >>confdefs.h LIBSSH2_DIST_CLEAN="" fi - $as_echo "#define HAVE_LIBSSH2 1" >>confdefs.h else @@ -6779,196 +6948,6 @@ fi -# 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 - - -# Check whether --with-libz was given. -if test "${with_libz+set}" = set; then : - withval=$with_libz; - case "$with_libz" in - yes) - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 -$as_echo_n "checking for gzread in -lz... " >&6; } -if ${ac_cv_lib_z_gzread+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gzread (); -int -main () -{ -return gzread (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_z_gzread=yes -else - ac_cv_lib_z_gzread=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 -$as_echo "$ac_cv_lib_z_gzread" >&6; } -if test "x$ac_cv_lib_z_gzread" = xyes; then : - have_libz="yes" -fi - - -fi - - - ;; - 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_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gzread in -lz" >&5 -$as_echo_n "checking for gzread in -lz... " >&6; } -if ${ac_cv_lib_z_gzread+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gzread (); -int -main () -{ -return gzread (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_z_gzread=yes -else - ac_cv_lib_z_gzread=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_gzread" >&5 -$as_echo "$ac_cv_lib_z_gzread" >&6; } -if test "x$ac_cv_lib_z_gzread" = xyes; then : - have_libz=yes - ZLIB_INC=$with_libz/include - ZLIB_LIB=$with_libz/lib -fi - - -fi - - - - LDFLAGS=$_ldflags - CPPFLAGS=$_cppflags - with_libz="yes" - ;; - esac - - -fi - - -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 - subdirs="$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" - -$as_echo "#define ZLIB_INCLUDED 1" >>confdefs.h - - else - ZLIB_LIBS="-lz" - ZLIB_BUILD="" - ZLIB_CLEAN="" - ZLIB_DIST_CLEAN="" - fi - -$as_echo "#define HAVE_LIBZ_V 1" >>confdefs.h - - -$as_echo "#define have_libz 1" >>confdefs.h - -else - trace_no_use="$trace_no_use zlib (libssh2 dependency)" - ZLIB_LIBS="" - ZLIB_BUILD="" - ZLIB_CLEAN="" - ZLIB_DIST_CLEAN="" -fi - - - - - - have_dnet=no requested_included_dnet=no LIBDNETDIR=libdnet-stripped diff --git a/configure.ac b/configure.ac index 1b29e65ed..4f7d69af9 100644 --- a/configure.ac +++ b/configure.ac @@ -552,11 +552,99 @@ AC_SUBST(PCRE_CLEAN) AC_SUBST(PCRE_DIST_CLEAN) -# We test whether desired libssh2 is specified explicitly +# We test whether desired libz is specified explicitly +# Since this is a libssh2 dependency, we have to do it first. +have_libz="no" +requested_included_libz="no" +test "${with_libz+set}" != "set" && with_libz="yes" +# For now, libz is a libssh2 dependency. +# If we end up using it for something else, we'll have to change this line. +if test "x${with_libssh2}" = "xno"; then + with_libz=no +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) + ;; + no) + # Do nothing + ;; + included) + requested_included_libz="yes" + ;; + *) + _cppflags=$CPPFLAGS + _ldflags=$LDFLAGS + + CPPFLAGS="-I$with_libz/include $CPPFLAGS" + LDFLAGS="-L$with_libz/lib $LDFLAGS" + + ac_configure_args="$ac_configure_args '--with-libz-prefix=$with_libz'" + 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 + ;; + esac +] +) + +if test $with_libz != no; then + trace_use="$trace_use zlib" + + # If they didn't specify it, we try to find it + if test $have_libz != yes -a $requested_included_libz != yes; then + AC_CHECK_HEADER(zlib.h,[ + AC_CHECK_LIB(z, gzread, + [have_libz="yes"],,[-lm]) + ]) + fi + + if test $have_libz != yes; then + AC_CONFIG_SUBDIRS(libz) + ac_configure_args="$ac_configure_args '--with-libz-prefix=\$(top_srcdir)/$ZLIBDIR'" + CPPFLAGS="-I\$(top_srcdir)/$ZLIBDIR $CPPFLAGS" + 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, 1, [Have zlib library]) +else + trace_no_use="$trace_no_use zlib" + 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) + +# We test whether desired libssh2 is specified explicitly use_libssh2="yes" have_libssh2="no" +requested_included_libssh2="no" test "${with_libssh2+set}" != "set" && with_libssh2="yes" AC_ARG_WITH(libssh2, @@ -565,17 +653,12 @@ 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" + requested_included_libssh2="yes" ;; *) _cppflags=$CPPFLAGS @@ -592,7 +675,6 @@ AC_HELP_STRING([--without-libssh2], [Compile without libssh2]), LDFLAGS=$_ldflags CPPFLAGS=$_cppflags - with_libssh2="yes" ;; esac] ) @@ -601,35 +683,30 @@ AC_HELP_STRING([--without-libssh2], [Compile without libssh2]), 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 + # If they didn't specify it, we try to find it + if test $have_libssh2 != yes -a $requested_included_libssh2 != yes; then + AC_CHECK_HEADER(libssh2.h,[ + AC_CHECK_LIB(ssh2, libssh2_version, + [have_libssh2="yes"],,[-lm]) + ]) fi + # If we still don't have it, we use our own if test $have_libssh2 != yes; then + have_libssh2=yes 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 - + CPPFLAGS="-I\$(top_srcdir)/$LIBSSH2DIR/include $CPPFLAGS" 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" @@ -646,102 +723,6 @@ 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 diff --git a/nbase/nbase_winconfig.h b/nbase/nbase_winconfig.h index a9d9ebd76..955f4b9d5 100644 --- a/nbase/nbase_winconfig.h +++ b/nbase/nbase_winconfig.h @@ -219,8 +219,6 @@ typedef signed __int64 int64_t; #define HAVE_OPENSSL 1 #define HAVE_SSL_SET_TLSEXT_HOST_NAME 1 -#define HAVE_LIBSSH2 1 -#define HAVE_LIBZ_V 1 /* Apparently __func__ isn't yet supported */ #define __func__ __FUNCTION__ diff --git a/nmap.cc b/nmap.cc index b4b4967c7..ad0042fa0 100644 --- a/nmap.cc +++ b/nmap.cc @@ -185,7 +185,7 @@ #include "libssh2/libssh2v.h" #endif -#if HAVE_LIBZ_V +#if HAVE_LIBZ #include "libz/libzv.h" #endif @@ -2852,7 +2852,7 @@ static void display_nmap_version() { without.push_back("libssh2"); #endif -#if HAVE_LIBZ_V +#if HAVE_LIBZ #ifdef ZLIB_INCLUDED with.push_back(std::string("nmap-libz-") + get_word_or_quote(LIBZ_VERSION_TEXT, 1)); #else diff --git a/nmap_config.h.in b/nmap_config.h.in index ae45eed84..4357cca3b 100644 --- a/nmap_config.h.in +++ b/nmap_config.h.in @@ -198,7 +198,7 @@ #undef HAVE_LIBSSH2 -#undef HAVE_LIBZ_V +#undef HAVE_LIBZ #undef HAVE_OPENSSL_EC diff --git a/nmap_winconfig.h b/nmap_winconfig.h index 912d790f5..d42404da1 100644 --- a/nmap_winconfig.h +++ b/nmap_winconfig.h @@ -144,6 +144,8 @@ #define HAVE_OPENSSL 1 #define HAVE_SSL_SET_TLSEXT_HOST_NAME 1 +#define HAVE_LIBSSH2 1 +#define HAVE_LIBZ 1 /* Since MSVC 2010, stdint.h is included as part of C99 compatibility */ #define HAVE_STDINT_H 1 @@ -151,6 +153,8 @@ #undef PCAP_INCLUDED #define DNET_INCLUDED 1 #define PCRE_INCLUDED 1 +#define LIBSSH2_INCLUDED 1 +#define ZLIB_INCLUDED 1 #endif /* NMAP_WINCONFIG_H */