1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.111 2000-04-01 12:09:57 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.111 $)
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_CHECK_FUNCS(getaddrinfo, [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 portability macros for getaddrinfo/getnameinfo
342 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
343 if test "$ac_cv_sockaddr_has_sa_len" = no; then
349 AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
350 if test "$ac_cv_portable_proto" = no; then
355 dnl check sizeof basic types.
356 dnl They're very likely to be wrong for cross-compiling.
357 AC_CHECK_SIZEOF(char, 1)
358 AC_CHECK_SIZEOF(short, 2)
359 AC_CHECK_SIZEOF(int, 4)
360 AC_CHECK_SIZEOF(long, 4)
363 dnl Checks for u_intXX_t
364 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
365 dnl if test "$ac_cv_bittypes" = no; then
366 dnl missing_includes=yes
370 dnl Checks for addrinfo structure
371 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
372 if test "$ac_cv_addrinfo" = no; then
377 dnl Checks for NI_MAXSERV
378 AC_NI_MAXSERV(ac_cv_maxserv)
379 if test "$ac_cv_maxserv" = no; then
384 dnl Checks for NI_NAMEREQD
385 AC_NI_NAMEREQD(ac_cv_namereqd)
386 if test "$ac_cv_namereqd" = no; then
391 dnl Checks for sockaddr_storage structure
392 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
393 if test "$ac_cv_sa_storage" = no; then
398 dnl Checks for IN[6]ADDRSZ
399 AC_CHECK_ADDRSZ(ac_cv_addrsz)
400 if test "$ac_cv_addrsz" = no; then
405 dnl Checks for RES_USE_INET6
406 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
407 if test "$ac_cv_res_inet6" = no; then
412 dnl Checks for res_state_ext structure
413 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
414 if test "$ac_cv_res_state_ext" = no; then
419 dnl Checks if res_state structure has nsort member.
420 AC_STRUCT_RES_STATE(ac_cv_res_state)
423 dnl set additional include path if necessary
424 if test "$missing_includes" = "yes"; then
425 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
426 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
430 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy)
431 AC_CHECK_FUNCS(ether_ntohost setlinebuf gethostbyname2)
434 AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freeaddrinfo,
435 [], [usegetipnodeby=no])
436 if test $usegetipnodeby = yes; then
437 AC_DEFINE(USE_GETIPNODEBY)
441 AC_CHECK_FUNCS(vsnprintf snprintf asprintf asnprintf vasprintf vasnprintf,,
443 if test $needsnprintf = yes; then
444 LIBOBJS="$LIBOBJS snprintf.o"
447 dnl The following generates a warning from autoconf...
448 errprint(__file__:__line__: please ignore the next warning:
452 AC_CHECK_LIB(dnet, main)
453 AC_CHECK_LIB(rpc, main)
454 AC_CHECK_LIB(nsl, getrpcbynumber)
455 dnl AC_CHECK_LIB(z, uncompress)
456 dnl AC_CHECK_HEADERS(zlib.h)
460 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
463 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
469 dnl Workaround to enable certain features
478 V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
483 dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
484 AC_DEFINE(__STDC__,2)
492 if test -f /dev/bpf0 ; then
496 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
497 AC_LBL_CHECK_TYPE(int16_t, short)
498 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
499 AC_LBL_CHECK_TYPE(int32_t, int)
500 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
502 AC_LBL_DEVEL(V_CCOPT)
504 AC_LBL_SOCKADDR_SA_LEN
506 AC_MSG_CHECKING(if ether_header uses ether_addr structs)
507 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
508 LBL_SAVE_CFLAGS="$CFLAGS"
509 CFLAGS="$CFLAGS $V_INCLS"
511 # include <sys/types.h>
513 /* osf3 has REALLY good prototyes */
517 # include <sys/socket.h>
519 # include <netinet/in.h>
520 # include <netinet/if_ether.h>],
522 sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
523 ac_cv_ether_header_has_ea=yes,
524 ac_cv_ether_header_has_ea=no)
525 CFLAGS="$LBL_SAVE_CFLAGS")
526 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
527 if test $ac_cv_ether_header_has_ea = yes ; then
528 AC_DEFINE(ETHER_HEADER_HAS_EA)
531 AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
532 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
533 LBL_SAVE_CFLAGS="$CFLAGS"
534 CFLAGS="$CFLAGS $V_INCLS"
536 # include <sys/types.h>
538 /* osf3 has REALLY good prototyes */
542 # include <sys/socket.h>
544 # include <netinet/in.h>
545 # include <netinet/if_ether.h>],
547 sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
548 ac_cv_ether_arp_has_ea=yes,
549 ac_cv_ether_arp_has_ea=no)
550 CFLAGS="$LBL_SAVE_CFLAGS")
551 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
552 if test $ac_cv_ether_arp_has_ea = yes ; then
553 AC_DEFINE(ETHER_ARP_HAS_EA)
556 AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
557 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
558 LBL_SAVE_CFLAGS="$CFLAGS"
559 CFLAGS="$CFLAGS $V_INCLS"
561 # include <sys/types.h>
562 # include <sys/socket.h>
564 /* osf3 has REALLY good prototyes */
569 # include <netinet/in.h>
570 # include <netinet/if_ether.h>],
571 [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
572 ac_cv_struct_ether_arp_x=yes,
573 ac_cv_struct_ether_arp_x=no)
574 CFLAGS="$LBL_SAVE_CFLAGS")
575 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
576 if test $ac_cv_struct_ether_arp_x = yes ; then
577 AC_DEFINE(ETHER_ARP_HAS_X)
580 AC_LBL_UNALIGNED_ACCESS
584 AC_MSG_CHECKING(for SSLeay)
587 for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
588 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
589 ac_cv_ssleay_path=$dir
591 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
592 incdir="-I$dir/include/ssleay"
593 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
594 incdir="-I$dir/include -I$dir/include/openssl"
595 elif test -d $dir/include -a -f $dir/include/des.h; then
596 incdir="-I$dir/include"
598 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
605 AC_MSG_RESULT($ac_cv_ssleay_path)
606 if test "$ac_cv_ssleay_path" != no; then
607 V_INCLS="$V_INCLS $incdir"
608 LIBS="$LIBS -L$dir/lib"
609 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
610 LIBS="$LIBS -lRSAglue"
612 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
613 LIBS="$LIBS -lrsaref"
615 AC_CHECK_LIB(crypto, des_cbc_encrypt)
617 bak_CPPFLAGS=$CPPFLAGS
618 CPPFLAGS="$CPPFLAGS $V_INCLS"
619 AC_CHECK_HEADERS(cast.h rc5.h)
621 if test "$ac_cv_header_cast_h" = "yes"; then
622 AC_MSG_CHECKING(for buggy CAST128)
628 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
629 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
630 unsigned char out[sizeof(in)];
631 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
633 CAST_set_key(&ks, sizeof(key), key);
634 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
635 if (memcmp(out, ok, sizeof(ok)) != 0)
642 [buggy_cast128="cross-compiling, assume yes"])
643 AC_MSG_RESULT($buggy_cast128)
644 if test "$buggy_cast128" != no; then
645 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
646 echo "disabling CAST128 support."
647 AC_DEFINE(HAVE_BUGGY_CAST128)
651 CPPFLAGS=$bak_CPPFLAGS
654 if test -r ${srcdir}/lbl/gnuc.h ; then
656 ln -s ${srcdir}/lbl/gnuc.h gnuc.h
667 AC_CONFIG_HEADER(config.h)
669 AC_OUTPUT_COMMANDS([if test -f .devel; then
670 echo timestamp > stamp-h
671 cat Makefile-devel-adds >> Makefile