Add sample strace output to illustrate the timeout problem.
[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 Ethereal.
3 dnl Copyright (C) 1998-2000 by Gerald Combs.
4 dnl
5 dnl $Id: acinclude.m4,v 1.15 1999/11/30 22:45:09 gram Exp $
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_ETHEREAL_STRUCT_SA_LEN
55 #
56 dnl AC_STRUCT_ST_BLKSIZE extracted from the file in qustion,
57 dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into
58 dnl AC_ETHEREAL_STRUCT_SA_LEN, which checks if "struct sockaddr"
59 dnl has the 4.4BSD "sa_len" member, and defines HAVE_SA_LEN; that's
60 dnl what's in this file.
61 dnl Done by Guy Harris <guy@alum.mit.edu> on 1998-11-14. 
62
63 dnl ### Checks for structure members
64
65 AC_DEFUN(AC_ETHEREAL_STRUCT_SA_LEN,
66 [AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_ethereal_struct_sa_len,
67 [AC_TRY_COMPILE([#include <sys/types.h>
68 #include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
69 ac_cv_ethereal_struct_sa_len=yes, ac_cv_ethereal_struct_sa_len=no)])
70 if test $ac_cv_ethereal_struct_sa_len = yes; then
71   AC_DEFINE(HAVE_SA_LEN)
72 fi
73 ])
74
75
76 #
77 # AC_ETHEREAL_IPV6_STACK
78 #
79 # By Jun-ichiro "itojun" Hagino, <itojun@iijlab.net>
80
81 AC_DEFUN(AC_ETHEREAL_IPV6_STACK,
82 [
83         v6type=unknown
84         v6lib=none
85
86         AC_MSG_CHECKING([ipv6 stack type])
87         for i in v6d toshiba kame inria zeta linux; do
88                 case $i in
89                 v6d)
90                         AC_EGREP_CPP(yes, [dnl
91 #include </usr/local/v6/include/sys/types.h>
92 #ifdef __V6D__
93 yes
94 #endif],
95                                 [v6type=$i; v6lib=v6;
96                                 v6libdir=/usr/local/v6/lib;
97                                 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
98                         ;;
99                 toshiba)
100                         AC_EGREP_CPP(yes, [dnl
101 #include <sys/param.h>
102 #ifdef _TOSHIBA_INET6
103 yes
104 #endif],
105                                 [v6type=$i; v6lib=inet6;
106                                 v6libdir=/usr/local/v6/lib;
107                                 CFLAGS="-DINET6 $CFLAGS"])
108                         ;;
109                 kame)
110                         AC_EGREP_CPP(yes, [dnl
111 #include <netinet/in.h>
112 #ifdef __KAME__
113 yes
114 #endif],
115                                 [v6type=$i; v6lib=inet6;
116                                 v6libdir=/usr/local/v6/lib;
117                                 CFLAGS="-DINET6 $CFLAGS"])
118                         ;;
119                 inria)
120                         AC_EGREP_CPP(yes, [dnl
121 #include <netinet/in.h>
122 #ifdef IPV6_INRIA_VERSION
123 yes
124 #endif],
125                                 [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
126                         ;;
127                 zeta)
128                         AC_EGREP_CPP(yes, [dnl
129 #include <sys/param.h>
130 #ifdef _ZETA_MINAMI_INET6
131 yes
132 #endif],
133                                 [v6type=$i; v6lib=inet6;
134                                 v6libdir=/usr/local/v6/lib;
135                                 CFLAGS="-DINET6 $CFLAGS"])
136                         ;;
137                 linux)
138                         if test -d /usr/inet6; then
139                                 v6type=$i
140                                 v6lib=inet6
141                                 v6libdir=/usr/inet6
142                                 CFLAGS="-DINET6 $CFLAGS"
143                         fi
144                         ;;
145                 esac
146                 if test "$v6type" != "unknown"; then
147                         break
148                 fi
149         done
150
151         if test "$v6lib" != "none"; then
152                 for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
153                         if test -d $dir -a -f $dir/lib$v6lib.a; then
154                                 LIBS="-L$dir $LIBS -l$v6lib"
155                                 break
156                         fi
157                 done
158                 enable_ipv6="yes"
159         else
160                 enable_ipv6="no"
161         fi
162         AC_MSG_RESULT(["$v6type, $v6lib"])
163 ])
164
165 #
166 # AC_ETHEREAL_PCAP_CHECK
167 #
168 AC_DEFUN(AC_ETHEREAL_PCAP_CHECK,
169 [
170         # Evidently, some systems have pcap.h, etc. in */include/pcap
171         AC_MSG_CHECKING(for extraneous pcap header directories)
172         found_pcap_dir=""
173         for pcap_dir in /usr/include/pcap /usr/local/include/pcap $prefix/include
174         do
175           if test -d $pcap_dir ; then
176             LIBS="$LIBS -L$pcap_dir"
177             CFLAGS="$CFLAGS -I$pcap_dir"
178             CPPFLAGS="$CPPFLAGS -I$pcap_dir"
179             found_pcap_dir=" $found_pcap_dir -L$pcap_dir"
180           fi
181         done
182
183         if test "$found_pcap_dir" != "" ; then
184           AC_MSG_RESULT(found --$found_pcap_dir added to LIBS and CFLAGS)
185         else
186           AC_MSG_RESULT(not found)
187         fi
188
189         # Pcap checks
190         AC_CHECK_HEADER(net/bpf.h,,
191             AC_MSG_ERROR([[Header file net/bpf.h not found; if you installed libpcap from source, did you also do \"make install-incl\"?]]))
192         AC_CHECK_HEADER(pcap.h,, AC_MSG_ERROR(Header file pcap.h not found.))
193         AC_CHECK_LIB(pcap, pcap_open_offline,, AC_MSG_ERROR(Library libpcap not found.))
194 ])
195
196 #
197 # AC_ETHEREAL_ZLIB_CHECK
198 #
199 AC_DEFUN(AC_ETHEREAL_ZLIB_CHECK,
200 [
201         AC_CHECK_HEADER(zlib.h,,enable_zlib=no)
202
203         dnl
204         dnl Check for "gzgets()" in zlib, because we need it, but
205         dnl some older versions of zlib don't have it.  It appears
206         dnl from the ChangeLog that any released version of zlib
207         dnl with "gzgets()" should have the other routines we
208         dnl depend on, such as "gzseek()", "gztell()", and "zError()".
209         dnl
210         AC_CHECK_LIB(z, gzgets,,enable_zlib=no)
211 ])
212
213 #
214 # AC_ETHEREAL_UCDSNMP_CHECK
215 #
216 AC_DEFUN(AC_ETHEREAL_UCDSNMP_CHECK,
217 [
218         want_ucdsnmp=yes
219
220         AC_ARG_WITH(ucdsnmp,
221         [  --with-ucdsnmp=DIR      use UCD SNMP client library, located in directory DIR.], [
222         if test $withval = no
223         then
224                 want_ucdsnmp=no
225         else
226                 want_ucdsnmp=yes
227                 ucdsnmp_user_dir=$withval
228         fi
229         ])
230
231         if test $want_ucdsnmp = yes
232         then
233                 ucdsnmpdir=""
234
235                 for d in $ucdsnmp_user_dir $prefix
236                 do
237                         if test x$d != xNONE 
238                         then
239                                 AC_MSG_CHECKING($d for ucd-snmp)
240
241                                 if test x$d != x/usr/local && test -f $d/include/ucd-snmp/snmp.h
242                                 then
243                                         AC_MSG_RESULT(found)
244                                         ucdsnmpdir=$d
245                                         break
246                                 else
247                                         AC_MSG_RESULT(not found)
248                                 fi
249                         fi
250                 done
251
252                 if test x$ucdsnmpdir != x
253                 then
254                         AC_MSG_RESULT(added $d to paths)
255                         CFLAGS="$CFLAGS -I${ucdsnmpdir}/include"
256                         CPPFLAGS="$CPPFLAGS -I${ucdsnmpdir}/include"
257                         LIBS="$LIBS -L${ucdsnmpdir}/lib"
258                 fi
259         fi
260 ])