1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.120 2000-07-11 00:48:16 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.120 $)
15 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
19 AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h)
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)
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'`)
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)
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)
41 AC_DEFINE(HAVE_NET_SLIP_H)
45 AC_CHECK_HEADERS(net/slip.h)
50 AC_CHECK_HEADERS(smi.h)
51 AC_CHECK_LIB(smi, smiInit)
52 AC_MSG_CHECKING([whether to enable libsmi])
53 AC_TRY_RUN([ /* libsmi available check */
57 int current, revision, age, n;
58 const int required = 2;
61 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
63 n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
66 if (required < current - age || required > current)
76 [ AC_MSG_RESULT(not when cross-compiling)
81 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
82 AC_MSG_CHECKING([whether to enable ipv6])
84 [ --enable-ipv6 enable ipv6 (with ipv4) support
85 --disable-ipv6 disable ipv6 support],
86 [ case "$enableval" in
87 yes) AC_MSG_RESULT(yes)
88 AC_DEFINE(ENABLE_IPV6)
89 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"
99 AC_TRY_RUN([ /* AF_INET6 available check */
100 #include <sys/types.h>
101 #include <sys/socket.h>
104 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
111 AC_DEFINE(ENABLE_IPV6)
112 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"
125 if test "$ipv6" = "yes"; then
126 AC_MSG_CHECKING([ipv6 stack type])
127 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
130 dnl http://www.kame.net/
131 AC_EGREP_CPP(yes, [dnl
132 #include <netinet/in.h>
133 #ifdef IPV6_INRIA_VERSION
137 CFLAGS="-DINET6 $CFLAGS"])
140 dnl http://www.kame.net/
141 AC_EGREP_CPP(yes, [dnl
142 #include <netinet/in.h>
148 ipv6libdir=/usr/local/v6/lib;
150 CFLAGS="-DINET6 $CFLAGS"])
153 dnl http://www.v6.linux.or.jp/
154 AC_EGREP_CPP(yes, [dnl
155 #include <features.h>
156 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
160 CFLAGS="-DINET6 $CFLAGS"])
163 dnl http://www.v6.linux.or.jp/
164 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
167 ipv6libdir=/usr/inet6/lib
169 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
173 AC_EGREP_CPP(yes, [dnl
174 #include <sys/param.h>
175 #ifdef _TOSHIBA_INET6
180 ipv6libdir=/usr/local/v6/lib;
181 CFLAGS="-DINET6 $CFLAGS"])
184 AC_EGREP_CPP(yes, [dnl
185 #include </usr/local/v6/include/sys/v6config.h>
191 ipv6libdir=/usr/local/v6/lib;
192 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
195 AC_EGREP_CPP(yes, [dnl
196 #include <sys/param.h>
197 #ifdef _ZETA_MINAMI_INET6
202 ipv6libdir=/usr/local/v6/lib;
203 CFLAGS="-DINET6 $CFLAGS"])
206 if test "$ipv6type" != "unknown"; then
210 AC_MSG_RESULT($ipv6type)
213 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
214 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
215 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
216 echo "You have $ipv6lib library, using it"
218 if test "$ipv6trylibc" = "yes"; then
219 echo "You do not have $ipv6lib library, using libc"
221 echo 'Fatal: no $ipv6lib library found. cannot continue.'
222 echo "You need to fetch lib$ipv6lib.a from appropriate"
223 echo 'ipv6 kit and compile beforehand.'
230 if test "$ipv6" = "yes"; then
231 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
232 AC_MSG_CHECKING(getaddrinfo bug)
234 #include <sys/types.h>
237 #include <sys/socket.h>
238 #include <netinet/in.h>
242 int passive, gaierr, inet4 = 0, inet6 = 0;
243 struct addrinfo hints, *ai, *aitop;
244 char straddr[INET6_ADDRSTRLEN], strport[16];
246 for (passive = 0; passive <= 1; passive++) {
247 memset(&hints, 0, sizeof(hints));
248 hints.ai_family = AF_UNSPEC;
249 hints.ai_flags = passive ? AI_PASSIVE : 0;
250 hints.ai_socktype = SOCK_STREAM;
251 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
252 (void)gai_strerror(gaierr);
255 for (ai = aitop; ai; ai = ai->ai_next) {
256 if (ai->ai_addr == NULL ||
257 ai->ai_addrlen == 0 ||
258 getnameinfo(ai->ai_addr, ai->ai_addrlen,
259 straddr, sizeof(straddr), strport, sizeof(strport),
260 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
263 switch (ai->ai_family) {
265 if (strcmp(strport, "54321") != 0) {
269 if (strcmp(straddr, "0.0.0.0") != 0) {
273 if (strcmp(straddr, "127.0.0.1") != 0) {
280 if (strcmp(strport, "54321") != 0) {
284 if (strcmp(straddr, "::") != 0) {
288 if (strcmp(straddr, "::1") != 0) {
305 /* another family support? */
311 /* supported family should be 2, unsupported family should be 0 */
312 if (!(inet4 == 0 || inet4 == 2))
314 if (!(inet6 == 0 || inet6 == 2))
330 buggygetaddrinfo=yes,
332 buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
334 if test "$buggygetaddrinfo" = "yes"; then
335 if test "$ipv6type" != "linux"; then
336 echo 'Fatal: You must get working getaddrinfo() function.'
337 echo ' or you can specify "--disable-ipv6"'.
340 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
341 echo ' Better upgreade your system library to newest version'
342 echo ' of GNU C library (aka glibc).'
345 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
347 AC_REPLACE_FUNCS(inet_ntop inet_pton inet_aton)
349 dnl check for struct icmp6_mld and struct mld6_hdr
351 AC_CACHE_CHECK([for struct icmp6_mld],
352 ac_cv_struct_icmp6_mld,
353 [AC_EGREP_CPP([icmp6_mld],[dnl
354 #include <sys/types.h>
355 #include <netinet/icmp6.h>
357 ac_cv_struct_icmp6_mld=yes,
358 ac_cv_struct_icmp6_mld=no)])
359 if test "$ac_cv_struct_icmp6_mld" = "yes"; then
360 AC_DEFINE(HAVE_STRUCT_ICMP6_MLD, 1, [define if you have struct icmp6_mld])
363 AC_CACHE_CHECK([for struct mld6_hdr],
364 ac_cv_struct_mld6_hdr,
365 [AC_EGREP_CPP([mld6_hdr],[dnl
366 #include <sys/types.h>
367 #include <netinet/icmp6.h>
369 ac_cv_struct_mld6_hdr=yes,
370 ac_cv_struct_mld6_hdr=no)])
371 if test "$ac_cv_struct_mld6_hdr" = "yes"; then
372 AC_DEFINE(HAVE_STRUCT_MLD6_HDR, 1, [define if you have struct mld6hdr])
375 dnl check for struct icmp6_nodeinfo
377 AC_CACHE_CHECK([for struct icmp6_nodeinfo],
378 ac_cv_struct_icmp6_nodeinfo,
379 [AC_EGREP_CPP([icmp6_nodeinfo],[dnl
380 #include <sys/types.h>
381 #include <netinet/icmp6.h>
383 ac_cv_struct_icmp6_nodeinfo=yes,
384 ac_cv_struct_icmp6_nodeinfo=no)])
385 if test "$ac_cv_struct_icmp6_nodeinfo" = "yes"; then
386 AC_DEFINE(HAVE_STRUCT_ICMP6_NODEINFO, 1, [define if you have struct icmp6_nodeinfo])
389 dnl portability macros for getaddrinfo/getnameinfo
392 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
393 if test "$ac_cv_sockaddr_has_sa_len" = no; then
399 AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
400 if test "$ac_cv_portable_proto" = no; then
405 dnl check sizeof basic types.
406 dnl They're very likely to be wrong for cross-compiling.
407 AC_CHECK_SIZEOF(char, 1)
408 AC_CHECK_SIZEOF(short, 2)
409 AC_CHECK_SIZEOF(int, 4)
410 AC_CHECK_SIZEOF(long, 4)
413 dnl Checks for u_intXX_t
414 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
415 dnl if test "$ac_cv_bittypes" = no; then
416 dnl missing_includes=yes
420 dnl Checks for addrinfo structure
421 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
422 if test "$ac_cv_addrinfo" = no; then
427 dnl Checks for NI_MAXSERV
428 AC_NI_MAXSERV(ac_cv_maxserv)
429 if test "$ac_cv_maxserv" = no; then
434 dnl Checks for NI_NAMEREQD
435 AC_NI_NAMEREQD(ac_cv_namereqd)
436 if test "$ac_cv_namereqd" = no; then
441 dnl Checks for sockaddr_storage structure
442 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
443 if test "$ac_cv_sa_storage" = no; then
448 dnl Checks for IN[6]ADDRSZ
449 AC_CHECK_ADDRSZ(ac_cv_addrsz)
450 if test "$ac_cv_addrsz" = no; then
455 dnl Checks for RES_USE_INET6
456 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
457 if test "$ac_cv_res_inet6" = no; then
462 dnl Checks for res_state_ext structure
463 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
464 if test "$ac_cv_res_state_ext" = no; then
469 dnl Checks if res_state structure has nsort member.
470 AC_STRUCT_RES_STATE(ac_cv_res_state)
473 dnl set additional include path if necessary
474 if test "$missing_includes" = "yes"; then
475 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
476 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
480 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy)
481 AC_CHECK_FUNCS(ether_ntohost setlinebuf)
484 AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freeaddrinfo,
485 [], [usegetipnodeby=no])
486 if test $usegetipnodeby = yes; then
487 AC_DEFINE(USE_GETIPNODEBY)
491 AC_CHECK_FUNCS(vsnprintf snprintf asprintf asnprintf vasprintf vasnprintf,,
493 if test $needsnprintf = yes; then
494 LIBOBJS="$LIBOBJS snprintf.o"
497 dnl The following generates a warning from autoconf...
498 errprint(__file__:__line__: please ignore the next warning:
502 AC_CHECK_LIB(dnet, main)
503 AC_CHECK_LIB(rpc, main)
504 AC_CHECK_LIB(nsl, getrpcbynumber)
505 dnl AC_CHECK_LIB(z, uncompress)
506 dnl AC_CHECK_HEADERS(zlib.h)
510 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
513 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
519 dnl Workaround to enable certain features
528 V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
533 dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
534 AC_DEFINE(__STDC__,2)
542 if test -f /dev/bpf0 ; then
546 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
547 AC_LBL_CHECK_TYPE(int16_t, short)
548 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
549 AC_LBL_CHECK_TYPE(int32_t, int)
550 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
552 AC_LBL_DEVEL(V_CCOPT)
554 AC_LBL_SOCKADDR_SA_LEN
556 AC_MSG_CHECKING(if ether_header uses ether_addr structs)
557 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
558 LBL_SAVE_CFLAGS="$CFLAGS"
559 CFLAGS="$CFLAGS $V_INCLS"
561 # include <sys/types.h>
563 /* osf3 has REALLY good prototyes */
567 # include <sys/socket.h>
569 # include <netinet/in.h>
570 # include <netinet/if_ether.h>],
572 sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
573 ac_cv_ether_header_has_ea=yes,
574 ac_cv_ether_header_has_ea=no)
575 CFLAGS="$LBL_SAVE_CFLAGS")
576 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
577 if test $ac_cv_ether_header_has_ea = yes ; then
578 AC_DEFINE(ETHER_HEADER_HAS_EA)
581 AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
582 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
583 LBL_SAVE_CFLAGS="$CFLAGS"
584 CFLAGS="$CFLAGS $V_INCLS"
586 # include <sys/types.h>
588 /* osf3 has REALLY good prototyes */
592 # include <sys/socket.h>
594 # include <netinet/in.h>
595 # include <netinet/if_ether.h>],
597 sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
598 ac_cv_ether_arp_has_ea=yes,
599 ac_cv_ether_arp_has_ea=no)
600 CFLAGS="$LBL_SAVE_CFLAGS")
601 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
602 if test $ac_cv_ether_arp_has_ea = yes ; then
603 AC_DEFINE(ETHER_ARP_HAS_EA)
606 AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
607 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
608 LBL_SAVE_CFLAGS="$CFLAGS"
609 CFLAGS="$CFLAGS $V_INCLS"
611 # include <sys/types.h>
612 # include <sys/socket.h>
614 /* osf3 has REALLY good prototyes */
619 # include <netinet/in.h>
620 # include <netinet/if_ether.h>],
621 [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
622 ac_cv_struct_ether_arp_x=yes,
623 ac_cv_struct_ether_arp_x=no)
624 CFLAGS="$LBL_SAVE_CFLAGS")
625 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
626 if test $ac_cv_struct_ether_arp_x = yes ; then
627 AC_DEFINE(ETHER_ARP_HAS_X)
630 AC_LBL_UNALIGNED_ACCESS
634 AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
636 AC_MSG_CHECKING(for SSLeay)
639 for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
640 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
641 ac_cv_ssleay_path=$dir
643 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
644 incdir="-I$dir/include/ssleay"
645 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
646 incdir="-I$dir/include -I$dir/include/openssl"
647 elif test -d $dir/include -a -f $dir/include/des.h; then
648 incdir="-I$dir/include"
650 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
657 AC_MSG_RESULT($ac_cv_ssleay_path)
658 if test "$ac_cv_ssleay_path" != no; then
659 V_INCLS="$V_INCLS $incdir"
660 LIBS="$LIBS -L$dir/lib"
661 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
662 LIBS="$LIBS -lRSAglue"
664 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
665 LIBS="$LIBS -lrsaref"
667 AC_CHECK_LIB(crypto, des_cbc_encrypt)
669 bak_CPPFLAGS=$CPPFLAGS
670 CPPFLAGS="$CPPFLAGS $V_INCLS"
671 AC_CHECK_HEADERS(cast.h rc5.h)
673 if test "$ac_cv_header_cast_h" = "yes"; then
674 AC_MSG_CHECKING(for buggy CAST128)
680 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
681 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
682 unsigned char out[sizeof(in)];
683 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
685 CAST_set_key(&ks, sizeof(key), key);
686 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
687 if (memcmp(out, ok, sizeof(ok)) != 0)
694 [buggy_cast128="cross-compiling, assume yes"])
695 AC_MSG_RESULT($buggy_cast128)
696 if test "$buggy_cast128" != no; then
697 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
698 echo "disabling CAST128 support."
699 AC_DEFINE(HAVE_BUGGY_CAST128)
703 CPPFLAGS=$bak_CPPFLAGS
715 AC_CONFIG_HEADER(config.h)
717 AC_OUTPUT_COMMANDS([if test -f .devel; then
718 echo timestamp > stamp-h
719 cat Makefile-devel-adds >> Makefile