]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: properly handle ./configure --with-libpcap
authorDiego Elio Pettenò <flameeyes@gmail.com>
Mon, 13 Dec 2010 13:44:46 +0000 (14:44 +0100)
committerEric Blake <eblake@redhat.com>
Mon, 13 Dec 2010 18:01:11 +0000 (11:01 -0700)
Without this fix, ./configure --with-libpcap will cause --with-libpcap=yes
to be implicitly passed down, which cause yes/bin/pcap-config to be
searched for rather than /usr/bin/pcap-config.

Also output pcap: no when pcap is not found or disabled.

configure.ac

index d8be160ad96ad9e1a1d0649d0743393559569698..c194510293250f669a2386331ed180da63742ff7 100644 (file)
@@ -1194,20 +1194,22 @@ LIBPCAP_FOUND="no"
 
 AC_ARG_WITH([libpcap], AC_HELP_STRING([--with-libpcap=@<:@PFX@:>@], [libpcap location]))
 if test "$with_qemu" = "yes"; then
-    if test "x$with_libpcap" != "xno" ; then
-        if test "x$with_libpcap" != "x" ; then
-            LIBPCAP_CONFIG=$with_libpcap/bin/$LIBPCAP_CONFIG
-        fi
-        AC_MSG_CHECKING(libpcap $LIBPCAP_CONFIG >= $LIBPCAP_REQUIRED )
-        if ! $LIBPCAP_CONFIG --libs > /dev/null 2>&1 ; then
-           AC_MSG_RESULT(no)
-       else
-            LIBPCAP_LIBS="`$LIBPCAP_CONFIG --libs`"
-            LIBPCAP_CFLAGS="`$LIBPCAP_CONFIG --cflags`"
-            LIBPCAP_FOUND="yes"
-            AC_MSG_RESULT(yes)
-        fi
+  AS_CASE(["x$with_libpcap"],
+    [xno], [LIBPCAP_CONFIG=""],
+    [x|xyes], [LIBPCAP_CONFIG="pcap-config"],
+    [LIBPCAP_CONFIG="$with_libpcap/bin/pcap-config"]
+  )
+  AS_IF([test "x$LIBPCAP_CONFIG" != "x"], [
+    AC_MSG_CHECKING(libpcap $LIBPCAP_CONFIG >= $LIBPCAP_REQUIRED )
+    if ! $LIBPCAP_CONFIG --libs > /dev/null 2>&1 ; then
+      AC_MSG_RESULT(no)
+    else
+      LIBPCAP_LIBS="`$LIBPCAP_CONFIG --libs`"
+      LIBPCAP_CFLAGS="`$LIBPCAP_CONFIG --cflags`"
+      LIBPCAP_FOUND="yes"
+      AC_MSG_RESULT(yes)
     fi
+  ])
 fi
 
 if test "x$LIBPCAP_FOUND" = "xyes"; then
@@ -2406,7 +2408,7 @@ AC_MSG_NOTICE([  xmlrpc: $XMLRPC_CFLAGS $XMLRPC_LIBS])
 else
 AC_MSG_NOTICE([  xmlrpc: no])
 fi
-if test "$with_qemu" = "yes" ; then
+if test "$with_qemu" = "yes" && test "$LIBPCAP_FOUND" != "no"; then
 AC_MSG_NOTICE([    pcap: $LIBPCAP_CFLAGS $LIBPCAP_LIBS])
 else
 AC_MSG_NOTICE([    pcap: no])