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