1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.114 2000-04-27 10:50:28 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.
9 AC_REVISION($Revision: 1.114 $)
17 if test -z "$PWD" ; then
21 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
25 AC_CHECK_HEADERS(fcntl.h malloc.h memory.h rpc/rpcent.h)
31 AC_MSG_CHECKING(Linux kernel version)
32 AC_CACHE_VAL(ac_cv_linux_vers,
33 ac_cv_linux_vers=`uname -r 2>&1 | \
34 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
35 AC_MSG_RESULT($ac_cv_linux_vers)
36 if test $ac_cv_linux_vers -lt 2 ; then
37 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
39 AC_DEFINE(HAVE_NET_SLIP_H)
43 AC_CHECK_HEADERS(net/slip.h)
48 AC_CHECK_HEADERS(smi.h)
49 AC_CHECK_LIB(smi, main)
50 AC_MSG_CHECKING([whether to enable libsmi])
51 AC_TRY_RUN([ /* libsmi available check */
66 [ AC_MSG_RESULT(not when cross-compiling)
71 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
72 AC_MSG_CHECKING([whether to enable ipv6])
74 [ --enable-ipv6 enable ipv6 (with ipv4) support
75 --disable-ipv6 disable ipv6 support],
76 [ case "$enableval" in
77 yes) AC_MSG_RESULT(yes)
78 AC_DEFINE(ENABLE_IPV6)
79 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"
89 AC_TRY_RUN([ /* AF_INET6 available check */
90 #include <sys/types.h>
91 #include <sys/socket.h>
94 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
101 AC_DEFINE(ENABLE_IPV6)
102 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"
115 if test "$ipv6" = "yes"; then
116 AC_MSG_CHECKING([ipv6 stack type])
117 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
120 dnl http://www.kame.net/
121 AC_EGREP_CPP(yes, [dnl
122 #include <netinet/in.h>
123 #ifdef IPV6_INRIA_VERSION
127 CFLAGS="-DINET6 $CFLAGS"])
130 dnl http://www.kame.net/
131 AC_EGREP_CPP(yes, [dnl
132 #include <netinet/in.h>
138 ipv6libdir=/usr/local/v6/lib;
140 CFLAGS="-DINET6 $CFLAGS"])
143 dnl http://www.v6.linux.or.jp/
144 AC_EGREP_CPP(yes, [dnl
145 #include <features.h>
146 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
150 CFLAGS="-DINET6 $CFLAGS"])
153 dnl http://www.v6.linux.or.jp/
154 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
157 ipv6libdir=/usr/inet6/lib
159 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
163 AC_EGREP_CPP(yes, [dnl
164 #include <sys/param.h>
165 #ifdef _TOSHIBA_INET6
170 ipv6libdir=/usr/local/v6/lib;
171 CFLAGS="-DINET6 $CFLAGS"])
174 AC_EGREP_CPP(yes, [dnl
175 #include </usr/local/v6/include/sys/v6config.h>
181 ipv6libdir=/usr/local/v6/lib;
182 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
185 AC_EGREP_CPP(yes, [dnl
186 #include <sys/param.h>
187 #ifdef _ZETA_MINAMI_INET6
192 ipv6libdir=/usr/local/v6/lib;
193 CFLAGS="-DINET6 $CFLAGS"])
196 if test "$ipv6type" != "unknown"; then
200 AC_MSG_RESULT($ipv6type)
203 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
204 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
205 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
206 echo "You have $ipv6lib library, using it"
208 if test "$ipv6trylibc" = "yes"; then
209 echo "You do not have $ipv6lib library, using libc"
211 echo 'Fatal: no $ipv6lib library found. cannot continue.'
212 echo "You need to fetch lib$ipv6lib.a from appropriate"
213 echo 'ipv6 kit and compile beforehand.'
220 if test "$ipv6" = "yes"; then
221 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
222 AC_MSG_CHECKING(getaddrinfo bug)
224 #include <sys/types.h>
227 #include <sys/socket.h>
228 #include <netinet/in.h>
232 int passive, gaierr, inet4 = 0, inet6 = 0;
233 struct addrinfo hints, *ai, *aitop;
234 char straddr[INET6_ADDRSTRLEN], strport[16];
236 for (passive = 0; passive <= 1; passive++) {
237 memset(&hints, 0, sizeof(hints));
238 hints.ai_family = AF_UNSPEC;
239 hints.ai_flags = passive ? AI_PASSIVE : 0;
240 hints.ai_socktype = SOCK_STREAM;
241 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
242 (void)gai_strerror(gaierr);
245 for (ai = aitop; ai; ai = ai->ai_next) {
246 if (ai->ai_addr == NULL ||
247 ai->ai_addrlen == 0 ||
248 getnameinfo(ai->ai_addr, ai->ai_addrlen,
249 straddr, sizeof(straddr), strport, sizeof(strport),
250 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
253 switch (ai->ai_family) {
255 if (strcmp(strport, "54321") != 0) {
259 if (strcmp(straddr, "0.0.0.0") != 0) {
263 if (strcmp(straddr, "127.0.0.1") != 0) {
270 if (strcmp(strport, "54321") != 0) {
274 if (strcmp(straddr, "::") != 0) {
278 if (strcmp(straddr, "::1") != 0) {
295 /* another family support? */
301 /* supported family should be 2, unsupported family should be 0 */
302 if (!(inet4 == 0 || inet4 == 2))
304 if (!(inet6 == 0 || inet6 == 2))
320 buggygetaddrinfo=yes,
322 buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
324 if test "$buggygetaddrinfo" = "yes"; then
325 if test "$ipv6type" != "linux"; then
326 echo 'Fatal: You must get working getaddrinfo() function.'
327 echo ' or you can specify "--disable-ipv6"'.
330 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
331 echo ' Better upgreade your system library to newest version'
332 echo ' of GNU C library (aka glibc).'
335 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
337 AC_REPLACE_FUNCS(inet_ntop inet_pton inet_aton)
339 dnl check for struct icmp6_mld and struct mld6_hdr
341 AC_CACHE_CHECK([for struct icmp6_mld],
342 ac_cv_struct_icmp6_mld,
343 [AC_EGREP_CPP([icmp6_mld],[dnl
344 #include <sys/types.h>
345 #include <netinet/icmp6.h>
347 ac_cv_struct_icmp6_mld=yes,
348 ac_cv_struct_icmp6_mld=no)])
349 if test "$ac_cv_struct_icmp6_mld" = "yes"; then
350 AC_DEFINE(HAVE_STRUCT_ICMP6_MLD, 1, [define if you have struct icmp6_mld])
354 AC_CACHE_CHECK([for struct mld6_hdr],
355 ac_cv_struct_mld6_hdr,
356 [AC_EGREP_CPP([mld6_hdr],[dnl
357 #include <sys/types.h>
358 #include <netinet/icmp6.h>
360 ac_cv_struct_mld6_hdr=yes,
361 ac_cv_struct_mld6_hdr=no)])
362 if test "$ac_cv_struct_mld6_hdr" = "yes"; then
363 AC_DEFINE(HAVE_STRUCT_MLD6_HDR, 1, [define if you have struct mld6hdr])
367 dnl portability macros for getaddrinfo/getnameinfo
370 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
371 if test "$ac_cv_sockaddr_has_sa_len" = no; then
377 AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
378 if test "$ac_cv_portable_proto" = no; then
383 dnl check sizeof basic types.
384 dnl They're very likely to be wrong for cross-compiling.
385 AC_CHECK_SIZEOF(char, 1)
386 AC_CHECK_SIZEOF(short, 2)
387 AC_CHECK_SIZEOF(int, 4)
388 AC_CHECK_SIZEOF(long, 4)
391 dnl Checks for u_intXX_t
392 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
393 dnl if test "$ac_cv_bittypes" = no; then
394 dnl missing_includes=yes
398 dnl Checks for addrinfo structure
399 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
400 if test "$ac_cv_addrinfo" = no; then
405 dnl Checks for NI_MAXSERV
406 AC_NI_MAXSERV(ac_cv_maxserv)
407 if test "$ac_cv_maxserv" = no; then
412 dnl Checks for NI_NAMEREQD
413 AC_NI_NAMEREQD(ac_cv_namereqd)
414 if test "$ac_cv_namereqd" = no; then
419 dnl Checks for sockaddr_storage structure
420 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
421 if test "$ac_cv_sa_storage" = no; then
426 dnl Checks for IN[6]ADDRSZ
427 AC_CHECK_ADDRSZ(ac_cv_addrsz)
428 if test "$ac_cv_addrsz" = no; then
433 dnl Checks for RES_USE_INET6
434 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
435 if test "$ac_cv_res_inet6" = no; then
440 dnl Checks for res_state_ext structure
441 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
442 if test "$ac_cv_res_state_ext" = no; then
447 dnl Checks if res_state structure has nsort member.
448 AC_STRUCT_RES_STATE(ac_cv_res_state)
451 dnl set additional include path if necessary
452 if test "$missing_includes" = "yes"; then
453 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
454 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
458 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy)
459 AC_CHECK_FUNCS(ether_ntohost setlinebuf gethostbyname2)
462 AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freeaddrinfo,
463 [], [usegetipnodeby=no])
464 if test $usegetipnodeby = yes; then
465 AC_DEFINE(USE_GETIPNODEBY)
469 AC_CHECK_FUNCS(vsnprintf snprintf asprintf asnprintf vasprintf vasnprintf,,
471 if test $needsnprintf = yes; then
472 LIBOBJS="$LIBOBJS snprintf.o"
475 dnl The following generates a warning from autoconf...
476 errprint(__file__:__line__: please ignore the next warning:
480 AC_CHECK_LIB(dnet, main)
481 AC_CHECK_LIB(rpc, main)
482 AC_CHECK_LIB(nsl, getrpcbynumber)
483 dnl AC_CHECK_LIB(z, uncompress)
484 dnl AC_CHECK_HEADERS(zlib.h)
488 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
491 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
497 dnl Workaround to enable certain features
506 V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
511 dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
512 AC_DEFINE(__STDC__,2)
520 if test -f /dev/bpf0 ; then
524 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
525 AC_LBL_CHECK_TYPE(int16_t, short)
526 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
527 AC_LBL_CHECK_TYPE(int32_t, int)
528 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
530 AC_LBL_DEVEL(V_CCOPT)
532 AC_LBL_SOCKADDR_SA_LEN
534 AC_MSG_CHECKING(if ether_header uses ether_addr structs)
535 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
536 LBL_SAVE_CFLAGS="$CFLAGS"
537 CFLAGS="$CFLAGS $V_INCLS"
539 # include <sys/types.h>
541 /* osf3 has REALLY good prototyes */
545 # include <sys/socket.h>
547 # include <netinet/in.h>
548 # include <netinet/if_ether.h>],
550 sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
551 ac_cv_ether_header_has_ea=yes,
552 ac_cv_ether_header_has_ea=no)
553 CFLAGS="$LBL_SAVE_CFLAGS")
554 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
555 if test $ac_cv_ether_header_has_ea = yes ; then
556 AC_DEFINE(ETHER_HEADER_HAS_EA)
559 AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
560 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
561 LBL_SAVE_CFLAGS="$CFLAGS"
562 CFLAGS="$CFLAGS $V_INCLS"
564 # include <sys/types.h>
566 /* osf3 has REALLY good prototyes */
570 # include <sys/socket.h>
572 # include <netinet/in.h>
573 # include <netinet/if_ether.h>],
575 sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
576 ac_cv_ether_arp_has_ea=yes,
577 ac_cv_ether_arp_has_ea=no)
578 CFLAGS="$LBL_SAVE_CFLAGS")
579 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
580 if test $ac_cv_ether_arp_has_ea = yes ; then
581 AC_DEFINE(ETHER_ARP_HAS_EA)
584 AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
585 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
586 LBL_SAVE_CFLAGS="$CFLAGS"
587 CFLAGS="$CFLAGS $V_INCLS"
589 # include <sys/types.h>
590 # include <sys/socket.h>
592 /* osf3 has REALLY good prototyes */
597 # include <netinet/in.h>
598 # include <netinet/if_ether.h>],
599 [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
600 ac_cv_struct_ether_arp_x=yes,
601 ac_cv_struct_ether_arp_x=no)
602 CFLAGS="$LBL_SAVE_CFLAGS")
603 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
604 if test $ac_cv_struct_ether_arp_x = yes ; then
605 AC_DEFINE(ETHER_ARP_HAS_X)
608 AC_LBL_UNALIGNED_ACCESS
612 AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
614 AC_MSG_CHECKING(for SSLeay)
617 for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
618 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
619 ac_cv_ssleay_path=$dir
621 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
622 incdir="-I$dir/include/ssleay"
623 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
624 incdir="-I$dir/include -I$dir/include/openssl"
625 elif test -d $dir/include -a -f $dir/include/des.h; then
626 incdir="-I$dir/include"
628 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
635 AC_MSG_RESULT($ac_cv_ssleay_path)
636 if test "$ac_cv_ssleay_path" != no; then
637 V_INCLS="$V_INCLS $incdir"
638 LIBS="$LIBS -L$dir/lib"
639 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
640 LIBS="$LIBS -lRSAglue"
642 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
643 LIBS="$LIBS -lrsaref"
645 AC_CHECK_LIB(crypto, des_cbc_encrypt)
647 bak_CPPFLAGS=$CPPFLAGS
648 CPPFLAGS="$CPPFLAGS $V_INCLS"
649 AC_CHECK_HEADERS(cast.h rc5.h)
651 if test "$ac_cv_header_cast_h" = "yes"; then
652 AC_MSG_CHECKING(for buggy CAST128)
658 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
659 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
660 unsigned char out[sizeof(in)];
661 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
663 CAST_set_key(&ks, sizeof(key), key);
664 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
665 if (memcmp(out, ok, sizeof(ok)) != 0)
672 [buggy_cast128="cross-compiling, assume yes"])
673 AC_MSG_RESULT($buggy_cast128)
674 if test "$buggy_cast128" != no; then
675 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
676 echo "disabling CAST128 support."
677 AC_DEFINE(HAVE_BUGGY_CAST128)
681 CPPFLAGS=$bak_CPPFLAGS
685 if test -r ${srcdir}/lbl/gnuc.h ; then
687 ln -s ${srcdir}/lbl/gnuc.h gnuc.h
698 AC_CONFIG_HEADER(config.h)
700 AC_OUTPUT_COMMANDS([if test -f .devel; then
701 echo timestamp > stamp-h
702 cat Makefile-devel-adds >> Makefile