Skip to content

Commit

Permalink
Fail if the user asks for --enable-{sniffing type} and we can't provi…
Browse files Browse the repository at this point in the history
…de it.

Treat --enable-{sniffing type} as a demand that we provide it; if we
can't do so, fail, don't just warn about its absence (with a message
that might well get lost amongst the other configure-script output) and
drive on.  If they don't demand it, provide it if we can, warn and drive
on if we can't.
diff --git a/configure b/configure
index 9c222a5..dc4d131 100755
--- a/configure
+++ b/configure
@@ -8000,7 +8000,7 @@ esac
 if test "${enable_bluetooth+set}" = set; then :
   enableval=$enable_bluetooth;
 else
-  enable_bluetooth=yes
+  enable_bluetooth=ifsupportavailable
 fi

@@ -8094,18 +8094,30 @@ $as_echo "#define PCAP_SUPPORT_BT_MONITOR /**/" >>confdefs.h
 			BT_MONITOR_SRC=pcap-bt-monitor-linux.c
 		      fi
 		    fi
+		    ac_lbl_bluetooth_available=yes

 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
-$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
+  ac_lbl_bluetooth_available=no

 fi

+		if test "x$ac_lbl_bluetooth_available" == "xno" ; then
+		    if test "x$enable_bluetooth" = "xyes" ; then
+			as_fn_error $? "Bluetooth sniffing is not supported; install bluez-lib devel to enable it" "$LINENO" 5
+		    else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
+$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
+		    fi
+		fi
 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
+		if test "x$enable_bluetooth" = "xyes" ; then
+		    as_fn_error $? "no Bluetooth sniffing support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
 $as_echo "$as_me: no Bluetooth sniffing support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac

@@ -8117,7 +8129,7 @@ fi
 if test "${enable_canusb+set}" = set; then :
   enableval=$enable_canusb;
 else
-  enable_canusb=yes
+  enable_canusb=ifsupportavailable
 fi

@@ -8170,27 +8182,39 @@ $as_echo "#define PCAP_SUPPORT_CANUSB 1" >>confdefs.h

 			CANUSB_SRC=pcap-canusb-linux.c
 			LIBS="-lusb-1.0 -lpthread $LIBS"
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
-$as_echo "$as_me: canusb sniffing is supported" >&6;}
+			ac_lbl_has_libusb=yes

 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
-$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
+  ac_lbl_has_libusb=no

 fi

 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
-$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
+  ac_lbl_has_libusb=no

 fi

+		if test "x$ac_lbl_has_libusb" = "xyes" ; then
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
+$as_echo "$as_me: canusb sniffing is supported" >&6;}
+		else
+		    if test "x$enable_canusb" = "xyes" ; then
+			as_fn_error $? "canusb sniffing is not supported; install libusb1.0 lib devel to enable it" "$LINENO" 5
+		    else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
+$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
+		    fi
+		fi
 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
+		if test "x$enable_canusb" = "xyes" ; then
+		    as_fn_error $? "no canusb support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
 $as_echo "$as_me: no canusb support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac

@@ -8213,21 +8237,33 @@ if test "x$enable_can" != "xno" ; then
 "
 if test "x$ac_cv_header_linux_can_h" = xyes; then :

+
 $as_echo "#define PCAP_SUPPORT_CAN 1" >>confdefs.h

-			CAN_SRC=pcap-can-linux.c
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
+			    CAN_SRC=pcap-can-linux.c
+			    { $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
 $as_echo "$as_me: CAN sniffing is supported" >&6;}
+
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
+
+			    if test "x$enable_can" = "xyes" ; then
+				as_fn_error $? "CAN sniffing is not supported" "$LINENO" 5
+			    else
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
 $as_echo "$as_me: CAN sniffing is not supported" >&6;}
+			    fi
+
 fi

 		;;
 	*)
-		{ $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
+		if test "x$enable_can" = "xyes" ; then
+		    as_fn_error $? "no CAN sniffing support implemented for $host_os" "$LINENO" 5
+		else
+		    { $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
 $as_echo "$as_me: no CAN sniffing support implemented for $host_os" >&6;}
+		fi
 		;;
 	esac

diff --git a/configure.in b/configure.in
index 8634825..5897e9e 100644
--- a/configure.in
+++ b/configure.in
@@ -1455,7 +1455,7 @@ AC_SUBST(NETFILTER_SRC)
 AC_ARG_ENABLE([bluetooth],
 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
     [],
-    [enable_bluetooth=yes])
+    [enable_bluetooth=ifsupportavailable])

 if test "x$enable_bluetooth" != "xno" ; then
 	dnl check for Bluetooth sniffing support
@@ -1506,12 +1506,24 @@ if test "x$enable_bluetooth" != "xno" ; then
 			BT_MONITOR_SRC=pcap-bt-monitor-linux.c
 		      fi
 		    fi
+		    ac_lbl_bluetooth_available=yes
 		],
-		AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		ac_lbl_bluetooth_available=no
 		)
