1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.74 1999-10-30 05:11:08 itojun Exp $ (LBL)
3 dnl Copyright (c) 1994, 1995, 1996, 1997
4 dnl The Regents of the University of California. All rights reserved.
6 dnl Process this file with autoconf to produce a configure script.
15 if test -z "$PWD" ; then
19 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
21 AC_CHECK_HEADERS(fcntl.h malloc.h memory.h rpc/rpcent.h)
27 AC_MSG_CHECKING(Linux kernel version)
28 AC_CACHE_VAL(ac_cv_linux_vers,
29 ac_cv_linux_vers=`uname -r 2>&1 | \
30 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
31 AC_MSG_RESULT($ac_cv_linux_vers)
32 if test $ac_cv_linux_vers -lt 2 ; then
33 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
35 AC_DEFINE(HAVE_NET_SLIP_H)
39 AC_CHECK_HEADERS(net/slip.h)
43 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
44 AC_MSG_CHECKING([whether to enable ipv6])
46 [ --enable-ipv6 Enable ipv6 (with ipv4) support
47 --disable-ipv6 Disable ipv6 support],
48 [ case "$enableval" in
54 AC_DEFINE(ENABLE_IPV6)
55 LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
61 AC_TRY_RUN([ /* AF_INET6 avalable check */
62 #include <sys/types.h>
63 #include <sys/socket.h>
67 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
74 AC_DEFINE(ENABLE_IPV6)
75 LOCALSRC="print-ip6.c print-ip6opts.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
88 if test "$ipv6" = "yes"; then
89 AC_MSG_CHECKING([ipv6 stack type])
90 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
93 dnl http://www.kame.net/
94 AC_EGREP_CPP(yes, [dnl
95 #include <netinet/in.h>
96 #ifdef IPV6_INRIA_VERSION
100 CFLAGS="-DINET6 $CFLAGS"])
103 dnl http://www.kame.net/
104 AC_EGREP_CPP(yes, [dnl
105 #include <netinet/in.h>
111 ipv6libdir=/usr/local/v6/lib;
113 CFLAGS="-DINET6 $CFLAGS"])
116 dnl http://www.v6.linux.or.jp/
117 AC_EGREP_CPP(yes, [dnl
118 #include <features.h>
119 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
123 CFLAGS="-DINET6 $CFLAGS"])
126 dnl http://www.v6.linux.or.jp/
127 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
130 ipv6libdir=/usr/inet6/lib
132 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
136 AC_EGREP_CPP(yes, [dnl
137 #include <sys/param.h>
138 #ifdef _TOSHIBA_INET6
143 ipv6libdir=/usr/local/v6/lib;
144 CFLAGS="-DINET6 $CFLAGS"])
147 AC_EGREP_CPP(yes, [dnl
148 #include </usr/local/v6/include/sys/v6config.h>
154 ipv6libdir=/usr/local/v6/lib;
155 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
158 AC_EGREP_CPP(yes, [dnl
159 #include <sys/param.h>
160 #ifdef _ZETA_MINAMI_INET6
165 ipv6libdir=/usr/local/v6/lib;
166 CFLAGS="-DINET6 $CFLAGS"])
169 if test "$ipv6type" != "unknown"; then
173 AC_MSG_RESULT($ipv6type)
176 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
177 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
178 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
179 echo "You have $ipv6lib library, using it"
181 if test "$ipv6trylibc" = "yes"; then
182 echo "You do not have $ipv6lib library, using libc"
184 echo 'Fatal: no $ipv6lib library found. cannot continue.'
185 echo "You need to fetch lib$ipv6lib.a from appropriate"
186 echo 'ipv6 kit and compile beforehand.'
193 AC_MSG_CHECKING(getaddrinfo bug)
195 #include <sys/types.h>
198 #include <sys/socket.h>
199 #include <netinet/in.h>
203 int passive, gaierr, inet4 = 0, inet6 = 0;
204 struct addrinfo hints, *ai, *aitop;
205 char straddr[INET6_ADDRSTRLEN], strport[16];
207 for (passive = 0; passive <= 1; passive++) {
208 memset(&hints, 0, sizeof(hints));
209 hints.ai_family = AF_UNSPEC;
210 hints.ai_flags = passive ? AI_PASSIVE : 0;
211 hints.ai_socktype = SOCK_STREAM;
212 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
213 (void)gai_strerror(gaierr);
216 for (ai = aitop; ai; ai = ai->ai_next) {
217 if (ai->ai_addr == NULL ||
218 ai->ai_addrlen == 0 ||
219 getnameinfo(ai->ai_addr, ai->ai_addrlen,
220 straddr, sizeof(straddr), strport, sizeof(strport),
221 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
224 switch (ai->ai_family) {
226 if (strcmp(strport, "54321") != 0) {
230 if (strcmp(straddr, "0.0.0.0") != 0) {
234 if (strcmp(straddr, "127.0.0.1") != 0) {
241 if (strcmp(strport, "54321") != 0) {
245 if (strcmp(straddr, "::") != 0) {
249 if (strcmp(straddr, "::1") != 0) {
266 /* another family support? */
272 if (inet6 != 2 || inet4 != 2)
288 buggygetaddrinfo=yes,
290 buggygetaddrinfo=yes)
292 if test "$buggygetaddrinfo" = "yes"; then
293 if test "$ipv6" = "yes" -a "$ipv6type" != "linux"; then
294 echo 'Fatal: You must get working getaddrinfo() function.'
295 echo ' or you can specify "--disable-ipv6"'.
297 elif test "$ipv6type" = "linux"; then
298 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
299 echo ' Better upgreade your system library to newest version'
300 echo ' of GNU C library (aka glibc).'
303 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
305 dnl portability macros for getaddrinfo/getnameinfo
308 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
309 if test "$ac_cv_sockaddr_has_sa_len" = no; then
315 AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
316 if test "$ac_cv_portable_proto" = no; then
321 dnl check sizeof basic types
322 AC_CHECK_SIZEOF(char)
323 AC_CHECK_SIZEOF(short)
325 AC_CHECK_SIZEOF(long)
328 dnl Checks for u_intXX_t
329 AC_CHECK_BITTYPES(ac_cv_bittypes)
330 if test "$ac_cv_bittypes" = no; then
335 dnl Checks for addrinfo structure
336 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
337 if test "$ac_cv_addrinfo" = no; then
342 dnl Checks for sockaddr_storage structure
343 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
344 if test "$ac_cv_sa_storage" = no; then
349 dnl Checks for IN[6]ADDRSZ
350 AC_CHECK_ADDRSZ(ac_cv_addrsz)
351 if test "$ac_cv_addrsz" = no; then
356 dnl Checks for RES_USE_INET6
357 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
358 if test "$ac_cv_res_inet6" = no; then
364 AC_CHECK_AAAA(ac_cv_aaaa)
365 if test "$ac_cv_aaaa" = no; then
366 AC_DEFINE(T_AAAA, 28)
370 dnl Checks for res_state_ext structure
371 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
372 if test "$ac_cv_res_state_ext" = no; then
377 dnl Checks if res_state structure has nsort member.
378 AC_STRUCT_RES_STATE(ac_cv_res_state)
381 dnl set additional include path if necessary
382 if test "$missing_includes" = "yes"; then
383 CPPFLAGS="$CPPFLAGS -I./missing"
387 AC_REPLACE_FUNCS(vfprintf strcasecmp)
388 AC_CHECK_FUNCS(ether_ntoa setlinebuf)
390 dnl The following generates a warning from autoconf...
393 AC_CHECK_LIB(dnet, main)
394 AC_CHECK_LIB(rpc, main)
395 AC_CHECK_LIB(z, uncompress)
396 AC_CHECK_HEADERS(zlib.h netinet6/ipcomp.h)
400 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
403 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
409 dnl Workaround to enable certain features
418 V_INCLS="$V_INCLS -Ilinux-include"
423 dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
424 AC_DEFINE(__STDC__,2)
432 if test -f /dev/bpf0 ; then
436 AC_LBL_CHECK_TYPE(int32_t, int)
437 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
439 AC_LBL_DEVEL(V_CCOPT)
441 AC_LBL_SOCKADDR_SA_LEN
443 AC_MSG_CHECKING(if ether_header uses ether_addr structs)
444 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
445 LBL_SAVE_CFLAGS="$CFLAGS"
446 CFLAGS="$CFLAGS $V_INCLS"
448 # include <sys/types.h>
450 /* osf3 has REALLY good prototyes */
454 # include <sys/socket.h>
456 # include <netinet/in.h>
457 # include <netinet/if_ether.h>],
459 sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
460 ac_cv_ether_header_has_ea=yes,
461 ac_cv_ether_header_has_ea=no)
462 CFLAGS="$LBL_SAVE_CFLAGS")
463 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
464 if test $ac_cv_ether_header_has_ea = yes ; then
465 AC_DEFINE(ETHER_HEADER_HAS_EA)
468 AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
469 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
470 LBL_SAVE_CFLAGS="$CFLAGS"
471 CFLAGS="$CFLAGS $V_INCLS"
473 # include <sys/types.h>
475 /* osf3 has REALLY good prototyes */
479 # include <sys/socket.h>
481 # include <netinet/in.h>
482 # include <netinet/if_ether.h>],
484 sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
485 ac_cv_ether_arp_has_ea=yes,
486 ac_cv_ether_arp_has_ea=no)
487 CFLAGS="$LBL_SAVE_CFLAGS")
488 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
489 if test $ac_cv_ether_arp_has_ea = yes ; then
490 AC_DEFINE(ETHER_ARP_HAS_EA)
493 AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
494 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
495 LBL_SAVE_CFLAGS="$CFLAGS"
496 CFLAGS="$CFLAGS $V_INCLS"
498 # include <sys/types.h>
499 # include <sys/socket.h>
501 /* osf3 has REALLY good prototyes */
506 # include <netinet/in.h>
507 # include <netinet/if_ether.h>],
508 [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
509 ac_cv_struct_ether_arp_x=yes,
510 ac_cv_struct_ether_arp_x=no)
511 CFLAGS="$LBL_SAVE_CFLAGS")
512 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
513 if test $ac_cv_struct_ether_arp_x = yes ; then
514 AC_DEFINE(ETHER_ARP_HAS_X)
517 AC_LBL_UNALIGNED_ACCESS
519 AC_MSG_CHECKING(for SSLeay)
522 for dir in /usr/local /usr/local/ssl /usr/pkg; do
523 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
524 ac_cv_ssleay_path=$dir
526 if test -d $dir/include -a -f $dir/include/des.h; then
527 incdir="-I$dir/include"
529 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
530 incdir="-I$dir/include/ssleay"
531 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
532 incdir="-I$dir/include -I$dir/include/openssl"
535 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
542 AC_MSG_RESULT($ac_cv_ssleay_path)
543 if test "$ac_cv_ssleay_path" != no; then
544 V_INCLS="$V_INCLS $incdir"
545 LIBS="$LIBS -L$dir/lib"
546 AC_CHECK_LIB(crypto, des_cbc_encrypt)
549 bak_CPPFLAGS=$CPPFLAGS
550 CPPFLAGS="$CPPFLAGS $V_INCLS"
551 AC_CHECK_HEADERS(cast.h rc5.h)
553 if test "$ac_cv_header_cast_h" = "yes"; then
554 AC_MSG_CHECKING(for buggy CAST128)
560 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
561 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
562 unsigned char out[sizeof(in)];
563 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
565 CAST_set_key(&ks, sizeof(key), key);
566 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
567 if (memcmp(out, ok, sizeof(ok)) != 0)
574 [buggy_cast128="cross-compiling, assume yes"])
575 AC_MSG_RESULT($buggy_cast128)
576 if test "$buggy_cast128" != no; then
577 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
578 echo "disabling CAST128 support."
579 AC_DEFINE(HAVE_BUGGY_CAST128)
583 CPPFLAGS=$bak_CPPFLAGS
586 if test "${srcdir}" = "." ; then
592 if test -r ${srcdirprefix}lbl/gnuc.h ; then
594 ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h
607 if test -f .devel ; then