From d029d1d75a34a5d240053cb72d727bc9038c47e5 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 19 Nov 2007 21:36:21 +0000 Subject: [PATCH] Look for strip in configure and strip nmap with strip -x on install. install -s or strip with no arguments was stripping dynamically loaded NSE functions on Mac OS X. The difference between plain strip and strip -x was so slight on Linux that I just made it unconditional. --- Makefile.in | 4 ++ configure | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++- configure.ac | 2 + 3 files changed, 113 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index ca9b212eb..7dff2ebef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -23,6 +23,7 @@ CC = @CC@ CXX = @CXX@ CCOPT = DBGFLAGS = +STRIP = @STRIP@ LIBPCAPDIR = @libpcapdir@ LIBPCREDIR = @LIBPCREDIR@ export LIBDNETDIR = @LIBDNETDIR@ @@ -178,6 +179,9 @@ my_distclean: install-nmap: $(TARGET) $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(nmapdatadir) $(INSTALL) -c -m 755 nmap $(DESTDIR)$(bindir)/nmap +# Use strip -x to avoid stripping dynamically loaded NSE functions. See +# http://seclists.org/nmap-dev/2007/q4/0272.html. + $(STRIP) -x $(DESTDIR)$(bindir)/nmap $(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/$(TARGET).1 $(INSTALL) -c -m 644 docs/nmap.xsl $(DESTDIR)$(nmapdatadir)/ $(INSTALL) -c -m 644 docs/nmap.dtd $(DESTDIR)$(nmapdatadir)/ diff --git a/configure b/configure index 1de9d1214..c0a3705d2 100755 --- a/configure +++ b/configure @@ -673,6 +673,7 @@ ac_ct_CXX CXXPROG COMPAT_OBJS COMPAT_SRCS +STRIP LUAFLAGS CPP GREP @@ -4138,6 +4139,109 @@ 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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $STRIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_STRIP="$STRIP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_STRIP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +STRIP=$ac_cv_path_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_STRIP"; then + ac_pt_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_ac_pt_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_STRIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_STRIP="$ac_pt_STRIP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_STRIP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_STRIP=$ac_cv_path_ac_pt_STRIP +if test -n "$ac_pt_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_pt_STRIP" >&5 +echo "${ECHO_T}$ac_pt_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_pt_STRIP" = x; then + STRIP="/bin/true" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_pt_STRIP + fi +else + STRIP="$ac_cv_path_STRIP" +fi + + needs_cpp_precomp=no LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\"" @@ -8975,6 +9079,7 @@ ac_ct_CXX!$ac_ct_CXX$ac_delim CXXPROG!$CXXPROG$ac_delim COMPAT_OBJS!$COMPAT_OBJS$ac_delim COMPAT_SRCS!$COMPAT_SRCS$ac_delim +STRIP!$STRIP$ac_delim LUAFLAGS!$LUAFLAGS$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim @@ -9011,7 +9116,6 @@ NBASEDIR!$NBASEDIR$ac_delim LIBNBASE_LIBS!$LIBNBASE_LIBS$ac_delim NSOCKDIR!$NSOCKDIR$ac_delim LIBNSOCK_LIBS!$LIBNSOCK_LIBS$ac_delim -PYTHON!$PYTHON$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -9053,6 +9157,7 @@ _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +PYTHON!$PYTHON$ac_delim PYTHON_VERSION!$PYTHON_VERSION$ac_delim PYTHON_PREFIX!$PYTHON_PREFIX$ac_delim PYTHON_EXEC_PREFIX!$PYTHON_EXEC_PREFIX$ac_delim @@ -9065,7 +9170,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 10; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 11; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index 23ba5d22f..d403352d1 100644 --- a/configure.ac +++ b/configure.ac @@ -104,6 +104,8 @@ fi AC_SUBST(COMPAT_OBJS) AC_SUBST(COMPAT_SRCS) +AC_PATH_TOOL([STRIP], [strip], [/bin/true]) + needs_cpp_precomp=no LUAFLAGS="MYCFLAGS=\"-DLUA_USE_POSIX -DLUA_USE_DLOPEN\""