Fix build by #if 0 out unused de_sgsap_tmsi() function.
[obnox/wireshark/wip.git] / acinclude.m4
1 dnl Macros that test for specific features.
2 dnl This file is part of the Autoconf packaging for Wireshark.
3 dnl Copyright (C) 1998-2000 by Gerald Combs.
4 dnl
5 dnl $Id$
6 dnl
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 2, or (at your option)
10 dnl any later version.
11 dnl
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 dnl GNU General Public License for more details.
16 dnl
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program; if not, write to the Free Software
19 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 dnl 02111-1307, USA.
21 dnl
22 dnl As a special exception, the Free Software Foundation gives unlimited
23 dnl permission to copy, distribute and modify the configure scripts that
24 dnl are the output of Autoconf.  You need not follow the terms of the GNU
25 dnl General Public License when using or distributing such scripts, even
26 dnl though portions of the text of Autoconf appear in them.  The GNU
27 dnl General Public License (GPL) does govern all other use of the material
28 dnl that constitutes the Autoconf program.
29 dnl
30 dnl Certain portions of the Autoconf source text are designed to be copied
31 dnl (in certain cases, depending on the input) into the output of
32 dnl Autoconf.  We call these the "data" portions.  The rest of the Autoconf
33 dnl source text consists of comments plus executable code that decides which
34 dnl of the data portions to output in any given case.  We call these
35 dnl comments and executable code the "non-data" portions.  Autoconf never
36 dnl copies any of the non-data portions into its output.
37 dnl
38 dnl This special exception to the GPL applies to versions of Autoconf
39 dnl released by the Free Software Foundation.  When you make and
40 dnl distribute a modified version of Autoconf, you may extend this special
41 dnl exception to the GPL to apply to your modified version as well, *unless*
42 dnl your modified version has the potential to copy into its output some
43 dnl of the text that was the non-data portion of the version that you started
44 dnl with.  (In other words, unless your change moves or copies text from
45 dnl the non-data portions to the data portions.)  If your modification has
46 dnl such potential, you must delete any notice of this special exception
47 dnl to the GPL from your modified version.
48 dnl
49 dnl Written by David MacKenzie, with help from
50 dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
51 dnl Roland McGrath, Noah Friedman, david d zuhn, and many others.
52
53 #
54 # AC_WIRESHARK_ADD_DASH_L
55 #
56 # Add to the variable specified as the first argument a "-L" flag for the
57 # directory specified as the second argument, and, on Solaris, add a
58 # "-R" flag for it as well.
59 #
60 # XXX - IRIX, and other OSes, may require some flag equivalent to
61 # "-R" here.
62 #
63 AC_DEFUN([AC_WIRESHARK_ADD_DASH_L],
64 [$1="$$1 -L$2"
65 case "$host_os" in
66   solaris*)
67     $1="$$1 -R$2"
68   ;;
69 esac
70 ])
71
72 #
73 # AC_WIRESHARK_TIMEZONE_ABBREV
74 #
75
76 AC_DEFUN([AC_WIRESHARK_TIMEZONE_ABBREV],
77 [
78   AC_CACHE_CHECK([for tm_zone in struct tm],
79     ac_cv_wireshark_have_tm_zone,
80     [
81       AC_TRY_COMPILE(
82         [#include <time.h>],
83         [struct tm t; t.tm_zone;],
84         ac_cv_wireshark_have_tm_zone=yes,
85         ac_cv_wireshark_have_tm_zone=no)
86     ])
87   if test $ac_cv_wireshark_have_tm_zone = yes; then
88     AC_DEFINE(HAVE_TM_ZONE, 1, [Define if tm_zone field exists in struct tm])
89   else
90     AC_CACHE_CHECK([for tzname],
91       ac_cv_wireshark_have_tzname,
92       [
93         AC_TRY_LINK(
94 [#include <time.h>
95 #include <stdio.h>],
96           [printf("%s", tzname[0]);],
97           ac_cv_wireshark_have_tzname=yes,
98           ac_cv_wireshark_have_tzname=no)
99       ])
100     if test $ac_cv_wireshark_have_tzname = yes; then
101       AC_DEFINE(HAVE_TZNAME, 1, [Define if tzname array exists])
102     fi
103   fi
104 ])
105
106
107 #
108 # AC_WIRESHARK_STRUCT_SA_LEN
109 #
110 dnl AC_STRUCT_ST_BLKSIZE extracted from the file in question,
111 dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into
112 dnl AC_WIRESHARK_STRUCT_SA_LEN, which checks if "struct sockaddr"
113 dnl has the 4.4BSD "sa_len" member, and defines HAVE_SA_LEN; that's
114 dnl what's in this file.
115 dnl Done by Guy Harris <guy@alum.mit.edu> on 1998-11-14.
116
117 dnl ### Checks for structure members
118
119 AC_DEFUN([AC_WIRESHARK_STRUCT_SA_LEN],
120 [AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_wireshark_struct_sa_len,
121 [AC_TRY_COMPILE([#include <sys/types.h>
122 #include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
123 ac_cv_wireshark_struct_sa_len=yes, ac_cv_wireshark_struct_sa_len=no)])
124 if test $ac_cv_wireshark_struct_sa_len = yes; then
125   AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
126 fi
127 ])
128
129
130 #
131 # AC_WIRESHARK_IPV6_STACK
132 #
133 # By Jun-ichiro "itojun" Hagino, <itojun@iijlab.net>
134 #
135 AC_DEFUN([AC_WIRESHARK_IPV6_STACK],
136 [
137         v6type=unknown
138         v6lib=none
139
140         AC_MSG_CHECKING([ipv6 stack type])
141         for i in v6d toshiba kame inria zeta linux linux-glibc solaris8; do
142                 case $i in
143                 v6d)
144                         AC_EGREP_CPP(yes, [
145 #include </usr/local/v6/include/sys/types.h>
146 #ifdef __V6D__
147 yes
148 #endif],
149                                 [v6type=$i; v6lib=v6;
150                                 v6libdir=/usr/local/v6/lib;
151                                 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
152                         ;;
153                 toshiba)
154                         AC_EGREP_CPP(yes, [
155 #include <sys/param.h>
156 #ifdef _TOSHIBA_INET6
157 yes
158 #endif],
159                                 [v6type=$i; v6lib=inet6;
160                                 v6libdir=/usr/local/v6/lib;
161                                 CFLAGS="-DINET6 $CFLAGS"])
162                         ;;
163                 kame)
164                         AC_EGREP_CPP(yes, [
165 #include <netinet/in.h>
166 #ifdef __KAME__
167 yes
168 #endif],
169                                 [v6type=$i; v6lib=inet6;
170                                 v6libdir=/usr/local/v6/lib;
171                                 CFLAGS="-DINET6 $CFLAGS"])
172                         ;;
173                 inria)
174                         AC_EGREP_CPP(yes, [
175 #include <netinet/in.h>
176 #ifdef IPV6_INRIA_VERSION
177 yes
178 #endif],
179                                 [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
180                         ;;
181                 zeta)
182                         AC_EGREP_CPP(yes, [
183 #include <sys/param.h>
184 #ifdef _ZETA_MINAMI_INET6
185 yes
186 #endif],
187                                 [v6type=$i; v6lib=inet6;
188                                 v6libdir=/usr/local/v6/lib;
189                                 CFLAGS="-DINET6 $CFLAGS"])
190                         ;;
191                 linux)
192                         if test -d /usr/inet6; then
193                                 v6type=$i
194                                 v6lib=inet6
195                                 v6libdir=/usr/inet6
196                                 CFLAGS="-DINET6 $CFLAGS"
197                         fi
198                         ;;
199                 linux-glibc)
200                         AC_EGREP_CPP(yes, [
201 #include <features.h>
202 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
203 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || __GLIBC__ > 2
204 yes
205 #endif
206 #endif],
207                         [v6type=$i; v6lib=inet6; CFLAGS="-DINET6 $CFLAGS"])
208                         ;;
209                 solaris8)
210                         if test "`uname -s`" = "SunOS" && test "`uname -r`" = "5.8"; then
211                                 v6type=$i
212                                 v6lib=inet6
213                                 [CFLAGS="-DINET6 -DSOLARIS8_INET6 $CFLAGS"]
214                         fi
215                         ;;
216                 esac
217                 if test "$v6type" != "unknown"; then
218                         break
219                 fi
220         done
221
222         if test "$v6lib" != "none"; then
223                 for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
224                         if test -d $dir -a -f $dir/lib$v6lib.a; then
225                                 LIBS="-L$dir $LIBS -l$v6lib"
226                                 break
227                         fi
228                 done
229                 enable_ipv6="yes"
230         else
231                 enable_ipv6="no"
232         fi
233         AC_MSG_RESULT(["$v6type, $v6lib"])
234 ])
235
236 #
237 # AC_WIRESHARK_GETHOSTBY_LIB_CHECK
238 #
239 # Checks whether we need "-lnsl" to get "gethostby*()", which we use
240 # in "resolv.c".
241 #
242 # Adapted from stuff in the AC_PATH_XTRA macro in "acspecific.m4" in
243 # GNU Autoconf 2.13; the comment came from there.
244 # Done by Guy Harris <guy@alum.mit.edu> on 2000-01-14.
245 #
246 AC_DEFUN([AC_WIRESHARK_GETHOSTBY_LIB_CHECK],
247 [
248     # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
249     # to get the SysV transport functions.
250     # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4)
251     # needs -lnsl.
252     # The nsl library prevents programs from opening the X display
253     # on Irix 5.2, according to dickey@clark.net.
254     AC_CHECK_FUNC(gethostbyname, ,
255         AC_CHECK_LIB(nsl, gethostbyname, NSL_LIBS="-lnsl"))
256     AC_SUBST(NSL_LIBS)
257 ])
258
259 #
260 # AC_WIRESHARK_SOCKET_LIB_CHECK
261 #
262 # Checks whether we need "-lsocket" to get "socket()", which is used
263 # by libpcap on some platforms - and, in effect, "gethostby*()" on
264 # most if not all platforms (so that it can use NIS or DNS or...
265 # to look up host names).
266 #
267 # Adapted from stuff in the AC_PATH_XTRA macro in "acspecific.m4" in
268 # GNU Autoconf 2.13; the comment came from there.
269 # Done by Guy Harris <guy@alum.mit.edu> on 2000-01-14.
270 #
271 # We use "connect" because that's what AC_PATH_XTRA did.
272 #
273 AC_DEFUN([AC_WIRESHARK_SOCKET_LIB_CHECK],
274 [
275     # lieder@skyler.mavd.honeywell.com says without -lsocket,
276     # socket/setsockopt and other routines are undefined under SCO ODT
277     # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
278     # on later versions), says simon@lia.di.epfl.ch: it contains
279     # gethostby* variants that don't use the nameserver (or something).
280     # -lsocket must be given before -lnsl if both are needed.
281     # We assume that if connect needs -lnsl, so does gethostbyname.
282     AC_CHECK_FUNC(connect, ,
283       AC_CHECK_LIB(socket, connect, SOCKET_LIBS="-lsocket",
284                 AC_MSG_ERROR(Function 'socket' not found.), $NSL_LIBS))
285     AC_SUBST(SOCKET_LIBS)
286 ])
287
288 #
289 # AC_WIRESHARK_BREAKLOOP_TRY_LINK
290 #
291 AC_DEFUN([AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK],
292 [
293   AC_LINK_IFELSE(
294   [
295       AC_LANG_SOURCE(
296       [[
297 #       include <pcap.h>
298         int main(void)
299         {
300           pcap_t  *pct = NULL;
301           pcap_breakloop(pct);
302           return 0;
303         }
304       ]])
305   ],
306   [
307     ws_breakloop_compiled=yes
308   ],
309   [
310     ws_breakloop_compiled=no
311   ])
312 ])
313
314
315
316 #
317 # AC_WIRESHARK_PCAP_CHECK
318 #
319 AC_DEFUN([AC_WIRESHARK_PCAP_CHECK],
320 [
321         if test -z "$pcap_dir"
322         then
323           # Pcap header checks
324           # XXX need to set a var AC_CHECK_HEADER(pcap.h,,)
325
326           #
327           # The user didn't specify a directory in which libpcap resides.
328           # First, look for a pcap-config script.
329           #
330           AC_PATH_PROG(PCAP_CONFIG, pcap-config)
331
332           if test -n "$PCAP_CONFIG" ; then
333             #
334             # Found it.
335             #
336             # Now check whether it's the libpcap 1.0 version, which
337             # put a space after "-L" - on some platforms, that doesn't
338             # work.
339             #
340             AC_MSG_CHECKING(for broken pcap-config)
341             case "`\"$PCAP_CONFIG\" --libs`" in
342
343             "-L "*)
344               #
345               # Space after -L.  Pretend pcap-config doesn't exist.
346               #
347               AC_MSG_RESULT(yes)
348               PCAP_CONFIG=""
349               ;;
350
351             *)
352               #
353               # No space after -L.
354               #
355               AC_MSG_RESULT(no)
356               ;;
357             esac
358           fi
359           if test -n "$PCAP_CONFIG" ; then
360             #
361             # Found it, and it's usable; use it to get the include flags
362             # for libpcap.
363             #
364             CFLAGS="$CFLAGS `\"$PCAP_CONFIG\" --cflags`"
365             CPPFLAGS="$CPPFLAGS `\"$PCAP_CONFIG\" --cflags`"
366           else  
367             #
368             # Didn't find it; we have to look for libpcap ourselves.
369             # We assume that the current library search path will work,
370             # but we may have to look for the header in a "pcap"
371             # subdirectory of "/usr/include" or "/usr/local/include",
372             # as some systems apparently put "pcap.h" in a "pcap"
373             # subdirectory, and we also check "$prefix/include" - and
374             # "$prefix/include/pcap", in case $prefix is set to
375             # "/usr/include" or "/usr/local/include".
376             #
377             # XXX - should we just add "$prefix/include" to the include
378             # search path and "$prefix/lib" to the library search path?
379             #
380             AC_MSG_CHECKING(for extraneous pcap header directories)
381             found_pcap_dir=""
382             pcap_dir_list="/usr/include/pcap $prefix/include/pcap $prefix/include"
383             if test "x$ac_cv_enable_usr_local" = "xyes" ; then
384               pcap_dir_list="$pcap_dir_list /usr/local/include/pcap"
385             fi
386             for pcap_dir in $pcap_dir_list
387             do
388               if test -d $pcap_dir ; then
389                 if test x$pcap_dir != x/usr/include -a x$pcap_dir != x/usr/local/include ; then
390                     CFLAGS="$CFLAGS -I$pcap_dir"
391                     CPPFLAGS="$CPPFLAGS -I$pcap_dir"
392                 fi
393                 found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
394                 break
395               fi
396             done
397
398             if test "$found_pcap_dir" != "" ; then
399               AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
400             else
401               AC_MSG_RESULT(not found)
402             fi
403           fi
404         else
405           #
406           # The user specified a directory in which libpcap resides,
407           # so add the "include" subdirectory of that directory to
408           # the include file search path and the "lib" subdirectory
409           # of that directory to the library search path.
410           #
411           # XXX - if there's also a libpcap in a directory that's
412           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
413           # make us find the version in the specified directory,
414           # as the compiler and/or linker will search that other
415           # directory before it searches the specified directory.
416           #
417           CFLAGS="$CFLAGS -I$pcap_dir/include"
418           CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
419           AC_WIRESHARK_ADD_DASH_L(LDFLAGS, $pcap_dir/lib)
420         fi
421
422         # Pcap header check
423         AC_CHECK_HEADER(pcap.h,,
424             AC_MSG_ERROR([[Header file pcap.h not found; if you installed libpcap
425 from source, did you also do \"make install-incl\", and if you installed a
426 binary package of libpcap, is there also a developer's package of libpcap,
427 and did you also install that package?]]))
428
429         if test -n "$PCAP_CONFIG" ; then
430           #
431           # We have pcap-config; we assume that means we have libpcap
432           # installed and that pcap-config will tell us whatever
433           # libraries libpcap needs.
434           #
435           if test x$enable_static = xyes; then
436             PCAP_LIBS="`\"$PCAP_CONFIG\" --libs --static`"
437           else
438             PCAP_LIBS="`\"$PCAP_CONFIG\" --libs`"
439           fi
440           AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
441         else
442           #
443           # Check to see if we find "pcap_open_live" in "-lpcap".
444           # Also check for various additional libraries that libpcap might
445           # require.
446           #
447           AC_CHECK_LIB(pcap, pcap_open_live,
448             [
449               PCAP_LIBS=-lpcap
450               AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
451             ], [
452               ac_wireshark_extras_found=no
453               ac_save_LIBS="$LIBS"
454               for extras in "-lcfg -lodm" "-lpfring"
455               do
456                 AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras])
457                 LIBS="-lpcap $extras"
458                 #
459                 # XXX - can't we use AC_CHECK_LIB here?
460                 #
461                 AC_TRY_LINK(
462                     [
463 #       include <pcap.h>
464                     ],
465                     [
466         pcap_open_live(NULL, 0, 0, 0, NULL);
467                     ],
468                     [
469                         ac_wireshark_extras_found=yes
470                         AC_MSG_RESULT([yes])
471                         PCAP_LIBS="-lpcap $extras"
472                         AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
473                     ],
474                     [
475                         AC_MSG_RESULT([no])
476                     ])
477                 if test x$ac_wireshark_extras_found = xyes
478                 then
479                     break
480                 fi
481               done
482               if test x$ac_wireshark_extras_found = xno
483               then
484                 AC_MSG_ERROR([Can't link with library libpcap.])
485               fi
486               LIBS=$ac_save_LIBS
487             ], $SOCKET_LIBS $NSL_LIBS)
488         fi
489         AC_SUBST(PCAP_LIBS)
490
491         #
492         # Check whether various variables and functions are defined by
493         # libpcap.
494         #
495         ac_save_LIBS="$LIBS"
496         AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
497         LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS"
498         AC_TRY_LINK(
499            [
500 #       include <stdio.h>
501         extern char *pcap_version;
502            ],
503            [
504         printf ("%s\n", pcap_version);
505            ],
506            ac_cv_pcap_version_defined=yes,
507            ac_cv_pcap_version_defined=no,
508            [echo $ac_n "cross compiling; assumed OK... $ac_c"])
509         if test "$ac_cv_pcap_version_defined" = yes ; then
510                 AC_MSG_RESULT(yes)
511                 AC_DEFINE(HAVE_PCAP_VERSION, 1, [Define if libpcap version is known])
512         else
513                 AC_MSG_RESULT(no)
514         fi
515         AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
516         #
517         # pcap_breakloop may be present in the library but not declared
518         # in the pcap.h header file.  If it's not declared in the header
519         # file, attempts to use it will get warnings, and, if we're
520         # building with warnings treated as errors, that warning will
521         # cause compilation to fail.
522         #
523         # We are therefore first testing whether the function is present
524         # and then, if we're compiling with warnings as errors, testing
525         # whether it is usable.  It is usable if it compiles without
526         # a -Wimplicit warning (the "compile with warnings as errors"
527         # option requires GCC). If it is not usable, we fail and tell
528         # the user that the pcap.h header needs to be updated.
529         #
530         # Ceteris paribus, this should only happen with Mac OS X 10.3[.x] which
531         # can have an up-to-date pcap library without the corresponding pcap
532         # header.
533         #
534         # However, it might also happen on some others OSes with some erroneous
535         # system manipulations where multiple versions of libcap might co-exist
536         # e.g. hand made symbolic link from libpcap.so -> libpcap.so.0.8 but
537         # having the pcap header version 0.7.
538         #
539         AC_MSG_CHECKING([whether pcap_breakloop is present])
540         ac_CFLAGS_saved="$CFLAGS"
541         AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK
542         if test "x$ws_breakloop_compiled" = "xyes"; then
543           AC_MSG_RESULT(yes)
544           AC_DEFINE(HAVE_PCAP_BREAKLOOP, 1, [Define if pcap_breakloop is known])
545           if test "x$with_warnings_as_errors" = "xyes"; then
546             AC_MSG_CHECKING([whether pcap_breakloop is usable])
547             CFLAGS="$CFLAGS -Werror -Wimplicit"
548             AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK
549             if test "x$ws_breakloop_compiled" = "xyes"; then
550               AC_MSG_RESULT(yes)
551             else
552               AC_MSG_RESULT(no)
553               AC_MSG_ERROR(
554 [Your pcap library is more recent than your pcap header.
555 As you are building with compiler warnings treated as errors, Wireshark
556 won't be able to use functions not declared in that header.
557 If you wish to build with compiler warnings treated as errors, You should
558 install a newer version of the header file.])
559             fi
560             CFLAGS="$ac_CFLAGS_saved"
561           fi
562         else
563           AC_MSG_RESULT(no)
564         fi
565
566         #
567         # Later versions of Mac OS X 10.3[.x] ship a pcap.h that
568         # doesn't define pcap_if_t but ship an 0.8[.x] libpcap,
569         # so the library has "pcap_findalldevs()", but pcap.h
570         # doesn't define "pcap_if_t" so you can't actually *use*
571         # "pcap_findalldevs()".
572         #
573         # That even appears to be true of systems shipped with
574         # 10.3.4, so it doesn't appear only to be a case of
575         # Software Update not updating header files.
576         #
577         # (You can work around this by installing the 0.8 header
578         # files.)
579         #
580         AC_CACHE_CHECK([whether pcap_findalldevs is present and usable],
581           [ac_cv_func_pcap_findalldevs],
582           [
583             AC_LINK_IFELSE(
584               [
585                 AC_LANG_SOURCE(
586                   [[
587                     #include <pcap.h>
588                     main()
589                     {
590                       pcap_if_t *devpointer;
591                       char errbuf[1];
592
593                       pcap_findalldevs(&devpointer, errbuf);
594                     }
595                   ]])
596               ],
597               [
598                 ac_cv_func_pcap_findalldevs=yes
599               ],
600               [
601                 ac_cv_func_pcap_findalldevs=no
602               ])
603           ])
604         #
605         # Don't check for other new routines that showed up after
606         # "pcap_findalldevs()" if we don't have a usable
607         # "pcap_findalldevs()", so we don't end up using them if the
608         # "pcap.h" is crufty and old and doesn't declare them.
609         #
610         if test $ac_cv_func_pcap_findalldevs = "yes" ; then
611           AC_DEFINE(HAVE_PCAP_FINDALLDEVS, 1,
612            [Define to 1 if you have the `pcap_findalldevs' function and a pcap.h that declares pcap_if_t.])
613           AC_CHECK_FUNCS(pcap_datalink_val_to_name pcap_datalink_name_to_val)
614           AC_CHECK_FUNCS(pcap_datalink_val_to_description)
615           AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink pcap_lib_version)
616           AC_CHECK_FUNCS(pcap_get_selectable_fd pcap_free_datalinks)
617           AC_CHECK_FUNCS(pcap_create bpf_image)
618         fi
619         LIBS="$ac_save_LIBS"
620 ])
621
622 AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK],
623 [
624     ac_save_LIBS="$LIBS"
625     LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS"
626     AC_DEFINE(HAVE_REMOTE, 1, [Define to 1 to enable remote
627               capturing feature in WinPcap library])
628     AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex pcap_createsrcstr)
629     if test $ac_cv_func_pcap_open = "yes" -a \
630             $ac_cv_func_pcap_findalldevs_ex = "yes" -a \
631             $ac_cv_func_pcap_createsrcstr = "yes" ; then
632         AC_DEFINE(HAVE_PCAP_REMOTE, 1,
633             [Define to 1 if you have WinPcap remote capturing support and prefer to use these new API features.])
634     fi
635     AC_CHECK_FUNCS(pcap_setsampling)
636     LIBS="$ac_save_LIBS"
637 ])
638
639 #
640 # AC_WIRESHARK_ZLIB_CHECK
641 #
642 AC_DEFUN([AC_WIRESHARK_ZLIB_CHECK],
643 [
644         if test "x$zlib_dir" != "x"
645         then
646           #
647           # The user specified a directory in which zlib resides,
648           # so add the "include" subdirectory of that directory to
649           # the include file search path and the "lib" subdirectory
650           # of that directory to the library search path.
651           #
652           # XXX - if there's also a zlib in a directory that's
653           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
654           # make us find the version in the specified directory,
655           # as the compiler and/or linker will search that other
656           # directory before it searches the specified directory.
657           #
658           wireshark_save_CFLAGS="$CFLAGS"
659           CFLAGS="$CFLAGS -I$zlib_dir/include"
660           wireshark_save_CPPFLAGS="$CPPFLAGS"
661           CPPFLAGS="$CPPFLAGS -I$zlib_dir/include"
662           wireshark_save_LIBS="$LIBS"
663           AC_WIRESHARK_ADD_DASH_L(LIBS, $zlib_dir/lib)
664         fi
665
666         #
667         # Make sure we have "zlib.h".  If we don't, it means we probably
668         # don't have zlib, so don't use it.
669         #
670         AC_CHECK_HEADER(zlib.h,,
671           [
672             if test "x$zlib_dir" != "x"
673             then
674               #
675               # The user used "--with-zlib=" to specify a directory
676               # containing zlib, but we didn't find the header file
677               # there; that either means they didn't specify the
678               # right directory or are confused about whether zlib
679               # is, in fact, installed.  Report the error and give up.
680               #
681               AC_MSG_ERROR([zlib header not found in directory specified in --with-zlib])
682             else
683               if test "x$want_zlib" = "xyes"
684               then
685                 #
686                 # The user tried to force us to use the library, but we
687                 # couldn't find the header file; report an error.
688                 #
689                 AC_MSG_ERROR(Header file zlib.h not found.)
690               else
691                 #
692                 # We couldn't find the header file; don't use the
693                 # library, as it's probably not present.
694                 #
695                 want_zlib=no
696               fi
697             fi
698           ])
699
700         if test "x$want_zlib" != "xno"
701         then
702                 #
703                 # Well, we at least have the zlib header file.
704                 #
705                 # Check for "gzgets()" in zlib, because we need it, but
706                 # some older versions of zlib don't have it.  It appears
707                 # from the zlib ChangeLog that any released version of zlib
708                 # with "gzgets()" should have the other routines we
709                 # depend on, such as "gzseek()", "gztell()", and "zError()".
710                 #
711                 # Another reason why we require "gzgets()" is that
712                 # some versions of zlib that didn't have it, such
713                 # as 1.0.8, had a bug in "gzseek()" that meant that it
714                 # doesn't work correctly on uncompressed files; this
715                 # means we cannot use version 1.0.8.  (Unfortunately,
716                 # that's the version that comes with recent X11 source,
717                 # and many people who install XFree86 on their Slackware
718                 # boxes don't realize that they should configure it to
719                 # use the native zlib rather than building and installing
720                 # the crappy old version that comes with XFree86.)
721                 #
722                 # I.e., we can't just avoid using "gzgets()", as
723                 # versions of zlib without "gzgets()" are likely to have
724                 # a broken "gzseek()".
725                 #
726                 AC_CHECK_LIB(z, gzgets,
727                 [
728                         if test "x$zlib_dir" != "x"
729                         then
730                                 #
731                                 # Put the "-I" and "-L" flags for zlib at
732                                 # the beginning of CFLAGS, CPPFLAGS, and
733                                 # LIBS.
734                                 #
735                                 LIBS=""
736                                 AC_WIRESHARK_ADD_DASH_L(LIBS, $zlib_dir/lib)
737                                 LIBS="$LIBS -lz $wireshark_save_LIBS"
738                         else
739                                 LIBS="-lz $LIBS"
740                         fi
741                         AC_DEFINE(HAVE_LIBZ, 1, [Define to use libz library])
742                 ],[
743                         if test "x$zlib_dir" != "x"
744                         then
745                                 #
746                                 # Restore the versions of CFLAGS, CPPFLAGS,
747                                 # and LIBS before we added the "-with-zlib="
748                                 # directory, as we didn't actually find
749                                 # zlib there, or didn't find a zlib that
750                                 # contains gzgets there.
751                                 #
752                                 CFLAGS="$wireshark_save_CFLAGS"
753                                 CPPFLAGS="$wireshark_save_CPPFLAGS"
754                                 LIBS="$wireshark_save_LIBS"
755                         fi
756                         want_zlib=no
757                 ])
758         fi
759
760         if test "x$want_zlib" != "xno"
761         then
762                 #
763                 # Well, we at least have the zlib header file and a zlib
764                 # with "gzgets()".
765                 #
766                 # Now check for "gzgets()" in zlib when linking with the
767                 # linker flags for GTK+ applications; people often grab
768                 # XFree86 source and build and install it on their systems,
769                 # and they appear sometimes to misconfigure XFree86 so that,
770                 # even on systems with zlib, it assumes there is no zlib,
771                 # so the XFree86 build process builds and installs its
772                 # own zlib in the X11 library directory.
773                 #
774                 # The XFree86 zlib is an older version that lacks
775                 # "gzgets()", and that's the zlib with which Wireshark
776                 # gets linked, so the build of Wireshark fails.
777                 #
778                 ac_save_CFLAGS="$CFLAGS"
779                 ac_save_LIBS="$LIBS"
780                 CFLAGS="$CFLAGS $GTK_CFLAGS"
781                 LIBS="$GTK_LIBS -lz $LIBS"
782                 AC_MSG_CHECKING([for gzgets missing when linking with X11])
783                 AC_TRY_LINK_FUNC(gzgets, AC_MSG_RESULT(no),
784                   [
785                     AC_MSG_RESULT(yes)
786                     AC_MSG_ERROR(old zlib found when linking with X11 - get rid of old zlib.)
787                   ])
788                 CFLAGS="$ac_save_CFLAGS"
789                 LIBS="$ac_save_LIBS"
790         fi
791 ])
792
793 #
794 # AC_WIRESHARK_LIBPCRE_CHECK
795 #
796 AC_DEFUN([AC_WIRESHARK_LIBPCRE_CHECK],
797 [
798         if test "x$pcre_dir" != "x"
799         then
800           #
801           # The user specified a directory in which libpcre resides,
802           # so add the "include" subdirectory of that directory to
803           # the include file search path and the "lib" subdirectory
804           # of that directory to the library search path.
805           #
806           # XXX - if there's also a libpcre in a directory that's
807           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
808           # make us find the version in the specified directory,
809           # as the compiler and/or linker will search that other
810           # directory before it searches the specified directory.
811           #
812           wireshark_save_CFLAGS="$CFLAGS"
813           CFLAGS="$CFLAGS -I$pcre_dir/include"
814           wireshark_save_CPPFLAGS="$CPPFLAGS"
815           CPPFLAGS="$CPPFLAGS -I$pcre_dir/include"
816           wireshark_save_LIBS="$LIBS"
817           LIBS="$LIBS -lpcre"
818           wireshark_save_LDFLAGS="$LDFLAGS"
819           LDFLAGS="$LDFLAGS -L$pcre_dir/lib"
820         fi
821
822         #
823         # Make sure we have "pcre.h".  If we don't, it means we probably
824         # don't have libpcre, so don't use it.
825         #
826         AC_CHECK_HEADER(pcre.h,,
827           [
828             if test "x$pcre_dir" != "x"
829             then
830               #
831               # The user used "--with-pcre=" to specify a directory
832               # containing libpcre, but we didn't find the header file
833               # there; that either means they didn't specify the
834               # right directory or are confused about whether libpcre
835               # is, in fact, installed.  Report the error and give up.
836               #
837               AC_MSG_ERROR([libpcre header not found in directory specified in --with-pcre])
838             else
839               if test "x$want_pcre" = "xyes"
840               then
841                 #
842                 # The user tried to force us to use the library, but we
843                 # couldn't find the header file; report an error.
844                 #
845                 AC_MSG_ERROR(Header file pcre.h not found.)
846               else
847                 #
848                 # We couldn't find the header file; don't use the
849                 # library, as it's probably not present.
850                 #
851                 want_pcre=no
852               fi
853             fi
854           ])
855
856         if test "x$want_pcre" != "xno"
857         then
858                 #
859                 # Well, we at least have the pcre header file.
860                 #
861                 # We're only using standard functions from libpcre,
862                 # so we don't need to perform extra checks.
863                 #
864                 AC_CHECK_LIB(pcre, pcre_compile,
865                 [
866                         if test "x$pcre_dir" != "x"
867                         then
868                                 #
869                                 # Put the "-I" and "-L" flags for pcre at
870                                 # the beginning of CFLAGS, CPPFLAGS,
871                                 # LDFLAGS, and LIBS.
872                                 #
873                                 PCRE_LIBS="-L$pcre_dir/lib -lpcre $wireshark_save_LIBS"
874                         else
875                                 PCRE_LIBS="-lpcre"
876                         fi
877                         AC_DEFINE(HAVE_LIBPCRE, 1, [Define to use libpcre library])
878                 ],[
879                         if test "x$pcre_dir" != "x"
880                         then
881                                 #
882                                 # Restore the versions of CFLAGS, CPPFLAGS,
883                                 # LDFLAGS, and LIBS before we added the
884                                 # "--with-pcre=" directory, as we didn't
885                                 # actually find pcre there.
886                                 #
887                                 CFLAGS="$wireshark_save_CFLAGS"
888                                 CPPFLAGS="$wireshark_save_CPPFLAGS"
889                                 LDFLAGS="$wireshark_save_LDFLAGS"
890                                 LIBS="$wireshark_save_LIBS"
891                                 PCRE_LIBS=""
892                         fi
893                         want_pcre=no
894                 ])
895                 AC_SUBST(PCRE_LIBS)
896         fi
897 ])
898
899 #
900 # AC_WIRESHARK_LIBLUA_CHECK
901 #
902 AC_DEFUN([AC_WIRESHARK_LIBLUA_CHECK],[
903
904         if test "x$lua_dir" != "x"
905         then
906                 #
907                 # The user specified a directory in which liblua resides,
908                 # so add the "include" subdirectory of that directory to
909                 # the include file search path and the "lib" subdirectory
910                 # of that directory to the library search path.
911                 #
912                 # XXX - if there's also a liblua in a directory that's
913                 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
914                 # make us find the version in the specified directory,
915                 # as the compiler and/or linker will search that other
916                 # directory before it searches the specified directory.
917                 #
918                 wireshark_save_CFLAGS="$CFLAGS"
919                 CFLAGS="$CFLAGS -I$lua_dir/include"
920                 wireshark_save_CPPFLAGS="$CPPFLAGS"
921                 CPPFLAGS="$CPPFLAGS -I$lua_dir/include"
922                 wireshark_save_LIBS="$LIBS"
923                 LIBS="$LIBS -L$lua_dir/lib -llua -lm"
924                 wireshark_save_LDFLAGS="$LDFLAGS"
925                 LDFLAGS="$LDFLAGS -L$lua_dir/lib"
926         else
927                 #
928                 # The user specified no directory in which liblua resides,
929                 # so just add "-llua -lliblua" to the used libs.
930                 #
931                 wireshark_save_CFLAGS="$CFLAGS"
932                 wireshark_save_CPPFLAGS="$CPPFLAGS"
933                 wireshark_save_LDFLAGS="$LDFLAGS"
934                 wireshark_save_LIBS="$LIBS"
935                 LIBS="$LIBS -llua -lm"
936         fi
937
938         #
939         # Make sure we have "lua.h", "lualib.h" and "lauxlib.h".  If we don't, it means we probably
940         # don't have liblua, so don't use it.
941         #
942         AC_CHECK_HEADERS(lua.h lualib.h lauxlib.h,,
943         [
944                 AC_CHECK_HEADERS(lua5.1/lua.h lua5.1/lualib.h lua5.1/lauxlib.h,
945                 [
946                         if test "x$lua_dir" != "x"
947                         then
948                                 LUA_INCLUDES="-I$lua_dir/include/lua5.1"
949                         else
950                                 #
951                                 # The user didn't specify a directory in which liblua resides;
952                                 # we must look for the headers in a "lua5.1" subdirectory of
953                                 # "/usr/include", "/usr/local/include", or "$prefix/include"
954                                 # as some systems apparently put the headers in a "lua5.1"
955                                 # subdirectory.
956                                 AC_MSG_CHECKING(for extraneous lua header directories)
957                                 found_lua_dir=""
958                                 lua_dir_list="/usr/include/lua5.1 $prefix/include/lua5.1"
959                                 if test "x$ac_cv_enable_usr_local" = "xyes"
960                                 then
961                                         lua_dir_list="$lua_dir_list /usr/local/include/lua5.1"
962                                 fi
963                                 for lua_dir_ent in $lua_dir_list
964                                 do
965                                         if test -d $lua_dir_ent
966                                         then
967                                                 LUA_INCLUDES="-I$lua_dir_ent"
968                                                 found_lua_dir="$lua_dir_ent"
969                                                 break
970                                         fi
971                                 done
972
973                                 if test "x$found_lua_dir" != "x"
974                                 then
975                                         AC_MSG_RESULT(found -- $found_lua_dir)
976                                 else
977                                         AC_MSG_RESULT(not found)
978                                         #
979                                         # Restore the versions of CFLAGS, CPPFLAGS,
980                                         # LDFLAGS, and LIBS before we added the
981                                         # "--with-lua=" directory, as we didn't
982                                         # actually find lua there.
983                                         #
984                                         CFLAGS="$wireshark_save_CFLAGS"
985                                         CPPFLAGS="$wireshark_save_CPPFLAGS"
986                                         LDFLAGS="$wireshark_save_LDFLAGS"
987                                         LIBS="$wireshark_save_LIBS"
988                                         LUA_LIBS=""
989                                         if test "x$want_lua" = "xyes"
990                                         then
991                                                 # we found lua5.1/lua.h, but we don't know which include dir contains it
992                                                 AC_MSG_ERROR(Header file lua.h was found as lua5.1/lua.h but we can't locate the include directory. Please set the DIR for the --with-lua configure parameter.)
993                                         else
994                                                 #
995                                                 # We couldn't find the header file; don't use the
996                                                 # library, as it's probably not present.
997                                                 #
998                                                 want_lua=no
999                                         fi
1000                                 fi
1001                         fi
1002                 ],
1003                 [
1004                         #
1005                         # Restore the versions of CFLAGS, CPPFLAGS,
1006                         # LDFLAGS, and LIBS before we added the
1007                         # "--with-lua=" directory, as we didn't
1008                         # actually find lua there.
1009                         #
1010                         CFLAGS="$wireshark_save_CFLAGS"
1011                         CPPFLAGS="$wireshark_save_CPPFLAGS"
1012                         LDFLAGS="$wireshark_save_LDFLAGS"
1013                         LIBS="$wireshark_save_LIBS"
1014                         LUA_LIBS=""
1015                         if test "x$lua_dir" != "x"
1016                         then
1017                                 #
1018                                 # The user used "--with-lua=" to specify a directory
1019                                 # containing liblua, but we didn't find the header file
1020                                 # there; that either means they didn't specify the
1021                                 # right directory or are confused about whether liblua
1022                                 # is, in fact, installed.  Report the error and give up.
1023                                 #
1024                                 AC_MSG_ERROR([liblua header not found in directory specified in --with-lua])
1025                         else
1026                                 if test "x$want_lua" = "xyes"
1027                                 then
1028                                         #
1029                                         # The user tried to force us to use the library, but we
1030                                         # couldn't find the header file; report an error.
1031                                         #
1032                                         AC_MSG_ERROR(Header file lua.h not found.)
1033                                 else
1034                                         #
1035                                         # We couldn't find the header file; don't use the
1036                                         # library, as it's probably not present.
1037                                         #
1038                                         want_lua=no
1039                                 fi
1040                         fi
1041                 ])
1042         ])
1043
1044         if test "x$want_lua" != "xno"
1045         then
1046                 #
1047                 # Well, we at least have the lua header file.
1048                 #
1049                 # let's check if the libs are there
1050                 #
1051
1052                 # At least on Suse 9.3 systems, liblualib needs linking
1053                 # against libm.
1054                 LIBS="$LIBS $LUA_LIBS -lm"
1055
1056                 AC_CHECK_LIB(lua, luaL_register,
1057                 [
1058                     #
1059                     #  Lua 5.1 found
1060                     #
1061                         if test "x$lua_dir" != "x"
1062                         then
1063                                 #
1064                                 # Put the "-I" and "-L" flags for lua at
1065                                 # the beginning of CFLAGS, CPPFLAGS,
1066                                 # LDFLAGS, and LIBS.
1067                                 #
1068                                 LUA_LIBS="-L$lua_dir/lib -llua -lm"
1069                                 LUA_INCLUDES="-I$lua_dir/include"
1070                         else
1071                                 LUA_LIBS="-llua -lm"
1072                                 LUA_INCLUDES=""
1073                         fi
1074                         AC_DEFINE(HAVE_LUA_5_1, 1, [Define to use Lua 5.1])
1075                         want_lua=yes
1076
1077                 ],[
1078                         #
1079                         # We could not find the libs, maybe we have version number in the lib name
1080                         #
1081
1082                         LIBS="$wireshark_save_LIBS -llua5.1 -lm"
1083
1084                         AC_CHECK_LIB(lua5.1, luaL_register,
1085                         [
1086                             #
1087                             #  Lua 5.1 found
1088                             #
1089                             LUA_LIBS=" -llua5.1 -lm"
1090                             AC_DEFINE(HAVE_LUA_5_1, 1, [Define to use Lua 5.1])
1091                             want_lua=yes
1092                         ],[
1093                                 #
1094                                 # Restore the versions of CFLAGS, CPPFLAGS,
1095                                 # LDFLAGS, and LIBS before we added the
1096                                 # "--with-lua=" directory, as we didn't
1097                                 # actually find lua there.
1098                                 #
1099                                 CFLAGS="$wireshark_save_CFLAGS"
1100                                 CPPFLAGS="$wireshark_save_CPPFLAGS"
1101                                 LDFLAGS="$wireshark_save_LDFLAGS"
1102                                 LIBS="$wireshark_save_LIBS"
1103                                 LUA_LIBS=""
1104                                 # User requested --with-lua but it isn't available
1105                                 if test "x$want_lua" = "xyes"
1106                                 then
1107                                         AC_MSG_ERROR(Linking with liblua failed.)
1108                                 fi
1109                                 want_lua=no
1110                         ])
1111                 ])
1112
1113         CFLAGS="$wireshark_save_CFLAGS"
1114         CPPFLAGS="$wireshark_save_CPPFLAGS"
1115         LDFLAGS="$wireshark_save_LDFLAGS"
1116         LIBS="$wireshark_save_LIBS"
1117         AC_SUBST(LUA_LIBS)
1118         AC_SUBST(LUA_INCLUDES)
1119
1120         fi
1121 ])
1122
1123 #
1124 # AC_WIRESHARK_LIBPORTAUDIO_CHECK
1125 #
1126 AC_DEFUN([AC_WIRESHARK_LIBPORTAUDIO_CHECK],[
1127
1128         if test "x$portaudio_dir" != "x"
1129         then
1130                 #
1131                 # The user specified a directory in which libportaudio
1132                 # resides, so add the "include" subdirectory of that directory to
1133                 # the include file search path and the "lib" subdirectory
1134                 # of that directory to the library search path.
1135                 #
1136                 # XXX - if there's also a libportaudio in a directory that's
1137                 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
1138                 # make us find the version in the specified directory,
1139                 # as the compiler and/or linker will search that other
1140                 # directory before it searches the specified directory.
1141                 #
1142                 wireshark_save_CFLAGS="$CFLAGS"
1143                 CFLAGS="$CFLAGS -I$portaudio_dir/include"
1144                 wireshark_save_CPPFLAGS="$CPPFLAGS"
1145                 CPPFLAGS="$CPPFLAGS -I$portaudio_dir/include"
1146                 wireshark_save_LIBS="$LIBS"
1147                 LIBS="$LIBS -L$portaudio_dir/lib -lportaudio"
1148                 wireshark_save_LDFLAGS="$LDFLAGS"
1149                 LDFLAGS="$LDFLAGS -L$portaudio_dir/lib"
1150         else
1151                 #
1152                 # The user specified no directory in which libportaudio resides,
1153                 # so just add "-lportaudio" to the used libs.
1154                 #
1155                 wireshark_save_CFLAGS="$CFLAGS"
1156                 wireshark_save_CPPFLAGS="$CPPFLAGS"
1157                 wireshark_save_LDFLAGS="$LDFLAGS"
1158                 wireshark_save_LIBS="$LIBS"
1159                 LIBS="$LIBS -lportaudio"
1160         fi
1161
1162         #
1163         # Make sure we have "portaudio.h".  If we don't, it means we probably
1164         # don't have libportaudio, so don't use it.
1165         #
1166         AC_CHECK_HEADERS(portaudio.h,,
1167         [
1168                 if test "x$portaudio_dir" != "x"
1169                 then
1170                         #
1171                         # The user used "--with-portaudio=" to specify a directory
1172                         # containing libportaudio, but we didn't find the header file
1173                         # there; that either means they didn't specify the
1174                         # right directory or are confused about whether libportaudio
1175                         # is, in fact, installed.  Report the error and give up.
1176                         #
1177                         AC_MSG_ERROR([libportaudio header not found in directory specified in --with-portaudio])
1178                 else
1179                         CFLAGS="$wireshark_save_CFLAGS"
1180                         CPPFLAGS="$wireshark_save_CPPFLAGS"
1181                         LDFLAGS="$wireshark_save_LDFLAGS"
1182                         LIBS="$wireshark_save_LIBS"
1183                         PORTAUDIO_LIBS=""
1184                         if test "x$want_portaudio" = "xyes"
1185                         then
1186                                 #
1187                                 # The user tried to force us to use the library, but we
1188                                 # couldn't find the header file; report an error.
1189                                 #
1190                                 AC_MSG_ERROR(Header file portaudio.h not found.)
1191                         else
1192                                 #
1193                                 # We couldn't find the header file; don't use the
1194                                 # library, as it's probably not present.
1195                                 #
1196                                 want_portaudio=no
1197                         fi
1198                 fi
1199         ])
1200
1201         #
1202         # Check whether we have the right version of portaudio
1203         #
1204         if test "x$want_portaudio" != "xno"
1205         then
1206                 AC_CHECK_TYPE(PortAudioStream,
1207                 AC_DEFINE(PORTAUDIO_API_1, 1, [Define if we are using version of of the Portaudio library API]),
1208                 ,
1209                 [#include <portaudio.h>])
1210         fi
1211
1212         if test "x$want_portaudio" != "xno"
1213         then
1214                 #
1215                 # Well, we at least have the portaudio header file.
1216                 #
1217                 # let's check if the libs are there
1218                 #
1219
1220                 AC_CHECK_LIB(portaudio, Pa_Initialize,
1221                 [
1222                         if test "x$portaudio_dir" != "x"
1223                         then
1224                                 #
1225                                 # Put the "-I" and "-L" flags for portaudio at
1226                                 # the beginning of CFLAGS, CPPFLAGS,
1227                                 # LDFLAGS, and LIBS.
1228                                 #
1229                                 PORTAUDIO_LIBS="-L$portaudio_dir/lib -lportaudio"
1230                                 PORTAUDIO_INCLUDES="-I$portaudio_dir/include"
1231                         else
1232                                 PORTAUDIO_LIBS="-lportaudio"
1233                                 PORTAUDIO_INCLUDES=""
1234                         fi
1235                         AC_DEFINE(HAVE_LIBPORTAUDIO, 1, [Define to use libportaudio library])
1236                         want_portaudio=yes
1237                 ],[
1238                         #
1239                         # Restore the versions of CFLAGS, CPPFLAGS,
1240                         # LDFLAGS, and LIBS before we added the
1241                         # "--with-portaudio=" directory, as we didn't
1242                         # actually find portaudio there.
1243                         #
1244                         CFLAGS="$wireshark_save_CFLAGS"
1245                         CPPFLAGS="$wireshark_save_CPPFLAGS"
1246                         LDFLAGS="$wireshark_save_LDFLAGS"
1247                         LIBS="$wireshark_save_LIBS"
1248                         PORTAUDIO_LIBS=""
1249                         # User requested --with-portaudio but it isn't available
1250                         if test "x$want_portaudio" = "xyes"
1251                         then
1252                                 AC_MSG_ERROR(Linking with libportaudio failed.)
1253                         fi
1254                         want_portaudio=no
1255                 ])
1256
1257         CFLAGS="$wireshark_save_CFLAGS"
1258         CPPFLAGS="$wireshark_save_CPPFLAGS"
1259         LDFLAGS="$wireshark_save_LDFLAGS"
1260         LIBS="$wireshark_save_LIBS"
1261         AC_SUBST(PORTAUDIO_LIBS)
1262         AC_SUBST(PORTAUDIO_INCLUDES)
1263
1264         fi
1265 ])
1266
1267 #
1268 # AC_WIRESHARK_RPM_CHECK
1269 # Looks for the rpm program, and checks to see if we can redefine "_topdir".
1270 #
1271 AC_DEFUN([AC_WIRESHARK_RPM_CHECK],
1272 [
1273         AC_CHECK_PROG(ac_cv_wireshark_have_rpm, rpm, "yes", "no")
1274         if test "x$ac_cv_wireshark_have_rpm" = "xyes"; then
1275                 rpm --define '_topdir /tmp' > /dev/null 2>&1
1276                 AC_MSG_CHECKING(to see if we can redefine _topdir)
1277                 if test $? -eq 0 ; then
1278                         AC_MSG_RESULT(yes)
1279                         HAVE_RPM=yes
1280                 else
1281                         AC_MSG_RESULT(no.  You'll have to build packages manually.)
1282                         HAVE_RPM=no
1283                 fi
1284         fi
1285 ])
1286
1287 #
1288 # AC_WIRESHARK_GNU_SED_CHECK
1289 # Checks if GNU sed is the first sed in PATH.
1290 #
1291 AC_DEFUN([AC_WIRESHARK_GNU_SED_CHECK],
1292 [
1293         AC_MSG_CHECKING(for GNU sed as first sed in PATH)
1294         if  ( sh -c "sed --version" </dev/null 2> /dev/null | grep "GNU sed" 2>&1 > /dev/null ) ;  then
1295                 AC_MSG_RESULT(yes)
1296                 HAVE_GNU_SED=yes
1297         else
1298                 AC_MSG_RESULT(no)
1299                 HAVE_GNU_SED=no
1300         fi
1301 ])
1302
1303 #
1304 # AC_WIRESHARK_C_ARES_CHECK
1305 #
1306 AC_DEFUN([AC_WIRESHARK_C_ARES_CHECK],
1307 [
1308         want_c_ares=defaultyes
1309
1310         if test "x$want_c_ares" = "xdefaultyes"; then
1311                 want_c_ares=yes
1312                 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1313                         withval=/usr/local
1314                         if test -d "$withval"; then
1315                                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1316                         fi
1317                 fi
1318         fi
1319
1320         if test "x$want_c_ares" = "xyes"; then
1321                 AC_CHECK_LIB(cares, ares_init,
1322                   [
1323                     C_ARES_LIBS=-lcares
1324                 AC_DEFINE(HAVE_C_ARES, 1, [Define to use c-ares library])
1325                 have_good_c_ares=yes
1326                   ],, $SOCKET_LIBS $NSL_LIBS
1327                 )
1328         else
1329                 AC_MSG_RESULT(not required)
1330         fi
1331 ])
1332
1333
1334 #
1335 # AC_WIRESHARK_ADNS_CHECK
1336 #
1337 AC_DEFUN([AC_WIRESHARK_ADNS_CHECK],
1338 [
1339         want_adns=defaultyes
1340
1341         if test "x$want_adns" = "xdefaultyes"; then
1342                 want_adns=yes
1343                 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1344                         withval=/usr/local
1345                         if test -d "$withval"; then
1346                                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1347                         fi
1348                 fi
1349         fi
1350
1351         if test "x$want_adns" = "xyes"; then
1352                 AC_CHECK_LIB(adns, adns_init,
1353                   [
1354                     ADNS_LIBS=-ladns
1355                 AC_DEFINE(HAVE_GNU_ADNS, 1, [Define to use GNU ADNS library])
1356                 have_good_adns=yes
1357                   ],, $SOCKET_LIBS $NSL_LIBS
1358                 )
1359         else
1360                 AC_MSG_RESULT(not required)
1361         fi
1362 ])
1363
1364
1365 #
1366 # AC_WIRESHARK_LIBCAP_CHECK
1367 #
1368 AC_DEFUN([AC_WIRESHARK_LIBCAP_CHECK],
1369 [
1370         want_libcap=defaultyes
1371
1372         if test "x$want_libcap" = "xdefaultyes"; then
1373                 want_libcap=yes
1374                 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1375                         withval=/usr/local
1376                         if test -d "$withval"; then
1377                                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1378                         fi
1379                 fi
1380         fi
1381
1382         if test "x$want_libcap" = "xyes"; then
1383                 AC_CHECK_LIB(cap, cap_set_flag,
1384                   [
1385                     LIBCAP_LIBS=-lcap
1386                 AC_DEFINE(HAVE_LIBCAP, 1, [Define to use the libcap library])
1387                 have_good_libcap=yes
1388                   ],,
1389                 )
1390         else
1391                 AC_MSG_RESULT(not required)
1392         fi
1393 ])
1394
1395
1396 #
1397 # AC_WIRESHARK_KRB5_CHECK
1398 #
1399 AC_DEFUN([AC_WIRESHARK_KRB5_CHECK],
1400 [
1401         wireshark_save_CFLAGS="$CFLAGS"
1402         wireshark_save_CPPFLAGS="$CPPFLAGS"
1403         if test "x$krb5_dir" != "x"
1404         then
1405           #
1406           # The user specified a directory in which kerberos resides,
1407           # so add the "include" subdirectory of that directory to
1408           # the include file search path and the "lib" subdirectory
1409           # of that directory to the library search path.
1410           #
1411           # XXX - if there's also a kerberos in a directory that's
1412           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
1413           # make us find the version in the specified directory,
1414           # as the compiler and/or linker will search that other
1415           # directory before it searches the specified directory.
1416           #
1417           CFLAGS="$CFLAGS -I$krb5_dir/include"
1418           CPPFLAGS="$CPPFLAGS -I$krb5_dir/include"
1419           ac_heimdal_version=`grep heimdal $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*heimdal.*$/HEIMDAL/'`
1420           # MIT Kerberos moved krb5.h to krb5/krb5.h starting with release 1.5
1421           ac_mit_version_olddir=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
1422           ac_mit_version_newdir=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
1423           ac_krb5_version="$ac_heimdal_version$ac_mit_version_olddir$ac_mit_version_newdir"
1424           if test "x$ac_krb5_version" = "xHEIMDAL"
1425               KRB5_LIBS="-L$krb5_dir/lib -lkrb5 -lasn1 $SSL_LIBS -lroken -lcrypt"
1426           then
1427               KRB5_LIBS="-L$krb5_dir/lib -lkrb5 -lk5crypto -lcom_err"
1428           fi
1429           if test "x$ac_krb5_version" = "xMIT"
1430           then
1431             AC_DEFINE(HAVE_MIT_KERBEROS, 1, [Define to use MIT kerberos])
1432           fi
1433         else
1434           AC_PATH_PROG(KRB5_CONFIG, krb5-config)
1435           if test -x "$KRB5_CONFIG"
1436           then
1437             KRB5_FLAGS=`"$KRB5_CONFIG" --cflags`
1438             KRB5_LIBS=`"$KRB5_CONFIG" --libs`
1439             CFLAGS="$CFLAGS $KRB5_FLAGS"
1440             CPPFLAGS="$CPPFLAGS $KRB5_FLAGS"
1441             #
1442             # If -lcrypto is in KRB5_FLAGS, we require it to build
1443             # with Heimdal/MIT.  We don't want to built with it by
1444             # default, due to annoying license incompatibilities
1445             # between the OpenSSL license and the GPL, so:
1446             #
1447             #   if SSL_LIBS is set to a non-empty string, we
1448             #   remove -lcrypto from KRB5_LIBS and replace
1449             #   it with SSL_LIBS;
1450             #
1451             #   if SSL_LIBS is not set to a non-empty string
1452             #   we fail with an appropriate error message.
1453             #
1454             case "$KRB5_LIBS" in
1455             *-lcrypto*)
1456                 if test ! -z "$SSL_LIBS"
1457                 then
1458                     KRB5_LIBS=`echo $KRB5_LIBS | sed 's/-lcrypto//'`
1459                     KRB5_LIBS="$KRB5_LIBS $SSL_LIBS"
1460                 else
1461                     AC_MSG_ERROR([Kerberos library requires -lcrypto but --with-ssl not specified])
1462                 fi
1463                 ;;
1464             esac
1465             ac_krb5_version=`"$KRB5_CONFIG" --version | head -n 1 | sed -e 's/^.*heimdal.*$/HEIMDAL/' -e 's/^Kerberos .*$/MIT/' -e 's/^Solaris Kerberos .*$/MIT/'`
1466           fi
1467         fi
1468
1469         #
1470         # Make sure we have "krb5.h".  If we don't, it means we probably
1471         # don't have kerberos, so don't use it.
1472         #
1473         AC_CHECK_HEADER(krb5.h,,
1474           [
1475             if test "x$krb5_dir" != "x"
1476             then
1477               #
1478               # The user used "--with-krb5=" to specify a directory
1479               # containing kerberos, but we didn't find the header file
1480               # there; that either means they didn't specify the
1481               # right directory or are confused about whether kerberos
1482               # is, in fact, installed.  Report the error and give up.
1483               #
1484               AC_MSG_ERROR([kerberos header not found in directory specified in --with-krb5])
1485             else
1486               if test "x$want_krb5" = "xyes"
1487               then
1488                 #
1489                 # The user tried to force us to use the library, but we
1490                 # couldn't find the header file; report an error.
1491                 #
1492                 AC_MSG_ERROR(Header file krb5.h not found.)
1493               else
1494                 #
1495                 # We couldn't find the header file; don't use the
1496                 # library, as it's probably not present.
1497                 #
1498                 want_krb5=no
1499                 AC_MSG_RESULT(No Heimdal or MIT header found - disabling dissection for some kerberos data in packet decoding)
1500               fi
1501             fi
1502           ])
1503
1504         if test "x$want_krb5" != "xno"
1505         then
1506             #
1507             # Well, we at least have the krb5 header file.
1508             # Check whether this is Heimdal or MIT.
1509             #
1510             AC_MSG_CHECKING(whether the Kerberos library is Heimdal or MIT)
1511             if test "x$ac_krb5_version" = "xHEIMDAL" -o "x$ac_krb5_version" = "xMIT"
1512             then
1513                 #
1514                 # Yes.
1515                 # Check whether we have krb5_kt_resolve - and whether
1516                 # we need to link with -lresolv when linking with
1517                 # the Kerberos library.
1518                 #
1519                 AC_MSG_RESULT($ac_krb5_version)
1520                 wireshark_save_LIBS="$LIBS"
1521                 found_krb5_kt_resolve=no
1522                 for extras in "" "-lresolv"
1523                 do
1524                     LIBS="$KRB5_LIBS $extras"
1525                     if test -z "$extras"
1526                     then
1527                         AC_MSG_CHECKING([whether $ac_krb5_version includes krb5_kt_resolve])
1528                     else
1529                         AC_MSG_CHECKING([whether $ac_krb5_version includes krb5_kt_resolve (linking with $extras)])
1530                     fi
1531                     AC_TRY_LINK(
1532                         [
1533                         ],
1534                         [
1535                             krb5_kt_resolve();
1536                         ],
1537                         [
1538                             #
1539                             # We found "krb5_kt_resolve()", and required
1540                             # the libraries in extras as well.
1541                             #
1542                             AC_MSG_RESULT(yes)
1543                             KRB5_LIBS="$LIBS"
1544                             AC_DEFINE(HAVE_KERBEROS, 1, [Define to use kerberos])
1545                             if test "x$ac_krb5_version" = "xHEIMDAL"
1546                             then
1547                                 AC_DEFINE(HAVE_HEIMDAL_KERBEROS, 1, [Define to use heimdal kerberos])
1548                             elif test "x$ac_krb5_version" = "xMIT"
1549                             then
1550                                 AC_DEFINE(HAVE_MIT_KERBEROS, 1, [Define to use MIT kerberos])
1551                             fi
1552                             found_krb5_kt_resolve=yes
1553                             break
1554                         ],
1555                         [
1556                             AC_MSG_RESULT(no)
1557                         ])
1558                 done
1559                 if test "$found_krb5_kt_resolve" = no
1560                 then
1561                     #
1562                     # We didn't find "krb5_kt_resolve()" in the
1563                     # Kerberos library, even when we tried linking
1564                     # with -lresolv; we can't link with kerberos.
1565                     #
1566                     if test "x$want_krb5" = "xyes"
1567                     then
1568                         #
1569                         # The user tried to force us to use the library,
1570                         # but we can't do so; report an error.
1571                         #
1572                         AC_MSG_ERROR(Usable $ac_krb5_version not found)
1573                     else
1574                         #
1575                         # Restore the versions of CFLAGS and CPPFLAGS
1576                         # from before we added the flags for Kerberos.
1577                         #
1578                         AC_MSG_RESULT(Usable $ac_krb5_version not found - disabling dissection for some kerberos data in packet decoding)
1579                         CFLAGS="$wireshark_save_CFLAGS"
1580                         CPPFLAGS="$wireshark_save_CPPFLAGS"
1581                         KRB5_LIBS=""
1582                         want_krb5=no
1583                     fi
1584                 else
1585                     #
1586                     # We can link with Kerberos; see whether krb5.h
1587                     # defines KEYTYPE_ARCFOUR_56 (where "defines" means
1588                     # "as a #define or as an enum member).
1589                     #
1590                     AC_MSG_CHECKING([whether krb5.h defines KEYTYPE_ARCFOUR_56])
1591                     AC_COMPILE_IFELSE(
1592                       [
1593                         AC_LANG_SOURCE(
1594                           [[
1595                             #include <krb5.h>
1596                             #include <stdio.h>
1597
1598                             main()
1599                             {
1600                               printf("%u\n", KEYTYPE_ARCFOUR_56);
1601                             }
1602                           ]])
1603                       ],
1604                       [
1605                         AC_MSG_RESULT(yes)
1606                         AC_DEFINE(HAVE_KEYTYPE_ARCFOUR_56, 1, [Define if krb5.h defines KEYTYPE_ARCFOUR_56])
1607                       ],
1608                       [
1609                         AC_MSG_RESULT(no)
1610                       ])
1611                 fi
1612                 LIBS="$wireshark_save_LIBS"
1613             else
1614                 #
1615                 # It's not Heimdal or MIT.
1616                 #
1617                 AC_MSG_RESULT(no)
1618                 if test "x$want_krb5" = "xyes"
1619                 then
1620                     #
1621                     # The user tried to force us to use the library,
1622                     # but we can't do so; report an error.
1623                     #
1624                     AC_MSG_ERROR(Kerberos not found)
1625                 else
1626                     #
1627                     # Restore the versions of CFLAGS and CPPFLAGS
1628                     # from before we added the flags for Kerberos.
1629                     #
1630                     AC_MSG_RESULT(Kerberos not found - disabling dissection for some kerberos data in packet decoding)
1631                     CFLAGS="$wireshark_save_CFLAGS"
1632                     CPPFLAGS="$wireshark_save_CPPFLAGS"
1633                     KRB5_LIBS=""
1634                     want_krb5=no
1635                 fi
1636             fi
1637         else
1638             #
1639             # The user asked us not to use Kerberos, or they didn't
1640             # say whether they wanted us to use it but we found
1641             # that we couldn't.
1642             #
1643             # Restore the versions of CFLAGS and CPPFLAGS
1644             # from before we added the flags for Kerberos.
1645             #
1646             CFLAGS="$wireshark_save_CFLAGS"
1647             CPPFLAGS="$wireshark_save_CPPFLAGS"
1648             KRB5_LIBS=""
1649             want_krb5=no
1650         fi
1651         AC_SUBST(KRB5_LIBS)
1652 ])
1653
1654 #
1655 # AC_WIRESHARK_GEOIP_CHECK
1656 #
1657 AC_DEFUN([AC_WIRESHARK_GEOIP_CHECK],
1658 [
1659         want_geoip=defaultyes
1660
1661         if test "x$want_geoip" = "xdefaultyes"; then
1662                 want_geoip=yes
1663                 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1664                         withval=/usr/local
1665                         if test -d "$withval"; then
1666                                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1667                         fi
1668                 fi
1669         fi
1670
1671         if test "x$want_geoip" = "xyes"; then
1672                 AC_CHECK_LIB(GeoIP, GeoIP_new,
1673                   [
1674                     GEOIP_LIBS=-lGeoIP
1675                 AC_DEFINE(HAVE_GEOIP, 1, [Define to use GeoIP library])
1676                 have_good_geoip=yes
1677                   ],,
1678                 )
1679         else
1680                 AC_MSG_RESULT(not required)
1681         fi
1682 ])
1683
1684 #AC_WIRESHARK_GCC_LDFLAGS_CHECK
1685 #
1686 # $1 : ldflag(s) to test
1687 #
1688 # The macro first determines if the compiler is GCC. Then compile with the
1689 # defined ldflags. The defined flags are added to LDFLAGS only if the
1690 # compilation succeeds.
1691 #
1692 AC_DEFUN([AC_WIRESHARK_GCC_LDFLAGS_CHECK],
1693 [GCC_OPTION="$1"
1694 AC_MSG_CHECKING(whether we can add $GCC_OPTION to LDFLAGS)
1695 if test "x$GCC" != "x"; then
1696   LDFLAGS_saved="$CFLAGS"
1697   LDFLAGS="$LDFLAGS $GCC_OPTION"
1698   AC_LINK_IFELSE([
1699     AC_LANG_SOURCE([[
1700                 main() { return; }
1701                   ]])],
1702                   [
1703                     AC_MSG_RESULT(yes)
1704                   ],
1705                   [
1706                     AC_MSG_RESULT(no)
1707                     LDFLAGS="$LDFLAGS_saved"
1708                   ])
1709 else
1710   AC_MSG_RESULT(no)
1711 fi
1712 ])
1713
1714 #
1715 # AC_WIRESHARK_GCC_CFLAGS_CHECK
1716 #
1717 # $1 : cflags to test
1718 #
1719 # The macro first determines if the compiler is GCC. Then compile with the
1720 # defined cflags. The defined flags are added to CFLAGS only if the compilation
1721 # succeeds.
1722 #
1723 AC_DEFUN([AC_WIRESHARK_GCC_CFLAGS_CHECK],
1724 [GCC_OPTION="$1"
1725 AC_MSG_CHECKING(whether we can add $GCC_OPTION to CFLAGS)
1726 if test "x$GCC" != "x"; then
1727   CFLAGS_saved="$CFLAGS"
1728   CFLAGS="$CFLAGS $GCC_OPTION"
1729   AC_COMPILE_IFELSE([
1730     AC_LANG_SOURCE([[
1731                       int foo;
1732                   ]])],
1733                   [
1734                     AC_MSG_RESULT(yes)
1735                   ],
1736                   [
1737                     AC_MSG_RESULT(no)
1738                     CFLAGS="$CFLAGS_saved"
1739                   ])
1740 else
1741   AC_MSG_RESULT(no)
1742 fi
1743 ])
1744
1745 #
1746 # AC_WIRESHARK_OSX_INTEGRATION_CHECK
1747 #
1748 # Checks for the presence of OS X integration functions in the GTK+ framework
1749 # or as a separate library.
1750 #
1751 # http://sourceforge.net/apps/trac/gtk-osx/wiki/Integrate
1752 #
1753 # http://live.gnome.org/GTK%2B/OSX/Integration
1754 #    for the old Carbon-based integration functions
1755 #
1756 # http://gtk-osx.sourceforge.net/ige-mac-integration/
1757 #    for the new Cocoa-based integration functions
1758 #
1759 AC_DEFUN([AC_WIRESHARK_OSX_INTEGRATION_CHECK],
1760 [
1761         ac_save_CFLAGS="$CFLAGS"
1762         ac_save_LIBS="$LIBS"
1763         CFLAGS="$CFLAGS $GTK_CFLAGS"
1764         LIBS="$GTK_LIBS $LIBS"
1765
1766         #
1767         # Check for the new integration functions in a -ligemacintegration
1768         # library.
1769         #
1770         AC_CHECK_LIB(igemacintegration, gtk_osxapplication_set_menu_bar,
1771         [
1772                 AC_DEFINE(HAVE_GTKOSXAPPLICATION, 1,
1773                         [Define to 1 if -ligemacintegration includes the GtkOSXApplication Integration functions.])
1774                 have_ige_mac=yes
1775                 # We don't want gtk stuff in LIBS (which is reset below) so
1776                 # manually set GTK_LIBS (which is more appropriate)
1777                 GTK_LIBS="$GTK_LIBS -ligemacintegration"
1778         ])
1779
1780         if test x$have_ige_mac == x
1781         then
1782                 #
1783                 # Not found - check for the old integration functions in
1784                 # the Gtk framework.
1785                 #
1786                 AC_CHECK_LIB(Gtk, ige_mac_menu_set_menu_bar,
1787                 [
1788                         AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
1789                                 [Define to 1 if the the Gtk+ framework or a separate library includes the Imendio IGE Mac OS X Integration functions.])
1790                         have_ige_mac=yes
1791                         # We don't want gtk stuff in LIBS (which is reset below) so
1792                         # manually set GTK_LIBS (which is more appropriate)
1793                         GTK_LIBS="$GTK_LIBS -lGtk"
1794                 ])
1795         fi
1796
1797         if test x$have_ige_mac == x
1798         then
1799                 #
1800                 # Not found - check for the old integration functions in
1801                 # a -ligemacintegration library.
1802                 #
1803                 AC_CHECK_LIB(igemacintegration, ige_mac_menu_set_menu_bar,
1804                 [
1805                         AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
1806                                 [Define to 1 if the the Gtk+ framework or a separate library includes the Imendio IGE Mac OS X Integration functions.])
1807                         have_ige_mac=yes
1808                         # We don't want gtk stuff in LIBS (which is reset below) so
1809                         # manually set GTK_LIBS (which is more appropriate)
1810                         GTK_LIBS="$GTK_LIBS -ligemacintegration"
1811                 ])
1812         fi
1813         CFLAGS="$ac_save_CFLAGS"
1814         LIBS="$ac_save_LIBS"
1815 ])
1816
1817 #
1818 # AC_WIRESHARK_PYTHON_CHECK
1819 #
1820 # Check whether python devel package is present
1821 #
1822 AC_DEFUN([AC_WIRESHARK_PYTHON_CHECK],
1823   [
1824     #
1825     # Checking whether we have a python devel environment available
1826     #
1827 #  AC_CACHE_CHECK([checking python devel package], ac_cv_wireshark_python_devel,
1828 #    [
1829     AC_CHECK_PROG([ac_ws_python_config], [python-config], "yes", "no")
1830     if test ac_ws_python_config = "no"; then
1831       ac_cv_wireshark_python_devel = "no"
1832     else
1833       AC_MSG_CHECKING([python devel])
1834       ac_save_ws_cflags=$CFLAGS
1835       ac_save_ws_libs=$LIBS
1836       CFLAGS=$(python-config --includes)
1837       LIBS=$(python-config --ldflags)
1838       AC_COMPILE_IFELSE(
1839         [
1840           AC_LANG_PROGRAM(
1841             [[#include <Python.h>]],
1842             [[Py_Initialiaze();]]
1843           )
1844         ],
1845         [
1846           #
1847           # Compilation successful, we have python devel available
1848           #
1849           ac_cv_wireshark_python_devel=yes
1850           PY_LIBS=$LIBS
1851           PY_CFLAGS=$CFLAGS
1852           AC_SUBST(PY_LIBS)
1853           AC_SUBST(PY_CFLAGS)
1854           CFLAGS="$ac_save_ws_cflags"
1855           LIBS="$ac_save_ws_libs"
1856           AC_DEFINE(HAVE_PYTHON, 1, [Define if python devel package available])
1857           AC_MSG_RESULT([yes])
1858         ],
1859         [
1860           #
1861           # Compilation unsuccessful, python devel not available
1862           #
1863           ac_cv_wireshark_python_devel=no
1864           CFLAGS=$ac_save_ws_cflags
1865           LIBS=$ac_save_ws_libs
1866           AC_MSG_RESULT([no])
1867         ])
1868     fi
1869 #    ])
1870 ])