Blame wireshark-0008-adds-autoconf-macro-file.patch

5579c4
From: =?UTF-8?q?Radek=20Vok=C3=A1l?= <rvokal@fedoraproject.org>
5579c4
Date: Mon, 21 Dec 2009 11:19:39 +0000
173888
Subject: [PATCH] adds autoconf macro file
5579c4
5579c4
updated autoconf macros and pkgconfig file in wireshark-devel to reflect current config.h Resolves: #746655
5579c4
5579c4
diff --git a/wireshark-autoconf.m4 b/wireshark-autoconf.m4
5579c4
new file mode 100644
5579c4
index 0000000..d8015d8
5579c4
--- /dev/null
5579c4
+++ b/wireshark-autoconf.m4
5579c4
@@ -0,0 +1,101 @@
5579c4
+dnl AM_PATH_WIRESHARK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
5579c4
+dnl Test for wireshark development files, and define WIRESHARK_CFLAGS,
5579c4
+dnl	WIRESHARK_LIBS and WIRESHARK_VERSION.
5579c4
+dnl
5579c4
+AC_DEFUN([AM_PATH_WIRESHARK],[ 
5579c4
+	AC_ARG_WITH(wireshark-prefix,
5579c4
+	    [  --with-wireshark-prefix=PFX  Prefix where wireshark libraries are installed (optional)],
5579c4
+	    wireshark_config_prefix="$withval", wireshark_config_prefix="")
5579c4
+
5579c4
+	wireshark_found=no
5579c4
+	if test "$wireshark_config_prefix" != "" ; then
5579c4
+		AM_PATH_GLIB_2_0(,,,[gmodule])
5579c4
+		WIRESHARK_CFLAGS="-DWS_VAR_IMPORT=extern -DWS_MSVC_NORETURN= -I$wireshark_config_prefix/include/wireshark -I$wireshark_config_prefix/include/wireshark/epan -I/usr/include/wireshark -I/usr/include/wireshark/epan $GLIB_CFLAGS"
5579c4
+		WIRESHARK_LIBS="-L$wireshark_config_prefix/lib -lwireshark -lwiretap $GLIB_LIBS"
5579c4
+		wireshark_found=yes
5579c4
+	else
5579c4
+		PKG_PROG_PKG_CONFIG()
5579c4
+		PKG_CHECK_MODULES(WIRESHARK, wireshark, wireshark_found=yes)
5579c4
+	fi
5579c4
+
5579c4
+	ac_save_CFLAGS="$CFLAGS"
5579c4
+	ac_save_CLIBS="$LIBS"
5579c4
+	CFLAGS="$CFLAGS $WIRESHARK_CFLAGS"
5579c4
+	LIBS="$WIRESHARK_LIBS $LIBS"
5579c4
+	min_wireshark_version=ifelse([$1], ,0.0.0,[$1])
5579c4
+	if test $wireshark_found = yes; then
5579c4
+		AC_MSG_CHECKING(for wireshark version >= $min_wireshark_version)
5579c4
+		wireshark_found=no
5579c4
+		AC_TRY_RUN([
5579c4
+#include <stdlib.h>
5579c4
+#include <stdio.h>
5579c4
+#include <string.h>
5579c4
+#include <gmodule.h>
5579c4
+#include <epan/packet.h>
5579c4
+#include <epan/prefs.h>
5579c4
+
5579c4
+int 
5579c4
+main()
5579c4
+
5579c4
+{
5579c4
+	int ws_major_version, ws_minor_version, ws_micro_version;
5579c4
+	int major, minor, micro;
5579c4
+	char **tmp_version;
5579c4
+
5579c4
+	tmp_version = (char *) strdup("$min_wireshark_version");
5579c4
+	major = 0;
5579c4
+	minor = 0;
5579c4
+	micro = 0;
5579c4
+	sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ);
5579c4
+	free(tmp_version);
5579c4
+	tmp_version = (char *) epan_get_version();
5579c4
+	sscanf(tmp_version, "%d.%d.%d",
5579c4
+	    &ws_major_version, &ws_minor_version, &ws_micro_version);
5579c4
+
5579c4
+	if (ws_major_version > major ||
5579c4
+	    (ws_major_version == major && ws_minor_version > minor) ||
5579c4
+	    (ws_major_version == major && ws_minor_version == minor &&
5579c4
+	    ws_micro_version >= micro))
5579c4
+		return 0;
5579c4
+
5579c4
+	printf("\n*** An old version of wireshark (%d.%d.%d) was found.\n",
5579c4
+	    ws_major_version, ws_minor_version, ws_micro_version);
5579c4
+	printf("*** You need a version of wireshark not older than %d.%d.%d. ",
5579c4
+	    major, minor, micro);
5579c4
+	return 1;
5579c4
+}
5579c4
+		], wireshark_found=yes)
5579c4
+	fi
5579c4
+
5579c4
+	if test "$wireshark_found" != no; then
5579c4
+		AC_LANG_PUSH(C)
5579c4
+		AC_LINK_IFELSE([AC_LANG_PROGRAM([
5579c4
+#include <stdlib.h>
5579c4
+#include <stdio.h>
5579c4
+#include <string.h>
5579c4
+#include <gmodule.h>
5579c4
+#include <epan/packet.h>
5579c4
+#include <epan/prefs.h>
5579c4
+], [puts(epan_get_version());])], [WIRESHARK_VERSION=`./conftest$ac_exeext`],
5579c4
+wireshark_found=no)
5579c4
+		
5579c4
+		AC_LANG_POP
5579c4
+	fi
5579c4
+
5579c4
+	CFLAGS="$ac_save_CFLAGS"
5579c4
+	LIBS="$ac_save_LIBS"
5579c4
+
5579c4
+	if test "$wireshark_found" != no; then
5579c4
+		AC_MSG_RESULT(yes)
5579c4
+		ifelse([$2],, :, [$2])     
5579c4
+	else
5579c4
+		AC_MSG_RESULT(no)
5579c4
+		WIRESHARK_CFLAGS=""
5579c4
+		WIRESHARK_LIBS=""
5579c4
+		WIRESHARK_VERSION=""
5579c4
+		ifelse([$3], , :, [$3])
5579c4
+	fi
5579c4
+	AC_SUBST(WIRESHARK_CFLAGS)
5579c4
+	AC_SUBST(WIRESHARK_LIBS)
5579c4
+	AC_SUBST(WIRESHARK_VERSION)
5579c4
+])