commit a39256b7c2d3ec836a9f8b60108123325a80a213
parent 673a400bc3b3c1a939b38d0f526a7a92e8e0d2db
Author: Jordan Ritter <jpr5@darkridge.com>
Date: Thu, 3 Sep 2015 09:33:06 -0700
Adds required libnet check to enable tcpkill
Incorporated an unsophisticated check for libnet_init_packet before
enabling the option. Requires that `libnet-config` be in your path and
`libnet` and its headers are in the configured path (either system-wide,
or via `configure` options).
Diffstat:
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
@@ -3430,6 +3430,53 @@ fi
# Check whether --enable-tcpkill was given.
if test "${enable_tcpkill+set}" = set; then :
enableval=$enable_tcpkill;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnet_init_packet in -lnet" >&5
+$as_echo_n "checking for libnet_init_packet in -lnet... " >&6; }
+if ${ac_cv_lib_net_libnet_init_packet+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnet $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 libnet_init_packet ();
+int
+main ()
+{
+return libnet_init_packet ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_net_libnet_init_packet=yes
+else
+ ac_cv_lib_net_libnet_init_packet=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_net_libnet_init_packet" >&5
+$as_echo "$ac_cv_lib_net_libnet_init_packet" >&6; }
+if test "x$ac_cv_lib_net_libnet_init_packet" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBNET 1
+_ACEOF
+
+ LIBS="-lnet $LIBS"
+
+else
+ echo !!! error: tcpkill feature enabled but no libnet found; exit
+fi
+
USE_TCPKILL="1"
EXTRA_OBJS="$EXTRA_OBJS tcpkill.o"
EXTRA_DEFINES="$EXTRA_DEFINES $(libnet-config --defines)"
diff --git a/configure.in b/configure.in
@@ -166,6 +166,7 @@ dnl
AC_ARG_ENABLE(tcpkill,
[ --enable-tcpkill enable connection killing support],
[
+ AC_CHECK_LIB(net, libnet_init_packet,,echo !!! error: tcpkill feature enabled but no libnet found; exit)
USE_TCPKILL="1"
EXTRA_OBJS="$EXTRA_OBJS tcpkill.o"
EXTRA_DEFINES="$EXTRA_DEFINES $(libnet-config --defines)"