1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.101 2000-01-18 05:25:06 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.101 $)
17 if test -z "$PWD" ; then
21 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
24 AC_CHECK_HEADERS(fcntl.h malloc.h memory.h rpc/rpcent.h)
30 AC_MSG_CHECKING(Linux kernel version)
31 AC_CACHE_VAL(ac_cv_linux_vers,
32 ac_cv_linux_vers=`uname -r 2>&1 | \
33 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
34 AC_MSG_RESULT($ac_cv_linux_vers)
35 if test $ac_cv_linux_vers -lt 2 ; then
36 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
38 AC_DEFINE(HAVE_NET_SLIP_H)
42 AC_CHECK_HEADERS(net/slip.h)
47 AC_CHECK_HEADERS(smi.h)
48 AC_CHECK_LIB(smi, main)
49 AC_MSG_CHECKING([whether to enable libsmi])
50 AC_TRY_RUN([ /* libsmi available check */
65 [ AC_MSG_RESULT(not when cross-compiling)
70 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
71 AC_MSG_CHECKING([whether to enable ipv6])
73 [ --enable-ipv6 enable ipv6 (with ipv4) support
74 --disable-ipv6 disable ipv6 support],
75 [ case "$enableval" in
76 yes) AC_MSG_RESULT(yes)
77 AC_DEFINE(ENABLE_IPV6)
78 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"
88 AC_TRY_RUN([ /* AF_INET6 available check */
89 #include <sys/types.h>
90 #include <sys/socket.h>
93 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
100 AC_DEFINE(ENABLE_IPV6)
101 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"
114 if test "$ipv6" = "yes"; then
115 AC_MSG_CHECKING([ipv6 stack type])
116 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
119 dnl http://www.kame.net/
120 AC_EGREP_CPP(yes, [dnl
121 #include <netinet/in.h>
122 #ifdef IPV6_INRIA_VERSION
126 CFLAGS="-DINET6 $CFLAGS"])
129 dnl http://www.kame.net/
130 AC_EGREP_CPP(yes, [dnl
131 #include <netinet/in.h>
137 ipv6libdir=/usr/local/v6/lib;
139 CFLAGS="-DINET6 $CFLAGS"])
142 dnl http://www.v6.linux.or.jp/
143 AC_EGREP_CPP(yes, [dnl
144 #include <features.h>
145 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
149 CFLAGS="-DINET6 $CFLAGS"])
152 dnl http://www.v6.linux.or.jp/
153 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
156 ipv6libdir=/usr/inet6/lib
158 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
162 AC_EGREP_CPP(yes, [dnl
163 #include <sys/param.h>
164 #ifdef _TOSHIBA_INET6
169 ipv6libdir=/usr/local/v6/lib;
170 CFLAGS="-DINET6 $CFLAGS"])
173 AC_EGREP_CPP(yes, [dnl
174 #include </usr/local/v6/include/sys/v6config.h>
180 ipv6libdir=/usr/local/v6/lib;
181 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
184 AC_EGREP_CPP(yes, [dnl
185 #include <sys/param.h>
186 #ifdef _ZETA_MINAMI_INET6
191 ipv6libdir=/usr/local/v6/lib;
192 CFLAGS="-DINET6 $CFLAGS"])
195 if test "$ipv6type" != "unknown"; then
199 AC_MSG_RESULT($ipv6type)
202 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
203 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
204 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
205 echo "You have $ipv6lib library, using it"
207 if test "$ipv6trylibc" = "yes"; then
208 echo "You do not have $ipv6lib library, using libc"
210 echo 'Fatal: no $ipv6lib library found. cannot continue.'
211 echo "You need to fetch lib$ipv6lib.a from appropriate"
212 echo 'ipv6 kit and compile beforehand.'
219 AC_MSG_CHECKING(getaddrinfo bug)
221 #include <sys/types.h>
224 #include <sys/socket.h>
225 #include <netinet/in.h>
229 int passive, gaierr, inet4 = 0, inet6 = 0;
230 struct addrinfo hints, *ai, *aitop;
231 char straddr[INET6_ADDRSTRLEN], strport[16];
233 for (passive = 0; passive <= 1; passive++) {
234 memset(&hints, 0, sizeof(hints));
235 hints.ai_family = AF_UNSPEC;
236 hints.ai_flags = passive ? AI_PASSIVE : 0;
237 hints.ai_socktype = SOCK_STREAM;
238 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
239 (void)gai_strerror(gaierr);
242 for (ai = aitop; ai; ai = ai->ai_next) {
243 if (ai->ai_addr == NULL ||
244 ai->ai_addrlen == 0 ||
245 getnameinfo(ai->ai_addr, ai->ai_addrlen,
246 straddr, sizeof(straddr), strport, sizeof(strport),
247 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
250 switch (ai->ai_family) {
252 if (strcmp(strport, "54321") != 0) {
256 if (strcmp(straddr, "0.0.0.0") != 0) {
260 if (strcmp(straddr, "127.0.0.1") != 0) {
267 if (strcmp(strport, "54321") != 0) {
271 if (strcmp(straddr, "::") != 0) {
275 if (strcmp(straddr, "::1") != 0) {
292 /* another family support? */
298 /* supported family should be 2, unsupported family should be 0 */
299 if (inet4 == 0 || inet4 == 2)
301 if (inet6 == 0 || inet6 == 2)
319 buggygetaddrinfo=yes,
321 buggygetaddrinfo=yes)
323 if test "$buggygetaddrinfo" = "yes"; then
324 if test "$ipv6" = "yes" -a "$ipv6type" != "linux"; then
325 echo 'Fatal: You must get working getaddrinfo() function.'
326 echo ' or you can specify "--disable-ipv6"'.
328 elif test "$ipv6type" = "linux"; then
329 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
330 echo ' Better upgreade your system library to newest version'
331 echo ' of GNU C library (aka glibc).'
334 AC_REPLACE_FUNCS(getaddrinfo getnameinfo inet_ntop inet_pton inet_aton)
336 dnl portability macros for getaddrinfo/getnameinfo
339 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
340 if test "$ac_cv_sockaddr_has_sa_len" = no; then
346 AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
347 if test "$ac_cv_portable_proto" = no; then
352 dnl check sizeof basic types.
353 dnl They're very likely to be wrong for cross-compiling.
354 AC_CHECK_SIZEOF(char, 1)
355 AC_CHECK_SIZEOF(short, 2)
356 AC_CHECK_SIZEOF(int, 4)
357 AC_CHECK_SIZEOF(long, 4)
360 dnl Checks for u_intXX_t
361 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
362 dnl if test "$ac_cv_bittypes" = no; then
363 dnl missing_includes=yes
367 dnl Checks for addrinfo structure
368 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
369 if test "$ac_cv_addrinfo" = no; then
374 dnl Checks for sockaddr_storage structure
375 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
376 if test "$ac_cv_sa_storage" = no; then
381 dnl Checks for IN[6]ADDRSZ
382 AC_CHECK_ADDRSZ(ac_cv_addrsz)
383 if test "$ac_cv_addrsz" = no; then
388 dnl Checks for RES_USE_INET6
389 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
390 if test "$ac_cv_res_inet6" = no; then
396 AC_CHECK_AAAA(ac_cv_aaaa)
397 if test "$ac_cv_aaaa" = no; then
398 AC_DEFINE(T_AAAA, 28)
402 dnl Checks for res_state_ext structure
403 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
404 if test "$ac_cv_res_state_ext" = no; then
409 dnl Checks if res_state structure has nsort member.
410 AC_STRUCT_RES_STATE(ac_cv_res_state)
413 dnl set additional include path if necessary
414 if test "$missing_includes" = "yes"; then
415 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
416 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
420 AC_REPLACE_FUNCS(vfprintf strcasecmp)
421 AC_CHECK_FUNCS(ether_ntohost setlinebuf gethostbyname2)
424 AC_CHECK_FUNCS(vsnprintf snprintf asprintf asnprintf vasprintf vasnprintf,,
426 if test $needsnprintf = yes; then
427 LIBOBJS="$LIBOBJS snprintf.o"
430 dnl The following generates a warning from autoconf...
431 errprint(__file__:__line__: please ignore the next warning:
435 AC_CHECK_LIB(dnet, main)
436 AC_CHECK_LIB(rpc, main)
437 AC_CHECK_LIB(z, uncompress)
438 AC_CHECK_HEADERS(zlib.h netinet6/ipcomp.h)
442 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
445 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
451 dnl Workaround to enable certain features
460 V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
465 dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
466 AC_DEFINE(__STDC__,2)
474 if test -f /dev/bpf0 ; then
478 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
479 AC_LBL_CHECK_TYPE(int16_t, short)
480 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
481 AC_LBL_CHECK_TYPE(int32_t, int)
482 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
484 AC_LBL_DEVEL(V_CCOPT)
486 AC_LBL_SOCKADDR_SA_LEN
488 AC_MSG_CHECKING(if ether_header uses ether_addr structs)
489 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
490 LBL_SAVE_CFLAGS="$CFLAGS"
491 CFLAGS="$CFLAGS $V_INCLS"
493 # include <sys/types.h>
495 /* osf3 has REALLY good prototyes */
499 # include <sys/socket.h>
501 # include <netinet/in.h>
502 # include <netinet/if_ether.h>],
504 sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
505 ac_cv_ether_header_has_ea=yes,
506 ac_cv_ether_header_has_ea=no)
507 CFLAGS="$LBL_SAVE_CFLAGS")
508 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
509 if test $ac_cv_ether_header_has_ea = yes ; then
510 AC_DEFINE(ETHER_HEADER_HAS_EA)
513 AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
514 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
515 LBL_SAVE_CFLAGS="$CFLAGS"
516 CFLAGS="$CFLAGS $V_INCLS"
518 # include <sys/types.h>
520 /* osf3 has REALLY good prototyes */
524 # include <sys/socket.h>
526 # include <netinet/in.h>
527 # include <netinet/if_ether.h>],
529 sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
530 ac_cv_ether_arp_has_ea=yes,
531 ac_cv_ether_arp_has_ea=no)
532 CFLAGS="$LBL_SAVE_CFLAGS")
533 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
534 if test $ac_cv_ether_arp_has_ea = yes ; then
535 AC_DEFINE(ETHER_ARP_HAS_EA)
538 AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
539 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
540 LBL_SAVE_CFLAGS="$CFLAGS"
541 CFLAGS="$CFLAGS $V_INCLS"
543 # include <sys/types.h>
544 # include <sys/socket.h>
546 /* osf3 has REALLY good prototyes */
551 # include <netinet/in.h>
552 # include <netinet/if_ether.h>],
553 [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
554 ac_cv_struct_ether_arp_x=yes,
555 ac_cv_struct_ether_arp_x=no)
556 CFLAGS="$LBL_SAVE_CFLAGS")
557 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
558 if test $ac_cv_struct_ether_arp_x = yes ; then
559 AC_DEFINE(ETHER_ARP_HAS_X)
562 AC_LBL_UNALIGNED_ACCESS
566 AC_MSG_CHECKING(for SSLeay)
569 for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
570 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
571 ac_cv_ssleay_path=$dir
573 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
574 incdir="-I$dir/include/ssleay"
575 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
576 incdir="-I$dir/include -I$dir/include/openssl"
577 elif test -d $dir/include -a -f $dir/include/des.h; then
578 incdir="-I$dir/include"
580 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
587 AC_MSG_RESULT($ac_cv_ssleay_path)
588 if test "$ac_cv_ssleay_path" != no; then
589 V_INCLS="$V_INCLS $incdir"
590 LIBS="$LIBS -L$dir/lib"
591 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
592 LIBS="$LIBS -lRSAglue"
594 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
595 LIBS="$LIBS -lrsaref"
597 AC_CHECK_LIB(crypto, des_cbc_encrypt)
599 bak_CPPFLAGS=$CPPFLAGS
600 CPPFLAGS="$CPPFLAGS $V_INCLS"
601 AC_CHECK_HEADERS(cast.h rc5.h)
603 if test "$ac_cv_header_cast_h" = "yes"; then
604 AC_MSG_CHECKING(for buggy CAST128)
610 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
611 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
612 unsigned char out[sizeof(in)];
613 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
615 CAST_set_key(&ks, sizeof(key), key);
616 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
617 if (memcmp(out, ok, sizeof(ok)) != 0)
624 [buggy_cast128="cross-compiling, assume yes"])
625 AC_MSG_RESULT($buggy_cast128)
626 if test "$buggy_cast128" != no; then
627 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
628 echo "disabling CAST128 support."
629 AC_DEFINE(HAVE_BUGGY_CAST128)
633 CPPFLAGS=$bak_CPPFLAGS
636 if test -r ${srcdir}/lbl/gnuc.h ; then
638 ln -s ${srcdir}/lbl/gnuc.h gnuc.h
649 AC_CONFIG_HEADER(config.h)
651 AC_OUTPUT_COMMANDS([if test -f .devel; then
652 echo timestamp > stamp-h
653 cat Makefile-devel-adds >> Makefile