net-analyzer/wireshark-3.0.0: arm64 keyworded (bug #646936)
[gentoo.git] / net-analyzer / wireshark / files / wireshark-2.4.3-libsmi.patch
1 From 72c2e53981a204d746737d8c01c4ad3738cd4880 Mon Sep 17 00:00:00 2001
2 From: =?utf8?q?Jo=C3=A3o=20Valverde?= <joao.valverde@tecnico.ulisboa.pt>
3 Date: Sun, 5 Nov 2017 12:05:43 +0000
4 Subject: [PATCH 1/1] autotools: Use pkg-config to configure Libsmi
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=utf8
7 Content-Transfer-Encoding: 8bit
8
9 Change-Id: Icecea743739aa7e1a65753f623f311514260d373
10 Reviewed-on: https://code.wireshark.org/review/24252
11 Petri-Dish: João Valverde <j@v6e.pt>
12 Tested-by: Petri Dish Buildbot
13 Reviewed-by: João Valverde <j@v6e.pt>
14 ---
15  Makefile.am      |   2 +-
16  configure.ac     |  27 +++++++++---
17  epan/Makefile.am |   2 +-
18  m4/libsmi.m4     | 125 -------------------------------------------------------
19  4 files changed, 24 insertions(+), 132 deletions(-)
20  delete mode 100644 m4/libsmi.m4
21
22 diff --git a/Makefile.am b/Makefile.am
23 index a2851e0..e6ed5eb 100644
24 --- a/Makefile.am
25 +++ b/Makefile.am
26 @@ -422,7 +422,7 @@ EPAN_EXTRA_LIBS = \
27         @KRB5_LIBS@                     \
28         @LIBGCRYPT_LIBS@                \
29         @LIBGNUTLS_LIBS@                \
30 -       @LIBSMI_LDFLAGS@
31 +       @LIBSMI_LIBS@
32  
33  # Libraries and plugin flags with which to link wireshark.
34  #
35 diff --git a/configure.ac b/configure.ac
36 index 3b3475b..326561c 100644
37 --- a/configure.ac
38 +++ b/configure.ac
39 @@ -432,10 +432,6 @@ linux*)
40         fi
41  esac
42  
43 -# libsmi
44 -# FIXME: currently the path argument to with-libsmi is being ignored
45 -AX_LIBSMI
46 -
47  #
48  # Check if we should build the Wireshark User's Guide
49  #
50 @@ -2427,6 +2423,27 @@ else
51  fi
52  AM_CONDITIONAL(HAVE_LIBXML2, test "x$have_libxml2" = "xyes")
53  
54 +#
55 +# Libsmi check
56 +#
57 +AC_ARG_WITH(libsmi,
58 +  AC_HELP_STRING([--with-libsmi=@<:@yes/no@:>@],
59 +                [use libsmi MIB/PIB library @<:@default=yes, if available@:>@]),
60 +                [], [with_libsmi="if_available"])
61 +
62 +have_libsmi=no
63 +if test "x$with_libsmi" != "xno"; then
64 +       PKG_CHECK_MODULES(LIBSMI, libsmi,
65 +               [have_libsmi=yes
66 +                AC_DEFINE(HAVE_LIBSMI, 1, [Define if you have libsmi])
67 +               ],
68 +               [if test "x$with_libsmi" = "xyes"; then
69 +                       # Error out if the user explicitly requested libsmi
70 +                       AC_MSG_ERROR([Libsmi was requested, but is not installed for development])
71 +                fi
72 +               ]
73 +       )
74 +fi
75  
76  dnl
77  dnl check whether plugins should be enabled
78 @@ -3012,7 +3029,7 @@ echo "                   Use pcap library : $want_pcap"
79  echo "                   Use zlib library : $zlib_message"
80  echo "               Use kerberos library : $krb5_message"
81  echo "                 Use c-ares library : $c_ares_message"
82 -echo "                Use SMI MIB library : $libsmi_message"
83 +echo "                Use SMI MIB library : $have_libsmi"
84  echo "             Use GNU gcrypt library : yes"
85  echo "                 Use GnuTLS library : $tls_message"
86  echo "     Use POSIX capabilities library : $libcap_message"
87 diff --git a/epan/Makefile.am b/epan/Makefile.am
88 index 9f7de62..e85f97b 100644
89 --- a/epan/Makefile.am
90 +++ b/epan/Makefile.am
91 @@ -330,7 +330,7 @@ libwireshark_la_LIBADD = \
92         @KRB5_LIBS@             \
93         @LIBGCRYPT_LIBS@        \
94         @LIBGNUTLS_LIBS@        \
95 -       @LIBSMI_LDFLAGS@        \
96 +       @LIBSMI_LIBS@   \
97         @LZ4_LIBS@              \
98         @NGHTTP2_LIBS@          \
99         @SNAPPY_LIBS@           \
100 diff --git a/m4/libsmi.m4 b/m4/libsmi.m4
101 deleted file mode 100644
102 index d719438..0000000
103 --- a/m4/libsmi.m4
104 +++ /dev/null
105 @@ -1,125 +0,0 @@
106 -# Configure paths for libsmi
107 -# Shamelessly stolen from http://autoconf-archive.cryp.to/ax_lib_sqlite3.html
108 -
109 -# Synopsis: AX_LIBSMI([minimum library version])
110 -# The default minimum library version is 2
111 -
112 -# This macro sets/substitutes the following:
113 -# AC_DEFINE(HAVE_LIBSMI)
114 -# AC_SUBST(LIBSMI_CFLAGS)
115 -# AC_SUBST(LIBSMI_LDFLAGS)
116 -# AC_SUBST(LIBSMI_VERSION)
117 -# $libsmi_message is set to "yes" or "no"
118 -
119 -AC_DEFUN([AX_LIBSMI],
120 -[
121 -    AC_ARG_WITH([libsmi],
122 -        AC_HELP_STRING(
123 -            [--with-libsmi=@<:@DIR@:>@],
124 -            [use libsmi MIB/PIB library @<:@default=yes@:>@, optionally specify the prefix for libsmi]
125 -        ),
126 -        [
127 -        if test "$withval" = "no"; then
128 -            WANT_LIBSMI="no"
129 -        elif test "$withval" = "yes"; then
130 -            WANT_LIBSMI="yes"
131 -            ac_libsmi_path=""
132 -        else
133 -            WANT_LIBSMI="yes"
134 -            ac_libsmi_path="$withval"
135 -        fi
136 -        ],
137 -        [WANT_LIBSMI="yes"]
138 -    )
139 -
140 -    libsmi_message="no"
141 -    LIBSMI_CFLAGS=""
142 -    LIBSMI_LDFLAGS=""
143 -    LIBSMI_VERSION=""
144 -
145 -    if test "x$WANT_LIBSMI" = "xyes"; then
146 -
147 -        ac_libsmi_header="smi.h"
148 -
149 -        libsmi_version_req=ifelse([$1], [], [2], [$1])
150 -
151 -        AC_MSG_CHECKING([for libsmi >= $libsmi_version_req])
152 -
153 -        if test "$ac_libsmi_path" != ""; then
154 -            ac_libsmi_ldflags="-L$ac_libsmi_path/lib"
155 -            ac_libsmi_cflags="-I$ac_libsmi_path/include"
156 -        else
157 -            for ac_libsmi_path_tmp in /usr /usr/local /opt $prefix; do
158 -                if test -f "$ac_libsmi_path_tmp/include/$ac_libsmi_header" \
159 -                    && test -r "$ac_libsmi_path_tmp/include/$ac_libsmi_header"; then
160 -                    ac_libsmi_path=$ac_libsmi_path_tmp
161 -                    ac_libsmi_ldflags="-L$ac_libsmi_path_tmp/lib"
162 -                    ac_libsmi_cflags="-I$ac_libsmi_path_tmp/include"
163 -                    break;
164 -                fi
165 -            done
166 -        fi
167 -
168 -        ac_libsmi_ldflags="$ac_libsmi_ldflags -lsmi"
169 -
170 -        saved_CFLAGS="$CFLAGS"
171 -        CFLAGS="$CFLAGS $ac_libsmi_cflags"
172 -
173 -        AC_LANG_PUSH(C)
174 -        AC_COMPILE_IFELSE(
175 -            [
176 -            AC_LANG_PROGRAM([[@%:@include <smi.h>]],
177 -                [[
178 -  int current, revision, age, n;
179 -  const int required = $libsmi_version_req;
180 -  if (smiInit(""))
181 -    exit(1);
182 -  if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
183 -    exit(2);
184 -  n = sscanf(smi_library_version, "%d:%d:%d", &current, &revision, &age);
185 -  if (n != 3)
186 -    exit(3);
187 -  if (required < current - age || required > current)
188 -    exit(4);
189 -                ]]
190 -            )
191 -            ],
192 -            [
193 -            AC_MSG_RESULT([yes])
194 -            libsmi_message="yes"
195 -            ],
196 -            [
197 -            AC_MSG_RESULT([not found])
198 -            libsmi_message="no"
199 -            ]
200 -        )
201 -        AC_LANG_POP([C])
202 -
203 -        CFLAGS="$saved_CFLAGS"
204 -
205 -        if test "$libsmi_message" = "yes"; then
206 -
207 -            LIBSMI_CFLAGS="$ac_libsmi_cflags"
208 -            LIBSMI_LDFLAGS="$ac_libsmi_ldflags"
209 -
210 -            ac_libsmi_header_path="$ac_libsmi_path/include/$ac_libsmi_header"
211 -
212 -            dnl Retrieve libsmi release version
213 -            if test "x$ac_libsmi_header_path" != "x"; then
214 -                ac_libsmi_version=`cat $ac_libsmi_header_path \
215 -                    | grep '#define.*SMI_LIBRARY_VERSION.*\"' | sed -e 's/.* "//' \
216 -                        | sed -e 's/"//'`
217 -                if test $ac_libsmi_version != ""; then
218 -                    LIBSMI_VERSION=$ac_libsmi_version
219 -                else
220 -                    AC_MSG_WARN([Can not find SMI_LIBRARY_VERSION macro in smi.h header to retrieve libsmi version!])
221 -                fi
222 -            fi
223 -
224 -            AC_SUBST(LIBSMI_CFLAGS)
225 -            AC_SUBST(LIBSMI_LDFLAGS)
226 -            AC_SUBST(LIBSMI_VERSION)
227 -            AC_DEFINE(HAVE_LIBSMI, 1, [Define to 1 if you have the `smi' library (-lsmi).])
228 -        fi
229 -    fi
230 -])
231 -- 
232 2.7.4
233