]> The Tcpdump Group git mirrors - tcpdump/blob - configure.in
When checking for pcap_if_t, add $V_INCLS to CFLAGS, so we look at the
[tcpdump] / configure.in
1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.181 2004-07-10 21:53:31 guy Exp $ (LBL)
2 dnl
3 dnl Copyright (c) 1994, 1995, 1996, 1997
4 dnl The Regents of the University of California. All rights reserved.
5 dnl
6 dnl Process this file with autoconf to produce a configure script.
7 dnl
8
9 AC_REVISION($Revision: 1.181 $)
10 AC_PREREQ(2.50)
11 AC_INIT(tcpdump.c)
12
13 AC_CANONICAL_HOST
14
15 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
16 AC_LBL_C_INLINE
17 AC_C___ATTRIBUTE__
18 AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h netinet/ether.h)
19 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
20 #include <sys/socket.h>])
21 AC_HEADER_TIME
22
23 case "$host_os" in
24
25 linux*)
26 AC_MSG_CHECKING(Linux kernel version)
27 if test "$cross_compiling" = yes; then
28 AC_CACHE_VAL(ac_cv_linux_vers,
29 ac_cv_linux_vers=unknown)
30 else
31 AC_CACHE_VAL(ac_cv_linux_vers,
32 ac_cv_linux_vers=`uname -r 2>&1 | \
33 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
34 fi
35 AC_MSG_RESULT($ac_cv_linux_vers)
36 if test $ac_cv_linux_vers = unknown ; then
37 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
38 fi
39 if test $ac_cv_linux_vers -lt 2 ; then
40 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
41 fi
42 ;;
43
44 *)
45 ;;
46 esac
47
48
49 AC_CHECK_HEADERS(smi.h)
50 AC_CHECK_LIB(smi, smiInit)
51 if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
52 then
53 AC_MSG_CHECKING([whether to enable libsmi])
54 AC_TRY_RUN([ /* libsmi available check */
55 #include <smi.h>
56 main()
57 {
58 int current, revision, age, n;
59 const int required = 2;
60 if (smiInit(""))
61 exit(1);
62 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
63 exit(2);
64 n = sscanf(smi_library_version, "%d:%d:%d", &current, &revision, &age);
65 if (n != 3)
66 exit(3);
67 if (required < current - age || required > current)
68 exit(4);
69 exit(0);
70 }
71 ],
72 [ AC_MSG_RESULT(yes)
73 AC_DEFINE(LIBSMI)
74 libsmi=yes],
75 dnl autoconf documentation says that $? contains the exit value.
76 dnl reality is that it does not. We leave this in just in case
77 dnl autoconf ever comes back to match the documentation.
78 [ case $? in
79 1) AC_MSG_RESULT(no - smiInit failed) ;;
80 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
81 3) AC_MSG_RESULT(no - can't determine library version) ;;
82 4) AC_MSG_RESULT(no - too old) ;;
83 *) AC_MSG_RESULT(no) ;;
84 esac
85 libsmi=no],
86 [ AC_MSG_RESULT(not when cross-compiling)
87 libsmi=no]
88 )
89 fi
90
91 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
92 AC_ARG_ENABLE(smb,
93 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
94 --disable-smb disable possibly-buggy SMB printer],,
95 enableval=yes)
96 case "$enableval" in
97 yes) AC_MSG_RESULT(yes)
98 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
99 AC_DEFINE(TCPDUMP_DO_SMB)
100 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
101 ;;
102 *) AC_MSG_RESULT(no)
103 ;;
104 esac
105
106 AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
107 AC_MSG_CHECKING([whether to drop root privileges by default])
108 if test ! -z "$with_user" ; then
109 AC_DEFINE_UNQUOTED(WITH_USER, "$withval")
110 AC_MSG_RESULT(to \"$withval\")
111 else
112 AC_MSG_RESULT(no)
113 fi
114
115 AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
116 AC_MSG_CHECKING([whether to chroot])
117 if test ! -z "$with_chroot" ; then
118 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval")
119 AC_MSG_RESULT(to \"$withval\")
120 else
121 AC_MSG_RESULT(no)
122 fi
123
124 AC_MSG_CHECKING([whether to enable ipv6])
125 AC_ARG_ENABLE(ipv6,
126 [ --enable-ipv6 enable ipv6 (with ipv4) support
127 --disable-ipv6 disable ipv6 support],
128 [ case "$enableval" in
129 yes) AC_MSG_RESULT(yes)
130 LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
131 AC_DEFINE(INET6)
132 ipv6=yes
133 ;;
134 *)
135 AC_MSG_RESULT(no)
136 ipv6=no
137 ;;
138 esac ],
139
140 AC_TRY_RUN([ /* AF_INET6 available check */
141 #include <sys/types.h>
142 #include <sys/socket.h>
143 main()
144 {
145 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
146 exit(1);
147 else
148 exit(0);
149 }
150 ],
151 [ AC_MSG_RESULT(yes)
152 LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
153 AC_DEFINE(INET6)
154 ipv6=yes],
155 [ AC_MSG_RESULT(no)
156 ipv6=no],
157 [ AC_MSG_RESULT(no)
158 ipv6=no]
159 ))
160
161 ipv6type=unknown
162 ipv6lib=none
163 ipv6trylibc=no
164
165 if test "$ipv6" = "yes"; then
166 AC_MSG_CHECKING([ipv6 stack type])
167 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
168 case $i in
169 inria)
170 dnl http://www.kame.net/
171 AC_EGREP_CPP(yes,
172 [#include <netinet/in.h>
173 #ifdef IPV6_INRIA_VERSION
174 yes
175 #endif],
176 [ipv6type=$i;
177 CFLAGS="-DINET6 $CFLAGS"])
178 ;;
179 kame)
180 dnl http://www.kame.net/
181 AC_EGREP_CPP(yes,
182 [#include <netinet/in.h>
183 #ifdef __KAME__
184 yes
185 #endif],
186 [ipv6type=$i;
187 ipv6lib=inet6;
188 ipv6libdir=/usr/local/v6/lib;
189 ipv6trylibc=yes;
190 CFLAGS="-DINET6 $CFLAGS"])
191 ;;
192 linux-glibc)
193 dnl http://www.v6.linux.or.jp/
194 AC_EGREP_CPP(yes,
195 [#include <features.h>
196 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
197 yes
198 #endif],
199 [ipv6type=$i;
200 CFLAGS="-DINET6 $CFLAGS"])
201 ;;
202 linux-libinet6)
203 dnl http://www.v6.linux.or.jp/
204 dnl
205 dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
206 dnl and possibly other versions of those OSes
207 dnl
208 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
209 ipv6type=$i
210 ipv6lib=inet6
211 ipv6libdir=/usr/inet6/lib
212 ipv6trylibc=yes;
213 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
214 fi
215 ;;
216 toshiba)
217 AC_EGREP_CPP(yes,
218 [#include <sys/param.h>
219 #ifdef _TOSHIBA_INET6
220 yes
221 #endif],
222 [ipv6type=$i;
223 ipv6lib=inet6;
224 ipv6libdir=/usr/local/v6/lib;
225 CFLAGS="-DINET6 $CFLAGS"])
226 ;;
227 v6d)
228 AC_EGREP_CPP(yes,
229 [#include </usr/local/v6/include/sys/v6config.h>
230 #ifdef __V6D__
231 yes
232 #endif],
233 [ipv6type=$i;
234 ipv6lib=v6;
235 ipv6libdir=/usr/local/v6/lib;
236 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
237 ;;
238 zeta)
239 AC_EGREP_CPP(yes,
240 [#include <sys/param.h>
241 #ifdef _ZETA_MINAMI_INET6
242 yes
243 #endif],
244 [ipv6type=$i;
245 ipv6lib=inet6;
246 ipv6libdir=/usr/local/v6/lib;
247 CFLAGS="-DINET6 $CFLAGS"])
248 ;;
249 esac
250 if test "$ipv6type" != "unknown"; then
251 break
252 fi
253 done
254 AC_MSG_RESULT($ipv6type)
255 fi
256
257 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
258 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
259 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
260 echo "You have $ipv6lib library, using it"
261 else
262 if test "$ipv6trylibc" = "yes"; then
263 echo "You do not have $ipv6lib library, using libc"
264 else
265 echo 'Fatal: no $ipv6lib library found. cannot continue.'
266 echo "You need to fetch lib$ipv6lib.a from appropriate"
267 echo 'ipv6 kit and compile beforehand.'
268 exit 1
269 fi
270 fi
271 fi
272
273
274 if test "$ipv6" = "yes"; then
275 #
276 # XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
277 # function in libc; there are "ngetaddrinfo()" and
278 # "ogetaddrinfo()" functions, and <netdb.h> #defines
279 # "getaddrinfo" to be either "ngetaddrinfo" or
280 # "ogetaddrinfo", depending on whether _SOCKADDR_LEN
281 # or _XOPEN_SOURCE_EXTENDED are defined or not.
282 #
283 # So this test doesn't work on Tru64 5.1, and possibly
284 # on other 5.x releases. This causes the configure
285 # script to become confused, and results in libpcap
286 # being unbuildable.
287 #
288 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
289 AC_MSG_CHECKING(getaddrinfo bug)
290 AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
291 #include <sys/types.h>
292 #include <netdb.h>
293 #include <string.h>
294 #include <sys/socket.h>
295 #include <netinet/in.h>
296
297 main()
298 {
299 int passive, gaierr, inet4 = 0, inet6 = 0;
300 struct addrinfo hints, *ai, *aitop;
301 char straddr[INET6_ADDRSTRLEN], strport[16];
302
303 for (passive = 0; passive <= 1; passive++) {
304 memset(&hints, 0, sizeof(hints));
305 hints.ai_family = AF_UNSPEC;
306 hints.ai_flags = passive ? AI_PASSIVE : 0;
307 hints.ai_socktype = SOCK_STREAM;
308 hints.ai_protocol = IPPROTO_TCP;
309 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
310 (void)gai_strerror(gaierr);
311 goto bad;
312 }
313 for (ai = aitop; ai; ai = ai->ai_next) {
314 if (ai->ai_addr == NULL ||
315 ai->ai_addrlen == 0 ||
316 getnameinfo(ai->ai_addr, ai->ai_addrlen,
317 straddr, sizeof(straddr), strport, sizeof(strport),
318 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
319 goto bad;
320 }
321 switch (ai->ai_family) {
322 case AF_INET:
323 if (strcmp(strport, "54321") != 0) {
324 goto bad;
325 }
326 if (passive) {
327 if (strcmp(straddr, "0.0.0.0") != 0) {
328 goto bad;
329 }
330 } else {
331 if (strcmp(straddr, "127.0.0.1") != 0) {
332 goto bad;
333 }
334 }
335 inet4++;
336 break;
337 case AF_INET6:
338 if (strcmp(strport, "54321") != 0) {
339 goto bad;
340 }
341 if (passive) {
342 if (strcmp(straddr, "::") != 0) {
343 goto bad;
344 }
345 } else {
346 if (strcmp(straddr, "::1") != 0) {
347 goto bad;
348 }
349 }
350 inet6++;
351 break;
352 case AF_UNSPEC:
353 goto bad;
354 break;
355 #ifdef AF_UNIX
356 case AF_UNIX:
357 #else
358 #ifdef AF_LOCAL
359 case AF_LOCAL:
360 #endif
361 #endif
362 default:
363 /* another family support? */
364 break;
365 }
366 }
367 }
368
369 /* supported family should be 2, unsupported family should be 0 */
370 if (!(inet4 == 0 || inet4 == 2))
371 goto bad;
372 if (!(inet6 == 0 || inet6 == 2))
373 goto bad;
374
375 if (aitop)
376 freeaddrinfo(aitop);
377 exit(0);
378
379 bad:
380 if (aitop)
381 freeaddrinfo(aitop);
382 exit(1);
383 }
384 ],
385 td_cv_buggygetaddrinfo=no,
386 td_cv_buggygetaddrinfo=yes,
387 td_cv_buggygetaddrinfo=yes)])
388 if test "$td_cv_buggygetaddrinfo" = no; then
389 AC_MSG_RESULT(good)
390 else
391 AC_MSG_RESULT(buggy)
392 fi
393
394 if test "$td_cv_buggygetaddrinfo" = "yes"; then
395 #
396 # XXX - it doesn't appear that "ipv6type" can ever be
397 # set to "linux". Should this be testing for
398 # "linux-glibc", or for that *or* "linux-libinet6"?
399 # If the latter, note that "linux-libinet6" is also
400 # the type given to some non-Linux OSes.
401 #
402 if test "$ipv6type" != "linux"; then
403 echo 'Fatal: You must get working getaddrinfo() function.'
404 echo ' or you can specify "--disable-ipv6"'.
405 exit 1
406 else
407 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
408 echo ' Better upgrade your system library to newest version'
409 echo ' of GNU C library (aka glibc).'
410 fi
411 fi
412 ])
413 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
414 fi
415
416 AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
417 [td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
418 [AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
419 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
420 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
421 if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
422 AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA)
423 fi
424
425 dnl
426 dnl check sizeof basic types.
427 dnl They're very likely to be wrong for cross-compiling.
428 AC_CHECK_SIZEOF(char, 1)
429 AC_CHECK_SIZEOF(short, 2)
430 AC_CHECK_SIZEOF(int, 4)
431 AC_CHECK_SIZEOF(long, 4)
432 AC_CHECK_SIZEOF(long long, 8)
433
434 dnl
435 dnl Checks for u_intXX_t
436 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
437 dnl if test "$ac_cv_bittypes" = no; then
438 dnl missing_includes=yes
439 dnl fi
440
441 dnl
442 dnl Checks for addrinfo structure
443 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
444 if test "$ac_cv_addrinfo" = no; then
445 missing_includes=yes
446 fi
447
448 dnl
449 dnl Checks for NI_MAXSERV
450 AC_NI_MAXSERV(ac_cv_maxserv)
451 if test "$ac_cv_maxserv" = no; then
452 missing_includes=yes
453 fi
454
455 dnl
456 dnl Checks for NI_NAMEREQD
457 AC_NI_NAMEREQD(ac_cv_namereqd)
458 if test "$ac_cv_namereqd" = no; then
459 missing_includes=yes
460 fi
461
462 dnl
463 dnl Checks for sockaddr_storage structure
464 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
465 if test "$ac_cv_sa_storage" = no; then
466 missing_includes=yes
467 fi
468
469 dnl
470 dnl Checks for IN[6]ADDRSZ
471 AC_CHECK_ADDRSZ(ac_cv_addrsz)
472 if test "$ac_cv_addrsz" = no; then
473 missing_includes=yes
474 fi
475
476 dnl
477 dnl Checks for RES_USE_INET6
478 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
479 if test "$ac_cv_res_inet6" = no; then
480 missing_includes=yes
481 fi
482
483 dnl
484 dnl Checks for res_state_ext structure
485 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
486 if test "$ac_cv_res_state_ext" = no; then
487 missing_includes=yes
488 fi
489
490 dnl
491 dnl Checks if res_state structure has nsort member.
492 AC_STRUCT_RES_STATE(ac_cv_res_state)
493
494
495 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
496 AC_CHECK_FUNCS(strftime)
497 AC_CHECK_FUNCS(ether_ntohost, [
498 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
499 AC_TRY_RUN([
500 #include <netdb.h>
501 #include <sys/types.h>
502 #include <sys/param.h>
503 #include <sys/socket.h>
504
505 int
506 main(int argc, char **argv)
507 {
508 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
509 char name[MAXHOSTNAMELEN];
510
511 ether_ntohost(name, (struct ether_addr *)ea);
512 exit(0);
513 }
514 ], [ac_cv_buggy_ether_ntohost=no],
515 [ac_cv_buggy_ether_ntohost=yes],
516 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
517 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
518 AC_DEFINE(USE_ETHER_NTOHOST)
519 fi
520 ])
521 AC_CHECK_FUNCS(setlinebuf alarm)
522
523 needsnprintf=no
524 AC_CHECK_FUNCS(vsnprintf snprintf,,
525 [needsnprintf=yes])
526 if test $needsnprintf = yes; then
527 AC_LIBOBJ(snprintf)
528 fi
529
530 AC_LBL_TYPE_SIGNAL
531
532 AC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))
533
534 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
535
536 dnl HP/UX may need -lnsl for getrpcbynumber.
537 AC_SEARCH_LIBS(getrpcbynumber, nsl)
538
539 dnl AC_CHECK_LIB(z, uncompress)
540 dnl AC_CHECK_HEADERS(zlib.h)
541
542 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
543
544 #
545 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
546 # libraries (e.g., "-lsocket -lnsl" on Solaris).
547 #
548 # We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
549 # use AC_CHECK_FUNC which doesn't let us specify the right #includes
550 # to make this work on BSD/OS 4.x. BSD/OS 4.x ships with the BIND8
551 # resolver, and the way it defines inet_{ntop,pton} is rather strange;
552 # it does not ship with a libc symbol "inet_ntop()", it ships with
553 # "_inet_ntop()", and has a #define macro in one of the system headers
554 # to rename it.
555 #
556 dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
557 AC_MSG_CHECKING(for inet_ntop)
558 AC_TRY_LINK([#include <sys/types.h>
559 #include <sys/socket.h>
560 #include <netinet/in.h>
561 #include <arpa/inet.h>], [char src[4], dst[128];
562 inet_ntop(AF_INET, src, dst, sizeof(dst));],
563 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
564 AC_LIBOBJ(inet_ntop)])
565 AC_MSG_CHECKING(for inet_pton)
566 AC_TRY_LINK([#include <sys/types.h>
567 #include <sys/socket.h>
568 #include <netinet/in.h>
569 #include <arpa/inet.h>], [char src[128], dst[4];
570 inet_pton(AF_INET, src, dst);],
571 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
572 AC_LIBOBJ(inet_pton)])
573 AC_MSG_CHECKING(for inet_aton)
574 AC_TRY_LINK([#include <sys/types.h>
575 #include <netinet/in.h>
576 #include <arpa/inet.h>], [char src[128];
577 struct in_addr dst;
578 inet_aton(src, &dst);],
579 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
580 AC_LIBOBJ(inet_aton)])
581
582 dnl portability macros for getaddrinfo/getnameinfo
583 dnl
584 dnl Check for sa_len
585 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
586 if test "$ac_cv_sockaddr_has_sa_len" = no; then
587 missing_includes=yes
588 fi
589
590 AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)
591 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
592 dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
593 dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
594 dnl have pcap_if_t.
595 savedcflags="$CFLAGS"
596 CFLAGS="$CFLAGS $V_INCLS"
597 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
598 CFLAGS="$savedcflags"
599 fi
600
601 if test $ac_cv_func_pcap_lib_version = "no" ; then
602 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
603 AC_TRY_LINK([],
604 [
605 char *
606 return_pcap_version(void)
607 {
608 extern char pcap_version[];
609
610 return pcap_version;
611 }
612 ],
613 ac_lbl_cv_pcap_version_defined=yes,
614 ac_lbl_cv_pcap_version_defined=no)
615 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
616 AC_MSG_RESULT(yes)
617 AC_DEFINE(HAVE_PCAP_VERSION)
618 else
619 AC_MSG_RESULT(no)
620 fi
621 fi
622 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
623 AC_TRY_LINK([],
624 [
625 int
626 return_pcap_debug(void)
627 {
628 extern int pcap_debug;
629
630 return pcap_debug;
631 }
632 ],
633 ac_lbl_cv_pcap_debug_defined=yes,
634 ac_lbl_cv_pcap_debug_defined=no)
635 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
636 AC_MSG_RESULT(yes)
637 AC_DEFINE(HAVE_PCAP_DEBUG)
638 else
639 AC_MSG_RESULT(no)
640 #
641 # OK, what about "yydebug"?
642 #
643 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
644 AC_TRY_LINK([],
645 [
646 int
647 return_yydebug(void)
648 {
649 extern int yydebug;
650
651 return yydebug;
652 }
653 ],
654 ac_lbl_cv_yydebug_defined=yes,
655 ac_lbl_cv_yydebug_defined=no)
656 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
657 AC_MSG_RESULT(yes)
658 AC_DEFINE(HAVE_YYDEBUG)
659 else
660 AC_MSG_RESULT(no)
661 fi
662 fi
663 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
664
665 V_GROUP=0
666 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
667 V_GROUP=wheel
668 fi
669 case "$host_os" in
670
671 aix*)
672 dnl Workaround to enable certain features
673 AC_DEFINE(_SUN)
674 ;;
675
676 irix*)
677 V_GROUP=sys
678 ;;
679
680 osf*)
681 V_GROUP=system
682 ;;
683
684 solaris*)
685 V_GROUP=sys
686 ;;
687 esac
688
689 if test -f /dev/bpf0 ; then
690 V_GROUP=bpf
691 fi
692
693 AC_LBL_CHECK_TYPE(int8_t, signed char)
694 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
695 AC_LBL_CHECK_TYPE(int16_t, short)
696 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
697 AC_LBL_CHECK_TYPE(int32_t, int)
698 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
699 AC_LBL_CHECK_TYPE(int64_t, long long)
700 AC_LBL_CHECK_TYPE(u_int64_t, unsigned long long)
701
702 #
703 # We can't just check for <inttypes.h> - some systems have one that
704 # doesn't define all the PRI[doxu]64 macros.
705 #
706 AC_CHECK_HEADERS(inttypes.h,
707 [
708 #
709 # OK, we have inttypes.h, but does it define those macros?
710 #
711 AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
712 AC_COMPILE_IFELSE(
713 [
714 AC_LANG_SOURCE(
715 [[
716 #include <inttypes.h>
717 #include <stdio.h>
718 #include <sys/types.h>
719
720 main()
721 {
722 printf("%" PRId64 "\n", (u_int64_t)1);
723 printf("%" PRIo64 "\n", (u_int64_t)1);
724 printf("%" PRIx64 "\n", (u_int64_t)1);
725 printf("%" PRIu64 "\n", (u_int64_t)1);
726 }
727 ]])
728 ],
729 [
730 AC_MSG_RESULT(yes)
731 ac_lbl_inttypes_h_defines_formats=yes
732 ],
733 [
734 AC_MSG_RESULT(no)
735 ac_lbl_inttypes_h_defines_formats=no
736 ])
737 ],
738 [
739 #
740 # We don't have inttypes.h, so it obviously can't define those
741 # macros.
742 #
743 ac_lbl_inttypes_h_defines_formats=no
744 ])
745 if test "$ac_lbl_inttypes_h_defines_formats" = yes; then
746 AC_DEFINE(INTTYPES_H_DEFINES_FORMATS)
747 else
748 AC_LBL_CHECK_64BIT_FORMAT(ll,
749 [
750 AC_LBL_CHECK_64BIT_FORMAT(L,
751 [
752 AC_LBL_CHECK_64BIT_FORMAT(q,
753 [
754 AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
755 ])
756 ])
757 ])
758 fi
759
760 AC_LBL_DEVEL(V_CCOPT)
761
762 AC_LBL_SOCKADDR_SA_LEN
763
764 AC_LBL_UNALIGNED_ACCESS
765
766 AC_VAR_H_ERRNO
767
768 AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
769 [], [
770 AC_MSG_CHECKING(for SSLeay)
771 ac_cv_ssleay_path=no
772 incdir=no
773
774 Xprefix=`eval echo $prefix`
775
776 for dir in $Xprefix /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
777 #
778 # XXX - is there a better way to check if a given library is
779 # in a given directory than checking each of the possible
780 # shared library suffixes?
781 #
782 # Are there any other suffixes we need to look for? Do we have to
783 # worry about ".so.{version}"?
784 #
785 # Or should we just look for "libcrypto.*"?
786 #
787 if test -d $dir/lib -a \( -f $dir/lib/libcrypto.a -o \
788 -f $dir/lib/libcrypto.so -o \
789 -f $dir/lib/libcrypto.sl -o \
790 -f $dir/lib/libcrypto.dylib \); then
791 ac_cv_ssleay_path=$dir
792 fi
793 if test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
794 incdir="-I$dir/include"
795 fi
796 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
797 break;
798 else
799 ac_cv_ssleay_path=no
800 incdir=no
801 fi
802 done
803 AC_MSG_RESULT($ac_cv_ssleay_path)
804 if test "$ac_cv_ssleay_path" != no; then
805 V_INCLS="$V_INCLS $incdir"
806 LDFLAGS="-L$dir/lib $LDFLAGS"
807 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
808 LIBS="$LIBS -lRSAglue"
809 fi
810 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
811 LIBS="$LIBS -lrsaref"
812 fi
813 AC_CHECK_LIB(crypto, DES_cbc_encrypt)
814
815 CPPFLAGS="$CPPFLAGS $V_INCLS"
816 AC_CHECK_HEADERS(openssl/evp.h)
817 fi
818 ])
819
820 dnl
821 dnl set additional include path if necessary
822 if test "$missing_includes" = "yes"; then
823 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
824 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
825 fi
826
827 AC_SUBST(V_CCOPT)
828 AC_SUBST(V_DEFS)
829 AC_SUBST(V_GROUP)
830 AC_SUBST(V_INCLS)
831 AC_SUBST(V_PCAPDEP)
832 AC_SUBST(LOCALSRC)
833
834 AC_PROG_INSTALL
835
836 AC_CONFIG_HEADER(config.h)
837
838 AC_OUTPUT_COMMANDS([if test -f .devel; then
839 echo timestamp > stamp-h
840 cat Makefile-devel-adds >> Makefile
841 make depend
842 fi])
843 AC_OUTPUT(Makefile)
844 exit 0