[PATCH] rpm-build: use pkg-config to detect wireshark presence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wireshark supports pkg-config since 1.11.3.  Right now we build
wireshark-dissectior tool as default trough rpm build only on
fedora >= 21 and there is newer wireshark that supports pkg-config.
If someone wants to build libvirt with wireshark-dissector against older
wireshark, they should specify the location by hand.

This patch is mainly to fix wrong dependency on wireshark binary as it
doesn't make sense to require that binary file to just get version info
of that package in makefile.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 configure.ac | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2fedd1a..75a0688 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2669,25 +2669,12 @@ if test "$with_wireshark_dissector" != "no"; then
     ])
 
     dnl Search for wireshark(or tshark) command
-    AC_PATH_PROG([WIRESHARK], [wireshark])
-    AC_PATH_PROG([WIRESHARK], [tshark])
-    if test -z "$WIRESHARK"; then
-        LIBVIRT_WS_HANDLE_ERROR([command not found wireshark or tshark])
-    else
-        dnl Check for wireshark headers
-        save_CPPFLAGS="$CPPFLAGS"
-        WS_DISSECTOR_CPPFLAGS="$WS_DISSECTOR_CPPFLAGS -I`dirname $WIRESHARK`/../include/wireshark"
-        CPPFLAGS="$CPPFLAGS $WS_DISSECTOR_CPPFLAGS"
-        AC_CHECK_HEADERS([wireshark/config.h],, [
-            LIBVIRT_WS_HANDLE_ERROR([wireshark/config.h is required for wireshark-dissector support])
-        ])
-        AC_CHECK_HEADERS([wireshark/epan/packet.h wireshark/epan/dissectors/packet-tcp.h],, [
-            LIBVIRT_WS_HANDLE_ERROR([wireshark/epan/{packet,packet-tcp}.h are required for wireshark-dissector support])
-        ], [
-          #include <wireshark/config.h>
-        ])
-        CPPFLAGS="$save_CPPFLAGS"
-    fi
+    PKG_CHECK_MODULES([WIRESHARK], [wireshark], [
+      WS_DISSECTOR_CPPFLAGS="$WS_DISSECTOR_CPPFLAGS `$PKG_CONFIG --cflags wireshark`"
+      ws_version=`$PKG_CONFIG --modversion wireshark`
+    ], [
+      LIBVIRT_WS_HANDLE_ERROR([pkg-config 'wireshark' is required for wireshark-dissector support])
+    ])
     if test "$with_wireshark_dissector" != "no"; then
         with_wireshark_dissector=yes
     fi
@@ -2701,7 +2688,6 @@ AC_ARG_WITH([ws-plugindir],
   [ws_plugindir=$withval])
 
 if test "$with_wireshark_dissector" != "no" && test -z "$ws_plugindir"; then
-    ws_version=`$WIRESHARK -v | head -1 | cut -f 2 -d' '`
     ws_plugindir="$libdir/wireshark/plugins/$ws_version"
 fi
 AC_SUBST([ws_plugindir])
-- 
2.0.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]