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