Fail if the user asks for --enable-{sniffing type} and we can't provide 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)
Don't fail if --enable-can wasn't specified and we can't support CAN sniffing.
Return the right figure of merit for the "any" device.

Thanks and a tip of the Hatlo hat to Coverity Scan for picking up this
one; we were picking the right value for "any", and then overriding it
with a value determined by parsing the name.
Add the UP and RUNNING flags to the "any" device.

That way, code that looks at those flags will make the "any" device look
like regular devices; as long as there's at least one network interface
up and running, or could be up and running at some point in the future,
the "any" device can be considered up and running, so that's
appropriate.
Only treat *trailing* digits as an instance number.

Some devices might have digits in the middle of their name (I think some
gigabit Ethernet devices on Solaris do, namely a "1000" in the name,
presumably meaning "1000 megabits/second"), so we don't want to treat
those digits as an instance number.
Fix addition of UP and RUNNING to the "any" device.
Merge remote-tracking branch 'upstream'