+		if test "x$ac_lbl_bluetooth_available" == "xno" ; then
+		    if test "x$enable_bluetooth" = "xyes" ; then
+			AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		    else
+			AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
+		    fi
+		fi
 		;;
 	*)
-		AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
+		if test "x$enable_bluetooth" = "xyes" ; then
+		    AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_BT)
@@ -1522,7 +1534,7 @@ fi
 AC_ARG_ENABLE([canusb],
 [AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
     [],
-    [enable_canusb=yes])
+    [enable_canusb=ifsupportavailable])

 if test "x$enable_canusb" != "xno" ; then
 	dnl check for canusb support
@@ -1535,16 +1547,29 @@ if test "x$enable_canusb" != "xno" ; then
 			AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
 			CANUSB_SRC=pcap-canusb-linux.c
 			LIBS="-lusb-1.0 -lpthread $LIBS"
-			AC_MSG_NOTICE(canusb sniffing is supported)
+			ac_lbl_has_libusb=yes
 		    ],
-		    AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		    ac_lbl_has_libusb=no
 		    )
 		],
-		AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		ac_lbl_has_libusb=no
 		)
+		if test "x$ac_lbl_has_libusb" = "xyes" ; then
+		    AC_MSG_NOTICE(canusb sniffing is supported)
+		else
+		    if test "x$enable_canusb" = "xyes" ; then
+			AC_MSG_ERROR(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		    else
+			AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
+		    fi
+		fi
 		;;
 	*)
-		AC_MSG_NOTICE(no canusb support implemented for $host_os)
+		if test "x$enable_canusb" = "xyes" ; then
+		    AC_MSG_ERROR(no canusb support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no canusb support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_CANUSB)
@@ -1561,15 +1586,27 @@ if test "x$enable_can" != "xno" ; then
 	case "$host_os" in
 	linux*)
 		AC_CHECK_HEADER(linux/can.h,
-			[ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
-			CAN_SRC=pcap-can-linux.c
-			AC_MSG_NOTICE(CAN sniffing is supported)],
-			AC_MSG_NOTICE(CAN sniffing is not supported),
+			[
+			    AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
+			    CAN_SRC=pcap-can-linux.c
+			    AC_MSG_NOTICE(CAN sniffing is supported)
+			],
+			[
+			    if test "x$enable_can" = "xyes" ; then
+				AC_MSG_ERROR(CAN sniffing is not supported)
+			    else
+				AC_MSG_NOTICE(CAN sniffing is not supported)
+			    fi
+			],
 			[#include <sys/socket.h>]
 		   )
 		;;
 	*)
-		AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
+		if test "x$enable_can" = "xyes" ; then
+		    AC_MSG_ERROR(no CAN sniffing support implemented for $host_os)
+		else
+		    AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
+		fi
 		;;
 	esac
 	AC_SUBST(PCAP_SUPPORT_CAN)
  • Loading branch information
guyharris committed Jul 8, 2014
1 parent 7090b00 commit d939500
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 29 deletions.
68 changes: 52 additions & 16 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -8000,7 +8000,7 @@ esac
if test "${enable_bluetooth+set}" = set; then :
enableval=$enable_bluetooth;
else
enable_bluetooth=yes
enable_bluetooth=ifsupportavailable
fi
Expand Down Expand Up @@ -8094,18 +8094,30 @@ $as_echo "#define PCAP_SUPPORT_BT_MONITOR /**/" >>confdefs.h
BT_MONITOR_SRC=pcap-bt-monitor-linux.c
fi
fi
ac_lbl_bluetooth_available=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
ac_lbl_bluetooth_available=no
fi
if test "x$ac_lbl_bluetooth_available" == "xno" ; then
if test "x$enable_bluetooth" = "xyes" ; then
as_fn_error $? "Bluetooth sniffing is not supported; install bluez-lib devel to enable it" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&5
$as_echo "$as_me: Bluetooth sniffing is not supported; install bluez-lib devel to enable it" >&6;}
fi
fi
;;
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
if test "x$enable_bluetooth" = "xyes" ; then
as_fn_error $? "no Bluetooth sniffing support implemented for $host_os" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: no Bluetooth sniffing support implemented for $host_os" >&5
$as_echo "$as_me: no Bluetooth sniffing support implemented for $host_os" >&6;}
fi
;;
esac
Expand All @@ -8117,7 +8129,7 @@ fi
if test "${enable_canusb+set}" = set; then :
enableval=$enable_canusb;
else
enable_canusb=yes
enable_canusb=ifsupportavailable
fi
Expand Down Expand Up @@ -8170,27 +8182,39 @@ $as_echo "#define PCAP_SUPPORT_CANUSB 1" >>confdefs.h
CANUSB_SRC=pcap-canusb-linux.c
LIBS="-lusb-1.0 -lpthread $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
$as_echo "$as_me: canusb sniffing is supported" >&6;}
ac_lbl_has_libusb=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
ac_lbl_has_libusb=no
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
ac_lbl_has_libusb=no
fi
if test "x$ac_lbl_has_libusb" = "xyes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is supported" >&5
$as_echo "$as_me: canusb sniffing is supported" >&6;}
else
if test "x$enable_canusb" = "xyes" ; then
as_fn_error $? "canusb sniffing is not supported; install libusb1.0 lib devel to enable it" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&5
$as_echo "$as_me: canusb sniffing is not supported; install libusb1.0 lib devel to enable it" >&6;}
fi
fi
;;
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
if test "x$enable_canusb" = "xyes" ; then
as_fn_error $? "no canusb support implemented for $host_os" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: no canusb support implemented for $host_os" >&5
$as_echo "$as_me: no canusb support implemented for $host_os" >&6;}
fi
;;
esac
Expand All @@ -8213,21 +8237,33 @@ if test "x$enable_can" != "xno" ; then
"
if test "x$ac_cv_header_linux_can_h" = xyes; then :
$as_echo "#define PCAP_SUPPORT_CAN 1" >>confdefs.h
CAN_SRC=pcap-can-linux.c
{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
CAN_SRC=pcap-can-linux.c
{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is supported" >&5
$as_echo "$as_me: CAN sniffing is supported" >&6;}
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
if test "x$enable_can" = "xyes" ; then
as_fn_error $? "CAN sniffing is not supported" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: CAN sniffing is not supported" >&5
$as_echo "$as_me: CAN sniffing is not supported" >&6;}
fi
fi
;;
*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
if test "x$enable_can" = "xyes" ; then
as_fn_error $? "no CAN sniffing support implemented for $host_os" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: no CAN sniffing support implemented for $host_os" >&5
$as_echo "$as_me: no CAN sniffing support implemented for $host_os" >&6;}
fi
;;
esac
Expand Down
63 changes: 50 additions & 13 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ AC_SUBST(NETFILTER_SRC)
AC_ARG_ENABLE([bluetooth],
[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
[],
[enable_bluetooth=yes])
[enable_bluetooth=ifsupportavailable])

