]> The Tcpdump Group git mirrors - tcpdump/blob - configure.in
d06589a6854c2feafddf31b36f55cf6ed0e70125
[tcpdump] / configure.in
1 dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.178 2004-04-05 00:11:27 mcr 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_REVISION($Revision: 1.178 $)
10 AC_PREREQ(2.50)
11 AC_INIT(tcpdump.c)
12
13 AC_CANONICAL_HOST
14
15 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
16 AC_LBL_C_INLINE
17 AC_C___ATTRIBUTE__
18
19 AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h netinet/ether.h)
20 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
21 #include <sys/socket.h>])
22 AC_HEADER_TIME
23
24 case "$host_os" in
25
26 linux*)
27 AC_MSG_CHECKING(Linux kernel version)
28 if test "$cross_compiling" = yes; then
29 AC_CACHE_VAL(ac_cv_linux_vers,
30 ac_cv_linux_vers=unknown)
31 else
32 AC_CACHE_VAL(ac_cv_linux_vers,
33 ac_cv_linux_vers=`uname -r 2>&1 | \
34 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
35 fi
36 AC_MSG_RESULT($ac_cv_linux_vers)
37 if test $ac_cv_linux_vers = unknown ; then
38 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
39 fi
40 if test $ac_cv_linux_vers -lt 2 ; then
41 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
42 fi
43 ;;
44
45 *)
46 ;;
47 esac
48
49
50 AC_CHECK_HEADERS(smi.h)
51 AC_CHECK_LIB(smi, smiInit)
52 if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
53 then
54 AC_MSG_CHECKING([whether to enable libsmi])
55 AC_TRY_RUN([ /* libsmi available check */
56 #include <smi.h>
57 main()
58 {
59 int current, revision, age, n;
60 const int required = 2;
61 if (smiInit(""))
62 exit(1);
63 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
64 exit(2);
65 n = sscanf(smi_library_version, "%d:%d:%d", &current, &revision, &age);
66 if (n != 3)
67 exit(3);
68 if (required < current - age || required > current)
69 exit(4);
70 exit(0);
71 }
72 ],
73 [ AC_MSG_RESULT(yes)
74 AC_DEFINE(LIBSMI)
75 libsmi=yes],
76 dnl autoconf documentation says that $? contains the exit value.
77 dnl reality is that it does not. We leave this in just in case
78 dnl autoconf ever comes back to match the documentation.
79 [ case $? in
80 1) AC_MSG_RESULT(no - smiInit failed) ;;
81 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
82 3) AC_MSG_RESULT(no - can't determine library version) ;;
83 4) AC_MSG_RESULT(no - too old) ;;
84 *) AC_MSG_RESULT(no) ;;
85 esac
86 libsmi=no],
87 [ AC_MSG_RESULT(not when cross-compiling)
88 libsmi=no]
89 )
90 fi
91
92 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
93 AC_ARG_ENABLE(smb,
94 [ --enable-smb enable possibly-buggy SMB printer [default=yes]
95 --disable-smb disable possibly-buggy SMB printer],,
96 enableval=yes)
97 case "$enableval" in
98 yes) AC_MSG_RESULT(yes)
99 AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
100 AC_DEFINE(TCPDUMP_DO_SMB)
101 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
102 ;;
103 *) AC_MSG_RESULT(no)
104 ;;
105 esac
106
107 AC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME])
108 AC_MSG_CHECKING([whether to drop root privileges by default])
109 if test ! -z "$with_user" ; then
110 AC_DEFINE_UNQUOTED(WITH_USER, "$withval")
111 AC_MSG_RESULT(to \"$withval\")
112 else
113 AC_MSG_RESULT(no)
114 fi
115
116 AC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
117 AC_MSG_CHECKING([whether to chroot])
118 if test ! -z "$with_chroot" ; then
119 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval")
120 AC_MSG_RESULT(to \"$withval\")
121 else
122 AC_MSG_RESULT(no)
123 fi
124
125 AC_MSG_CHECKING([whether to enable ipv6])
126 AC_ARG_ENABLE(ipv6,
127 [ --enable-ipv6 enable ipv6 (with ipv4) support
128 --disable-ipv6 disable ipv6 support],
129 [ case "$enableval" in
130 yes) AC_MSG_RESULT(yes)
131 LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
132 AC_DEFINE(INET6)
133 ipv6=yes
134 ;;
135 *)
136 AC_MSG_RESULT(no)
137 ipv6=no
138 ;;
139 esac ],
140
141 AC_TRY_RUN([ /* AF_INET6 available check */
142 #include <sys/types.h>
143 #include <sys/socket.h>
144 main()
145 {
146 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
147 exit(1);
148 else
149 exit(0);
150 }
151 ],
152 [ AC_MSG_RESULT(yes)
153 LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
154 AC_DEFINE(INET6)
155 ipv6=yes],
156 [ AC_MSG_RESULT(no)
157 ipv6=no],
158 [ AC_MSG_RESULT(no)
159 ipv6=no]
160 ))
161
162 ipv6type=unknown
163 ipv6lib=none
164 ipv6trylibc=no
165
166 if test "$ipv6" = "yes"; then
167 AC_MSG_CHECKING([ipv6 stack type])
168 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
169 case $i in
170 inria)
171 dnl http://www.kame.net/
172 AC_EGREP_CPP(yes,
173 [#include <netinet/in.h>
174 #ifdef IPV6_INRIA_VERSION
175 yes
176 #endif],
177 [ipv6type=$i;
178 CFLAGS="-DINET6 $CFLAGS"])
179 ;;
180 kame)
181 dnl http://www.kame.net/
182 AC_EGREP_CPP(yes,
183 [#include <netinet/in.h>
184 #ifdef __KAME__
185 yes
186 #endif],
187 [ipv6type=$i;
188 ipv6lib=inet6;
189 ipv6libdir=/usr/local/v6/lib;
190 ipv6trylibc=yes;
191 CFLAGS="-DINET6 $CFLAGS"])
192 ;;
193 linux-glibc)
194 dnl http://www.v6.linux.or.jp/
195 AC_EGREP_CPP(yes,
196 [#include <features.h>
197 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
198 yes
199 #endif],
200 [ipv6type=$i;
201 CFLAGS="-DINET6 $CFLAGS"])
202 ;;
203 linux-libinet6)
204 dnl http://www.v6.linux.or.jp/
205 dnl
206 dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
207 dnl and possibly other versions of those OSes
208 dnl
209 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
210 ipv6type=$i
211 ipv6lib=inet6
212 ipv6libdir=/usr/inet6/lib
213 ipv6trylibc=yes;
214 CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
215 fi
216 ;;
217 toshiba)
218 AC_EGREP_CPP(yes,
219 [#include <sys/param.h>
220 #ifdef _TOSHIBA_INET6
221 yes
222 #endif],
223 [ipv6type=$i;
224 ipv6lib=inet6;
225 ipv6libdir=/usr/local/v6/lib;
226 CFLAGS="-DINET6 $CFLAGS"])
227 ;;
228 v6d)
229 AC_EGREP_CPP(yes,
230 [#include </usr/local/v6/include/sys/v6config.h>
231 #ifdef __V6D__
232 yes
233 #endif],
234 [ipv6type=$i;
235 ipv6lib=v6;
236 ipv6libdir=/usr/local/v6/lib;
237 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
238 ;;
239 zeta)
240 AC_EGREP_CPP(yes,
241 [#include <sys/param.h>
242 #ifdef _ZETA_MINAMI_INET6
243 yes
244 #endif],
245 [ipv6type=$i;
246 ipv6lib=inet6;
247 ipv6libdir=/usr/local/v6/lib;
248 CFLAGS="-DINET6 $CFLAGS"])
249 ;;
250 esac
251 if test "$ipv6type" != "unknown"; then
252 break
253 fi
254 done
255 AC_MSG_RESULT($ipv6type)
256 fi
257
258 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
259 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
260 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
261 echo "You have $ipv6lib library, using it"
262 else
263 if test "$ipv6trylibc" = "yes"; then
264 echo "You do not have $ipv6lib library, using libc"
265 else
266 echo 'Fatal: no $ipv6lib library found. cannot continue.'
267 echo "You need to fetch lib$ipv6lib.a from appropriate"
268 echo 'ipv6 kit and compile beforehand.'
269 exit 1
270 fi
271 fi
272 fi
273
274
275 if test "$ipv6" = "yes"; then
276 #
277 # XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
278 # function in libc; there are "ngetaddrinfo()" and
279 # "ogetaddrinfo()" functions, and <netdb.h> #defines
280 # "getaddrinfo" to be either "ngetaddrinfo" or
281 # "ogetaddrinfo", depending on whether _SOCKADDR_LEN
282 # or _XOPEN_SOURCE_EXTENDED are defined or not.
283 #
284 # So this test doesn't work on Tru64 5.1, and possibly
285 # on other 5.x releases. This causes the configure
286 # script to become confused, and results in libpcap
287 # being unbuildable.
288 #
289 AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
290 AC_MSG_CHECKING(getaddrinfo bug)
291 AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
292 #include <sys/types.h>
293 #include <netdb.h>
294 #include <string.h>
295 #include <sys/socket.h>
296 #include <netinet/in.h>
297
298 main()
299 {
300 int passive, gaierr, inet4 = 0, inet6 = 0;
301 struct addrinfo hints, *ai, *aitop;
302 char straddr[INET6_ADDRSTRLEN], strport[16];
303
304 for (passive = 0; passive <= 1; passive++) {
305 memset(&hints, 0, sizeof(hints));
306 hints.ai_family = AF_UNSPEC;
307 hints.ai_flags = passive ? AI_PASSIVE : 0;
308 hints.ai_socktype = SOCK_STREAM;
309 hints.ai_protocol = IPPROTO_TCP;
310 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
311 (void)gai_strerror(gaierr);
312 goto bad;
313 }
314 for (ai = aitop; ai; ai = ai->ai_next) {
315 if (ai->ai_addr == NULL ||
316 ai->ai_addrlen == 0 ||
317 getnameinfo(ai->ai_addr, ai->ai_addrlen,
318 straddr, sizeof(straddr), strport, sizeof(strport),
319 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
320 goto bad;
321 }
322 switch (ai->ai_family) {
323 case AF_INET:
324 if (strcmp(strport, "54321") != 0) {
325 goto bad;
326 }
327 if (passive) {
328 if (strcmp(straddr, "0.0.0.0") != 0) {
329 goto bad;
330 }
331 } else {
332 if (strcmp(straddr, "127.0.0.1") != 0) {
333 goto bad;
334 }
335 }
336 inet4++;
337 break;
338 case AF_INET6:
339 if (strcmp(strport, "54321") != 0) {
340 goto bad;
341 }
342 if (passive) {
343 if (strcmp(straddr, "::") != 0) {
344 goto bad;
345 }
346 } else {
347 if (strcmp(straddr, "::1") != 0) {
348 goto bad;
349 }
350 }
351 inet6++;
352 break;
353 case AF_UNSPEC:
354 goto bad;
355 break;
356 #ifdef AF_UNIX
357 case AF_UNIX:
358 #else
359 #ifdef AF_LOCAL
360 case AF_LOCAL:
361 #endif
362 #endif
363 default:
364 /* another family support? */
365 break;
366 }
367 }
368 }
369
370 /* supported family should be 2, unsupported family should be 0 */
371 if (!(inet4 == 0 || inet4 == 2))
372 goto bad;
373 if (!(inet6 == 0 || inet6 == 2))
374 goto bad;
375
376 if (aitop)
377 freeaddrinfo(aitop);
378 exit(0);
379
380 bad:
381 if (aitop)
382 freeaddrinfo(aitop);
383 exit(1);
384 }
385 ],
386 td_cv_buggygetaddrinfo=no,
387 td_cv_buggygetaddrinfo=yes,
388 td_cv_buggygetaddrinfo=yes)])
389 if test "$td_cv_buggygetaddrinfo" = no; then
390 AC_MSG_RESULT(good)
391 else
392 AC_MSG_RESULT(buggy)
393 fi
394
395 if test "$td_cv_buggygetaddrinfo" = "yes"; then
396 #
397 # XXX - it doesn't appear that "ipv6type" can ever be
398 # set to "linux". Should this be testing for
399 # "linux-glibc", or for that *or* "linux-libinet6"?
400 # If the latter, note that "linux-libinet6" is also
401 # the type given to some non-Linux OSes.
402 #
403 if test "$ipv6type" != "linux"; then
404 echo 'Fatal: You must get working getaddrinfo() function.'
405 echo ' or you can specify "--disable-ipv6"'.
406 exit 1
407 else
408 echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
409 echo ' Better upgrade your system library to newest version'
410 echo ' of GNU C library (aka glibc).'
411 fi
412 fi
413 ])
414 AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
415 fi
416
417 AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
418 [td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
419 [AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
420 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
421 td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
422 if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
423 AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA)
424 fi
425
426 dnl
427 dnl check sizeof basic types.
428 dnl They're very likely to be wrong for cross-compiling.
429 AC_CHECK_SIZEOF(char, 1)
430 AC_CHECK_SIZEOF(short, 2)
431 AC_CHECK_SIZEOF(int, 4)
432 AC_CHECK_SIZEOF(long, 4)
433
434 dnl
435 dnl Checks for u_intXX_t
436 dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
437 dnl if test "$ac_cv_bittypes" = no; then
438 dnl missing_includes=yes
439 dnl fi
440
441 dnl
442 dnl Checks for addrinfo structure
443 AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
444 if test "$ac_cv_addrinfo" = no; then
445 missing_includes=yes
446 fi
447
448 dnl
449 dnl Checks for NI_MAXSERV
450 AC_NI_MAXSERV(ac_cv_maxserv)
451 if test "$ac_cv_maxserv" = no; then
452 missing_includes=yes
453 fi
454
455 dnl
456 dnl Checks for NI_NAMEREQD
457 AC_NI_NAMEREQD(ac_cv_namereqd)
458 if test "$ac_cv_namereqd" = no; then
459 missing_includes=yes
460 fi
461
462 dnl
463 dnl Checks for sockaddr_storage structure
464 AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
465 if test "$ac_cv_sa_storage" = no; then
466 missing_includes=yes
467 fi
468
469 dnl
470 dnl Checks for IN[6]ADDRSZ
471 AC_CHECK_ADDRSZ(ac_cv_addrsz)
472 if test "$ac_cv_addrsz" = no; then
473 missing_includes=yes
474 fi
475
476 dnl
477 dnl Checks for RES_USE_INET6
478 AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
479 if test "$ac_cv_res_inet6" = no; then
480 missing_includes=yes
481 fi
482
483 dnl
484 dnl Checks for res_state_ext structure
485 AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
486 if test "$ac_cv_res_state_ext" = no; then
487 missing_includes=yes
488 fi
489
490 dnl
491 dnl Checks if res_state structure has nsort member.
492 AC_STRUCT_RES_STATE(ac_cv_res_state)
493
494
495 AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
496 AC_CHECK_FUNCS(strftime)
497 AC_CHECK_FUNCS(ether_ntohost, [
498 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
499 AC_TRY_RUN([
500 #include <netdb.h>
501 #include <sys/types.h>
502 #include <sys/param.h>
503 #include <sys/socket.h>
504
505 int
506 main(int argc, char **argv)
507 {
508 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
509 char name[MAXHOSTNAMELEN];
510
511 ether_ntohost(name, (struct ether_addr *)ea);
512 exit(0);
513 }
514 ], [ac_cv_buggy_ether_ntohost=no],
515 [ac_cv_buggy_ether_ntohost=yes],
516 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
517 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
518 AC_DEFINE(USE_ETHER_NTOHOST)
519 fi
520 ])
521 AC_CHECK_FUNCS(setlinebuf alarm)
522
523 needsnprintf=no
524 AC_CHECK_FUNCS(vsnprintf snprintf,,
525 [needsnprintf=yes])
526 if test $needsnprintf = yes; then
527 AC_LIBOBJ(snprintf)
528 fi
529
530 AC_LBL_TYPE_SIGNAL
531
532 AC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))
533
534 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
535
536 dnl HP/UX may need -lnsl for getrpcbynumber.
537 AC_SEARCH_LIBS(getrpcbynumber, nsl)
538
539 dnl AC_CHECK_LIB(z, uncompress)
540 dnl AC_CHECK_HEADERS(zlib.h)
541
542 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
543
544 #
545 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
546 # libraries (e.g., "-lsocket -lnsl" on Solaris).
547 #
548 # We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
549 # use AC_CHECK_FUNC which doesn't let us specify the right #includes
550 # to make this work on BSD/OS 4.x. BSD/OS 4.x ships with the BIND8
551 # resolver, and the way it defines inet_{ntop,pton} is rather strange;
552 # it does not ship with a libc symbol "inet_ntop()", it ships with
553 # "_inet_ntop()", and has a #define macro in one of the system headers
554 # to rename it.
555 #
556 dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
557 AC_MSG_CHECKING(for inet_ntop)
558 AC_TRY_LINK([#include <sys/types.h>
559 #include <sys/socket.h>
560 #include <netinet/in.h>
561 #include <arpa/inet.h>], [char src[4], dst[128];
562 inet_ntop(AF_INET, src, dst, sizeof(dst));],
563 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
564 AC_LIBOBJ(inet_ntop)])
565 AC_MSG_CHECKING(for inet_pton)
566 AC_TRY_LINK([#include <sys/types.h>
567 #include <sys/socket.h>
568 #include <netinet/in.h>
569 #include <arpa/inet.h>], [char src[128], dst[4];
570 inet_pton(AF_INET, src, dst);],
571 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
572 AC_LIBOBJ(inet_pton)])
573 AC_MSG_CHECKING(for inet_aton)
574 AC_TRY_LINK([#include <sys/types.h>
575 #include <netinet/in.h>
576 #include <arpa/inet.h>], [char src[128];
577 struct in_addr dst;
578 inet_aton(src, &dst);],
579 [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
580 AC_LIBOBJ(inet_aton)])
581
582 dnl portability macros for getaddrinfo/getnameinfo
583 dnl
584 dnl Check for sa_len
585 AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
586 if test "$ac_cv_sockaddr_has_sa_len" = no; then
587 missing_includes=yes
588 fi
589
590 AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)
591 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
592 dnl Check for MacOS X, which may ship pcap.h from 0.6 but libpcap may
593 dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
594 dnl have pcap_if_t.
595 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
596 fi
597 if test $ac_cv_func_pcap_lib_version = "no" ; then
598 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
599 AC_TRY_LINK([],
600 [
601 char *
602 return_pcap_version(void)
603 {
604 extern char pcap_version[];
605
606 return pcap_version;
607 }
608 ],
609 ac_lbl_cv_pcap_version_defined=yes,
610 ac_lbl_cv_pcap_version_defined=no)
611 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
612 AC_MSG_RESULT(yes)
613 AC_DEFINE(HAVE_PCAP_VERSION)
614 else
615 AC_MSG_RESULT(no)
616 fi
617 fi
618 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
619 AC_TRY_LINK([],
620 [
621 int
622 return_pcap_debug(void)
623 {
624 extern int pcap_debug;
625
626 return pcap_debug;
627 }
628 ],
629 ac_lbl_cv_pcap_debug_defined=yes,
630 ac_lbl_cv_pcap_debug_defined=no)
631 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
632 AC_MSG_RESULT(yes)
633 AC_DEFINE(HAVE_PCAP_DEBUG)
634 else
635 AC_MSG_RESULT(no)
636 #
637 # OK, what about "yydebug"?
638 #
639 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
640 AC_TRY_LINK([],
641 [
642 int
643 return_yydebug(void)
644 {
645 extern int yydebug;
646
647 return yydebug;
648 }
649 ],
650 ac_lbl_cv_yydebug_defined=yes,
651 ac_lbl_cv_yydebug_defined=no)
652 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
653 AC_MSG_RESULT(yes)
654 AC_DEFINE(HAVE_YYDEBUG)
655 else
656 AC_MSG_RESULT(no)
657 fi
658 fi
659 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
660
661 V_GROUP=0
662 if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
663 V_GROUP=wheel
664 fi
665 case "$host_os" in
666
667 aix*)
668 dnl Workaround to enable certain features
669 AC_DEFINE(_SUN)
670 ;;
671
672 irix*)
673 V_GROUP=sys
674 ;;
675
676 osf*)
677 V_GROUP=system
678 ;;
679
680 solaris*)
681 V_GROUP=sys
682 ;;
683 esac
684
685 if test -f /dev/bpf0 ; then
686 V_GROUP=bpf
687 fi
688
689 AC_LBL_CHECK_TYPE(int8_t, signed char)
690 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
691 AC_LBL_CHECK_TYPE(int16_t, short)
692 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
693 AC_LBL_CHECK_TYPE(int32_t, int)
694 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
695
696 AC_LBL_DEVEL(V_CCOPT)
697
698 AC_LBL_SOCKADDR_SA_LEN
699
700 AC_LBL_UNALIGNED_ACCESS
701
702 AC_VAR_H_ERRNO
703
704 AC_ARG_WITH(crypto, [ --without-crypto disable crypto support],
705 [], [
706 AC_MSG_CHECKING(for SSLeay)
707 ac_cv_ssleay_path=no
708 incdir=no
709
710 Xprefix=`eval echo $prefix`
711
712 for dir in $Xprefix /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
713 #
714 # XXX - is there a better way to check if a given library is
715 # in a given directory than checking each of the possible
716 # shared library suffixes?
717 #
718 # Are there any other suffixes we need to look for? Do we have to
719 # worry about ".so.{version}"?
720 #
721 # Or should we just look for "libcrypto.*"?
722 #
723 if test -d $dir/lib -a \( -f $dir/lib/libcrypto.a -o \
724 -f $dir/lib/libcrypto.so -o \
725 -f $dir/lib/libcrypto.sl -o \
726 -f $dir/lib/libcrypto.dylib \); then
727 ac_cv_ssleay_path=$dir
728 fi
729 if test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
730 incdir="-I$dir/include"
731 fi
732 if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
733 break;
734 else
735 ac_cv_ssleay_path=no
736 incdir=no
737 fi
738 done
739 AC_MSG_RESULT($ac_cv_ssleay_path)
740 if test "$ac_cv_ssleay_path" != no; then
741 V_INCLS="$V_INCLS $incdir"
742 LDFLAGS="-L$dir/lib $LDFLAGS"
743 if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
744 LIBS="$LIBS -lRSAglue"
745 fi
746 if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
747 LIBS="$LIBS -lrsaref"
748 fi
749 AC_CHECK_LIB(crypto, DES_cbc_encrypt)
750
751 CPPFLAGS="$CPPFLAGS $V_INCLS"
752 AC_CHECK_HEADERS(openssl/evp.h)
753 fi
754 ])
755
756 dnl
757 dnl set additional include path if necessary
758 if test "$missing_includes" = "yes"; then
759 CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
760 V_INCLS="$V_INCLS -I\$(srcdir)/missing"
761 fi
762
763 AC_SUBST(V_CCOPT)
764 AC_SUBST(V_DEFS)
765 AC_SUBST(V_GROUP)
766 AC_SUBST(V_INCLS)
767 AC_SUBST(V_PCAPDEP)
768 AC_SUBST(LOCALSRC)
769
770 AC_PROG_INSTALL
771
772 AC_CONFIG_HEADER(config.h)
773
774 AC_OUTPUT_COMMANDS([if test -f .devel; then
775 echo timestamp > stamp-h
776 cat Makefile-devel-adds >> Makefile
777 make depend
778 fi])
779 AC_OUTPUT(Makefile)
780 exit 0