adds autoconf macro file

This commit is contained in:
Radek Vokál 2009-12-21 11:19:39 +00:00
parent fb8504bcb8
commit a57ef083c0
2 changed files with 115 additions and 2 deletions

101
wireshark-autoconf.m4 Normal file
View File

@ -0,0 +1,101 @@
dnl AM_PATH_WIRESHARK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for wireshark development files, and define WIRESHARK_CFLAGS,
dnl WIRESHARK_LIBS and WIRESHARK_VERSION.
dnl
AC_DEFUN([AM_PATH_WIRESHARK],[
AC_ARG_WITH(wireshark-prefix,
[ --with-wireshark-prefix=PFX Prefix where wireshark libraries are installed (optional)],
wireshark_config_prefix="$withval", wireshark_config_prefix="")
wireshark_found=no
if test "$wireshark_config_prefix" != "" ; then
AM_PATH_GLIB_2_0(,,,[gmodule])
WIRESHARK_CFLAGS="-DWS_VAR_IMPORT=extern -I$wireshark_config_prefix/include/wireshark -I$wireshark_config_prefix/include/wireshark/epan -I/usr/include/wireshark -I/usr/include/wireshark/epan $GLIB_CFLAGS"
WIRESHARK_LIBS="-L$wireshark_config_prefix/lib -lwireshark -lwiretap $GLIB_LIBS"
wireshark_found=yes
else
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(WIRESHARK, wireshark, wireshark_found=yes)
fi
ac_save_CFLAGS="$CFLAGS"
ac_save_CLIBS="$LIBS"
CFLAGS="$CFLAGS $WIRESHARK_CFLAGS"
LIBS="$WIRESHARK_LIBS $LIBS"
min_wireshark_version=ifelse([$1], ,0.0.0,[$1])
if test $wireshark_found = yes; then
AC_MSG_CHECKING(for wireshark version >= $min_wireshark_version)
wireshark_found=no
AC_TRY_RUN([
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gmodule.h>
#include <epan/packet.h>
#include <epan/prefs.h>
int
main()
{
int ws_major_version, ws_minor_version, ws_micro_version;
int major, minor, micro;
char **tmp_version;
tmp_version = (char *) strdup("$min_wireshark_version");
major = 0;
minor = 0;
micro = 0;
sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro);
free(tmp_version);
tmp_version = (char *) epan_get_version();
sscanf(tmp_version, "%d.%d.%d",
&ws_major_version, &ws_minor_version, &ws_micro_version);
if (ws_major_version > major ||
(ws_major_version == major && ws_minor_version > minor) ||
(ws_major_version == major && ws_minor_version == minor &&
ws_micro_version >= micro))
return 0;
printf("\n*** An old version of wireshark (%d.%d.%d) was found.\n",
ws_major_version, ws_minor_version, ws_micro_version);
printf("*** You need a version of wireshark not older than %d.%d.%d. ",
major, minor, micro);
return 1;
}
], wireshark_found=yes)
fi
if test "$wireshark_found" != no; then
AC_LANG_PUSH(C)
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gmodule.h>
#include <epan/packet.h>
#include <epan/prefs.h>
], [puts(epan_get_version());])], [WIRESHARK_VERSION=`./conftest$ac_exeext`],
wireshark_found=no)
AC_LANG_POP
fi
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
if test "$wireshark_found" != no; then
AC_MSG_RESULT(yes)
ifelse([$2],, :, [$2])
else
AC_MSG_RESULT(no)
WIRESHARK_CFLAGS=""
WIRESHARK_LIBS=""
WIRESHARK_VERSION=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(WIRESHARK_CFLAGS)
AC_SUBST(WIRESHARK_LIBS)
AC_SUBST(WIRESHARK_VERSION)
])

View File

@ -12,7 +12,7 @@
Summary: Network traffic analyzer
Name: wireshark
Version: 1.2.5
Release: 1%{?dist}
Release: 2%{?dist}
License: GPL+
Group: Applications/Internet
%if %{svn_version}
@ -23,6 +23,7 @@ Source0: http://wireshark.org/download/src/%{name}-%{version}.tar.bz2
Source1: wireshark.pam
Source2: wireshark.console
Source3: wireshark.desktop
Source4: wireshark-autoconf.m4
Patch1: wireshark-1.0.2-pie.patch
Patch2: wireshark-nfsv4-opts.patch
Patch3: wireshark-0.99.7-path.patch
@ -193,6 +194,7 @@ mkdir -p "${IDIR}/epan/ftypes"
mkdir -p "${IDIR}/epan/dfilter"
mkdir -p "${IDIR}/wiretap"
install -m 644 color.h "${IDIR}/"
install -m 644 register.h "${IDIR}/"
install -m 644 epan/packet.h "${IDIR}/epan/"
install -m 644 epan/prefs.h "${IDIR}/epan/"
install -m 644 epan/proto.h "${IDIR}/epan/"
@ -214,7 +216,9 @@ install -m 644 epan/guid-utils.h "${IDIR}/epan/"
install -m 644 epan/exceptions.h "${IDIR}/epan/"
install -m 644 epan/address.h "${IDIR}/epan/"
install -m 644 epan/slab.h "${IDIR}/epan/"
install -m 644 epan/tfs.h "${IDIR}/epan/"
install -m 644 epan/except.h "${IDIR}/epan/"
install -m 644 epan/emem.h "${IDIR}/epan/"
install -m 644 epan/ftypes/ftypes.h "${IDIR}/epan/ftypes/"
install -m 644 epan/dfilter/dfilter.h "${IDIR}/epan/dfilter/"
install -m 644 epan/dfilter/drange.h "${IDIR}/epan/dfilter/"
@ -231,11 +235,15 @@ cat > "${RPM_BUILD_ROOT}%{_libdir}/pkgconfig/wireshark.pc" <<- "EOF"
Name: %{name}
Description: Network Traffic Analyzer
Version: %{version}
Requires: glib-2.0
Requires: glib-2.0 gmodule-2.0
Libs: -L${libdir} -lwireshark -lwiretap
Cflags: -DWS_VAR_IMPORT=extern -DHAVE_STDARG_H -I${includedir}/wireshark -I${includedir}/wireshark/epan
EOF
# Install the autoconf macro.
mkdir -p "${RPM_BUILD_ROOT}%{_datadir}/aclocal"
cp "%{SOURCE4}" "${RPM_BUILD_ROOT}%{_datadir}/aclocal/wireshark.m4"
# Remove .la files
rm -f $RPM_BUILD_ROOT/%{_libdir}/%{name}/plugins/%{version}/*.la
@ -293,6 +301,7 @@ rm -rf $RPM_BUILD_ROOT
%{_includedir}/wireshark
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*
%{_datadir}/aclocal/*
%{_mandir}/man1/idl2wrs.*
%{_sbindir}/idl2wrs
%if %{with_lua}
@ -300,6 +309,9 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Fri Dec 18 2009 Patrick Monnerat <pm@datasphere.ch> 1.2.5-2
- Autoconf macro for plugin development.
* Fri Dec 18 2009 Radek Vokal <rvokal@redhat.com> - 1.2.5-1
- upgrade to 1.2.5
- fixes security vulnaribilities, see http://www.wireshark.org/security/wnpa-sec-2009-09.html