Add the time zone abbreviation to the result of abs_time_to_str() and
[metze/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           #
333           # Now check whether it's the libpcap 1.0 version, which
334           # put a space after "-L" - on some platforms, that doesn't
335           # work.
336           #
337           AC_MSG_CHECKING(for broken pcap-config)
338           if test -n "$PCAP_CONFIG" ; then
339             case "`\"$PCAP_CONFIG\" --libs`" in
340
341             "-L "*)
342               #
343               # Space after -L.  Pretend pcap-config doesn't exist.
344               #
345               AC_MSG_RESULT(yes)
346               PCAP_CONFIG=""
347               ;;
348
349             *)
350               #
351               # No space after -L.
352               #
353               AC_MSG_RESULT(no)
354               ;;
355             esac
356           fi
357           if test -n "$PCAP_CONFIG" ; then
358             #
359             # Found - use it to get the include flags for
360             # libpcap.
361             #
362             CFLAGS="$CFLAGS `\"$PCAP_CONFIG\" --cflags`"
363             CPPFLAGS="$CPPFLAGS `\"$PCAP_CONFIG\" --cflags`"
364           else  
365             #
366             # Didn't find it; we have to look for libpcap ourselves.
367             # We assume that the current library search path will work,
368             # but we may have to look for the header in a "pcap"
369             # subdirectory of "/usr/include" or "/usr/local/include",
370             # as some systems apparently put "pcap.h" in a "pcap"
371             # subdirectory, and we also check "$prefix/include" - and
372             # "$prefix/include/pcap", in case $prefix is set to
373             # "/usr/include" or "/usr/local/include".
374             #
375             # XXX - should we just add "$prefix/include" to the include
376             # search path and "$prefix/lib" to the library search path?
377             #
378             AC_MSG_CHECKING(for extraneous pcap header directories)
379             found_pcap_dir=""
380             pcap_dir_list="/usr/include/pcap $prefix/include/pcap $prefix/include"
381             if test "x$ac_cv_enable_usr_local" = "xyes" ; then
382               pcap_dir_list="$pcap_dir_list /usr/local/include/pcap"
383             fi
384             for pcap_dir in $pcap_dir_list
385             do
386               if test -d $pcap_dir ; then
387                 if test x$pcap_dir != x/usr/include -a x$pcap_dir != x/usr/local/include ; then
388                     CFLAGS="$CFLAGS -I$pcap_dir"
389                     CPPFLAGS="$CPPFLAGS -I$pcap_dir"
390                 fi
391                 found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
392                 break
393               fi
394             done
395
396             if test "$found_pcap_dir" != "" ; then
397               AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
398             else
399               AC_MSG_RESULT(not found)
400             fi
401           fi
402         else
403           #
404           # The user specified a directory in which libpcap resides,
405           # so add the "include" subdirectory of that directory to
406           # the include file search path and the "lib" subdirectory
407           # of that directory to the library search path.
408           #
409           # XXX - if there's also a libpcap in a directory that's
410           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
411           # make us find the version in the specified directory,
412           # as the compiler and/or linker will search that other
413           # directory before it searches the specified directory.
414           #
415           CFLAGS="$CFLAGS -I$pcap_dir/include"
416           CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
417           AC_WIRESHARK_ADD_DASH_L(LDFLAGS, $pcap_dir/lib)
418         fi
419
420         # Pcap header check
421         AC_CHECK_HEADER(pcap.h,,
422             AC_MSG_ERROR([[Header file pcap.h not found; if you installed libpcap
423 from source, did you also do \"make install-incl\", and if you installed a
424 binary package of libpcap, is there also a developer's package of libpcap,
425 and did you also install that package?]]))
426
427         if test -n "$PCAP_CONFIG" ; then
428           #
429           # We have pcap-config; we assume that means we have libpcap
430           # installed and that pcap-config will tell us whatever
431           # libraries libpcap needs.
432           #
433           if test x$enable_static = xyes; then
434             PCAP_LIBS="`\"$PCAP_CONFIG\" --libs --static`"
435           else
436             PCAP_LIBS="`\"$PCAP_CONFIG\" --libs`"
437           fi
438           AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
439         else
440           #
441           # Check to see if we find "pcap_open_live" in "-lpcap".
442           # Also check for various additional libraries that libpcap might
443           # require.
444           #
445           AC_CHECK_LIB(pcap, pcap_open_live,
446             [
447               PCAP_LIBS=-lpcap
448               AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
449             ], [
450               ac_wireshark_extras_found=no
451               ac_save_LIBS="$LIBS"
452               for extras in "-lcfg -lodm" "-lpfring"
453               do
454                 AC_MSG_CHECKING([for pcap_open_live in -lpcap with $extras])
455                 LIBS="-lpcap $extras"
456                 #
457                 # XXX - can't we use AC_CHECK_LIB here?
458                 #
459                 AC_TRY_LINK(
460                     [
461 #       include <pcap.h>
462                     ],
463                     [
464         pcap_open_live(NULL, 0, 0, 0, NULL);
465                     ],
466                     [
467                         ac_wireshark_extras_found=yes
468                         AC_MSG_RESULT([yes])
469                         PCAP_LIBS="-lpcap $extras"
470                         AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
471                     ],
472                     [
473                         AC_MSG_RESULT([no])
474                     ])
475                 if test x$ac_wireshark_extras_found = xyes
476                 then
477                     break
478                 fi
479               done
480               if test x$ac_wireshark_extras_found = xno
481               then
482                 AC_MSG_ERROR([Can't link with library libpcap.])
483               fi
484               LIBS=$ac_save_LIBS
485             ], $SOCKET_LIBS $NSL_LIBS)
486         fi
487         AC_SUBST(PCAP_LIBS)
488
489         #
490         # Check whether various variables and functions are defined by
491         # libpcap.
492         #
493         ac_save_LIBS="$LIBS"
494         AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
495         LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS"
496         AC_TRY_LINK(
497            [
498 #       include <stdio.h>
499         extern char *pcap_version;
500            ],
501            [
502         printf ("%s\n", pcap_version);
503            ],
504            ac_cv_pcap_version_defined=yes,
505            ac_cv_pcap_version_defined=no,
506            [echo $ac_n "cross compiling; assumed OK... $ac_c"])
507         if test "$ac_cv_pcap_version_defined" = yes ; then
508                 AC_MSG_RESULT(yes)
509                 AC_DEFINE(HAVE_PCAP_VERSION, 1, [Define if libpcap version is known])
510         else
511                 AC_MSG_RESULT(no)
512         fi
513         AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
514         #
515         # pcap_breakloop may be present in the library but not declared
516         # in the pcap.h header file.  If it's not declared in the header
517         # file, attempts to use it will get warnings, and, if we're
518         # building with warnings treated as errors, that warning will
519         # cause compilation to fail.
520         #
521         # We are therefore first testing whether the function is present
522         # and then, if we're compiling with warnings as errors, testing
523         # whether it is usable.  It is usable if it compiles without
524         # a -Wimplicit warning (the "compile with warnings as errors"
525         # option requires GCC). If it is not usable, we fail and tell
526         # the user that the pcap.h header needs to be updated.
527         #
528         # Ceteris paribus, this should only happen with Mac OS X 10.3[.x] which
529         # can have an up-to-date pcap library without the corresponding pcap
530         # header.
531         #
532         # However, it might also happen on some others OSes with some erroneous
533         # system manipulations where multiple versions of libcap might co-exist
534         # e.g. hand made symbolic link from libpcap.so -> libpcap.so.0.8 but
535         # having the pcap header version 0.7.
536         #
537         AC_MSG_CHECKING([whether pcap_breakloop is present])
538         ac_CFLAGS_saved="$CFLAGS"
539         AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK
540         if test "x$ws_breakloop_compiled" = "xyes"; then
541           AC_MSG_RESULT(yes)
542           AC_DEFINE(HAVE_PCAP_BREAKLOOP, 1, [Define if pcap_breakloop is known])
543           if test "x$with_warnings_as_errors" = "xyes"; then
544             AC_MSG_CHECKING([whether pcap_breakloop is usable])
545             CFLAGS="$CFLAGS -Werror -Wimplicit"
546             AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK
547             if test "x$ws_breakloop_compiled" = "xyes"; then
548               AC_MSG_RESULT(yes)
549             else
550               AC_MSG_RESULT(no)
551               AC_MSG_ERROR(
552 [Your pcap library is more recent than your pcap header.
553 As you are building with compiler warnings treated as errors, Wireshark
554 won't be able to use functions not declared in that header.
555 If you wish to build with compiler warnings treated as errors, You should
556 install a newer version of the header file.])
557             fi
558             CFLAGS="$ac_CFLAGS_saved"
559           fi
560         else
561           AC_MSG_RESULT(no)
562         fi
563
564         #
565         # Later versions of Mac OS X 10.3[.x] ship a pcap.h that
566         # doesn't define pcap_if_t but ship an 0.8[.x] libpcap,
567         # so the library has "pcap_findalldevs()", but pcap.h
568         # doesn't define "pcap_if_t" so you can't actually *use*
569         # "pcap_findalldevs()".
570         #
571         # That even appears to be true of systems shipped with
572         # 10.3.4, so it doesn't appear only to be a case of
573         # Software Update not updating header files.
574         #
575         # (You can work around this by installing the 0.8 header
576         # files.)
577         #
578         AC_CACHE_CHECK([whether pcap_findalldevs is present and usable],
579           [ac_cv_func_pcap_findalldevs],
580           [
581             AC_LINK_IFELSE(
582               [
583                 AC_LANG_SOURCE(
584                   [[
585                     #include <pcap.h>
586                     main()
587                     {
588                       pcap_if_t *devpointer;
589                       char errbuf[1];
590
591                       pcap_findalldevs(&devpointer, errbuf);
592                     }
593                   ]])
594               ],
595               [
596                 ac_cv_func_pcap_findalldevs=yes
597               ],
598               [
599                 ac_cv_func_pcap_findalldevs=no
600               ])
601           ])
602         #
603         # Don't check for other new routines that showed up after
604         # "pcap_findalldevs()" if we don't have a usable
605         # "pcap_findalldevs()", so we don't end up using them if the
606         # "pcap.h" is crufty and old and doesn't declare them.
607         #
608         if test $ac_cv_func_pcap_findalldevs = "yes" ; then
609           AC_DEFINE(HAVE_PCAP_FINDALLDEVS, 1,
610            [Define to 1 if you have the `pcap_findalldevs' function and a pcap.h that declares pcap_if_t.])
611           AC_CHECK_FUNCS(pcap_datalink_val_to_name pcap_datalink_name_to_val)
612           AC_CHECK_FUNCS(pcap_datalink_val_to_description)
613           AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink pcap_lib_version)
614           AC_CHECK_FUNCS(pcap_get_selectable_fd pcap_free_datalinks)
615         fi
616         LIBS="$ac_save_LIBS"
617 ])
618
619 AC_DEFUN([AC_WIRESHARK_PCAP_REMOTE_CHECK],
620 [
621     ac_save_LIBS="$LIBS"
622     LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS"
623     AC_DEFINE(HAVE_REMOTE, 1, [Define to 1 to enable remote
624               capturing feature in WinPcap library])
625     AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex pcap_createsrcstr)
626     if test $ac_cv_func_pcap_open = "yes" -a \
627             $ac_cv_func_pcap_findalldevs_ex = "yes" -a \
628             $ac_cv_func_pcap_createsrcstr = "yes" ; then
629         AC_DEFINE(HAVE_PCAP_REMOTE, 1,
630             [Define to 1 if you have WinPcap remote capturing support and prefer to use these new API features.])
631     fi
632     AC_CHECK_FUNCS(pcap_setsampling)
633     LIBS="$ac_save_LIBS"
634 ])
635
636 #
637 # AC_WIRESHARK_ZLIB_CHECK
638 #
639 AC_DEFUN([AC_WIRESHARK_ZLIB_CHECK],
640 [
641         if test "x$zlib_dir" != "x"
642         then
643           #
644           # The user specified a directory in which zlib resides,
645           # so add the "include" subdirectory of that directory to
646           # the include file search path and the "lib" subdirectory
647           # of that directory to the library search path.
648           #
649           # XXX - if there's also a zlib in a directory that's
650           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
651           # make us find the version in the specified directory,
652           # as the compiler and/or linker will search that other
653           # directory before it searches the specified directory.
654           #
655           wireshark_save_CFLAGS="$CFLAGS"
656           CFLAGS="$CFLAGS -I$zlib_dir/include"
657           wireshark_save_CPPFLAGS="$CPPFLAGS"
658           CPPFLAGS="$CPPFLAGS -I$zlib_dir/include"
659           wireshark_save_LIBS="$LIBS"
660           AC_WIRESHARK_ADD_DASH_L(LIBS, $zlib_dir/lib)
661         fi
662
663         #
664         # Make sure we have "zlib.h".  If we don't, it means we probably
665         # don't have zlib, so don't use it.
666         #
667         AC_CHECK_HEADER(zlib.h,,
668           [
669             if test "x$zlib_dir" != "x"
670             then
671               #
672               # The user used "--with-zlib=" to specify a directory
673               # containing zlib, but we didn't find the header file
674               # there; that either means they didn't specify the
675               # right directory or are confused about whether zlib
676               # is, in fact, installed.  Report the error and give up.
677               #
678               AC_MSG_ERROR([zlib header not found in directory specified in --with-zlib])
679             else
680               if test "x$want_zlib" = "xyes"
681               then
682                 #
683                 # The user tried to force us to use the library, but we
684                 # couldn't find the header file; report an error.
685                 #
686                 AC_MSG_ERROR(Header file zlib.h not found.)
687               else
688                 #
689                 # We couldn't find the header file; don't use the
690                 # library, as it's probably not present.
691                 #
692                 want_zlib=no
693               fi
694             fi
695           ])
696
697         if test "x$want_zlib" != "xno"
698         then
699                 #
700                 # Well, we at least have the zlib header file.
701                 #
702                 # Check for "gzgets()" in zlib, because we need it, but
703                 # some older versions of zlib don't have it.  It appears
704                 # from the zlib ChangeLog that any released version of zlib
705                 # with "gzgets()" should have the other routines we
706                 # depend on, such as "gzseek()", "gztell()", and "zError()".
707                 #
708                 # Another reason why we require "gzgets()" is that
709                 # some versions of zlib that didn't have it, such
710                 # as 1.0.8, had a bug in "gzseek()" that meant that it
711                 # doesn't work correctly on uncompressed files; this
712                 # means we cannot use version 1.0.8.  (Unfortunately,
713                 # that's the version that comes with recent X11 source,
714                 # and many people who install XFree86 on their Slackware
715                 # boxes don't realize that they should configure it to
716                 # use the native zlib rather than building and installing
717                 # the crappy old version that comes with XFree86.)
718                 #
719                 # I.e., we can't just avoid using "gzgets()", as
720                 # versions of zlib without "gzgets()" are likely to have
721                 # a broken "gzseek()".
722                 #
723                 AC_CHECK_LIB(z, gzgets,
724                 [
725                         if test "x$zlib_dir" != "x"
726                         then
727                                 #
728                                 # Put the "-I" and "-L" flags for zlib at
729                                 # the beginning of CFLAGS, CPPFLAGS, and
730                                 # LIBS.
731                                 #
732                                 LIBS=""
733                                 AC_WIRESHARK_ADD_DASH_L(LIBS, $zlib_dir/lib)
734                                 LIBS="$LIBS -lz $wireshark_save_LIBS"
735                         else
736                                 LIBS="-lz $LIBS"
737                         fi
738                         AC_DEFINE(HAVE_LIBZ, 1, [Define to use libz library])
739                 ],[
740                         if test "x$zlib_dir" != "x"
741                         then
742                                 #
743                                 # Restore the versions of CFLAGS, CPPFLAGS,
744                                 # and LIBS before we added the "-with-zlib="
745                                 # directory, as we didn't actually find
746                                 # zlib there, or didn't find a zlib that
747                                 # contains gzgets there.
748                                 #
749                                 CFLAGS="$wireshark_save_CFLAGS"
750                                 CPPFLAGS="$wireshark_save_CPPFLAGS"
751                                 LIBS="$wireshark_save_LIBS"
752                         fi
753                         want_zlib=no
754                 ])
755         fi
756
757         if test "x$want_zlib" != "xno"
758         then
759                 #
760                 # Well, we at least have the zlib header file and a zlib
761                 # with "gzgets()".
762                 #
763                 # Now check for "gzgets()" in zlib when linking with the
764                 # linker flags for GTK+ applications; people often grab
765                 # XFree86 source and build and install it on their systems,
766                 # and they appear sometimes to misconfigure XFree86 so that,
767                 # even on systems with zlib, it assumes there is no zlib,
768                 # so the XFree86 build process builds and installs its
769                 # own zlib in the X11 library directory.
770                 #
771                 # The XFree86 zlib is an older version that lacks
772                 # "gzgets()", and that's the zlib with which Wireshark
773                 # gets linked, so the build of Wireshark fails.
774                 #
775                 ac_save_CFLAGS="$CFLAGS"
776                 ac_save_LIBS="$LIBS"
777                 CFLAGS="$CFLAGS $GTK_CFLAGS"
778                 LIBS="$GTK_LIBS -lz $LIBS"
779                 AC_MSG_CHECKING([for gzgets missing when linking with X11])
780                 AC_TRY_LINK_FUNC(gzgets, AC_MSG_RESULT(no),
781                   [
782                     AC_MSG_RESULT(yes)
783                     AC_MSG_ERROR(old zlib found when linking with X11 - get rid of old zlib.)
784                   ])
785                 CFLAGS="$ac_save_CFLAGS"
786                 LIBS="$ac_save_LIBS"
787         fi
788 ])
789
790 #
791 # AC_WIRESHARK_LIBPCRE_CHECK
792 #
793 AC_DEFUN([AC_WIRESHARK_LIBPCRE_CHECK],
794 [
795         if test "x$pcre_dir" != "x"
796         then
797           #
798           # The user specified a directory in which libpcre resides,
799           # so add the "include" subdirectory of that directory to
800           # the include file search path and the "lib" subdirectory
801           # of that directory to the library search path.
802           #
803           # XXX - if there's also a libpcre in a directory that's
804           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
805           # make us find the version in the specified directory,
806           # as the compiler and/or linker will search that other
807           # directory before it searches the specified directory.
808           #
809           wireshark_save_CFLAGS="$CFLAGS"
810           CFLAGS="$CFLAGS -I$pcre_dir/include"
811           wireshark_save_CPPFLAGS="$CPPFLAGS"
812           CPPFLAGS="$CPPFLAGS -I$pcre_dir/include"
813           wireshark_save_LIBS="$LIBS"
814           LIBS="$LIBS -lpcre"
815           wireshark_save_LDFLAGS="$LDFLAGS"
816           LDFLAGS="$LDFLAGS -L$pcre_dir/lib"
817         fi
818
819         #
820         # Make sure we have "pcre.h".  If we don't, it means we probably
821         # don't have libpcre, so don't use it.
822         #
823         AC_CHECK_HEADER(pcre.h,,
824           [
825             if test "x$pcre_dir" != "x"
826             then
827               #
828               # The user used "--with-pcre=" to specify a directory
829               # containing libpcre, but we didn't find the header file
830               # there; that either means they didn't specify the
831               # right directory or are confused about whether libpcre
832               # is, in fact, installed.  Report the error and give up.
833               #
834               AC_MSG_ERROR([libpcre header not found in directory specified in --with-pcre])
835             else
836               if test "x$want_pcre" = "xyes"
837               then
838                 #
839                 # The user tried to force us to use the library, but we
840                 # couldn't find the header file; report an error.
841                 #
842                 AC_MSG_ERROR(Header file pcre.h not found.)
843               else
844                 #
845                 # We couldn't find the header file; don't use the
846                 # library, as it's probably not present.
847                 #
848                 want_pcre=no
849               fi
850             fi
851           ])
852
853         if test "x$want_pcre" != "xno"
854         then
855                 #
856                 # Well, we at least have the pcre header file.
857                 #
858                 # We're only using standard functions from libpcre,
859                 # so we don't need to perform extra checks.
860                 #
861                 AC_CHECK_LIB(pcre, pcre_compile,
862                 [
863                         if test "x$pcre_dir" != "x"
864                         then
865                                 #
866                                 # Put the "-I" and "-L" flags for pcre at
867                                 # the beginning of CFLAGS, CPPFLAGS,
868                                 # LDFLAGS, and LIBS.
869                                 #
870                                 PCRE_LIBS="-L$pcre_dir/lib -lpcre $wireshark_save_LIBS"
871                         else
872                                 PCRE_LIBS="-lpcre"
873                         fi
874                         AC_DEFINE(HAVE_LIBPCRE, 1, [Define to use libpcre library])
875                 ],[
876                         if test "x$pcre_dir" != "x"
877                         then
878                                 #
879                                 # Restore the versions of CFLAGS, CPPFLAGS,
880                                 # LDFLAGS, and LIBS before we added the
881                                 # "--with-pcre=" directory, as we didn't
882                                 # actually find pcre there.
883                                 #
884                                 CFLAGS="$wireshark_save_CFLAGS"
885                                 CPPFLAGS="$wireshark_save_CPPFLAGS"
886                                 LDFLAGS="$wireshark_save_LDFLAGS"
887                                 LIBS="$wireshark_save_LIBS"
888                                 PCRE_LIBS=""
889                         fi
890                         want_pcre=no
891                 ])
892                 AC_SUBST(PCRE_LIBS)
893         fi
894 ])
895
896 #
897 # AC_WIRESHARK_LIBLUA_CHECK
898 #
899 AC_DEFUN([AC_WIRESHARK_LIBLUA_CHECK],[
900
901         if test "x$lua_dir" != "x"
902         then
903                 #
904                 # The user specified a directory in which liblua resides,
905                 # so add the "include" subdirectory of that directory to
906                 # the include file search path and the "lib" subdirectory
907                 # of that directory to the library search path.
908                 #
909                 # XXX - if there's also a liblua in a directory that's
910                 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
911                 # make us find the version in the specified directory,
912                 # as the compiler and/or linker will search that other
913                 # directory before it searches the specified directory.
914                 #
915                 wireshark_save_CFLAGS="$CFLAGS"
916                 CFLAGS="$CFLAGS -I$lua_dir/include"
917                 wireshark_save_CPPFLAGS="$CPPFLAGS"
918                 CPPFLAGS="$CPPFLAGS -I$lua_dir/include"
919                 wireshark_save_LIBS="$LIBS"
920                 LIBS="$LIBS -L$lua_dir/lib -llua -lm"
921                 wireshark_save_LDFLAGS="$LDFLAGS"
922                 LDFLAGS="$LDFLAGS -L$lua_dir/lib"
923         else
924                 #
925                 # The user specified no directory in which liblua resides,
926                 # so just add "-llua -lliblua" to the used libs.
927                 #
928                 wireshark_save_CFLAGS="$CFLAGS"
929                 wireshark_save_CPPFLAGS="$CPPFLAGS"
930                 wireshark_save_LDFLAGS="$LDFLAGS"
931                 wireshark_save_LIBS="$LIBS"
932                 LIBS="$LIBS -llua -lm"
933         fi
934
935         #
936         # Make sure we have "lua.h", "lualib.h" and "lauxlib.h".  If we don't, it means we probably
937         # don't have liblua, so don't use it.
938         #
939         AC_CHECK_HEADERS(lua.h lualib.h lauxlib.h,,
940         [
941                 AC_CHECK_HEADERS(lua5.1/lua.h lua5.1/lualib.h lua5.1/lauxlib.h,
942                 [
943                         if test "x$lua_dir" != "x"
944                         then
945                                 LUA_INCLUDES="-I$lua_dir/include/lua5.1"
946                         else
947                                 #
948                                 # The user didn't specify a directory in which liblua resides;
949                                 # we must look for the headers in a "lua5.1" subdirectory of
950                                 # "/usr/include", "/usr/local/include", or "$prefix/include"
951                                 # as some systems apparently put the headers in a "lua5.1"
952                                 # subdirectory.
953                                 AC_MSG_CHECKING(for extraneous lua header directories)
954                                 found_lua_dir=""
955                                 lua_dir_list="/usr/include/lua5.1 $prefix/include/lua5.1"
956                                 if test "x$ac_cv_enable_usr_local" = "xyes"
957                                 then
958                                         lua_dir_list="$lua_dir_list /usr/local/include/lua5.1"
959                                 fi
960                                 for lua_dir_ent in $lua_dir_list
961                                 do
962                                         if test -d $lua_dir_ent
963                                         then
964                                                 LUA_INCLUDES="-I$lua_dir_ent"
965                                                 found_lua_dir="$lua_dir_ent"
966                                                 break
967                                         fi
968                                 done
969
970                                 if test "x$found_lua_dir" != "x"
971                                 then
972                                         AC_MSG_RESULT(found -- $found_lua_dir)
973                                 else
974                                         AC_MSG_RESULT(not found)
975                                         #
976                                         # Restore the versions of CFLAGS, CPPFLAGS,
977                                         # LDFLAGS, and LIBS before we added the
978                                         # "--with-lua=" directory, as we didn't
979                                         # actually find lua there.
980                                         #
981                                         CFLAGS="$wireshark_save_CFLAGS"
982                                         CPPFLAGS="$wireshark_save_CPPFLAGS"
983                                         LDFLAGS="$wireshark_save_LDFLAGS"
984                                         LIBS="$wireshark_save_LIBS"
985                                         LUA_LIBS=""
986                                         if test "x$want_lua" = "xyes"
987                                         then
988                                                 # we found lua5.1/lua.h, but we don't know which include dir contains it
989                                                 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.)
990                                         else
991                                                 #
992                                                 # We couldn't find the header file; don't use the
993                                                 # library, as it's probably not present.
994                                                 #
995                                                 want_lua=no
996                                         fi
997                                 fi
998                         fi
999                 ],
1000                 [
1001                         #
1002                         # Restore the versions of CFLAGS, CPPFLAGS,
1003                         # LDFLAGS, and LIBS before we added the
1004                         # "--with-lua=" directory, as we didn't
1005                         # actually find lua there.
1006                         #
1007                         CFLAGS="$wireshark_save_CFLAGS"
1008                         CPPFLAGS="$wireshark_save_CPPFLAGS"
1009                         LDFLAGS="$wireshark_save_LDFLAGS"
1010                         LIBS="$wireshark_save_LIBS"
1011                         LUA_LIBS=""
1012                         if test "x$lua_dir" != "x"
1013                         then
1014                                 #
1015                                 # The user used "--with-lua=" to specify a directory
1016                                 # containing liblua, but we didn't find the header file
1017                                 # there; that either means they didn't specify the
1018                                 # right directory or are confused about whether liblua
1019                                 # is, in fact, installed.  Report the error and give up.
1020                                 #
1021                                 AC_MSG_ERROR([liblua header not found in directory specified in --with-lua])
1022                         else
1023                                 if test "x$want_lua" = "xyes"
1024                                 then
1025                                         #
1026                                         # The user tried to force us to use the library, but we
1027                                         # couldn't find the header file; report an error.
1028                                         #
1029                                         AC_MSG_ERROR(Header file lua.h not found.)
1030                                 else
1031                                         #
1032                                         # We couldn't find the header file; don't use the
1033                                         # library, as it's probably not present.
1034                                         #
1035                                         want_lua=no
1036                                 fi
1037                         fi
1038                 ])
1039         ])
1040
1041         if test "x$want_lua" != "xno"
1042         then
1043                 #
1044                 # Well, we at least have the lua header file.
1045                 #
1046                 # let's check if the libs are there
1047                 #
1048
1049                 # At least on Suse 9.3 systems, liblualib needs linking
1050                 # against libm.
1051                 LIBS="$LIBS $LUA_LIBS -lm"
1052
1053                 AC_CHECK_LIB(lua, luaL_register,
1054                 [
1055                     #
1056                     #  Lua 5.1 found
1057                     #
1058                         if test "x$lua_dir" != "x"
1059                         then
1060                                 #
1061                                 # Put the "-I" and "-L" flags for lua at
1062                                 # the beginning of CFLAGS, CPPFLAGS,
1063                                 # LDFLAGS, and LIBS.
1064                                 #
1065                                 LUA_LIBS="-L$lua_dir/lib -llua -lm"
1066                                 LUA_INCLUDES="-I$lua_dir/include"
1067                         else
1068                                 LUA_LIBS="-llua -lm"
1069                                 LUA_INCLUDES=""
1070                         fi
1071                         AC_DEFINE(HAVE_LUA_5_1, 1, [Define to use Lua 5.1])
1072                         want_lua=yes
1073
1074                 ],[
1075                         #
1076                         # We could not find the libs, maybe we have version number in the lib name
1077                         #
1078
1079                         LIBS="$wireshark_save_LIBS -llua5.1 -lm"
1080
1081                         AC_CHECK_LIB(lua5.1, luaL_register,
1082                         [
1083                             #
1084                             #  Lua 5.1 found
1085                             #
1086                             LUA_LIBS=" -llua5.1 -lm"
1087                             AC_DEFINE(HAVE_LUA_5_1, 1, [Define to use Lua 5.1])
1088                             want_lua=yes
1089                         ],[
1090                                 #
1091                                 # Restore the versions of CFLAGS, CPPFLAGS,
1092                                 # LDFLAGS, and LIBS before we added the
1093                                 # "--with-lua=" directory, as we didn't
1094                                 # actually find lua there.
1095                                 #
1096                                 CFLAGS="$wireshark_save_CFLAGS"
1097                                 CPPFLAGS="$wireshark_save_CPPFLAGS"
1098                                 LDFLAGS="$wireshark_save_LDFLAGS"
1099                                 LIBS="$wireshark_save_LIBS"
1100                                 LUA_LIBS=""
1101                                 # User requested --with-lua but it isn't available
1102                                 if test "x$want_lua" = "xyes"
1103                                 then
1104                                         AC_MSG_ERROR(Linking with liblua failed.)
1105                                 fi
1106                                 want_lua=no
1107                         ])
1108                 ])
1109
1110         CFLAGS="$wireshark_save_CFLAGS"
1111         CPPFLAGS="$wireshark_save_CPPFLAGS"
1112         LDFLAGS="$wireshark_save_LDFLAGS"
1113         LIBS="$wireshark_save_LIBS"
1114         AC_SUBST(LUA_LIBS)
1115         AC_SUBST(LUA_INCLUDES)
1116
1117         fi
1118 ])
1119
1120 #
1121 # AC_WIRESHARK_LIBPORTAUDIO_CHECK
1122 #
1123 AC_DEFUN([AC_WIRESHARK_LIBPORTAUDIO_CHECK],[
1124
1125         if test "x$portaudio_dir" != "x"
1126         then
1127                 #
1128                 # The user specified a directory in which libportaudio
1129                 # resides, so add the "include" subdirectory of that directory to
1130                 # the include file search path and the "lib" subdirectory
1131                 # of that directory to the library search path.
1132                 #
1133                 # XXX - if there's also a libportaudio in a directory that's
1134                 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
1135                 # make us find the version in the specified directory,
1136                 # as the compiler and/or linker will search that other
1137                 # directory before it searches the specified directory.
1138                 #
1139                 wireshark_save_CFLAGS="$CFLAGS"
1140                 CFLAGS="$CFLAGS -I$portaudio_dir/include"
1141                 wireshark_save_CPPFLAGS="$CPPFLAGS"
1142                 CPPFLAGS="$CPPFLAGS -I$portaudio_dir/include"
1143                 wireshark_save_LIBS="$LIBS"
1144                 LIBS="$LIBS -L$portaudio_dir/lib -lportaudio"
1145                 wireshark_save_LDFLAGS="$LDFLAGS"
1146                 LDFLAGS="$LDFLAGS -L$portaudio_dir/lib"
1147         else
1148                 #
1149                 # The user specified no directory in which libportaudio resides,
1150                 # so just add "-lportaudio" to the used libs.
1151                 #
1152                 wireshark_save_CFLAGS="$CFLAGS"
1153                 wireshark_save_CPPFLAGS="$CPPFLAGS"
1154                 wireshark_save_LDFLAGS="$LDFLAGS"
1155                 wireshark_save_LIBS="$LIBS"
1156                 LIBS="$LIBS -lportaudio"
1157         fi
1158
1159         #
1160         # Make sure we have "portaudio.h".  If we don't, it means we probably
1161         # don't have libportaudio, so don't use it.
1162         #
1163         AC_CHECK_HEADERS(portaudio.h,,
1164         [
1165                 if test "x$portaudio_dir" != "x"
1166                 then
1167                         #
1168                         # The user used "--with-portaudio=" to specify a directory
1169                         # containing libportaudio, but we didn't find the header file
1170                         # there; that either means they didn't specify the
1171                         # right directory or are confused about whether libportaudio
1172                         # is, in fact, installed.  Report the error and give up.
1173                         #
1174                         AC_MSG_ERROR([libportaudio header not found in directory specified in --with-portaudio])
1175                 else
1176                         CFLAGS="$wireshark_save_CFLAGS"
1177                         CPPFLAGS="$wireshark_save_CPPFLAGS"
1178                         LDFLAGS="$wireshark_save_LDFLAGS"
1179                         LIBS="$wireshark_save_LIBS"
1180                         PORTAUDIO_LIBS=""
1181                         if test "x$want_portaudio" = "xyes"
1182                         then
1183                                 #
1184                                 # The user tried to force us to use the library, but we
1185                                 # couldn't find the header file; report an error.
1186                                 #
1187                                 AC_MSG_ERROR(Header file portaudio.h not found.)
1188                         else
1189                                 #
1190                                 # We couldn't find the header file; don't use the
1191                                 # library, as it's probably not present.
1192                                 #
1193                                 want_portaudio=no
1194                         fi
1195                 fi
1196         ])
1197
1198         #
1199         # Check whether we have the right version of portaudio
1200         #
1201         if test "x$want_portaudio" != "xno"
1202         then
1203                 AC_CHECK_TYPE(PortAudioStream,
1204                 AC_DEFINE(PORTAUDIO_API_1, 1, [Define if we are using version of of the Portaudio library API]),
1205                 ,
1206                 [#include <portaudio.h>])
1207         fi
1208
1209         if test "x$want_portaudio" != "xno"
1210         then
1211                 #
1212                 # Well, we at least have the portaudio header file.
1213                 #
1214                 # let's check if the libs are there
1215                 #
1216
1217                 AC_CHECK_LIB(portaudio, Pa_Initialize,
1218                 [
1219                         if test "x$portaudio_dir" != "x"
1220                         then
1221                                 #
1222                                 # Put the "-I" and "-L" flags for portaudio at
1223                                 # the beginning of CFLAGS, CPPFLAGS,
1224                                 # LDFLAGS, and LIBS.
1225                                 #
1226                                 PORTAUDIO_LIBS="-L$portaudio_dir/lib -lportaudio"
1227                                 PORTAUDIO_INCLUDES="-I$portaudio_dir/include"
1228                         else
1229                                 PORTAUDIO_LIBS="-lportaudio"
1230                                 PORTAUDIO_INCLUDES=""
1231                         fi
1232                         AC_DEFINE(HAVE_LIBPORTAUDIO, 1, [Define to use libportaudio library])
1233                         want_portaudio=yes
1234                 ],[
1235                         #
1236                         # Restore the versions of CFLAGS, CPPFLAGS,
1237                         # LDFLAGS, and LIBS before we added the
1238                         # "--with-portaudio=" directory, as we didn't
1239                         # actually find portaudio there.
1240                         #
1241                         CFLAGS="$wireshark_save_CFLAGS"
1242                         CPPFLAGS="$wireshark_save_CPPFLAGS"
1243                         LDFLAGS="$wireshark_save_LDFLAGS"
1244                         LIBS="$wireshark_save_LIBS"
1245                         PORTAUDIO_LIBS=""
1246                         # User requested --with-portaudio but it isn't available
1247                         if test "x$want_portaudio" = "xyes"
1248                         then
1249                                 AC_MSG_ERROR(Linking with libportaudio failed.)
1250                         fi
1251                         want_portaudio=no
1252                 ])
1253
1254         CFLAGS="$wireshark_save_CFLAGS"
1255         CPPFLAGS="$wireshark_save_CPPFLAGS"
1256         LDFLAGS="$wireshark_save_LDFLAGS"
1257         LIBS="$wireshark_save_LIBS"
1258         AC_SUBST(PORTAUDIO_LIBS)
1259         AC_SUBST(PORTAUDIO_INCLUDES)
1260
1261         fi
1262 ])
1263
1264 #
1265 # AC_WIRESHARK_RPM_CHECK
1266 # Looks for the rpm program, and checks to see if we can redefine "_topdir".
1267 #
1268 AC_DEFUN([AC_WIRESHARK_RPM_CHECK],
1269 [
1270         AC_CHECK_PROG(ac_cv_wireshark_have_rpm, rpm, "yes", "no")
1271         if test "x$ac_cv_wireshark_have_rpm" = "xyes"; then
1272                 rpm --define '_topdir /tmp' > /dev/null 2>&1
1273                 AC_MSG_CHECKING(to see if we can redefine _topdir)
1274                 if test $? -eq 0 ; then
1275                         AC_MSG_RESULT(yes)
1276                         HAVE_RPM=yes
1277                 else
1278                         AC_MSG_RESULT(no.  You'll have to build packages manually.)
1279                         HAVE_RPM=no
1280                 fi
1281         fi
1282 ])
1283
1284 #
1285 # AC_WIRESHARK_GNU_SED_CHECK
1286 # Checks if GNU sed is the first sed in PATH.
1287 #
1288 AC_DEFUN([AC_WIRESHARK_GNU_SED_CHECK],
1289 [
1290         AC_MSG_CHECKING(for GNU sed as first sed in PATH)
1291         if  ( sh -c "sed --version" </dev/null 2> /dev/null | grep "GNU sed" 2>&1 > /dev/null ) ;  then
1292                 AC_MSG_RESULT(yes)
1293                 HAVE_GNU_SED=yes
1294         else
1295                 AC_MSG_RESULT(no)
1296                 HAVE_GNU_SED=no
1297         fi
1298 ])
1299
1300 #
1301 # AC_WIRESHARK_C_ARES_CHECK
1302 #
1303 AC_DEFUN([AC_WIRESHARK_C_ARES_CHECK],
1304 [
1305         want_c_ares=defaultyes
1306
1307         if test "x$want_c_ares" = "xdefaultyes"; then
1308                 want_c_ares=yes
1309                 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1310                         withval=/usr/local
1311                         if test -d "$withval"; then
1312                                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1313                         fi
1314                 fi
1315         fi
1316
1317         if test "x$want_c_ares" = "xyes"; then
1318                 AC_CHECK_LIB(cares, ares_init,
1319                   [
1320                     C_ARES_LIBS=-lcares
1321                 AC_DEFINE(HAVE_C_ARES, 1, [Define to use c-ares library])
1322                 have_good_c_ares=yes
1323                   ],, $SOCKET_LIBS $NSL_LIBS
1324                 )
1325         else
1326                 AC_MSG_RESULT(not required)
1327         fi
1328 ])
1329
1330
1331 #
1332 # AC_WIRESHARK_ADNS_CHECK
1333 #
1334 AC_DEFUN([AC_WIRESHARK_ADNS_CHECK],
1335 [
1336         want_adns=defaultyes
1337
1338         if test "x$want_adns" = "xdefaultyes"; then
1339                 want_adns=yes
1340                 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1341                         withval=/usr/local
1342                         if test -d "$withval"; then
1343                                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1344                         fi
1345                 fi
1346         fi
1347
1348         if test "x$want_adns" = "xyes"; then
1349                 AC_CHECK_LIB(adns, adns_init,
1350                   [
1351                     ADNS_LIBS=-ladns
1352                 AC_DEFINE(HAVE_GNU_ADNS, 1, [Define to use GNU ADNS library])
1353                 have_good_adns=yes
1354                   ],, $SOCKET_LIBS $NSL_LIBS
1355                 )
1356         else
1357                 AC_MSG_RESULT(not required)
1358         fi
1359 ])
1360
1361
1362 #
1363 # AC_WIRESHARK_LIBCAP_CHECK
1364 #
1365 AC_DEFUN([AC_WIRESHARK_LIBCAP_CHECK],
1366 [
1367         want_libcap=defaultyes
1368
1369         if test "x$want_libcap" = "xdefaultyes"; then
1370                 want_libcap=yes
1371                 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1372                         withval=/usr/local
1373                         if test -d "$withval"; then
1374                                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1375                         fi
1376                 fi
1377         fi
1378
1379         if test "x$want_libcap" = "xyes"; then
1380                 AC_CHECK_LIB(cap, cap_set_flag,
1381                   [
1382                     LIBCAP_LIBS=-lcap
1383                 AC_DEFINE(HAVE_LIBCAP, 1, [Define to use the libcap library])
1384                 have_good_libcap=yes
1385                   ],,
1386                 )
1387         else
1388                 AC_MSG_RESULT(not required)
1389         fi
1390 ])
1391
1392
1393 #
1394 # AC_WIRESHARK_KRB5_CHECK
1395 #
1396 AC_DEFUN([AC_WIRESHARK_KRB5_CHECK],
1397 [
1398         wireshark_save_CFLAGS="$CFLAGS"
1399         wireshark_save_CPPFLAGS="$CPPFLAGS"
1400         if test "x$krb5_dir" != "x"
1401         then
1402           #
1403           # The user specified a directory in which kerberos resides,
1404           # so add the "include" subdirectory of that directory to
1405           # the include file search path and the "lib" subdirectory
1406           # of that directory to the library search path.
1407           #
1408           # XXX - if there's also a kerberos in a directory that's
1409           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
1410           # make us find the version in the specified directory,
1411           # as the compiler and/or linker will search that other
1412           # directory before it searches the specified directory.
1413           #
1414           CFLAGS="$CFLAGS -I$krb5_dir/include"
1415           CPPFLAGS="$CPPFLAGS -I$krb5_dir/include"
1416           ac_heimdal_version=`grep heimdal $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*heimdal.*$/HEIMDAL/'`
1417           ac_mit_version=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
1418           ac_krb5_version="$ac_heimdal_version$ac_mit_version"
1419           if test "x$ac_krb5_version" = "xHEIMDAL"
1420               KRB5_LIBS="-L$krb5_dir/lib -lkrb5 -lasn1 $SSL_LIBS -lroken -lcrypt"
1421           then
1422               KRB5_LIBS="-L$krb5_dir/lib -lkrb5 -lk5crypto -lcom_err"
1423           fi
1424           if test "x$ac_krb5_version" = "xMIT"
1425           then
1426             AC_DEFINE(HAVE_MIT_KERBEROS, 1, [Define to use MIT kerberos])
1427           fi
1428         else
1429           AC_PATH_PROG(KRB5_CONFIG, krb5-config)
1430           if test -x "$KRB5_CONFIG"
1431           then
1432             KRB5_FLAGS=`"$KRB5_CONFIG" --cflags`
1433             KRB5_LIBS=`"$KRB5_CONFIG" --libs`
1434             CFLAGS="$CFLAGS $KRB5_FLAGS"
1435             CPPFLAGS="$CPPFLAGS $KRB5_FLAGS"
1436             #
1437             # If -lcrypto is in KRB5_FLAGS, we require it to build
1438             # with Heimdal/MIT.  We don't want to built with it by
1439             # default, due to annoying license incompatibilities
1440             # between the OpenSSL license and the GPL, so:
1441             #
1442             #   if SSL_LIBS is set to a non-empty string, we
1443             #   remove -lcrypto from KRB5_LIBS and replace
1444             #   it with SSL_LIBS;
1445             #
1446             #   if SSL_LIBS is not set to a non-empty string
1447             #   we fail with an appropriate error message.
1448             #
1449             case "$KRB5_LIBS" in
1450             *-lcrypto*)
1451                 if test ! -z "$SSL_LIBS"
1452                 then
1453                     KRB5_LIBS=`echo $KRB5_LIBS | sed 's/-lcrypto//'`
1454                     KRB5_LIBS="$KRB5_LIBS $SSL_LIBS"
1455                 else
1456                     AC_MSG_ERROR([Kerberos library requires -lcrypto but --with-ssl not specified])
1457                 fi
1458                 ;;
1459             esac
1460             ac_krb5_version=`"$KRB5_CONFIG" --version | head -n 1 | sed -e 's/^.*heimdal.*$/HEIMDAL/' -e 's/^Kerberos .*$/MIT/' -e 's/^Solaris Kerberos .*$/MIT/'`
1461           fi
1462         fi
1463
1464         #
1465         # Make sure we have "krb5.h".  If we don't, it means we probably
1466         # don't have kerberos, so don't use it.
1467         #
1468         AC_CHECK_HEADER(krb5.h,,
1469           [
1470             if test "x$krb5_dir" != "x"
1471             then
1472               #
1473               # The user used "--with-krb5=" to specify a directory
1474               # containing kerberos, but we didn't find the header file
1475               # there; that either means they didn't specify the
1476               # right directory or are confused about whether kerberos
1477               # is, in fact, installed.  Report the error and give up.
1478               #
1479               AC_MSG_ERROR([kerberos header not found in directory specified in --with-krb5])
1480             else
1481               if test "x$want_krb5" = "xyes"
1482               then
1483                 #
1484                 # The user tried to force us to use the library, but we
1485                 # couldn't find the header file; report an error.
1486                 #
1487                 AC_MSG_ERROR(Header file krb5.h not found.)
1488               else
1489                 #
1490                 # We couldn't find the header file; don't use the
1491                 # library, as it's probably not present.
1492                 #
1493                 want_krb5=no
1494                 AC_MSG_RESULT(No Heimdal or MIT header found - disabling dissection for some kerberos data in packet decoding)
1495               fi
1496             fi
1497           ])
1498
1499         if test "x$want_krb5" != "xno"
1500         then
1501             #
1502             # Well, we at least have the krb5 header file.
1503             # Check whether this is Heimdal or MIT.
1504             #
1505             AC_MSG_CHECKING(whether the Kerberos library is Heimdal or MIT)
1506             if test "x$ac_krb5_version" = "xHEIMDAL" -o "x$ac_krb5_version" = "xMIT"
1507             then
1508                 #
1509                 # Yes.
1510                 # Check whether we have krb5_kt_resolve - and whether
1511                 # we need to link with -lresolv when linking with
1512                 # the Kerberos library.
1513                 #
1514                 AC_MSG_RESULT($ac_krb5_version)
1515                 wireshark_save_LIBS="$LIBS"
1516                 found_krb5_kt_resolve=no
1517                 for extras in "" "-lresolv"
1518                 do
1519                     LIBS="$KRB5_LIBS $extras"
1520                     if test -z "$extras"
1521                     then
1522                         AC_MSG_CHECKING([whether $ac_krb5_version includes krb5_kt_resolve])
1523                     else
1524                         AC_MSG_CHECKING([whether $ac_krb5_version includes krb5_kt_resolve (linking with $extras)])
1525                     fi
1526                     AC_TRY_LINK(
1527                         [
1528                         ],
1529                         [
1530                             krb5_kt_resolve();
1531                         ],
1532                         [
1533                             #
1534                             # We found "krb5_kt_resolve()", and required
1535                             # the libraries in extras as well.
1536                             #
1537                             AC_MSG_RESULT(yes)
1538                             KRB5_LIBS="$LIBS"
1539                             AC_DEFINE(HAVE_KERBEROS, 1, [Define to use kerberos])
1540                             if test "x$ac_krb5_version" = "xHEIMDAL"
1541                             then
1542                                 AC_DEFINE(HAVE_HEIMDAL_KERBEROS, 1, [Define to use heimdal kerberos])
1543                             elif test "x$ac_krb5_version" = "xMIT"
1544                             then
1545                                 AC_DEFINE(HAVE_MIT_KERBEROS, 1, [Define to use MIT kerberos])
1546                             fi
1547                             found_krb5_kt_resolve=yes
1548                             break
1549                         ],
1550                         [
1551                             AC_MSG_RESULT(no)
1552                         ])
1553                 done
1554                 if test "$found_krb5_kt_resolve" = no
1555                 then
1556                     #
1557                     # We didn't find "krb5_kt_resolve()" in the
1558                     # Kerberos library, even when we tried linking
1559                     # with -lresolv; we can't link with kerberos.
1560                     #
1561                     if test "x$want_krb5" = "xyes"
1562                     then
1563                         #
1564                         # The user tried to force us to use the library,
1565                         # but we can't do so; report an error.
1566                         #
1567                         AC_MSG_ERROR(Usable $ac_krb5_version not found)
1568                     else
1569                         #
1570                         # Restore the versions of CFLAGS and CPPFLAGS
1571                         # from before we added the flags for Kerberos.
1572                         #
1573                         AC_MSG_RESULT(Usable $ac_krb5_version not found - disabling dissection for some kerberos data in packet decoding)
1574                         CFLAGS="$wireshark_save_CFLAGS"
1575                         CPPFLAGS="$wireshark_save_CPPFLAGS"
1576                         KRB5_LIBS=""
1577                         want_krb5=no
1578                     fi
1579                 else
1580                     #
1581                     # We can link with Kerberos; see whether krb5.h
1582                     # defines KEYTYPE_ARCFOUR_56 (where "defines" means
1583                     # "as a #define or as an enum member).
1584                     #
1585                     AC_MSG_CHECKING([whether krb5.h defines KEYTYPE_ARCFOUR_56])
1586                     AC_COMPILE_IFELSE(
1587                       [
1588                         AC_LANG_SOURCE(
1589                           [[
1590                             #include <krb5.h>
1591                             #include <stdio.h>
1592
1593                             main()
1594                             {
1595                               printf("%u\n", KEYTYPE_ARCFOUR_56);
1596                             }
1597                           ]])
1598                       ],
1599                       [
1600                         AC_MSG_RESULT(yes)
1601                         AC_DEFINE(HAVE_KEYTYPE_ARCFOUR_56, 1, [Define if krb5.h defines KEYTYPE_ARCFOUR_56])
1602                       ],
1603                       [
1604                         AC_MSG_RESULT(no)
1605                       ])
1606                 fi
1607                 LIBS="$wireshark_save_LIBS"
1608             else
1609                 #
1610                 # It's not Heimdal or MIT.
1611                 #
1612                 AC_MSG_RESULT(no)
1613                 if test "x$want_krb5" = "xyes"
1614                 then
1615                     #
1616                     # The user tried to force us to use the library,
1617                     # but we can't do so; report an error.
1618                     #
1619                     AC_MSG_ERROR(Kerberos not found)
1620                 else
1621                     #
1622                     # Restore the versions of CFLAGS and CPPFLAGS
1623                     # from before we added the flags for Kerberos.
1624                     #
1625                     AC_MSG_RESULT(Kerberos not found - disabling dissection for some kerberos data in packet decoding)
1626                     CFLAGS="$wireshark_save_CFLAGS"
1627                     CPPFLAGS="$wireshark_save_CPPFLAGS"
1628                     KRB5_LIBS=""
1629                     want_krb5=no
1630                 fi
1631             fi
1632         else
1633             #
1634             # The user asked us not to use Kerberos, or they didn't
1635             # say whether they wanted us to use it but we found
1636             # that we couldn't.
1637             #
1638             # Restore the versions of CFLAGS and CPPFLAGS
1639             # from before we added the flags for Kerberos.
1640             #
1641             CFLAGS="$wireshark_save_CFLAGS"
1642             CPPFLAGS="$wireshark_save_CPPFLAGS"
1643             KRB5_LIBS=""
1644             want_krb5=no
1645         fi
1646         AC_SUBST(KRB5_LIBS)
1647 ])
1648
1649 #
1650 # AC_WIRESHARK_GEOIP_CHECK
1651 #
1652 AC_DEFUN([AC_WIRESHARK_GEOIP_CHECK],
1653 [
1654         want_geoip=defaultyes
1655
1656         if test "x$want_geoip" = "xdefaultyes"; then
1657                 want_geoip=yes
1658                 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
1659                         withval=/usr/local
1660                         if test -d "$withval"; then
1661                                 AC_WIRESHARK_ADD_DASH_L(LDFLAGS, ${withval}/lib)
1662                         fi
1663                 fi
1664         fi
1665
1666         if test "x$want_geoip" = "xyes"; then
1667                 AC_CHECK_LIB(GeoIP, GeoIP_new,
1668                   [
1669                     GEOIP_LIBS=-lGeoIP
1670                 AC_DEFINE(HAVE_GEOIP, 1, [Define to use GeoIP library])
1671                 have_good_geoip=yes
1672                   ],,
1673                 )
1674         else
1675                 AC_MSG_RESULT(not required)
1676         fi
1677 ])
1678
1679 #AC_WIRESHARK_GCC_LDFLAGS_CHECK
1680 #
1681 # $1 : ldflag(s) to test
1682 #
1683 # The macro first determines if the compiler is GCC. Then compile with the
1684 # defined ldflags. The defined flags are added to LDFLAGS only if the
1685 # compilation succeeds.
1686 #
1687 AC_DEFUN([AC_WIRESHARK_GCC_LDFLAGS_CHECK],
1688 [GCC_OPTION="$1"
1689 AC_MSG_CHECKING(whether we can add $GCC_OPTION to LDFLAGS)
1690 if test "x$GCC" != "x"; then
1691   LDFLAGS_saved="$CFLAGS"
1692   LDFLAGS="$LDFLAGS $GCC_OPTION"
1693   AC_LINK_IFELSE([
1694     AC_LANG_SOURCE([[
1695                 main() { return; }
1696                   ]])],
1697                   [
1698                     AC_MSG_RESULT(yes)
1699                   ],
1700                   [
1701                     AC_MSG_RESULT(no)
1702                     LDFLAGS="$LDFLAGS_saved"
1703                   ])
1704 else
1705   AC_MSG_RESULT(no)
1706 fi
1707 ])
1708
1709 #
1710 # AC_WIRESHARK_GCC_CFLAGS_CHECK
1711 #
1712 # $1 : cflags to test
1713 #
1714 # The macro first determines if the compiler is GCC. Then compile with the
1715 # defined cflags. The defined flags are added to CFLAGS only if the compilation
1716 # succeeds.
1717 #
1718 AC_DEFUN([AC_WIRESHARK_GCC_CFLAGS_CHECK],
1719 [GCC_OPTION="$1"
1720 AC_MSG_CHECKING(whether we can add $GCC_OPTION to CFLAGS)
1721 if test "x$GCC" != "x"; then
1722   CFLAGS_saved="$CFLAGS"
1723   CFLAGS="$CFLAGS $GCC_OPTION"
1724   AC_COMPILE_IFELSE([
1725     AC_LANG_SOURCE([[
1726                       int foo;
1727                   ]])],
1728                   [
1729                     AC_MSG_RESULT(yes)
1730                   ],
1731                   [
1732                     AC_MSG_RESULT(no)
1733                     CFLAGS="$CFLAGS_saved"
1734                   ])
1735 else
1736   AC_MSG_RESULT(no)
1737 fi
1738 ])
1739
1740 #
1741 # AC_WIRESHARK_IGE_MAC_INTEGRATION_CHECK
1742 #
1743 # Checks for the presence of OS X integration functions in the GTK+ framework
1744 # or as a separate library.
1745 #
1746 # http://developer.imendio.com/projects/gtk-macosx/integration
1747 #
1748 AC_DEFUN([AC_WIRESHARK_IGE_MAC_INTEGRATION_CHECK],
1749 [
1750         ac_save_CFLAGS="$CFLAGS"
1751         ac_save_LIBS="$LIBS"
1752         CFLAGS="$CFLAGS $GTK_CFLAGS"
1753         LIBS="$GTK_LIBS $LIBS"
1754         AC_CHECK_LIB(Gtk, ige_mac_menu_set_menu_bar,
1755         [
1756                 AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
1757                         [Define to 1 if the the Gtk+ framework or a separate library inclues the Imendio IGE Mac OS X Integration functions.])
1758                 have_ige_mac=yes
1759                 # We don't want gtk stuff in LIBS (which is reset below) so
1760                 # manually set GTK_LIBS (which is more appropriate)
1761                 GTK_LIBS="$GTK_LIBS -lGtk"
1762         ])
1763
1764         if test x$have_ige_mac == x
1765         then
1766                 AC_CHECK_LIB(igemacintegration, ige_mac_menu_set_menu_bar,
1767                 [
1768                         AC_DEFINE(HAVE_IGE_MAC_INTEGRATION, 1,
1769                                 [Define to 1 if the the Gtk+ framework or a separate library inclues the Imendio IGE Mac OS X Integration functions.])
1770                         # We don't want gtk stuff in LIBS (which is reset below) so
1771                         # manually set GTK_LIBS (which is more appropriate)
1772                         GTK_LIBS="$GTK_LIBS -ligemacintegration"
1773                 ])
1774         fi
1775         CFLAGS="$ac_save_CFLAGS"
1776         LIBS="$ac_save_LIBS"
1777 ])
1778
1779 #
1780 # AC_WIRESHARK_PYTHON_CHECK
1781 #
1782 # Check whether python devel package is present
1783 #
1784 AC_DEFUN([AC_WIRESHARK_PYTHON_CHECK],
1785   [
1786     #
1787     # Checking whether we have a python devel environment available
1788     #
1789 #  AC_CACHE_CHECK([checking python devel package], ac_cv_wireshark_python_devel,
1790 #    [
1791     AC_CHECK_PROG([ac_ws_python_config], [python-config], "yes", "no")
1792     if test ac_ws_python_config = "no"; then
1793       ac_cv_wireshark_python_devel = "no"
1794     else
1795       AC_MSG_CHECKING([python devel])
1796       ac_save_ws_cflags=$CFLAGS
1797       ac_save_ws_libs=$LIBS
1798       CFLAGS=$(python-config --includes)
1799       LIBS=$(python-config --ldflags)
1800       AC_COMPILE_IFELSE(
1801         [
1802           AC_LANG_PROGRAM(
1803             [[#include <Python.h>]],
1804             [[Py_Initialiaze();]]
1805           )
1806         ],
1807         [
1808           #
1809           # Compilation successful, we have python devel available
1810           #
1811           ac_cv_wireshark_python_devel=yes
1812           PY_LIBS=$LIBS
1813           PY_CFLAGS=$CFLAGS
1814           AC_SUBST(PY_LIBS)
1815           AC_SUBST(PY_CFLAGS)
1816           CFLAGS="$ac_save_ws_cflags"
1817           LIBS="$ac_save_ws_libs"
1818           AC_DEFINE(HAVE_PYTHON, 1, [Define if python devel package available])
1819           AC_MSG_RESULT([yes])
1820         ],
1821         [
1822           #
1823           # Compilation unsuccessful, python devel not available
1824           #
1825           ac_cv_wireshark_python_devel=no
1826           CFLAGS=$ac_save_ws_cflags
1827           LIBS=$ac_save_ws_libs
1828           AC_MSG_RESULT([no])
1829         ])
1830     fi
1831 #    ])
1832 ])