1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.116 2000-06-10 14:19:02 assar 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.116 $)
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 if test "$cross_compiling" = yes; then
33 AC_CACHE_VAL(ac_cv_linux_vers,
34 ac_cv_linux_vers=unknown)
36 AC_CACHE_VAL(ac_cv_linux_vers,
37 ac_cv_linux_vers=`uname -r 2>&1 | \
38 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
40 AC_MSG_RESULT($ac_cv_linux_vers)
41 if test $ac_cv_linux_vers = unknown ; then
42 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
44 if test $ac_cv_linux_vers -lt 2 ; then
45 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
47 AC_DEFINE(HAVE_NET_SLIP_H)
51 AC_CHECK_HEADERS(net/slip.h)
56 AC_CHECK_HEADERS(smi.h)
57 AC_CHECK_LIB(smi, main)
58 AC_MSG_CHECKING([whether to enable libsmi])
59 AC_TRY_RUN([ /* libsmi available check */
74 [ AC_MSG_RESULT(not when cross-compiling)
79 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
80 AC_MSG_CHECKING([whether to enable ipv6])
82 [ --enable-ipv6 enable ipv6 (with ipv4) support
83 --disable-ipv6 disable ipv6 support],
84 [ case "$enableval" in
85 yes) AC_MSG_RESULT(yes)
86 AC_DEFINE(ENABLE_IPV6)
87 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"
97 AC_TRY_RUN([ /* AF_INET6 available check */
98 #include <sys/types.h>
99 #include <sys/socket.h>
102 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
109 AC_DEFINE(ENABLE_IPV6)
110 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"
123 if test "$ipv6" = "yes"; then
124 AC_MSG_CHECKING([ipv6 stack type])
125 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
128 dnl http://www.kame.net/
129 AC_EGREP_CPP(yes, [dnl
130 #include <netinet/in.h>
131 #ifdef IPV6_INRIA_VERSION
135 CFLAGS="-DINET6 $CFLAGS"])
138 dnl http://www.kame.net/
139 AC_EGREP_CPP(yes, [dnl
140 #include <netinet/in.h>
146 ipv6libdir=/usr/local/v6/lib;
148 CFLAGS="-DINET6 $CFLAGS"])
151 dnl http://www.v6.linux.or.jp/
152 AC_EGREP_CPP(yes, [dnl
153 #include <features.h>
154 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
158 CFLAGS="-DINET6 $CFLAGS"])
161 dnl http://www.v6.linux.or.jp/
162 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
165 ipv6libdir=/usr/inet6/lib
167 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
171 AC_EGREP_CPP(yes, [dnl
172 #include <sys/param.h>
173 #ifdef _TOSHIBA_INET6
178 ipv6libdir=/usr/local/v6/lib;
179 CFLAGS="-DINET6 $CFLAGS"])
182 AC_EGREP_CPP(yes, [dnl
183 #include </usr/local/v6/include/sys/v6config.h>
189 ipv6libdir=/usr/local/v6/lib;
190 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
193 AC_EGREP_CPP(yes, [dnl
194 #include <sys/param.h>
195 #ifdef _ZETA_MINAMI_INET6
200 ipv6libdir=/usr/local/v6/lib;
201 CFLAGS="-DINET6 $CFLAGS"])
204 if test "$ipv6type" != "unknown"; then
208 AC_MSG_RESULT($ipv6type)
211 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
212 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
213 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
214 echo "You have $ipv6lib library, using it"
216 if test "$ipv6trylibc" = "yes"; then
217 echo "You do not have $ipv6lib library, using libc"
219 echo 'Fatal: no $ipv6lib library found. cannot continue.'
220 echo "You need to fetch lib$ipv6lib.a from appropriate"
221 echo 'ipv6 kit and compile beforehand.'
228 if test "$ipv6" = "yes"; then
229 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
230 AC_MSG_CHECKING(getaddrinfo bug)
232 #include <sys/types.h>
235 #include <sys/socket.h>
236 #include <netinet/in.h>
240 int passive, gaierr, inet4 = 0, inet6 = 0;
241 struct addrinfo hints, *ai, *aitop;
242 char straddr[INET6_ADDRSTRLEN], strport[16];
244 for (passive = 0; passive <= 1; passive++) {
245 memset(&hints, 0, sizeof(hints));
246 hints.ai_family = AF_UNSPEC;
247 hints.ai_flags = passive ? AI_PASSIVE : 0;
248 hints.ai_socktype = SOCK_STREAM;
249 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
250 (void)gai_strerror(gaierr);
253 for (ai = aitop; ai; ai = ai->ai_next) {
254 if (ai->ai_addr == NULL ||
255 ai->ai_addrlen == 0 ||
256 getnameinfo(ai->ai_addr, ai->ai_addrlen,
257 straddr, sizeof(straddr), strport, sizeof(strport),
258 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
261 switch (ai->ai_family) {
263 if (strcmp(strport, "54321") != 0) {
267 if (strcmp(straddr, "0.0.0.0") != 0) {
271 if (strcmp(straddr, "127.0.0.1") != 0) {
278 if (strcmp(strport, "54321") != 0) {
282 if (strcmp(straddr, "::") != 0) {
286 if (strcmp(straddr, "::1") != 0) {
303 /* another family support? */
309 /* supported family should be 2, unsupported family should be 0 */
310 if (!(inet4 == 0 || inet4 == 2))
312 if (!(inet6 == 0 || inet6 == 2))
328 buggygetaddrinfo=yes,
330 buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
332 if test "$buggygetaddrinfo" = "yes"; then
333 if test "$ipv6type" != "linux"; then
334 echo 'Fatal: You must get working getaddrinfo() function.'
335 echo ' or you can specify "--disable-ipv6"'.
338 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
339 echo ' Better upgreade your system library to newest version'
340 echo ' of GNU C library (aka glibc).'
343 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
345 AC_REPLACE_FUNCS(inet_ntop inet_pton inet_aton)
347 dnl check for struct icmp6_mld and struct mld6_hdr
349 AC_CACHE_CHECK([for struct icmp6_mld],
350 ac_cv_struct_icmp6_mld,
351 [AC_EGREP_CPP([icmp6_mld],[dnl
352 #include <sys/types.h>
353 #include <netinet/icmp6.h>
355 ac_cv_struct_icmp6_mld=yes,
356 ac_cv_struct_icmp6_mld=no)])
357 if test "$ac_cv_struct_icmp6_mld" = "yes"; then
358 AC_DEFINE(HAVE_STRUCT_ICMP6_MLD, 1, [define if you have struct icmp6_mld])
361 AC_CACHE_CHECK([for struct mld6_hdr],
362 ac_cv_struct_mld6_hdr,
363 [AC_EGREP_CPP([mld6_hdr],[dnl
364 #include <sys/types.h>
365 #include <netinet/icmp6.h>
367 ac_cv_struct_mld6_hdr=yes,
368 ac_cv_struct_mld6_hdr=no)])
369 if test "$ac_cv_struct_mld6_hdr" = "yes"; then
370 AC_DEFINE(HAVE_STRUCT_MLD6_HDR, 1, [define if you have struct mld6hdr])
373 dnl check for struct icmp6_nodeinfo
375 AC_CACHE_CHECK([for struct icmp6_nodeinfo],
376 ac_cv_struct_icmp6_nodeinfo,
377 [AC_EGREP_CPP([icmp6_nodeinfo],[dnl
378 #include <sys/types.h>
379 #include <netinet/icmp6.h>
381 ac_cv_struct_icmp6_nodeinfo=yes,
382 ac_cv_struct_icmp6_nodeinfo=no)])
383 if test "$ac_cv_struct_icmp6_nodeinfo" = "yes"; then
384 AC_DEFINE(HAVE_STRUCT_ICMP6_NODEINFO, 1, [define if you have struct icmp6_nodeinfo])
387 dnl portability macros for getaddrinfo/getnameinfo
390 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
391 if test "$ac_cv_sockaddr_has_sa_len" = no; then
397 AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
398 if test "$ac_cv_portable_proto" = no; then
403 dnl check sizeof basic types.
404 dnl They're very likely to be wrong for cross-compiling.
405 AC_CHECK_SIZEOF(char, 1)
406 AC_CHECK_SIZEOF(short, 2)
407 AC_CHECK_SIZEOF(int, 4)
408 AC_CHECK_SIZEOF(long, 4)
411 dnl Checks for u_intXX_t
412 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
413 dnl if test "$ac_cv_bittypes" = no; then
414 dnl missing_includes=yes
418 dnl Checks for addrinfo structure
419 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
420 if test "$ac_cv_addrinfo" = no; then
425 dnl Checks for NI_MAXSERV
426 AC_NI_MAXSERV(ac_cv_maxserv)
427 if test "$ac_cv_maxserv" = no; then
432 dnl Checks for NI_NAMEREQD
433 AC_NI_NAMEREQD(ac_cv_namereqd)
434 if test "$ac_cv_namereqd" = no; then
439 dnl Checks for sockaddr_storage structure
440 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
441 if test "$ac_cv_sa_storage" = no; then
446 dnl Checks for IN[6]ADDRSZ
447 AC_CHECK_ADDRSZ(ac_cv_addrsz)
448 if test "$ac_cv_addrsz" = no; then
453 dnl Checks for RES_USE_INET6
454 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
455 if test "$ac_cv_res_inet6" = no; then
460 dnl Checks for res_state_ext structure
461 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
462 if test "$ac_cv_res_state_ext" = no; then
467 dnl Checks if res_state structure has nsort member.
468 AC_STRUCT_RES_STATE(ac_cv_res_state)
471 dnl set additional include path if necessary
472 if test "$missing_includes" = "yes"; then
473 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
474 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
478 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy)
479 AC_CHECK_FUNCS(ether_ntohost setlinebuf gethostbyname2)
482 AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freeaddrinfo,
483 [], [usegetipnodeby=no])
484 if test $usegetipnodeby = yes; then
485 AC_DEFINE(USE_GETIPNODEBY)
489 AC_CHECK_FUNCS(vsnprintf snprintf asprintf asnprintf vasprintf vasnprintf,,
491 if test $needsnprintf = yes; then
492 LIBOBJS="$LIBOBJS snprintf.o"
495 dnl The following generates a warning from autoconf...
496 errprint(__file__:__line__: please ignore the next warning:
500 AC_CHECK_LIB(dnet, main)
501 AC_CHECK_LIB(rpc, main)
502 AC_CHECK_LIB(nsl, getrpcbynumber)
503 dnl AC_CHECK_LIB(z, uncompress)
504 dnl AC_CHECK_HEADERS(zlib.h)
508 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
511 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
517 dnl Workaround to enable certain features
526 V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
531 dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
532 AC_DEFINE(__STDC__,2)
540 if test -f /dev/bpf0 ; then
544 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
545 AC_LBL_CHECK_TYPE(int16_t, short)
546 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
547 AC_LBL_CHECK_TYPE(int32_t, int)
548 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
550 AC_LBL_DEVEL(V_CCOPT)
552 AC_LBL_SOCKADDR_SA_LEN
554 AC_MSG_CHECKING(if ether_header uses ether_addr structs)
555 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
556 LBL_SAVE_CFLAGS="$CFLAGS"
557 CFLAGS="$CFLAGS $V_INCLS"
559 # include <sys/types.h>
561 /* osf3 has REALLY good prototyes */
565 # include <sys/socket.h>
567 # include <netinet/in.h>
568 # include <netinet/if_ether.h>],
570 sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
571 ac_cv_ether_header_has_ea=yes,
572 ac_cv_ether_header_has_ea=no)
573 CFLAGS="$LBL_SAVE_CFLAGS")
574 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
575 if test $ac_cv_ether_header_has_ea = yes ; then
576 AC_DEFINE(ETHER_HEADER_HAS_EA)
579 AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
580 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
581 LBL_SAVE_CFLAGS="$CFLAGS"
582 CFLAGS="$CFLAGS $V_INCLS"
584 # include <sys/types.h>
586 /* osf3 has REALLY good prototyes */
590 # include <sys/socket.h>
592 # include <netinet/in.h>
593 # include <netinet/if_ether.h>],
595 sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
596 ac_cv_ether_arp_has_ea=yes,
597 ac_cv_ether_arp_has_ea=no)
598 CFLAGS="$LBL_SAVE_CFLAGS")
599 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
600 if test $ac_cv_ether_arp_has_ea = yes ; then
601 AC_DEFINE(ETHER_ARP_HAS_EA)
604 AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
605 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
606 LBL_SAVE_CFLAGS="$CFLAGS"
607 CFLAGS="$CFLAGS $V_INCLS"
609 # include <sys/types.h>
610 # include <sys/socket.h>
612 /* osf3 has REALLY good prototyes */
617 # include <netinet/in.h>
618 # include <netinet/if_ether.h>],
619 [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
620 ac_cv_struct_ether_arp_x=yes,
621 ac_cv_struct_ether_arp_x=no)
622 CFLAGS="$LBL_SAVE_CFLAGS")
623 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
624 if test $ac_cv_struct_ether_arp_x = yes ; then
625 AC_DEFINE(ETHER_ARP_HAS_X)
628 AC_LBL_UNALIGNED_ACCESS
632 AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
634 AC_MSG_CHECKING(for SSLeay)
637 for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
638 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
639 ac_cv_ssleay_path=$dir
641 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
642 incdir="-I$dir/include/ssleay"
643 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
644 incdir="-I$dir/include -I$dir/include/openssl"
645 elif test -d $dir/include -a -f $dir/include/des.h; then
646 incdir="-I$dir/include"
648 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
655 AC_MSG_RESULT($ac_cv_ssleay_path)
656 if test "$ac_cv_ssleay_path" != no; then
657 V_INCLS="$V_INCLS $incdir"
658 LIBS="$LIBS -L$dir/lib"
659 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
660 LIBS="$LIBS -lRSAglue"
662 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
663 LIBS="$LIBS -lrsaref"
665 AC_CHECK_LIB(crypto, des_cbc_encrypt)
667 bak_CPPFLAGS=$CPPFLAGS
668 CPPFLAGS="$CPPFLAGS $V_INCLS"
669 AC_CHECK_HEADERS(cast.h rc5.h)
671 if test "$ac_cv_header_cast_h" = "yes"; then
672 AC_MSG_CHECKING(for buggy CAST128)
678 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
679 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
680 unsigned char out[sizeof(in)];
681 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
683 CAST_set_key(&ks, sizeof(key), key);
684 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
685 if (memcmp(out, ok, sizeof(ok)) != 0)
692 [buggy_cast128="cross-compiling, assume yes"])
693 AC_MSG_RESULT($buggy_cast128)
694 if test "$buggy_cast128" != no; then
695 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
696 echo "disabling CAST128 support."
697 AC_DEFINE(HAVE_BUGGY_CAST128)
701 CPPFLAGS=$bak_CPPFLAGS
705 if test -r ${srcdir}/lbl/gnuc.h ; then
707 ln -s ${srcdir}/lbl/gnuc.h gnuc.h
718 AC_CONFIG_HEADER(config.h)
720 AC_OUTPUT_COMMANDS([if test -f .devel; then
721 echo timestamp > stamp-h
722 cat Makefile-devel-adds >> Makefile