]> The Tcpdump Group git mirrors - tcpdump/blob - configure.in
regen
[tcpdump] / configure.in
1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.89 2000-01-07 16:33:22 assar Exp $ (LBL)
2 dnl
3 dnl Copyright (c) 1994, 1995, 1996, 1997
4 dnl The Regents of the University of California. All rights reserved.
5 dnl
6 dnl Process this file with autoconf to produce a configure script.
7 dnl
8
9 AC_INIT(tcpdump.c)
10
11 AC_CANONICAL_SYSTEM
12
13 umask 002
14
15 if test -z "$PWD" ; then
16 PWD=`pwd`
17 fi
18
19 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
20 AC_C_INLINE
21
22 AC_CHECK_HEADERS(fcntl.h malloc.h memory.h rpc/rpcent.h sys/cdefs.h)
23 AC_HEADER_TIME
24
25 case "$target_os" in
26
27 linux*)
28 AC_MSG_CHECKING(Linux kernel version)
29 AC_CACHE_VAL(ac_cv_linux_vers,
30 ac_cv_linux_vers=`uname -r 2>&1 | \
31 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
32 AC_MSG_RESULT($ac_cv_linux_vers)
33 if test $ac_cv_linux_vers -lt 2 ; then
34 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
35 fi
36 AC_DEFINE(HAVE_NET_SLIP_H)
37 ;;
38
39 *)
40 AC_CHECK_HEADERS(net/slip.h)
41 ;;
42 esac
43
44
45 AC_CHECK_HEADERS(smi.h)
46 AC_CHECK_LIB(smi, main)
47 AC_MSG_CHECKING([whether to enable libsmi])
48 AC_TRY_RUN([ /* libsmi available check */
49 #include <smi.h>
50 main()
51 {
52 if (smiInit(""))
53 exit(1);
54 else
55 exit(0);
56 }
57 ],
58 [ AC_MSG_RESULT(yes)
59 AC_DEFINE(LIBSMI)
60 libsmi=yes],
61 [ AC_MSG_RESULT(no)
62 libsmi=no]
63 )
64
65
66 CFLAGS="$CFLAGS -Dss_family=__ss_family -Dss_len=__ss_len"
67 AC_MSG_CHECKING([whether to enable ipv6])
68 AC_ARG_ENABLE(ipv6,
69 [ --enable-ipv6 enable ipv6 (with ipv4) support
70 --disable-ipv6 disable ipv6 support],
71 [ case "$enableval" in
72 yes) AC_MSG_RESULT(yes)
73 AC_DEFINE(ENABLE_IPV6)
74 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"
75 AC_DEFINE(INET6)
76 ipv6=yes
77 ;;
78 *)
79 AC_MSG_RESULT(no)
80 ipv6=no
81 ;;
82 esac ],
83
84 AC_TRY_RUN([ /* AF_INET6 available check */
85 #include <sys/types.h>
86 #include <sys/socket.h>
87 main()
88 {
89 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
90 exit(1);
91 else
92 exit(0);
93 }
94 ],
95 [ AC_MSG_RESULT(yes)
96 AC_DEFINE(ENABLE_IPV6)
97 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"
98 AC_DEFINE(INET6)
99 ipv6=yes],
100 [ AC_MSG_RESULT(no)
101 ipv6=no],
102 [ AC_MSG_RESULT(no)
103 ipv6=no]
104 ))
105
106 ipv6type=unknown
107 ipv6lib=none
108 ipv6trylibc=no
109
110 if test "$ipv6" = "yes"; then
111 AC_MSG_CHECKING([ipv6 stack type])
112 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
113 case $i in
114 inria)
115 dnl http://www.kame.net/
116 AC_EGREP_CPP(yes, [dnl
117 #include <netinet/in.h>
118 #ifdef IPV6_INRIA_VERSION
119 yes
120 #endif],
121 [ipv6type=$i;
122 CFLAGS="-DINET6 $CFLAGS"])
123 ;;
124 kame)
125 dnl http://www.kame.net/
126 AC_EGREP_CPP(yes, [dnl
127 #include <netinet/in.h>
128 #ifdef __KAME__
129 yes
130 #endif],
131 [ipv6type=$i;
132 ipv6lib=inet6;
133 ipv6libdir=/usr/local/v6/lib;
134 ipv6trylibc=yes;
135 CFLAGS="-DINET6 $CFLAGS"])
136 ;;
137 linux-glibc)
138 dnl http://www.v6.linux.or.jp/
139 AC_EGREP_CPP(yes, [dnl
140 #include <features.h>
141 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
142 yes
143 #endif],
144 [ipv6type=$i;
145 CFLAGS="-DINET6 $CFLAGS"])
146 ;;
147 linux-libinet6)
148 dnl http://www.v6.linux.or.jp/
149 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
150 ipv6type=$i
151 ipv6lib=inet6
152 ipv6libdir=/usr/inet6/lib
153 ipv6trylibc=yes;
154 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
155 fi
156 ;;
157 toshiba)
158 AC_EGREP_CPP(yes, [dnl
159 #include <sys/param.h>
160 #ifdef _TOSHIBA_INET6
161 yes
162 #endif],
163 [ipv6type=$i;
164 ipv6lib=inet6;
165 ipv6libdir=/usr/local/v6/lib;
166 CFLAGS="-DINET6 $CFLAGS"])
167 ;;
168 v6d)
169 AC_EGREP_CPP(yes, [dnl
170 #include </usr/local/v6/include/sys/v6config.h>
171 #ifdef __V6D__
172 yes
173 #endif],
174 [ipv6type=$i;
175 ipv6lib=v6;
176 ipv6libdir=/usr/local/v6/lib;
177 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
178 ;;
179 zeta)
180 AC_EGREP_CPP(yes, [dnl
181 #include <sys/param.h>
182 #ifdef _ZETA_MINAMI_INET6
183 yes
184 #endif],
185 [ipv6type=$i;
186 ipv6lib=inet6;
187 ipv6libdir=/usr/local/v6/lib;
188 CFLAGS="-DINET6 $CFLAGS"])
189 ;;
190 esac
191 if test "$ipv6type" != "unknown"; then
192 break
193 fi
194 done
195 AC_MSG_RESULT($ipv6type)
196 fi
197
198 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
199 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
200 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
201 echo "You have $ipv6lib library, using it"
202 else
203 if test "$ipv6trylibc" = "yes"; then
204 echo "You do not have $ipv6lib library, using libc"
205 else
206 echo 'Fatal: no $ipv6lib library found. cannot continue.'
207 echo "You need to fetch lib$ipv6lib.a from appropriate"
208 echo 'ipv6 kit and compile beforehand.'
209 exit 1
210 fi
211 fi
212 fi
213
214
215 AC_MSG_CHECKING(getaddrinfo bug)
216 AC_TRY_RUN([
217 #include <sys/types.h>
218 #include <netdb.h>
219 #include <string.h>
220 #include <sys/socket.h>
221 #include <netinet/in.h>
222
223 main()
224 {
225 int passive, gaierr, inet4 = 0, inet6 = 0;
226 struct addrinfo hints, *ai, *aitop;
227 char straddr[INET6_ADDRSTRLEN], strport[16];
228
229 for (passive = 0; passive <= 1; passive++) {
230 memset(&hints, 0, sizeof(hints));
231 hints.ai_family = AF_UNSPEC;
232 hints.ai_flags = passive ? AI_PASSIVE : 0;
233 hints.ai_socktype = SOCK_STREAM;
234 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
235 (void)gai_strerror(gaierr);
236 goto bad;
237 }
238 for (ai = aitop; ai; ai = ai->ai_next) {
239 if (ai->ai_addr == NULL ||
240 ai->ai_addrlen == 0 ||
241 getnameinfo(ai->ai_addr, ai->ai_addrlen,
242 straddr, sizeof(straddr), strport, sizeof(strport),
243 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
244 goto bad;
245 }
246 switch (ai->ai_family) {
247 case AF_INET:
248 if (strcmp(strport, "54321") != 0) {
249 goto bad;
250 }
251 if (passive) {
252 if (strcmp(straddr, "0.0.0.0") != 0) {
253 goto bad;
254 }
255 } else {
256 if (strcmp(straddr, "127.0.0.1") != 0) {
257 goto bad;
258 }
259 }
260 inet4++;
261 break;
262 case AF_INET6:
263 if (strcmp(strport, "54321") != 0) {
264 goto bad;
265 }
266 if (passive) {
267 if (strcmp(straddr, "::") != 0) {
268 goto bad;
269 }
270 } else {
271 if (strcmp(straddr, "::1") != 0) {
272 goto bad;
273 }
274 }
275 inet6++;
276 break;
277 case AF_UNSPEC:
278 goto bad;
279 break;
280 #ifdef AF_UNIX
281 case AF_UNIX:
282 #else
283 #ifdef AF_LOCAL
284 case AF_LOCAL:
285 #endif
286 #endif
287 default:
288 /* another family support? */
289 break;
290 }
291 }
292 }
293
294 if (inet6 != 2 || inet4 != 2)
295 goto bad;
296
297 if (aitop)
298 freeaddrinfo(aitop);
299 exit(0);
300
301 bad:
302 if (aitop)
303 freeaddrinfo(aitop);
304 exit(1);
305 }
306 ],
307 AC_MSG_RESULT(good)
308 buggygetaddrinfo=no,
309 AC_MSG_RESULT(buggy)
310 buggygetaddrinfo=yes,
311 AC_MSG_RESULT(buggy)
312 buggygetaddrinfo=yes)
313
314 if test "$buggygetaddrinfo" = "yes"; then
315 if test "$ipv6" = "yes" -a "$ipv6type" != "linux"; then
316 echo 'Fatal: You must get working getaddrinfo() function.'
317 echo ' or you can specify "--disable-ipv6"'.
318 exit 1
319 elif test "$ipv6type" = "linux"; then
320 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
321 echo ' Better upgreade your system library to newest version'
322 echo ' of GNU C library (aka glibc).'
323 fi
324 fi
325 AC_REPLACE_FUNCS(getaddrinfo getnameinfo inet_ntop inet_pton inet_aton)
326
327 dnl portability macros for getaddrinfo/getnameinfo
328 dnl
329 dnl Check for sa_len
330 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
331 if test "$ac_cv_sockaddr_has_sa_len" = no; then
332 missing_includes=yes
333 fi
334
335 dnl
336 dnl check __P macro
337 AC_CHECK_PORTABLE_PROTO(ac_cv_portable_proto)
338 if test "$ac_cv_portable_proto" = no; then
339 missing_includes=yes
340 fi
341
342 dnl
343 dnl check sizeof basic types
344 AC_CHECK_SIZEOF(char)
345 AC_CHECK_SIZEOF(short)
346 AC_CHECK_SIZEOF(int)
347 AC_CHECK_SIZEOF(long)
348
349 dnl
350 dnl Checks for u_intXX_t
351 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
352 dnl if test "$ac_cv_bittypes" = no; then
353 dnl missing_includes=yes
354 dnl fi
355
356 dnl
357 dnl Checks for addrinfo structure
358 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
359 if test "$ac_cv_addrinfo" = no; then
360 missing_includes=yes
361 fi
362
363 dnl
364 dnl Checks for sockaddr_storage structure
365 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
366 if test "$ac_cv_sa_storage" = no; then
367 missing_includes=yes
368 fi
369
370 dnl
371 dnl Checks for IN[6]ADDRSZ
372 AC_CHECK_ADDRSZ(ac_cv_addrsz)
373 if test "$ac_cv_addrsz" = no; then
374 missing_includes=yes
375 fi
376
377 dnl
378 dnl Checks for RES_USE_INET6
379 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
380 if test "$ac_cv_res_inet6" = no; then
381 missing_includes=yes
382 fi
383
384 dnl
385 dnl Checks for AAAA
386 AC_CHECK_AAAA(ac_cv_aaaa)
387 if test "$ac_cv_aaaa" = no; then
388 AC_DEFINE(T_AAAA, 28)
389 fi
390
391 dnl
392 dnl Checks for res_state_ext structure
393 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
394 if test "$ac_cv_res_state_ext" = no; then
395 missing_includes=yes
396 fi
397
398 dnl
399 dnl Checks if res_state structure has nsort member.
400 AC_STRUCT_RES_STATE(ac_cv_res_state)
401
402 dnl
403 dnl set additional include path if necessary
404 if test "$missing_includes" = "yes"; then
405 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
406 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
407 fi
408
409
410 AC_REPLACE_FUNCS(vfprintf strcasecmp)
411 AC_CHECK_FUNCS(ether_ntohost setlinebuf gethostbyname2)
412
413 AC_CHECK_FUNCS(vsnprintf snprintf asprintf asnprintf vasprintf vasnprintf)
414
415 dnl The following generates a warning from autoconf...
416 AC_C_BIGENDIAN
417
418 AC_CHECK_LIB(dnet, main)
419 AC_CHECK_LIB(rpc, main)
420 AC_CHECK_LIB(z, uncompress)
421 AC_CHECK_HEADERS(zlib.h netinet6/ipcomp.h)
422
423 AC_LBL_TYPE_SIGNAL
424
425 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
426
427 V_GROUP=0
428 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
429 V_GROUP=wheel
430 fi
431 case "$target_os" in
432
433 aix*)
434 dnl Workaround to enable certain features
435 AC_DEFINE(_SUN)
436 ;;
437
438 irix*)
439 V_GROUP=sys
440 ;;
441
442 linux*)
443 V_INCLS="$V_INCLS -I\$(srcdir)/linux-include"
444 ;;
445
446 osf*)
447 V_GROUP=system
448 dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
449 AC_DEFINE(__STDC__,2)
450 ;;
451
452 solaris*)
453 V_GROUP=sys
454 ;;
455 esac
456
457 if test -f /dev/bpf0 ; then
458 V_GROUP=bpf
459 fi
460
461 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
462 AC_LBL_CHECK_TYPE(int16_t, short)
463 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
464 AC_LBL_CHECK_TYPE(int32_t, int)
465 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
466
467 AC_LBL_DEVEL(V_CCOPT)
468
469 AC_LBL_SOCKADDR_SA_LEN
470
471 AC_MSG_CHECKING(if ether_header uses ether_addr structs)
472 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
473 LBL_SAVE_CFLAGS="$CFLAGS"
474 CFLAGS="$CFLAGS $V_INCLS"
475 AC_TRY_COMPILE([
476 # include <sys/types.h>
477 # if __STDC__
478 /* osf3 has REALLY good prototyes */
479 struct mbuf;
480 struct rtentry;
481 # endif
482 # include <sys/socket.h>
483 # include <net/if.h>
484 # include <netinet/in.h>
485 # include <netinet/if_ether.h>],
486 [u_int i =
487 sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
488 ac_cv_ether_header_has_ea=yes,
489 ac_cv_ether_header_has_ea=no)
490 CFLAGS="$LBL_SAVE_CFLAGS")
491 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
492 if test $ac_cv_ether_header_has_ea = yes ; then
493 AC_DEFINE(ETHER_HEADER_HAS_EA)
494 fi
495
496 AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
497 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
498 LBL_SAVE_CFLAGS="$CFLAGS"
499 CFLAGS="$CFLAGS $V_INCLS"
500 AC_TRY_COMPILE([
501 # include <sys/types.h>
502 # if __STDC__
503 /* osf3 has REALLY good prototyes */
504 struct mbuf;
505 struct rtentry;
506 # endif
507 # include <sys/socket.h>
508 # include <net/if.h>
509 # include <netinet/in.h>
510 # include <netinet/if_ether.h>],
511 [u_int i =
512 sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
513 ac_cv_ether_arp_has_ea=yes,
514 ac_cv_ether_arp_has_ea=no)
515 CFLAGS="$LBL_SAVE_CFLAGS")
516 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
517 if test $ac_cv_ether_arp_has_ea = yes ; then
518 AC_DEFINE(ETHER_ARP_HAS_EA)
519 fi
520
521 AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
522 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
523 LBL_SAVE_CFLAGS="$CFLAGS"
524 CFLAGS="$CFLAGS $V_INCLS"
525 AC_TRY_COMPILE([
526 # include <sys/types.h>
527 # include <sys/socket.h>
528 # if __STDC__
529 /* osf3 has REALLY good prototyes */
530 struct mbuf;
531 struct rtentry;
532 # endif
533 # include <net/if.h>
534 # include <netinet/in.h>
535 # include <netinet/if_ether.h>],
536 [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
537 ac_cv_struct_ether_arp_x=yes,
538 ac_cv_struct_ether_arp_x=no)
539 CFLAGS="$LBL_SAVE_CFLAGS")
540 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
541 if test $ac_cv_struct_ether_arp_x = yes ; then
542 AC_DEFINE(ETHER_ARP_HAS_X)
543 fi
544
545 AC_LBL_UNALIGNED_ACCESS
546
547 AC_VAR_H_ERRNO
548
549 AC_MSG_CHECKING(for SSLeay)
550 ac_cv_ssleay_path=no
551 incdir=no
552 for dir in /usr/local /usr/local/ssl /usr/pkg; do
553 if test -d $dir/lib -a -f $dir/lib/libcrypto.a; then
554 ac_cv_ssleay_path=$dir
555 fi
556 if test -d $dir/include -a -f $dir/include/des.h; then
557 incdir="-I$dir/include"
558 else
559 if test -d $dir/include/ssleay -a -f $dir/include/ssleay/des.h; then
560 incdir="-I$dir/include/ssleay"
561 elif test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
562 incdir="-I$dir/include -I$dir/include/openssl"
563 fi
564 fi
565 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
566 break;
567 else
568 ac_cv_ssleay_path=no
569 incdir=no
570 fi
571 done
572 AC_MSG_RESULT($ac_cv_ssleay_path)
573 if test "$ac_cv_ssleay_path" != no; then
574 V_INCLS="$V_INCLS $incdir"
575 LIBS="$LIBS -L$dir/lib"
576 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
577 LIBS="$LIBS -lRSAglue"
578 fi
579 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
580 LIBS="$LIBS -lrsaref"
581 fi
582 AC_CHECK_LIB(crypto, des_cbc_encrypt)
583 AC_DEFINE(CRYPTO)
584
585 bak_CPPFLAGS=$CPPFLAGS
586 CPPFLAGS="$CPPFLAGS $V_INCLS"
587 AC_CHECK_HEADERS(cast.h rc5.h)
588
589 if test "$ac_cv_header_cast_h" = "yes"; then
590 AC_MSG_CHECKING(for buggy CAST128)
591 AC_TRY_RUN(dnl
592 [
593 #include <cast.h>
594 main()
595 {
596 unsigned char key[] = {0x01,0x23,0x45,0x67,0x12};
597 unsigned char in[] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};
598 unsigned char out[sizeof(in)];
599 unsigned char ok[] = {0x7A,0xC8,0x16,0xD1,0x6E,0x9B,0x30,0x2E};
600 CAST_KEY ks;
601 CAST_set_key(&ks, sizeof(key), key);
602 CAST_ecb_encrypt(in, out, &ks, CAST_ENCRYPT);
603 if (memcmp(out, ok, sizeof(ok)) != 0)
604 return 0;
605 else
606 return 1;
607 }],
608 [buggy_cast128=yes],
609 [buggy_cast128=no],
610 [buggy_cast128="cross-compiling, assume yes"])
611 AC_MSG_RESULT($buggy_cast128)
612 if test "$buggy_cast128" != no; then
613 echo "NOTE: SSLeay 0.9.0b has a bug in CAST128 en/decoding routine."
614 echo "disabling CAST128 support."
615 AC_DEFINE(HAVE_BUGGY_CAST128)
616 fi
617 fi
618
619 CPPFLAGS=$bak_CPPFLAGS
620 fi
621
622 if test -r ${srcdir}/lbl/gnuc.h ; then
623 rm -f gnuc.h
624 ln -s ${srcdir}/lbl/gnuc.h gnuc.h
625 fi
626
627 AC_SUBST(V_CCOPT)
628 AC_SUBST(V_GROUP)
629 AC_SUBST(V_INCLS)
630 AC_SUBST(V_PCAPDEP)
631 AC_SUBST(LOCALSRC)
632
633 AC_PROG_INSTALL
634
635 AC_CONFIG_HEADER(config.h)
636
637 AC_OUTPUT(Makefile)
638
639 if test -f .devel ; then
640 make depend
641 fi
642 exit 0