1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.143 2001-10-09 06:56:24 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.143 $)
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],
93 [ case "$enableval" in
94 yes) AC_MSG_RESULT(yes)
95 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
96 AC_DEFINE(TCPDUMP_DO_SMB)
97 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
102 ], AC_MSG_RESULT(no))
104 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
105 AC_MSG_CHECKING([whether to enable ipv6])
107 [ --enable-ipv6 enable ipv6 (with ipv4) support
108 --disable-ipv6 disable ipv6 support],
109 [ case "$enableval" in
110 yes) AC_MSG_RESULT(yes)
111 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 AC_TRY_RUN([ /* AF_INET6 available check */
122 #include <sys/types.h>
123 #include <sys/socket.h>
126 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
133 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"
146 if test "$ipv6" = "yes"; then
147 AC_MSG_CHECKING([ipv6 stack type])
148 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
151 dnl http://www.kame.net/
152 AC_EGREP_CPP(yes, [dnl
153 #include <netinet/in.h>
154 #ifdef IPV6_INRIA_VERSION
158 CFLAGS="-DINET6 $CFLAGS"])
161 dnl http://www.kame.net/
162 AC_EGREP_CPP(yes, [dnl
163 #include <netinet/in.h>
169 ipv6libdir=/usr/local/v6/lib;
171 CFLAGS="-DINET6 $CFLAGS"])
174 dnl http://www.v6.linux.or.jp/
175 AC_EGREP_CPP(yes, [dnl
176 #include <features.h>
177 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
181 CFLAGS="-DINET6 $CFLAGS"])
184 dnl http://www.v6.linux.or.jp/
185 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
188 ipv6libdir=/usr/inet6/lib
190 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
194 AC_EGREP_CPP(yes, [dnl
195 #include <sys/param.h>
196 #ifdef _TOSHIBA_INET6
201 ipv6libdir=/usr/local/v6/lib;
202 CFLAGS="-DINET6 $CFLAGS"])
205 AC_EGREP_CPP(yes, [dnl
206 #include </usr/local/v6/include/sys/v6config.h>
212 ipv6libdir=/usr/local/v6/lib;
213 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
216 AC_EGREP_CPP(yes, [dnl
217 #include <sys/param.h>
218 #ifdef _ZETA_MINAMI_INET6
223 ipv6libdir=/usr/local/v6/lib;
224 CFLAGS="-DINET6 $CFLAGS"])
227 if test "$ipv6type" != "unknown"; then
231 AC_MSG_RESULT($ipv6type)
234 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
235 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
236 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
237 echo "You have $ipv6lib library, using it"
239 if test "$ipv6trylibc" = "yes"; then
240 echo "You do not have $ipv6lib library, using libc"
242 echo 'Fatal: no $ipv6lib library found. cannot continue.'
243 echo "You need to fetch lib$ipv6lib.a from appropriate"
244 echo 'ipv6 kit and compile beforehand.'
251 if test "$ipv6" = "yes"; then
252 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
253 AC_MSG_CHECKING(getaddrinfo bug)
255 #include <sys/types.h>
258 #include <sys/socket.h>
259 #include <netinet/in.h>
263 int passive, gaierr, inet4 = 0, inet6 = 0;
264 struct addrinfo hints, *ai, *aitop;
265 char straddr[INET6_ADDRSTRLEN], strport[16];
267 for (passive = 0; passive <= 1; passive++) {
268 memset(&hints, 0, sizeof(hints));
269 hints.ai_family = AF_UNSPEC;
270 hints.ai_flags = passive ? AI_PASSIVE : 0;
271 hints.ai_socktype = SOCK_STREAM;
272 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
273 (void)gai_strerror(gaierr);
276 for (ai = aitop; ai; ai = ai->ai_next) {
277 if (ai->ai_addr == NULL ||
278 ai->ai_addrlen == 0 ||
279 getnameinfo(ai->ai_addr, ai->ai_addrlen,
280 straddr, sizeof(straddr), strport, sizeof(strport),
281 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
284 switch (ai->ai_family) {
286 if (strcmp(strport, "54321") != 0) {
290 if (strcmp(straddr, "0.0.0.0") != 0) {
294 if (strcmp(straddr, "127.0.0.1") != 0) {
301 if (strcmp(strport, "54321") != 0) {
305 if (strcmp(straddr, "::") != 0) {
309 if (strcmp(straddr, "::1") != 0) {
326 /* another family support? */
332 /* supported family should be 2, unsupported family should be 0 */
333 if (!(inet4 == 0 || inet4 == 2))
335 if (!(inet6 == 0 || inet6 == 2))
351 buggygetaddrinfo=yes,
353 buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
355 if test "$buggygetaddrinfo" = "yes"; then
356 if test "$ipv6type" != "linux"; then
357 echo 'Fatal: You must get working getaddrinfo() function.'
358 echo ' or you can specify "--disable-ipv6"'.
361 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
362 echo ' Better upgreade your system library to newest version'
363 echo ' of GNU C library (aka glibc).'
366 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
368 dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
369 AC_MSG_CHECKING(for inet_ntop)
370 AC_TRY_COMPILE([#include <sys/types.h>
371 #include <sys/socket.h>
372 #include <netinet/in.h>
373 #include <arpa/inet.h>], [char src[4], dst[128];
374 inet_ntop(AF_INET, src, dst, sizeof(dst));],
375 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
376 AC_REPLACE_FUNCS(inet_ntop)])
377 AC_MSG_CHECKING(for inet_pton)
378 AC_TRY_COMPILE([#include <sys/types.h>
379 #include <sys/socket.h>
380 #include <netinet/in.h>
381 #include <arpa/inet.h>], [char src[128], dst[4];
382 inet_pton(AF_INET, src, dst);],
383 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
384 AC_REPLACE_FUNCS(inet_pton)])
385 AC_MSG_CHECKING(for inet_aton)
386 AC_TRY_COMPILE([#include <sys/types.h>
387 #include <netinet/in.h>
388 #include <arpa/inet.h>], [char src[128];
390 inet_aton(src, &dst);],
391 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
392 AC_REPLACE_FUNCS(inet_aton)])
394 dnl portability macros for getaddrinfo/getnameinfo
397 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
398 if test "$ac_cv_sockaddr_has_sa_len" = no; then
403 dnl check sizeof basic types.
404 dnl They're very likely to be wrong for cross-compiling.
405 AC_CHECK_SIZEOF(char, 1)
406 AC_CHECK_SIZEOF(short, 2)
407 AC_CHECK_SIZEOF(int, 4)
408 AC_CHECK_SIZEOF(long, 4)
411 dnl Checks for u_intXX_t
412 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
413 dnl if test "$ac_cv_bittypes" = no; then
414 dnl missing_includes=yes
418 dnl Checks for addrinfo structure
419 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
420 if test "$ac_cv_addrinfo" = no; then
425 dnl Checks for NI_MAXSERV
426 AC_NI_MAXSERV(ac_cv_maxserv)
427 if test "$ac_cv_maxserv" = no; then
432 dnl Checks for NI_NAMEREQD
433 AC_NI_NAMEREQD(ac_cv_namereqd)
434 if test "$ac_cv_namereqd" = no; then
439 dnl Checks for sockaddr_storage structure
440 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
441 if test "$ac_cv_sa_storage" = no; then
446 dnl Checks for IN[6]ADDRSZ
447 AC_CHECK_ADDRSZ(ac_cv_addrsz)
448 if test "$ac_cv_addrsz" = no; then
453 dnl Checks for RES_USE_INET6
454 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
455 if test "$ac_cv_res_inet6" = no; then
460 dnl Checks for res_state_ext structure
461 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
462 if test "$ac_cv_res_state_ext" = no; then
467 dnl Checks if res_state structure has nsort member.
468 AC_STRUCT_RES_STATE(ac_cv_res_state)
471 dnl set additional include path if necessary
472 if test "$missing_includes" = "yes"; then
473 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
474 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
478 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup)
479 AC_CHECK_FUNCS(ether_ntohost, [
480 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
483 #include <sys/types.h>
484 #include <sys/param.h>
485 #include <sys/socket.h>
488 main(int argc, char **argv)
490 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
491 char name[MAXHOSTNAMELEN];
493 ether_ntohost(name, (struct ether_addr *)ea);
496 ], [ac_cv_buggy_ether_ntohost=no],
497 [ac_cv_buggy_ether_ntohost=yes],
498 [ac_cv_buggy_ether_ntohost=not while cross-compiling])])
499 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
500 AC_DEFINE(USE_ETHER_NTOHOST)
503 AC_CHECK_FUNCS(setlinebuf)
506 AC_CHECK_FUNCS(vsnprintf snprintf,,
508 if test $needsnprintf = yes; then
509 LIBOBJS="$LIBOBJS snprintf.o"
514 AC_CHECK_LIB(dnet, dnet_htoa)
516 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
518 dnl HP/UX may need -lnsl for getrpcbynumber.
519 AC_SEARCH_LIBS(getrpcbynumber, nsl)
521 dnl AC_CHECK_LIB(z, uncompress)
522 dnl AC_CHECK_HEADERS(zlib.h)
524 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
526 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
529 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
535 dnl Workaround to enable certain features
552 if test -f /dev/bpf0 ; then
556 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
557 AC_LBL_CHECK_TYPE(int16_t, short)
558 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
559 AC_LBL_CHECK_TYPE(int32_t, int)
560 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
562 AC_LBL_DEVEL(V_CCOPT)
564 AC_LBL_SOCKADDR_SA_LEN
566 AC_LBL_UNALIGNED_ACCESS
570 AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
572 AC_MSG_CHECKING(for SSLeay)
575 for dir in /usr /usr/local /usr/local/ssl /usr/pkg; do
576 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
577 ac_cv_ssleay_path=$dir
579 if test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
580 incdir="-I$dir/include"
582 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
589 AC_MSG_RESULT($ac_cv_ssleay_path)
590 if test "$ac_cv_ssleay_path" != no; then
591 V_INCLS="$V_INCLS $incdir"
592 LDFLAGS="-L$dir/lib $LDFLAGS"
593 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
594 LIBS="$LIBS -lRSAglue"
596 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
597 LIBS="$LIBS -lrsaref"
599 AC_CHECK_LIB(crypto, des_cbc_encrypt)
601 bak_CPPFLAGS=$CPPFLAGS
602 CPPFLAGS="$CPPFLAGS $V_INCLS"
603 AC_CHECK_HEADERS(cast.h)
605 if test "$ac_cv_header_cast_h" = "yes"; then
606 AC_MSG_CHECKING(for buggy CAST128)
612 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
613 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
614 unsigned char out[sizeof(in)];
615 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
617 CAST_set_key(&ks, sizeof(key), key);
618 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
619 if (memcmp(out, ok, sizeof(ok)) != 0)
626 [buggy_cast128="cross-compiling, assume yes"])
627 AC_MSG_RESULT($buggy_cast128)
628 if test "$buggy_cast128" != no; then
629 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
630 echo "disabling CAST128 support."
631 AC_DEFINE(HAVE_BUGGY_CAST128)
635 CPPFLAGS=$bak_CPPFLAGS
638 AC_CHECK_HEADERS(rc5.h)
648 AC_CONFIG_HEADER(config.h)
650 AC_OUTPUT_COMMANDS([if test -f .devel; then
651 echo timestamp > stamp-h
652 cat Makefile-devel-adds >> Makefile