if test "x$enable_bluetooth" != "xno" ; then
dnl check for Bluetooth sniffing support
Expand Down Expand Up @@ -1506,12 +1506,24 @@ if test "x$enable_bluetooth" != "xno" ; then
BT_MONITOR_SRC=pcap-bt-monitor-linux.c
fi
fi
ac_lbl_bluetooth_available=yes
],
AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
ac_lbl_bluetooth_available=no
)
if test "x$ac_lbl_bluetooth_available" == "xno" ; then
if test "x$enable_bluetooth" = "xyes" ; then
AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
else
AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
fi
fi
;;
*)
AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
if test "x$enable_bluetooth" = "xyes" ; then
AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
else
AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
fi
;;
esac
AC_SUBST(PCAP_SUPPORT_BT)
Expand All @@ -1522,7 +1534,7 @@ fi
AC_ARG_ENABLE([canusb],
[AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
[],
[enable_canusb=yes])
[enable_canusb=ifsupportavailable])

if test "x$enable_canusb" != "xno" ; then
dnl check for canusb support
Expand All @@ -1535,16 +1547,29 @@ if test "x$enable_canusb" != "xno" ; then
AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
CANUSB_SRC=pcap-canusb-linux.c
LIBS="-lusb-1.0 -lpthread $LIBS"
AC_MSG_NOTICE(canusb sniffing is supported)
ac_lbl_has_libusb=yes
],
AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
ac_lbl_has_libusb=no
)
],
AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
ac_lbl_has_libusb=no
)
if test "x$ac_lbl_has_libusb" = "xyes" ; then
AC_MSG_NOTICE(canusb sniffing is supported)
else
if test "x$enable_canusb" = "xyes" ; then
AC_MSG_ERROR(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
else
AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
fi
fi
;;
*)
AC_MSG_NOTICE(no canusb support implemented for $host_os)
if test "x$enable_canusb" = "xyes" ; then
AC_MSG_ERROR(no canusb support implemented for $host_os)
else
AC_MSG_NOTICE(no canusb support implemented for $host_os)
fi
;;
esac
AC_SUBST(PCAP_SUPPORT_CANUSB)
Expand All @@ -1561,15 +1586,27 @@ if test "x$enable_can" != "xno" ; then
case "$host_os" in
linux*)
AC_CHECK_HEADER(linux/can.h,
[ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
CAN_SRC=pcap-can-linux.c
AC_MSG_NOTICE(CAN sniffing is supported)],
AC_MSG_NOTICE(CAN sniffing is not supported),
[
AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
CAN_SRC=pcap-can-linux.c
AC_MSG_NOTICE(CAN sniffing is supported)
],
[
if test "x$enable_can" = "xyes" ; then
AC_MSG_ERROR(CAN sniffing is not supported)
else
AC_MSG_NOTICE(CAN sniffing is not supported)
fi
],
[#include <sys/socket.h>]
)
;;
*)
AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
if test "x$enable_can" = "xyes" ; then
AC_MSG_ERROR(no CAN sniffing support implemented for $host_os)
else
AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
fi
;;
esac
AC_SUBST(PCAP_SUPPORT_CAN)
Expand Down

0 comments on commit d939500

Please sign in to comment.