1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Add configure/Makefile stuff for libsvn1 detection.

nmap-update is built optionally, only if libsvn1 is present.
This commit is contained in:
david
2011-12-19 05:16:17 +00:00
parent cefbbb961a
commit f8e4071164
3 changed files with 237 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ OBJS = main.o nmap.o targets.o tcpip.o nmap_error.o utils.o idle_scan.o osscan.o
# large for field of 2 bytes". Disable debugging for this one file.
FPModel.o: CXXFLAGS += -g0
all: @LUA_BUILD@ @LIBLINEAR_BUILD@ @PCAP_BUILD@ @PCRE_BUILD@ @DNET_BUILD@ @NBASE_BUILD@ @NSOCK_BUILD@ @NCAT_BUILD@ netutil_build
all: @LUA_BUILD@ @LIBLINEAR_BUILD@ @PCAP_BUILD@ @PCRE_BUILD@ @DNET_BUILD@ @NBASE_BUILD@ @NSOCK_BUILD@ @NCAT_BUILD@ @NMAP_UPDATE_BUILD@ netutil_build
$(MAKE) $(TARGET) $(BUILDZENMAP) $(BUILDNDIFF) $(BUILDNPING)
$(TARGET): @LUA_DEPENDS@ @LIBLINEAR_DEPENDS@ @PCAP_DEPENDS@ @PCRE_DEPENDS@ @DNET_DEPENDS@ $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a libnetutil/libnetutil.a $(OBJS)
@@ -118,6 +118,9 @@ $(TARGET): @LUA_DEPENDS@ @LIBLINEAR_DEPENDS@ @PCAP_DEPENDS@ @PCRE_DEPENDS@ @DNET
rm -f $@
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
build-%: %/Makefile
cd $* && $(MAKE)
pcre_build: $(LIBPCREDIR)/Makefile
@echo Compiling libpcre; cd $(LIBPCREDIR) && $(MAKE)
@@ -148,6 +151,7 @@ lua_build: $(LIBLUADIR)/Makefile
liblinear_build: $(LIBLINEARDIR)/Makefile
@echo Compiling liblinear; cd $(LIBLINEARDIR) && $(MAKE) liblinear.a CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)"
#$(LIBPCAPDIR)/Makefile:
# @echo Configuring libpcap; cd $(LIBPCAPDIR); ./configure
@@ -176,11 +180,17 @@ release-rpms:
web:
cd $(NMAPDEVDIR) && $(MAKE) web
clean: @LUA_CLEAN@ @LIBLINEAR_CLEAN@ @PCAP_CLEAN@ @PCRE_CLEAN@ @DNET_CLEAN@ nsock_clean nbase_clean netutil_clean my_clean @NPING_CLEAN@ @ZENMAP_CLEAN@ @NCAT_CLEAN@
clean: @LUA_CLEAN@ @LIBLINEAR_CLEAN@ @PCAP_CLEAN@ @PCRE_CLEAN@ @DNET_CLEAN@ nsock_clean nbase_clean netutil_clean my_clean @NPING_CLEAN@ @ZENMAP_CLEAN@ @NCAT_CLEAN@ @NMAP_UPDATE_CLEAN@
my_clean:
rm -f dependencies.mk makefile.dep
rm -f $(OBJS) $(TARGET) config.cache
clean-%:
-cd $* && $(MAKE) clean
distclean-%: clean-%
-cd $* && $(MAKE) distclean
pcap_clean:
-cd $(LIBPCAPDIR) && $(MAKE) clean
pcre_clean:
@@ -231,7 +241,7 @@ nping_dist_clean:
debugclean:
rm -f *.gcov *.gcda *.gcno gmon.out
distclean: my_clean my_distclean @LUA_DIST_CLEAN@ @LIBLINEAR_DIST_CLEAN@ @PCAP_DIST_CLEAN@ @PCRE_DIST_CLEAN@ @DNET_DIST_CLEAN@ @NPING_DIST_CLEAN@ @ZENMAP_DIST_CLEAN@ @NCAT_DIST_CLEAN@ nsock_dist_clean nbase_dist_clean netutil_dist_clean
distclean: my_clean my_distclean @LUA_DIST_CLEAN@ @LIBLINEAR_DIST_CLEAN@ @PCAP_DIST_CLEAN@ @PCRE_DIST_CLEAN@ @DNET_DIST_CLEAN@ @NPING_DIST_CLEAN@ @ZENMAP_DIST_CLEAN@ @NCAT_DIST_CLEAN@ @NMAP_UPDATE_DIST_CLEAN@ nsock_dist_clean nbase_dist_clean netutil_dist_clean
my_distclean:
rm -f Makefile Makefile.bak makefile.dep nmap_config.h stamp-h stamp-h.in \
@@ -331,16 +341,21 @@ install-nse: $(TARGET)
$(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
done
install-%: build-% %/Makefile
cd $* && $(MAKE) install
uninstall-%: %/Makefile
cd $* && $(MAKE) uninstall
install-ncat: $(NCATDIR)/ncat
@cd $(NCATDIR) && $(MAKE) install
install-nping: $(NPINGDIR)/nping
@cd $(NPINGDIR) && $(MAKE) install
install: install-nmap $(INSTALLNSE) $(INSTALLZENMAP) @NCAT_INSTALL@ $(INSTALLNDIFF) $(INSTALLNPING)
install: install-nmap $(INSTALLNSE) $(INSTALLZENMAP) @NCAT_INSTALL@ @NMAP_UPDATE_INSTALL@ $(INSTALLNDIFF) $(INSTALLNPING)
@echo "NMAP SUCCESSFULLY INSTALLED"
uninstall: uninstall-nmap $(UNINSTALLZENMAP) @NCAT_UNINSTALL@ $(UNINSTALLNPING)
uninstall: uninstall-nmap $(UNINSTALLZENMAP) @NCAT_UNINSTALL@ @NMAP_UPDATE_UNINSTALL@ $(UNINSTALLNPING)
uninstall-nmap:
rm -f $(DESTDIR)$(bindir)/$(TARGET)

167
configure vendored
View File

@@ -602,6 +602,12 @@ ac_includes_default="\
enable_option_checking=no
ac_subst_vars='LTLIBOBJS
LIBOBJS
NMAP_UPDATE_DIST_CLEAN
NMAP_UPDATE_CLEAN
NMAP_UPDATE_UNINSTALL
NMAP_UPDATE_INSTALL
NMAP_UPDATE_BUILD
APR_CONFIG
NCAT_DIST_CLEAN
NCAT_CLEAN
NCAT_UNINSTALL
@@ -759,6 +765,7 @@ with_liblinear
with_libnbase
with_libnsock
with_ncat
with_nmap_update
'
ac_precious_vars='build_alias
host_alias
@@ -778,7 +785,8 @@ libpcre
libdnet-stripped
nbase
nsock/src
ncat'
ncat
nmap-update'
# Initialize some variables set by options.
ac_init_help=
@@ -1426,6 +1434,7 @@ Optional Packages:
--with-libnbase=DIR Look for nbase include/libs in DIR
--with-libnsock=DIR Compile and link to libnsock in DIR
--without-ncat Skip build and installation of Ncat
--without-nmap-update Skip build and installation of nmap-update
Some influential environment variables:
CC C compiler command
@@ -7586,6 +7595,162 @@ fi
# Check whether --with-nmap-update was given.
if test "${with_nmap_update+set}" = set; then :
withval=$with_nmap_update;
else
with_nmap_update=check
fi
if test "$with_nmap_update" != "no"; then
have_libsvn=yes
if test "$have_libsvn" = "yes"; then
for ac_prog in apr-1-config
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_APR_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$APR_CONFIG"; then
ac_cv_prog_APR_CONFIG="$APR_CONFIG" # Let the user override the test.
else
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_prog_APR_CONFIG="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
APR_CONFIG=$ac_cv_prog_APR_CONFIG
if test -n "$APR_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $APR_CONFIG" >&5
$as_echo "$APR_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$APR_CONFIG" && break
done
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $($APR_CONFIG --cppflags --includes)"
ac_fn_c_check_header_mongrel "$LINENO" "subversion-1/svn_client.h" "ac_cv_header_subversion_1_svn_client_h" "$ac_includes_default"
if test "x$ac_cv_header_subversion_1_svn_client_h" = xyes; then :
else
have_libsvn=no
fi
CPPFLAGS="$old_CPPFLAGS"
fi
if test "$have_libsvn" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for svn_client_create_context in -lsvn_client-1" >&5
$as_echo_n "checking for svn_client_create_context in -lsvn_client-1... " >&6; }
if ${ac_cv_lib_svn_client_1_svn_client_create_context+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsvn_client-1 $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 svn_client_create_context ();
int
main ()
{
return svn_client_create_context ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_svn_client_1_svn_client_create_context=yes
else
ac_cv_lib_svn_client_1_svn_client_create_context=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_svn_client_1_svn_client_create_context" >&5
$as_echo "$ac_cv_lib_svn_client_1_svn_client_create_context" >&6; }
if test "x$ac_cv_lib_svn_client_1_svn_client_create_context" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSVN_CLIENT_1 1
_ACEOF
LIBS="-lsvn_client-1 $LIBS"
else
have_libsvn=no
fi
fi
if test "$have_libsvn" != "yes"; then
if test "$with_nmap_update" = "check"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not building nmap-update because libsvn1 was not found" >&5
$as_echo "$as_me: WARNING: Not building nmap-update because libsvn1 was not found" >&2;}
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "--with-nmap-update requires libsvn1
See \`config.log' for more details" "$LINENO" 5; }
fi
with_nmap_update=no
else
with_nmap_update=yes
fi
fi
if test "$with_nmap_update" = "no"; then
NMAP_UPDATE_BUILD=""
NMAP_UPDATE_INSTALL=""
NMAP_UPDATE_UNINSTALL=""
NMAP_UPDATE_CLEAN=""
NMAP_UPDATE_DIST_CLEAN=""
else
NMAP_UPDATE_BUILD="build-nmap-update"
NMAP_UPDATE_INSTALL="install-nmap-update"
NMAP_UPDATE_UNINSTALL="uninstall-nmap-update"
NMAP_UPDATE_CLEAN="clean-nmap-update"
NMAP_UPDATE_DIST_CLEAN="distclean-nmap-update"
fi
subdirs="$subdirs nmap-update"
ac_config_files="$ac_config_files Makefile libnetutil/Makefile"
cat >confcache <<\_ACEOF

View File

@@ -854,6 +854,57 @@ AC_SUBST(NCAT_UNINSTALL)
AC_SUBST(NCAT_CLEAN)
AC_SUBST(NCAT_DIST_CLEAN)
AC_ARG_WITH([nmap-update],
AC_HELP_STRING([--without-nmap-update], [Skip build and installation of nmap-update]), [], [with_nmap_update=check])
if test "$with_nmap_update" != "no"; then
have_libsvn=yes
if test "$have_libsvn" = "yes"; then
AC_CHECK_PROGS([APR_CONFIG], [apr-1-config])
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $($APR_CONFIG --cppflags --includes)"
AC_CHECK_HEADER([subversion-1/svn_client.h], [], [have_libsvn=no])
CPPFLAGS="$old_CPPFLAGS"
fi
if test "$have_libsvn" = "yes"; then
AC_CHECK_LIB([svn_client-1], [svn_client_create_context], [], [have_libsvn=no])
fi
if test "$have_libsvn" != "yes"; then
if test "$with_nmap_update" = "check"; then
AC_MSG_WARN([Not building nmap-update because libsvn1 was not found])
else
AC_MSG_FAILURE([--with-nmap-update requires libsvn1])
fi
with_nmap_update=no
else
with_nmap_update=yes
fi
fi
if test "$with_nmap_update" = "no"; then
NMAP_UPDATE_BUILD=""
NMAP_UPDATE_INSTALL=""
NMAP_UPDATE_UNINSTALL=""
NMAP_UPDATE_CLEAN=""
NMAP_UPDATE_DIST_CLEAN=""
else
NMAP_UPDATE_BUILD="build-nmap-update"
NMAP_UPDATE_INSTALL="install-nmap-update"
NMAP_UPDATE_UNINSTALL="uninstall-nmap-update"
NMAP_UPDATE_CLEAN="clean-nmap-update"
NMAP_UPDATE_DIST_CLEAN="distclean-nmap-update"
fi
AC_SUBST(NMAP_UPDATE_BUILD)
AC_SUBST(NMAP_UPDATE_INSTALL)
AC_SUBST(NMAP_UPDATE_UNINSTALL)
AC_SUBST(NMAP_UPDATE_CLEAN)
AC_SUBST(NMAP_UPDATE_DIST_CLEAN)
AC_CONFIG_SUBDIRS(nmap-update)
AC_OUTPUT(Makefile libnetutil/Makefile)
# Krad ASCII ART#!#@$!@#$
if test -f docs/leet-nmap-ascii-art.txt; then