1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-20 13:19:01 +00:00

Improve support for non-included libpcap in nsock

This commit is contained in:
dmiller
2014-01-26 16:38:22 +00:00
parent 6251f85c9e
commit 2e047114f6
5 changed files with 45 additions and 13 deletions

5
configure vendored
View File

@@ -2422,6 +2422,11 @@ if test "$user_localdirs" = 1; then
fi
fi
if test "${top_nmap_srcdir+set}" != set; then
top_nmap_srcdir=`cd "$srcdir" && pwd`
export top_nmap_srcdir
fi
libpcapdir=libpcap

View File

@@ -30,6 +30,12 @@ if test "$user_localdirs" = 1; then
fi
fi
dnl Let subdirs configure scripts find the Nmap source dir
if test "${top_nmap_srcdir+set}" != set; then
top_nmap_srcdir=`cd "$srcdir" && pwd`
export top_nmap_srcdir
fi
libpcapdir=libpcap
AC_SUBST(libpcapdir)

20
nsock/src/configure vendored
View File

@@ -626,6 +626,7 @@ NBASEDIR
LIBNBASE_LIBS
OPENSSL_LIBS
RANLIB
LIBPCAP_LIBS
EGREP
GREP
CPP
@@ -2107,6 +2108,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "${top_nmap_srcdir+set}" != set; then
top_nmap_srcdir=../..
export top_nmap_srcdir
fi
ac_config_files="$ac_config_files Makefile ../tests/Makefile"
ac_config_headers="$ac_config_headers ../include/nsock_config.h"
@@ -3530,7 +3539,7 @@ fi
;;
included)
LIBPCAP_INC=../../libpcap
LIBPCAP_INC=${top_nmap_srcdir}/libpcap
have_libpcap=yes
;;
no)
@@ -3559,11 +3568,13 @@ fi
if test "$have_libpcap" != "no"; then
$as_echo "#define HAVE_PCAP 1" >>confdefs.h
LIBPCAP_LIBS=-lpcap
if test "${LIBPCAP_INC+set}" = "set"; then
CPPFLAGS="-I$LIBPCAP_INC $CPPFLAGS"
fi
fi
ax_have_epoll_cppflags="${CPPFLAGS}"
ac_fn_c_check_header_mongrel "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default"
if test "x$ac_cv_header_linux_version_h" = xyes; then :
@@ -4831,7 +4842,7 @@ if test "${with_libnbase+set}" = set; then :
;;
esac
else
NBASEDIR="../../nbase"
NBASEDIR="${top_nmap_srcdir}/nbase"
fi
@@ -4848,8 +4859,6 @@ LIBNBASE_LIBS="$LIBS -lnbase"
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -5539,8 +5548,9 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"../include/nsock_config.h") CONFIG_HEADERS="$CONFIG_HEADERS ../include/nsock_config.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"../tests/Makefile") CONFIG_FILES="$CONFIG_FILES ../tests/Makefile" ;;
"../include/nsock_config.h") CONFIG_HEADERS="$CONFIG_HEADERS ../include/nsock_config.h" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac

View File

@@ -9,6 +9,15 @@ AC_PREREQ(2.13)
dnl Process this file with autoconf to produce a configure script.
AC_INIT(nsock_core.c)
dnl Find the Nmap source for nbase, etc.
if test "${top_nmap_srcdir+set}" != set; then
top_nmap_srcdir=../..
export top_nmap_srcdir
fi
dnl Generate these files
AC_CONFIG_FILES([Makefile ../tests/Makefile])
dnl use nsock_config.h instad of -D macros
AC_CONFIG_HEADER(../include/nsock_config.h)
@@ -119,7 +128,7 @@ AC_HELP_STRING([--without-libpcap], [Disable pcap functions.]),
have_libpcap=yes ])
;;
included)
LIBPCAP_INC=../../libpcap
LIBPCAP_INC=${top_nmap_srcdir}/libpcap
have_libpcap=yes
;;
no)
@@ -140,10 +149,12 @@ AC_HELP_STRING([--without-libpcap], [Disable pcap functions.]),
if test "$have_libpcap" != "no"; then
AC_DEFINE(HAVE_PCAP)
LIBPCAP_LIBS=-lpcap
if test "${LIBPCAP_INC+set}" = "set"; then
CPPFLAGS="-I$LIBPCAP_INC $CPPFLAGS"
fi
fi
AC_SUBST(LIBPCAP_LIBS)
AX_HAVE_EPOLL([AC_DEFINE(HAVE_EPOLL)], )
AX_HAVE_POLL([AC_DEFINE(HAVE_POLL)], )
@@ -253,7 +264,7 @@ AC_ARG_WITH(libnbase,
NBASEDIR="$with_libnbase"
;;
esac],
NBASEDIR="../../nbase"
NBASEDIR="${top_nmap_srcdir}/nbase"
)
NSOCKTESTDIR="../tests"
@@ -268,4 +279,4 @@ AC_SUBST(NSOCKTESTDIR)
AC_SUBST(CFLAGS)
AC_OUTPUT(Makefile)
AC_OUTPUT()

View File

@@ -3,14 +3,14 @@
# Same license as nmap -- see http://nmap.org/book/man-legal.html
##
NBASEDIR=../../nbase
NBASEDIR=@NBASEDIR@
NSOCKLIB=../src/libnsock.a
NBASELIB=$(NBASEDIR)/libnbase.a
CC = gcc
CFLAGS = -Wall -O0 -ggdb -I../include/ -I$(NBASEDIR)
LDFLAGS =
LIBS = -lssl -lpcap -lcrypto
CC = @CC@
CFLAGS = -Wall -O0 -I../include -I$(NBASEDIR)
LDFLAGS = @LDFLAGS@
LIBS = @OPENSSL_LIBS@ @LIBPCAP_LIBS@
SRC = tests_main.c \
basic.c \