1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.134 2001-01-20 07:22:22 guy 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.134 $)
15 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
19 AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netinet/if_ether.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)
48 AC_CHECK_HEADERS(smi.h)
49 AC_CHECK_LIB(smi, smiInit)
50 AC_MSG_CHECKING([whether to enable libsmi])
51 AC_TRY_RUN([ /* libsmi available check */
55 int current, revision, age, n;
56 const int required = 2;
59 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
61 n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age);
64 if (required < current - age || required > current)
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 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"
96 AC_TRY_RUN([ /* AF_INET6 available check */
97 #include <sys/types.h>
98 #include <sys/socket.h>
101 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
108 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"
121 if test "$ipv6" = "yes"; then
122 AC_MSG_CHECKING([ipv6 stack type])
123 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
126 dnl http://www.kame.net/
127 AC_EGREP_CPP(yes, [dnl
128 #include <netinet/in.h>
129 #ifdef IPV6_INRIA_VERSION
133 CFLAGS="-DINET6 $CFLAGS"])
136 dnl http://www.kame.net/
137 AC_EGREP_CPP(yes, [dnl
138 #include <netinet/in.h>
144 ipv6libdir=/usr/local/v6/lib;
146 CFLAGS="-DINET6 $CFLAGS"])
149 dnl http://www.v6.linux.or.jp/
150 AC_EGREP_CPP(yes, [dnl
151 #include <features.h>
152 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
156 CFLAGS="-DINET6 $CFLAGS"])
159 dnl http://www.v6.linux.or.jp/
160 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
163 ipv6libdir=/usr/inet6/lib
165 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
169 AC_EGREP_CPP(yes, [dnl
170 #include <sys/param.h>
171 #ifdef _TOSHIBA_INET6
176 ipv6libdir=/usr/local/v6/lib;
177 CFLAGS="-DINET6 $CFLAGS"])
180 AC_EGREP_CPP(yes, [dnl
181 #include </usr/local/v6/include/sys/v6config.h>
187 ipv6libdir=/usr/local/v6/lib;
188 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
191 AC_EGREP_CPP(yes, [dnl
192 #include <sys/param.h>
193 #ifdef _ZETA_MINAMI_INET6
198 ipv6libdir=/usr/local/v6/lib;
199 CFLAGS="-DINET6 $CFLAGS"])
202 if test "$ipv6type" != "unknown"; then
206 AC_MSG_RESULT($ipv6type)
209 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
210 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
211 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
212 echo "You have $ipv6lib library, using it"
214 if test "$ipv6trylibc" = "yes"; then
215 echo "You do not have $ipv6lib library, using libc"
217 echo 'Fatal: no $ipv6lib library found. cannot continue.'
218 echo "You need to fetch lib$ipv6lib.a from appropriate"
219 echo 'ipv6 kit and compile beforehand.'
226 if test "$ipv6" = "yes"; then
227 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
228 AC_MSG_CHECKING(getaddrinfo bug)
230 #include <sys/types.h>
233 #include <sys/socket.h>
234 #include <netinet/in.h>
238 int passive, gaierr, inet4 = 0, inet6 = 0;
239 struct addrinfo hints, *ai, *aitop;
240 char straddr[INET6_ADDRSTRLEN], strport[16];
242 for (passive = 0; passive <= 1; passive++) {
243 memset(&hints, 0, sizeof(hints));
244 hints.ai_family = AF_UNSPEC;
245 hints.ai_flags = passive ? AI_PASSIVE : 0;
246 hints.ai_socktype = SOCK_STREAM;
247 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
248 (void)gai_strerror(gaierr);
251 for (ai = aitop; ai; ai = ai->ai_next) {
252 if (ai->ai_addr == NULL ||
253 ai->ai_addrlen == 0 ||
254 getnameinfo(ai->ai_addr, ai->ai_addrlen,
255 straddr, sizeof(straddr), strport, sizeof(strport),
256 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
259 switch (ai->ai_family) {
261 if (strcmp(strport, "54321") != 0) {
265 if (strcmp(straddr, "0.0.0.0") != 0) {
269 if (strcmp(straddr, "127.0.0.1") != 0) {
276 if (strcmp(strport, "54321") != 0) {
280 if (strcmp(straddr, "::") != 0) {
284 if (strcmp(straddr, "::1") != 0) {
301 /* another family support? */
307 /* supported family should be 2, unsupported family should be 0 */
308 if (!(inet4 == 0 || inet4 == 2))
310 if (!(inet6 == 0 || inet6 == 2))
326 buggygetaddrinfo=yes,
328 buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
330 if test "$buggygetaddrinfo" = "yes"; then
331 if test "$ipv6type" != "linux"; then
332 echo 'Fatal: You must get working getaddrinfo() function.'
333 echo ' or you can specify "--disable-ipv6"'.
336 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
337 echo ' Better upgreade your system library to newest version'
338 echo ' of GNU C library (aka glibc).'
341 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
343 dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
344 AC_MSG_CHECKING(for inet_ntop)
345 AC_TRY_COMPILE([#include <sys/types.h>
346 #include <sys/socket.h>
347 #include <netinet/in.h>
348 #include <arpa/inet.h>], [char src[4], dst[128];
349 inet_ntop(AF_INET, src, dst, sizeof(dst));],
350 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
351 AC_REPLACE_FUNCS(inet_ntop)])
352 AC_MSG_CHECKING(for inet_pton)
353 AC_TRY_COMPILE([#include <sys/types.h>
354 #include <sys/socket.h>
355 #include <netinet/in.h>
356 #include <arpa/inet.h>], [char src[128], dst[4];
357 inet_pton(AF_INET, src, dst);],
358 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
359 AC_REPLACE_FUNCS(inet_pton)])
360 AC_MSG_CHECKING(for inet_aton)
361 AC_TRY_COMPILE([#include <sys/types.h>
362 #include <netinet/in.h>
363 #include <arpa/inet.h>], [char src[128];
365 inet_aton(src, &dst);],
366 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
367 AC_REPLACE_FUNCS(inet_aton)])
369 dnl portability macros for getaddrinfo/getnameinfo
372 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
373 if test "$ac_cv_sockaddr_has_sa_len" = no; then
378 dnl check sizeof basic types.
379 dnl They're very likely to be wrong for cross-compiling.
380 AC_CHECK_SIZEOF(char, 1)
381 AC_CHECK_SIZEOF(short, 2)
382 AC_CHECK_SIZEOF(int, 4)
383 AC_CHECK_SIZEOF(long, 4)
386 dnl Checks for u_intXX_t
387 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
388 dnl if test "$ac_cv_bittypes" = no; then
389 dnl missing_includes=yes
393 dnl Checks for addrinfo structure
394 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
395 if test "$ac_cv_addrinfo" = no; then
400 dnl Checks for NI_MAXSERV
401 AC_NI_MAXSERV(ac_cv_maxserv)
402 if test "$ac_cv_maxserv" = no; then
407 dnl Checks for NI_NAMEREQD
408 AC_NI_NAMEREQD(ac_cv_namereqd)
409 if test "$ac_cv_namereqd" = no; then
414 dnl Checks for sockaddr_storage structure
415 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
416 if test "$ac_cv_sa_storage" = no; then
421 dnl Checks for IN[6]ADDRSZ
422 AC_CHECK_ADDRSZ(ac_cv_addrsz)
423 if test "$ac_cv_addrsz" = no; then
428 dnl Checks for RES_USE_INET6
429 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
430 if test "$ac_cv_res_inet6" = no; then
435 dnl Checks for res_state_ext structure
436 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
437 if test "$ac_cv_res_state_ext" = no; then
442 dnl Checks if res_state structure has nsort member.
443 AC_STRUCT_RES_STATE(ac_cv_res_state)
446 dnl set additional include path if necessary
447 if test "$missing_includes" = "yes"; then
448 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
449 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
453 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup)
454 AC_CHECK_FUNCS(ether_ntohost setlinebuf)
457 AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freeaddrinfo,
458 [], [usegetipnodeby=no])
459 if test $usegetipnodeby = yes; then
460 AC_DEFINE(USE_GETIPNODEBY)
464 AC_CHECK_FUNCS(vsnprintf snprintf,,
466 if test $needsnprintf = yes; then
467 LIBOBJS="$LIBOBJS snprintf.o"
470 dnl The following generates a warning from autoconf...
471 errprint(__file__:__line__: please ignore the next warning:
475 AC_CHECK_LIB(dnet, main)
476 AC_CHECK_LIB(rpc, main)
477 AC_CHECK_LIB(nsl, getrpcbynumber)
478 dnl AC_CHECK_LIB(z, uncompress)
479 dnl AC_CHECK_HEADERS(zlib.h)
483 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
485 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
488 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
494 dnl Workaround to enable certain features
511 if test -f /dev/bpf0 ; then
515 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
516 AC_LBL_CHECK_TYPE(int16_t, short)
517 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
518 AC_LBL_CHECK_TYPE(int32_t, int)
519 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
521 AC_LBL_DEVEL(V_CCOPT)
523 AC_LBL_SOCKADDR_SA_LEN
525 AC_LBL_UNALIGNED_ACCESS
529 AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
531 AC_MSG_CHECKING(for SSLeay)
534 for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
535 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
536 ac_cv_ssleay_path=$dir
538 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
539 incdir="-I$dir/include/ssleay"
540 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
541 incdir="-I$dir/include -I$dir/include/openssl"
542 elif test -d $dir/include -a -f $dir/include/des.h; then
543 incdir="-I$dir/include"
545 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
552 AC_MSG_RESULT($ac_cv_ssleay_path)
553 if test "$ac_cv_ssleay_path" != no; then
554 V_INCLS="$V_INCLS $incdir"
555 LDFLAGS="-L$dir/lib $LDFLAGS"
556 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
557 LIBS="$LIBS -lRSAglue"
559 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
560 LIBS="$LIBS -lrsaref"
562 AC_CHECK_LIB(crypto, des_cbc_encrypt)
564 bak_CPPFLAGS=$CPPFLAGS
565 CPPFLAGS="$CPPFLAGS $V_INCLS"
566 AC_CHECK_HEADERS(cast.h)
568 if test "$ac_cv_header_cast_h" = "yes"; then
569 AC_MSG_CHECKING(for buggy CAST128)
575 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
576 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
577 unsigned char out[sizeof(in)];
578 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
580 CAST_set_key(&ks, sizeof(key), key);
581 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
582 if (memcmp(out, ok, sizeof(ok)) != 0)
589 [buggy_cast128="cross-compiling, assume yes"])
590 AC_MSG_RESULT($buggy_cast128)
591 if test "$buggy_cast128" != no; then
592 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
593 echo "disabling CAST128 support."
594 AC_DEFINE(HAVE_BUGGY_CAST128)
598 CPPFLAGS=$bak_CPPFLAGS
601 AC_CHECK_HEADERS(rc5.h)
611 AC_CONFIG_HEADER(config.h)
613 AC_OUTPUT_COMMANDS([if test -f .devel; then
614 echo timestamp > stamp-h
615 cat Makefile-devel-adds >> Makefile