d30874b19e27f7d533863fb72519f645bffa04a6
[obnox/wireshark/wip.git] / wiretap / acinclude.m4
1 dnl Macros that test for specific features.
2 dnl This file is part of the Autoconf packaging for Ethereal.
3 dnl Copyright (C) 1998-2000 by Gerald Combs.
4 dnl
5 dnl $Id: acinclude.m4,v 1.13 2002/02/06 09:58:30 guy Exp $
6 dnl
7
8 #
9 # AC_WIRETAP_PCAP_CHECK
10 #
11 AC_DEFUN(AC_WIRETAP_PCAP_CHECK,
12 [
13         if test -z "$pcap_dir"
14         then
15           #
16           # The user didn't specify a directory in which libpcap resides;
17           # we assume that the current library search path will work,
18           # but we may have to look for the header in a "pcap"
19           # subdirectory of "/usr/include" or "/usr/local/include",
20           # as some systems apparently put "pcap.h" in a "pcap"
21           # subdirectory, and we also check "$prefix/include".
22           #
23           # XXX - should we just add "$prefix/include" to the include
24           # search path?
25           #
26           AC_MSG_CHECKING(for extraneous pcap header directories)
27           found_pcap_dir=""
28           for pcap_dir in /usr/include/pcap /usr/local/include/pcap $prefix/include
29           do
30             if test -d $pcap_dir ; then
31               CFLAGS="$CFLAGS -I$pcap_dir"
32               CPPFLAGS="$CPPFLAGS -I$pcap_dir"
33               found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
34             fi
35           done
36
37           if test "$found_pcap_dir" != "" ; then
38             AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
39           else
40             AC_MSG_RESULT(not found)
41           fi
42         else
43           #
44           # The user specified a directory in which libpcap resides,
45           # so add the "include" subdirectory of that directory to
46           # the include file search path.
47           #
48           # XXX - if there's also a libpcap in a directory that's
49           # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
50           # make us find the version in the specified directory,
51           # as the compiler and/or linker will search that other
52           # directory before it searches the specified directory.
53           #
54           CFLAGS="$CFLAGS -I$pcap_dir/include"
55           CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
56         fi
57
58         # Pcap header check
59         AC_CHECK_HEADERS(pcap.h)
60 ])
61
62 #
63 # AC_WIRETAP_ZLIB_CHECK
64 #
65 AC_DEFUN(AC_WIRETAP_ZLIB_CHECK,
66 [
67         AC_CHECK_HEADER(zlib.h,,enable_zlib=no)
68
69         if test x$enable_zlib != xno
70         then
71                 #
72                 # Well, we at least have the zlib header file.
73                 #
74                 # Check for "gzgets()" in zlib, because we need it, but
75                 # some older versions of zlib don't have it.  It appears
76                 # from the zlib ChangeLog that any released version of zlib
77                 # with "gzgets()" should have the other routines we
78                 # depend on, such as "gzseek()", "gztell()", and "zError()".
79                 #
80                 # Another reason why we require "gzgets()" is that
81                 # some versions of zlib that didn't have it, such
82                 # as 1.0.8, had a bug in "gzseek()" that meant that it
83                 # doesn't work correctly on uncompressed files; this
84                 # means we cannot use version 1.0.8.  (Unfortunately,
85                 # that's the version that comes with recent X11 source,
86                 # and many people who install XFree86 on their Slackware
87                 # boxes don't realize that they should configure it to
88                 # use the native zlib rather than building and installing
89                 # the crappy old version that comes with XFree86.)
90                 #
91                 # I.e., we can't just avoid using "gzgets()", as
92                 # versions of zlib without "gzgets()" are likely to have
93                 # a broken "gzseek()".
94                 #
95                 AC_CHECK_LIB(z, gzgets,,enable_zlib=no)
96         fi
97 ])