1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.87 1999-12-29 01:12:54 mcr 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)
22 AC_CHECK_HEADERS(fcntl.h malloc.h memory.h rpc/rpcent.h)
28 AC_MSG_CHECKING(Linux kernel version)
29 AC_CACHE_VAL(ac_cv_linux_vers,
30 ac_cv_linux_vers=`uname -r 2>&1 | \
31 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
32 AC_MSG_RESULT($ac_cv_linux_vers)
33 if test $ac_cv_linux_vers -lt 2 ; then
34 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
36 AC_DEFINE(HAVE_NET_SLIP_H)
40 AC_CHECK_HEADERS(net/slip.h)
45 AC_CHECK_HEADERS(smi.h)
46 AC_CHECK_LIB(smi, main)
47 AC_MSG_CHECKING([whether to enable libsmi])
48 AC_TRY_RUN([ /* libsmi available check */
66 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
67 AC_MSG_CHECKING([whether to enable ipv6])
69 [ --enable-ipv6 enable ipv6 (with ipv4) support
70 --disable-ipv6 disable ipv6 support],
71 [ case "$enableval" in
72 yes) AC_MSG_RESULT(yes)
73 AC_DEFINE(ENABLE_IPV6)
74 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"
84 AC_TRY_RUN([ /* AF_INET6 available check */
85 #include <sys/types.h>
86 #include <sys/socket.h>
89 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
96 AC_DEFINE(ENABLE_IPV6)
97 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"
110 if test "$ipv6" = "yes"; then
111 AC_MSG_CHECKING([ipv6 stack type])
112 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
115 dnl http://www.kame.net/
116 AC_EGREP_CPP(yes, [dnl
117 #include <netinet/in.h>
118 #ifdef IPV6_INRIA_VERSION
122 CFLAGS="-DINET6 $CFLAGS"])
125 dnl http://www.kame.net/
126 AC_EGREP_CPP(yes, [dnl
127 #include <netinet/in.h>
133 ipv6libdir=/usr/local/v6/lib;
135 CFLAGS="-DINET6 $CFLAGS"])
138 dnl http://www.v6.linux.or.jp/
139 AC_EGREP_CPP(yes, [dnl
140 #include <features.h>
141 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
145 CFLAGS="-DINET6 $CFLAGS"])
148 dnl http://www.v6.linux.or.jp/
149 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
152 ipv6libdir=/usr/inet6/lib
154 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
158 AC_EGREP_CPP(yes, [dnl
159 #include <sys/param.h>
160 #ifdef _TOSHIBA_INET6
165 ipv6libdir=/usr/local/v6/lib;
166 CFLAGS="-DINET6 $CFLAGS"])
169 AC_EGREP_CPP(yes, [dnl
170 #include </usr/local/v6/include/sys/v6config.h>
176 ipv6libdir=/usr/local/v6/lib;
177 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
180 AC_EGREP_CPP(yes, [dnl
181 #include <sys/param.h>
182 #ifdef _ZETA_MINAMI_INET6
187 ipv6libdir=/usr/local/v6/lib;
188 CFLAGS="-DINET6 $CFLAGS"])
191 if test "$ipv6type" != "unknown"; then
195 AC_MSG_RESULT($ipv6type)
198 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
199 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
200 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
201 echo "You have $ipv6lib library, using it"
203 if test "$ipv6trylibc" = "yes"; then
204 echo "You do not have $ipv6lib library, using libc"
206 echo 'Fatal: no $ipv6lib library found. cannot continue.'
207 echo "You need to fetch lib$ipv6lib.a from appropriate"
208 echo 'ipv6 kit and compile beforehand.'
215 AC_MSG_CHECKING(getaddrinfo bug)
217 #include <sys/types.h>
220 #include <sys/socket.h>
221 #include <netinet/in.h>
225 int passive, gaierr, inet4 = 0, inet6 = 0;
226 struct addrinfo hints, *ai, *aitop;
227 char straddr[INET6_ADDRSTRLEN], strport[16];
229 for (passive = 0; passive <= 1; passive++) {
230 memset(&hints, 0, sizeof(hints));
231 hints.ai_family = AF_UNSPEC;
232 hints.ai_flags = passive ? AI_PASSIVE : 0;
233 hints.ai_socktype = SOCK_STREAM;
234 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
235 (void)gai_strerror(gaierr);
238 for (ai = aitop; ai; ai = ai->ai_next) {
239 if (ai->ai_addr == NULL ||
240 ai->ai_addrlen == 0 ||
241 getnameinfo(ai->ai_addr, ai->ai_addrlen,
242 straddr, sizeof(straddr), strport, sizeof(strport),
243 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
246 switch (ai->ai_family) {
248 if (strcmp(strport, "54321") != 0) {
252 if (strcmp(straddr, "0.0.0.0") != 0) {
256 if (strcmp(straddr, "127.0.0.1") != 0) {
263 if (strcmp(strport, "54321") != 0) {
267 if (strcmp(straddr, "::") != 0) {
271 if (strcmp(straddr, "::1") != 0) {
288 /* another family support? */
294 if (inet6 != 2 || inet4 != 2)
310 buggygetaddrinfo=yes,
312 buggygetaddrinfo=yes)
314 if test "$buggygetaddrinfo" = "yes"; then
315 if test "$ipv6" = "yes" -a "$ipv6type" != "linux"; then
316 echo 'Fatal: You must get working getaddrinfo() function.'
317 echo ' or you can specify "--disable-ipv6"'.
319 elif test "$ipv6type" = "linux"; then
320 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
321 echo ' Better upgreade your system library to newest version'
322 echo ' of GNU C library (aka glibc).'
325 AC_REPLACE_FUNCS(getaddrinfo getnameinfo inet_ntop inet_pton inet_aton)
327 dnl portability macros for getaddrinfo/getnameinfo
330 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
331 if test "$ac_cv_sockaddr_has_sa_len" = no; then
337 AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
338 if test "$ac_cv_portable_proto" = no; then
343 dnl check sizeof basic types
344 AC_CHECK_SIZEOF(char)
345 AC_CHECK_SIZEOF(short)
347 AC_CHECK_SIZEOF(long)
350 dnl Checks for u_intXX_t
351 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
352 dnl if test "$ac_cv_bittypes" = no; then
353 dnl missing_includes=yes
357 dnl Checks for addrinfo structure
358 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
359 if test "$ac_cv_addrinfo" = no; then
364 dnl Checks for sockaddr_storage structure
365 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
366 if test "$ac_cv_sa_storage" = no; then
371 dnl Checks for IN[6]ADDRSZ
372 AC_CHECK_ADDRSZ(ac_cv_addrsz)
373 if test "$ac_cv_addrsz" = no; then
378 dnl Checks for RES_USE_INET6
379 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
380 if test "$ac_cv_res_inet6" = no; then
386 AC_CHECK_AAAA(ac_cv_aaaa)
387 if test "$ac_cv_aaaa" = no; then
388 AC_DEFINE(T_AAAA, 28)
392 dnl Checks for res_state_ext structure
393 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
394 if test "$ac_cv_res_state_ext" = no; then
399 dnl Checks if res_state structure has nsort member.
400 AC_STRUCT_RES_STATE(ac_cv_res_state)
403 dnl set additional include path if necessary
404 if test "$missing_includes" = "yes"; then
405 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
406 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
410 AC_REPLACE_FUNCS(vfprintf strcasecmp)
411 AC_CHECK_FUNCS(ether_ntohost setlinebuf gethostbyname2)
413 dnl The following generates a warning from autoconf...
416 AC_CHECK_LIB(dnet, main)
417 AC_CHECK_LIB(rpc, main)
418 AC_CHECK_LIB(z, uncompress)
419 AC_CHECK_HEADERS(zlib.h netinet6/ipcomp.h)
423 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
426 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
432 dnl Workaround to enable certain features
441 V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
446 dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
447 AC_DEFINE(__STDC__,2)
455 if test -f /dev/bpf0 ; then
459 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
460 AC_LBL_CHECK_TYPE(int16_t, short)
461 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
462 AC_LBL_CHECK_TYPE(int32_t, int)
463 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
465 AC_LBL_DEVEL(V_CCOPT)
467 AC_LBL_SOCKADDR_SA_LEN
469 AC_MSG_CHECKING(if ether_header uses ether_addr structs)
470 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
471 LBL_SAVE_CFLAGS="$CFLAGS"
472 CFLAGS="$CFLAGS $V_INCLS"
474 # include <sys/types.h>
476 /* osf3 has REALLY good prototyes */
480 # include <sys/socket.h>
482 # include <netinet/in.h>
483 # include <netinet/if_ether.h>],
485 sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
486 ac_cv_ether_header_has_ea=yes,
487 ac_cv_ether_header_has_ea=no)
488 CFLAGS="$LBL_SAVE_CFLAGS")
489 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
490 if test $ac_cv_ether_header_has_ea = yes ; then
491 AC_DEFINE(ETHER_HEADER_HAS_EA)
494 AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
495 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
496 LBL_SAVE_CFLAGS="$CFLAGS"
497 CFLAGS="$CFLAGS $V_INCLS"
499 # include <sys/types.h>
501 /* osf3 has REALLY good prototyes */
505 # include <sys/socket.h>
507 # include <netinet/in.h>
508 # include <netinet/if_ether.h>],
510 sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
511 ac_cv_ether_arp_has_ea=yes,
512 ac_cv_ether_arp_has_ea=no)
513 CFLAGS="$LBL_SAVE_CFLAGS")
514 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
515 if test $ac_cv_ether_arp_has_ea = yes ; then
516 AC_DEFINE(ETHER_ARP_HAS_EA)
519 AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
520 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
521 LBL_SAVE_CFLAGS="$CFLAGS"
522 CFLAGS="$CFLAGS $V_INCLS"
524 # include <sys/types.h>
525 # include <sys/socket.h>
527 /* osf3 has REALLY good prototyes */
532 # include <netinet/in.h>
533 # include <netinet/if_ether.h>],
534 [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
535 ac_cv_struct_ether_arp_x=yes,
536 ac_cv_struct_ether_arp_x=no)
537 CFLAGS="$LBL_SAVE_CFLAGS")
538 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
539 if test $ac_cv_struct_ether_arp_x = yes ; then
540 AC_DEFINE(ETHER_ARP_HAS_X)
543 AC_LBL_UNALIGNED_ACCESS
547 AC_MSG_CHECKING(for SSLeay)
550 for dir in /usr/local /usr/local/ssl /usr/pkg; do
551 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
552 ac_cv_ssleay_path=$dir
554 if test -d $dir/include -a -f $dir/include/des.h; then
555 incdir="-I$dir/include"
557 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
558 incdir="-I$dir/include/ssleay"
559 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
560 incdir="-I$dir/include -I$dir/include/openssl"
563 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
570 AC_MSG_RESULT($ac_cv_ssleay_path)
571 if test "$ac_cv_ssleay_path" != no; then
572 V_INCLS="$V_INCLS $incdir"
573 LIBS="$LIBS -L$dir/lib"
574 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
575 LIBS="$LIBS -lRSAglue"
577 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
578 LIBS="$LIBS -lrsaref"
580 AC_CHECK_LIB(crypto, des_cbc_encrypt)
583 bak_CPPFLAGS=$CPPFLAGS
584 CPPFLAGS="$CPPFLAGS $V_INCLS"
585 AC_CHECK_HEADERS(cast.h rc5.h)
587 if test "$ac_cv_header_cast_h" = "yes"; then
588 AC_MSG_CHECKING(for buggy CAST128)
594 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
595 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
596 unsigned char out[sizeof(in)];
597 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
599 CAST_set_key(&ks, sizeof(key), key);
600 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
601 if (memcmp(out, ok, sizeof(ok)) != 0)
608 [buggy_cast128="cross-compiling, assume yes"])
609 AC_MSG_RESULT($buggy_cast128)
610 if test "$buggy_cast128" != no; then
611 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
612 echo "disabling CAST128 support."
613 AC_DEFINE(HAVE_BUGGY_CAST128)
617 CPPFLAGS=$bak_CPPFLAGS
620 if test -r ${srcdir}/lbl/gnuc.h ; then
622 ln -s ${srcdir}/lbl/gnuc.h gnuc.h
633 AC_CONFIG_HEADER(config.h)
637 if test -f .devel ; then