1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.146 2002-04-07 02:01:36 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.146 $)
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 if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
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)
74 dnl autoconf documentation says that $? contains the exit value.
75 dnl reality is that it does not. We leave this in just in case
76 dnl autoconf ever comes back to match the documentation.
78 1) AC_MSG_RESULT(no - smiInit failed) ;;
79 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
80 3) AC_MSG_RESULT(no - can't determine library version) ;;
81 4) AC_MSG_RESULT(no - too old) ;;
82 *) AC_MSG_RESULT(no) ;;
85 [ AC_MSG_RESULT(not when cross-compiling)
90 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
92 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
93 --disable-smb disable possibly-buggy SMB printer],,
96 yes) AC_MSG_RESULT(yes)
97 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
98 AC_DEFINE(TCPDUMP_DO_SMB)
99 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
105 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
106 AC_MSG_CHECKING([whether to enable ipv6])
108 [ --enable-ipv6 enable ipv6 (with ipv4) support
109 --disable-ipv6 disable ipv6 support],
110 [ case "$enableval" in
111 yes) AC_MSG_RESULT(yes)
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"
122 AC_TRY_RUN([ /* AF_INET6 available check */
123 #include <sys/types.h>
124 #include <sys/socket.h>
127 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
134 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"
147 if test "$ipv6" = "yes"; then
148 AC_MSG_CHECKING([ipv6 stack type])
149 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
152 dnl http://www.kame.net/
153 AC_EGREP_CPP(yes, [dnl
154 #include <netinet/in.h>
155 #ifdef IPV6_INRIA_VERSION
159 CFLAGS="-DINET6 $CFLAGS"])
162 dnl http://www.kame.net/
163 AC_EGREP_CPP(yes, [dnl
164 #include <netinet/in.h>
170 ipv6libdir=/usr/local/v6/lib;
172 CFLAGS="-DINET6 $CFLAGS"])
175 dnl http://www.v6.linux.or.jp/
176 AC_EGREP_CPP(yes, [dnl
177 #include <features.h>
178 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
182 CFLAGS="-DINET6 $CFLAGS"])
185 dnl http://www.v6.linux.or.jp/
186 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
189 ipv6libdir=/usr/inet6/lib
191 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
195 AC_EGREP_CPP(yes, [dnl
196 #include <sys/param.h>
197 #ifdef _TOSHIBA_INET6
202 ipv6libdir=/usr/local/v6/lib;
203 CFLAGS="-DINET6 $CFLAGS"])
206 AC_EGREP_CPP(yes, [dnl
207 #include </usr/local/v6/include/sys/v6config.h>
213 ipv6libdir=/usr/local/v6/lib;
214 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
217 AC_EGREP_CPP(yes, [dnl
218 #include <sys/param.h>
219 #ifdef _ZETA_MINAMI_INET6
224 ipv6libdir=/usr/local/v6/lib;
225 CFLAGS="-DINET6 $CFLAGS"])
228 if test "$ipv6type" != "unknown"; then
232 AC_MSG_RESULT($ipv6type)
235 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
236 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
237 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
238 echo "You have $ipv6lib library, using it"
240 if test "$ipv6trylibc" = "yes"; then
241 echo "You do not have $ipv6lib library, using libc"
243 echo 'Fatal: no $ipv6lib library found. cannot continue.'
244 echo "You need to fetch lib$ipv6lib.a from appropriate"
245 echo 'ipv6 kit and compile beforehand.'
252 if test "$ipv6" = "yes"; then
253 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
254 AC_MSG_CHECKING(getaddrinfo bug)
255 AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
256 #include <sys/types.h>
259 #include <sys/socket.h>
260 #include <netinet/in.h>
264 int passive, gaierr, inet4 = 0, inet6 = 0;
265 struct addrinfo hints, *ai, *aitop;
266 char straddr[INET6_ADDRSTRLEN], strport[16];
268 for (passive = 0; passive <= 1; passive++) {
269 memset(&hints, 0, sizeof(hints));
270 hints.ai_family = AF_UNSPEC;
271 hints.ai_flags = passive ? AI_PASSIVE : 0;
272 hints.ai_socktype = SOCK_STREAM;
273 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
274 (void)gai_strerror(gaierr);
277 for (ai = aitop; ai; ai = ai->ai_next) {
278 if (ai->ai_addr == NULL ||
279 ai->ai_addrlen == 0 ||
280 getnameinfo(ai->ai_addr, ai->ai_addrlen,
281 straddr, sizeof(straddr), strport, sizeof(strport),
282 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
285 switch (ai->ai_family) {
287 if (strcmp(strport, "54321") != 0) {
291 if (strcmp(straddr, "0.0.0.0") != 0) {
295 if (strcmp(straddr, "127.0.0.1") != 0) {
302 if (strcmp(strport, "54321") != 0) {
306 if (strcmp(straddr, "::") != 0) {
310 if (strcmp(straddr, "::1") != 0) {
327 /* another family support? */
333 /* supported family should be 2, unsupported family should be 0 */
334 if (!(inet4 == 0 || inet4 == 2))
336 if (!(inet6 == 0 || inet6 == 2))
349 td_cv_buggygetaddrinfo=no,
350 td_cv_buggygetaddrinfo=yes,
351 td_cv_buggygetaddrinfo=yes)])
352 if test "$td_cv_buggygetaddrinfo" = no; then
358 if test "$td_cv_buggygetaddrinfo" = "yes"; then
359 if test "$ipv6type" != "linux"; then
360 echo 'Fatal: You must get working getaddrinfo() function.'
361 echo ' or you can specify "--disable-ipv6"'.
364 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
365 echo ' Better upgreade your system library to newest version'
366 echo ' of GNU C library (aka glibc).'
370 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
372 dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
373 AC_MSG_CHECKING(for inet_ntop)
374 AC_TRY_COMPILE([#include <sys/types.h>
375 #include <sys/socket.h>
376 #include <netinet/in.h>
377 #include <arpa/inet.h>], [char src[4], dst[128];
378 inet_ntop(AF_INET, src, dst, sizeof(dst));],
379 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
380 AC_REPLACE_FUNCS(inet_ntop)])
381 AC_MSG_CHECKING(for inet_pton)
382 AC_TRY_COMPILE([#include <sys/types.h>
383 #include <sys/socket.h>
384 #include <netinet/in.h>
385 #include <arpa/inet.h>], [char src[128], dst[4];
386 inet_pton(AF_INET, src, dst);],
387 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
388 AC_REPLACE_FUNCS(inet_pton)])
389 AC_MSG_CHECKING(for inet_aton)
390 AC_TRY_COMPILE([#include <sys/types.h>
391 #include <netinet/in.h>
392 #include <arpa/inet.h>], [char src[128];
394 inet_aton(src, &dst);],
395 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
396 AC_REPLACE_FUNCS(inet_aton)])
398 dnl portability macros for getaddrinfo/getnameinfo
401 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
402 if test "$ac_cv_sockaddr_has_sa_len" = no; then
407 dnl check sizeof basic types.
408 dnl They're very likely to be wrong for cross-compiling.
409 AC_CHECK_SIZEOF(char, 1)
410 AC_CHECK_SIZEOF(short, 2)
411 AC_CHECK_SIZEOF(int, 4)
412 AC_CHECK_SIZEOF(long, 4)
415 dnl Checks for u_intXX_t
416 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
417 dnl if test "$ac_cv_bittypes" = no; then
418 dnl missing_includes=yes
422 dnl Checks for addrinfo structure
423 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
424 if test "$ac_cv_addrinfo" = no; then
429 dnl Checks for NI_MAXSERV
430 AC_NI_MAXSERV(ac_cv_maxserv)
431 if test "$ac_cv_maxserv" = no; then
436 dnl Checks for NI_NAMEREQD
437 AC_NI_NAMEREQD(ac_cv_namereqd)
438 if test "$ac_cv_namereqd" = no; then
443 dnl Checks for sockaddr_storage structure
444 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
445 if test "$ac_cv_sa_storage" = no; then
450 dnl Checks for IN[6]ADDRSZ
451 AC_CHECK_ADDRSZ(ac_cv_addrsz)
452 if test "$ac_cv_addrsz" = no; then
457 dnl Checks for RES_USE_INET6
458 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
459 if test "$ac_cv_res_inet6" = no; then
464 dnl Checks for res_state_ext structure
465 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
466 if test "$ac_cv_res_state_ext" = no; then
471 dnl Checks if res_state structure has nsort member.
472 AC_STRUCT_RES_STATE(ac_cv_res_state)
475 dnl set additional include path if necessary
476 if test "$missing_includes" = "yes"; then
477 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
478 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
482 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup)
483 AC_CHECK_FUNCS(ether_ntohost, [
484 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
487 #include <sys/types.h>
488 #include <sys/param.h>
489 #include <sys/socket.h>
492 main(int argc, char **argv)
494 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
495 char name[MAXHOSTNAMELEN];
497 ether_ntohost(name, (struct ether_addr *)ea);
500 ], [ac_cv_buggy_ether_ntohost=no],
501 [ac_cv_buggy_ether_ntohost=yes],
502 [ac_cv_buggy_ether_ntohost=not while cross-compiling])])
503 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
504 AC_DEFINE(USE_ETHER_NTOHOST)
507 AC_CHECK_FUNCS(setlinebuf)
510 AC_CHECK_FUNCS(vsnprintf snprintf,,
512 if test $needsnprintf = yes; then
513 LIBOBJS="$LIBOBJS snprintf.o"
518 AC_CHECK_LIB(dnet, dnet_htoa)
520 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
522 dnl HP/UX may need -lnsl for getrpcbynumber.
523 AC_SEARCH_LIBS(getrpcbynumber, nsl)
525 dnl AC_CHECK_LIB(z, uncompress)
526 dnl AC_CHECK_HEADERS(zlib.h)
528 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
530 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
533 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
539 dnl Workaround to enable certain features
556 if test -f /dev/bpf0 ; then
560 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
561 AC_LBL_CHECK_TYPE(int16_t, short)
562 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
563 AC_LBL_CHECK_TYPE(int32_t, int)
564 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
566 AC_LBL_DEVEL(V_CCOPT)
568 AC_LBL_SOCKADDR_SA_LEN
570 AC_LBL_UNALIGNED_ACCESS
574 AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
576 AC_MSG_CHECKING(for SSLeay)
579 for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
580 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
581 ac_cv_ssleay_path=$dir
583 if test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
584 incdir="-I$dir/include"
586 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
593 AC_MSG_RESULT($ac_cv_ssleay_path)
594 if test "$ac_cv_ssleay_path" != no; then
595 V_INCLS="$V_INCLS $incdir"
596 LDFLAGS="-L$dir/lib $LDFLAGS"
597 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
598 LIBS="$LIBS -lRSAglue"
600 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
601 LIBS="$LIBS -lrsaref"
603 AC_CHECK_LIB(crypto, des_cbc_encrypt)
605 bak_CPPFLAGS=$CPPFLAGS
606 CPPFLAGS="$CPPFLAGS $V_INCLS"
607 AC_CHECK_HEADERS(cast.h)
609 if test "$ac_cv_header_cast_h" = "yes"; then
610 AC_MSG_CHECKING(for buggy CAST128)
616 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
617 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
618 unsigned char out[sizeof(in)];
619 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
621 CAST_set_key(&ks, sizeof(key), key);
622 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
623 if (memcmp(out, ok, sizeof(ok)) != 0)
630 [buggy_cast128="cross-compiling, assume yes"])
631 AC_MSG_RESULT($buggy_cast128)
632 if test "$buggy_cast128" != no; then
633 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
634 echo "disabling CAST128 support."
635 AC_DEFINE(HAVE_BUGGY_CAST128)
639 CPPFLAGS=$bak_CPPFLAGS
642 AC_CHECK_HEADERS(rc5.h)
652 AC_CONFIG_HEADER(config.h)
654 AC_OUTPUT_COMMANDS([if test -f .devel; then
655 echo timestamp > stamp-h
656 cat Makefile-devel-adds >> Makefile