mirror of
https://github.com/nmap/nmap.git
synced 2025-12-17 05:09:00 +00:00
Move the libpcap version number check into acinclude.m4, call it
PCAP_IS_SUITABLE.
This commit is contained in:
23
acinclude.m4
23
acinclude.m4
@@ -26,3 +26,26 @@ recvfrom (0, NULL, 0, 0, NULL, &arg);],[
|
|||||||
[Type of 6th argument to recvfrom()])
|
[Type of 6th argument to recvfrom()])
|
||||||
AC_LANG_POP(C++)
|
AC_LANG_POP(C++)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([PCAP_IS_SUITABLE],
|
||||||
|
[
|
||||||
|
AC_MSG_CHECKING(if libpcap version is suitable)
|
||||||
|
AC_TRY_RUN([
|
||||||
|
#include <stdio.h>
|
||||||
|
extern char pcap_version[];
|
||||||
|
int main() {
|
||||||
|
int major, minor1, minor2;
|
||||||
|
sscanf(pcap_version,"%d.%d.%d", &major, &minor1, &minor2);
|
||||||
|
if (major > 0)
|
||||||
|
exit(0);
|
||||||
|
if (minor1 < 9)
|
||||||
|
exit(1);
|
||||||
|
if (minor2 < 4)
|
||||||
|
exit(1);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[AC_MSG_RESULT(yes); $1],
|
||||||
|
[AC_MSG_RESULT(no); $2],
|
||||||
|
[AC_MSG_RESULT(cross-compiling -- assuming yes); $3])
|
||||||
|
])
|
||||||
|
|||||||
7
configure
vendored
7
configure
vendored
@@ -7181,8 +7181,9 @@ if test $have_libpcap = yes; then
|
|||||||
# link with -lpcap for the purposes of this test
|
# link with -lpcap for the purposes of this test
|
||||||
LIBS_OLD="$LIBS"
|
LIBS_OLD="$LIBS"
|
||||||
LIBS="$LIBS -lpcap"
|
LIBS="$LIBS -lpcap"
|
||||||
{ $as_echo "$as_me:$LINENO: checking if libpcap version is recent enough" >&5
|
|
||||||
$as_echo_n "checking if libpcap version is recent enough... " >&6; }
|
{ $as_echo "$as_me:$LINENO: checking if libpcap version is suitable" >&5
|
||||||
|
$as_echo_n "checking if libpcap version is suitable... " >&6; }
|
||||||
if test "$cross_compiling" = yes; then
|
if test "$cross_compiling" = yes; then
|
||||||
{ $as_echo "$as_me:$LINENO: result: cross-compiling -- assuming yes" >&5
|
{ $as_echo "$as_me:$LINENO: result: cross-compiling -- assuming yes" >&5
|
||||||
$as_echo "cross-compiling -- assuming yes" >&6; }; have_libpcap=yes
|
$as_echo "cross-compiling -- assuming yes" >&6; }; have_libpcap=yes
|
||||||
@@ -7207,6 +7208,7 @@ int main() {
|
|||||||
exit(1);
|
exit(1);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ACEOF
|
_ACEOF
|
||||||
rm -f conftest$ac_exeext
|
rm -f conftest$ac_exeext
|
||||||
if { (ac_try="$ac_link"
|
if { (ac_try="$ac_link"
|
||||||
@@ -7246,6 +7248,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$a
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LIBS="$LIBS_OLD"
|
LIBS="$LIBS_OLD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
19
configure.ac
19
configure.ac
@@ -369,24 +369,7 @@ if test $have_libpcap = yes; then
|
|||||||
# link with -lpcap for the purposes of this test
|
# link with -lpcap for the purposes of this test
|
||||||
LIBS_OLD="$LIBS"
|
LIBS_OLD="$LIBS"
|
||||||
LIBS="$LIBS -lpcap"
|
LIBS="$LIBS -lpcap"
|
||||||
AC_MSG_CHECKING(if libpcap version is recent enough)
|
PCAP_IS_SUITABLE([have_libpcap=yes], [have_libpcap=no], [have_libpcap=yes])
|
||||||
AC_TRY_RUN([
|
|
||||||
#include <stdio.h>
|
|
||||||
extern char pcap_version[];
|
|
||||||
int main() {
|
|
||||||
int major, minor1, minor2;
|
|
||||||
sscanf(pcap_version,"%d.%d.%d", &major, &minor1, &minor2);
|
|
||||||
if (major > 0)
|
|
||||||
exit(0);
|
|
||||||
if (minor1 < 9)
|
|
||||||
exit(1);
|
|
||||||
if (minor2 < 4)
|
|
||||||
exit(1);
|
|
||||||
exit(0);
|
|
||||||
}],
|
|
||||||
[AC_MSG_RESULT(yes); have_libpcap=yes],
|
|
||||||
[AC_MSG_RESULT(no); have_libpcap=no],
|
|
||||||
[AC_MSG_RESULT(cross-compiling -- assuming yes); have_libpcap=yes])
|
|
||||||
LIBS="$LIBS_OLD"
|
LIBS="$LIBS_OLD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user