]> The Tcpdump Group git mirrors - tcpdump/blob - configure.ac
CMake: Fix the comment about versions. [skip ci]
[tcpdump] / configure.ac
1 dnl Copyright (c) 1994, 1995, 1996, 1997
2 dnl The Regents of the University of California. All rights reserved.
3 dnl
4 dnl Process this file with autoconf to produce a configure script.
5 dnl
6
7 #
8 # See
9 #
10 # https://ftp.gnu.org/gnu/config/README
11 #
12 # for the URLs to use to fetch new versions of config.guess and
13 # config.sub.
14 #
15
16 AC_PREREQ([2.69])
17 AC_INIT([tcpdump],[m4_esyscmd_s(cat VERSION)])
18 AC_CONFIG_SRCDIR(tcpdump.c)
19
20 AC_CANONICAL_HOST
21
22 AC_LBL_C_INIT_BEFORE_CC(V_INCLS)
23 #
24 # Try to enable as many C99 features as we can.
25 # At minimum, we want C++/C99-style // comments.
26 #
27 AC_PROG_CC_C99
28 if test "$ac_cv_prog_cc_c99" = "no"; then
29 AC_MSG_WARN([The C compiler does not support C99; there may be compiler errors])
30 fi
31 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
32 AC_LBL_C_INLINE
33
34 AC_CHECK_HEADERS(rpc/rpc.h rpc/rpcent.h net/if.h)
35 #
36 # Get the size of a void *, to know whether this is a 32-bit or 64-bit build.
37 #
38 AC_CHECK_SIZEOF([void *])
39
40 #
41 # Get the size of a time_t, to know whether it's 32-bit or 64-bit.
42 #
43 AC_CHECK_SIZEOF([time_t],,[#include <time.h>])
44
45 case "$host_os" in
46
47 darwin*)
48 AC_ARG_ENABLE(universal,
49 AS_HELP_STRING([--disable-universal],[don't build universal on macOS]))
50 if test "$enable_universal" != "no"; then
51 case "$host_os" in
52
53 darwin9.*)
54 #
55 # Leopard. Build for x86 and 32-bit PowerPC, with
56 # x86 first. (That's what Apple does.)
57 #
58 V_CCOPT="$V_CCOPT -arch i386 -arch ppc"
59 LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
60 ;;
61
62 darwin10.*)
63 #
64 # Snow Leopard. Build for x86-64 and x86, with
65 # x86-64 first. (That's what Apple does.)
66 #
67 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
68 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
69 ;;
70 esac
71 fi
72 ;;
73 esac
74
75 #
76 # Do we have pkg-config?
77 #
78 PKG_PROG_PKG_CONFIG
79
80 #
81 # Do we have the brew command from Homebrew?
82 #
83 AC_PATH_PROG([BREW], [brew])
84
85 AC_ARG_WITH([smi],
86 [AS_HELP_STRING([--with-smi],
87 [link with libsmi (allows to load MIBs on the fly to decode SNMP packets) [default=yes, if available]])],
88 [],
89 [with_smi=yes])
90
91 if test "x$with_smi" != "xno" ; then
92 AC_CHECK_HEADER(smi.h,
93 [
94 #
95 # OK, we found smi.h. Do we have libsmi with smiInit?
96 #
97 AC_CHECK_LIB(smi, smiInit,
98 [
99 #
100 # OK, we have libsmi with smiInit. Can we use it?
101 #
102 AC_MSG_CHECKING([whether to enable libsmi])
103 savedlibs="$LIBS"
104 LIBS="-lsmi $LIBS"
105 AC_RUN_IFELSE([AC_LANG_SOURCE([[
106 /* libsmi available check */
107 #include <stdio.h>
108 #include <stdlib.h>
109 #include <string.h>
110 #include <smi.h>
111 int main()
112 {
113 int current, revision, age, n;
114 const int required = 2;
115 if (smiInit(""))
116 exit(1);
117 if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
118 exit(2);
119 n = sscanf(smi_library_version, "%d:%d:%d", &current, &revision, &age);
120 if (n != 3)
121 exit(3);
122 if (required < current - age || required > current)
123 exit(4);
124 exit(0);
125 }
126 ]])
127 ],
128 [
129 AC_MSG_RESULT(yes)
130 AC_DEFINE(USE_LIBSMI, 1,
131 [Define if you enable support for libsmi])
132 ],
133 [
134 dnl autoconf documentation says that
135 dnl $? contains the exit value.
136 dnl reality is that it does not.
137 dnl We leave this in just in case
138 dnl autoconf ever comes back to
139 dnl match the documentation.
140 case $? in
141 1) AC_MSG_RESULT(no - smiInit failed) ;;
142 2) AC_MSG_RESULT(no - header/library version mismatch) ;;
143 3) AC_MSG_RESULT(no - can't determine library version) ;;
144 4) AC_MSG_RESULT(no - too old) ;;
145 *) AC_MSG_RESULT(no) ;;
146 esac
147 LIBS="$savedlibs"
148 ],
149 [
150 AC_MSG_RESULT(not when cross-compiling)
151 LIBS="$savedlibs"
152 ]
153 )
154 ])
155 ])
156 fi
157
158 AC_MSG_CHECKING([whether to enable the instrument functions code])
159 AC_ARG_ENABLE([instrument-functions],
160 [AS_HELP_STRING([--enable-instrument-functions],
161 [enable instrument functions code [default=no]])],
162 [],
163 [enableval=no])
164 case "$enableval" in
165 yes) AC_MSG_RESULT(yes)
166 AC_CHECK_LIB([bfd], [bfd_init],
167 [true],
168 [AC_MSG_ERROR(
169 [--enable-instrument-functions was given, but test for library libbfd failed. Please install the 'binutils-dev' package.])],
170 [])
171 AC_DEFINE(ENABLE_INSTRUMENT_FUNCTIONS, 1,
172 [define if you want to build the instrument functions code])
173 LOCALSRC="$LOCALSRC instrument-functions.c"
174 # Add '-finstrument-functions' instrumentation option to generate
175 # instrumentation calls for entry and exit to functions.
176 # Try to avoid Address Space Layout Randomization (ALSR).
177 CFLAGS="$CFLAGS -O0 -ggdb -finstrument-functions -fno-stack-protector -fno-pic"
178 LDFLAGS="$LDFLAGS -O0 -ggdb -fno-stack-protector -no-pie"
179 LIBS="$LIBS -lbfd"
180 ;;
181 *) AC_MSG_RESULT(no)
182 ;;
183 esac
184
185 AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
186 AC_ARG_ENABLE([smb],
187 [AS_HELP_STRING([--enable-smb],
188 [enable possibly-buggy SMB printer [default=no]])],
189 [],
190 [enableval=no])
191 case "$enableval" in
192 yes) AC_MSG_RESULT(yes)
193 AC_DEFINE(ENABLE_SMB, 1,
194 [define if you want to build the possibly-buggy SMB printer])
195 LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
196 ;;
197 *) AC_MSG_RESULT(no)
198 ;;
199 esac
200
201 AC_MSG_CHECKING([whether to drop root privileges by default])
202 AC_ARG_WITH(
203 [user],
204 [AS_HELP_STRING([--with-user=USERNAME],
205 [drop privileges by default to USERNAME]
206 )],
207 [],
208 [withval=no])
209 AS_CASE(["$withval"],
210 [no], [AC_MSG_RESULT(no)],
211 [''|yes], [AC_MSG_ERROR([--with-user requires a username])],
212 [
213 AC_DEFINE_UNQUOTED(WITH_USER, "$withval",
214 [define if should drop privileges by default])
215 AC_MSG_RESULT([yes, to user "$withval"])
216 ]
217 )
218
219 AC_MSG_CHECKING([whether to chroot])
220 AC_ARG_WITH(
221 [chroot],
222 [AS_HELP_STRING([--with-chroot=DIRECTORY],
223 [when dropping privileges, chroot to DIRECTORY]
224 )],
225 [],
226 [withval=no]
227 )
228 AS_CASE(["$withval"],
229 [no], [AC_MSG_RESULT(no)],
230 [''|yes], [AC_MSG_ERROR([--with-chroot requires a directory])],
231 [
232 AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval",
233 [define if should chroot when dropping privileges])
234 AC_MSG_RESULT([yes, to directory "$withval"])
235 ]
236 )
237
238 AC_ARG_WITH(sandbox-capsicum,
239 AS_HELP_STRING([--with-sandbox-capsicum],
240 [use Capsicum security functions @<:@default=yes, if available@:>@]))
241 #
242 # Check whether various functions are available. If any are, set
243 # ac_lbl_capsicum_function_seen to yes; if any are not, set
244 # ac_lbl_capsicum_function_not_seen to yes.
245 #
246 # We don't check cap_rights_init(), as it's a macro, wrapping another
247 # function, in at least some versions of FreeBSD, and AC_CHECK_FUNCS()
248 # doesn't handle that.
249 #
250 # All of the ones we check for must be available in order to enable
251 # capsicum sandboxing.
252 #
253 # XXX - do we need to check for all of them, or are there some that, if
254 # present, imply others are present?
255 #
256 if test -z "$with_sandbox_capsicum" || test "$with_sandbox_capsicum" != "no" ; then
257 #
258 # First, make sure we have the required header.
259 #
260 AC_CHECK_HEADER(sys/capsicum.h,
261 [
262 #
263 # We do; now make sure we have the required functions.
264 #
265 AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat,
266 ac_lbl_capsicum_function_seen=yes,
267 ac_lbl_capsicum_function_not_seen=yes)
268 ])
269 AC_CHECK_LIB(casper, cap_init, LIBS="$LIBS -lcasper")
270 AC_CHECK_LIB(cap_dns, cap_gethostbyaddr, LIBS="$LIBS -lcap_dns")
271 fi
272 AC_MSG_CHECKING([whether to sandbox using capsicum])
273 if test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_function_not_seen" != "xyes"; then
274 AC_DEFINE(HAVE_CAPSICUM, 1, [capsicum support available])
275 AC_MSG_RESULT(yes)
276 else
277 AC_MSG_RESULT(no)
278 fi
279 AC_MSG_CHECKING([whether to sandbox using Casper library])
280 if test "x$ac_cv_lib_casper_cap_init" = "xyes" -a "x$ac_cv_lib_cap_dns_cap_gethostbyaddr" = "xyes"; then
281 AC_DEFINE(HAVE_CASPER, 1, [Casper support available])
282 AC_MSG_RESULT(yes)
283 else
284 AC_MSG_RESULT(no)
285 fi
286
287 #
288 # We must check this before checking whether to check the OS's IPv6,
289 # support because, on some platforms (such as SunOS 5.x), the test
290 # program requires the extra networking libraries.
291 #
292 AC_LBL_LIBRARY_NET
293
294 #
295 # Check whether AF_INET6 and struct in6_addr are defined.
296 # If they aren't both defined, we don't have sufficient OS
297 # support for IPv6, so we don't look for IPv6 support libraries,
298 # and we define AF_INET6 and struct in6_addr ourselves.
299 #
300 AC_MSG_CHECKING([whether the operating system supports IPv6])
301 AC_COMPILE_IFELSE(
302 [
303 AC_LANG_SOURCE(
304 [[
305 #include <string.h>
306 /* AF_INET6 available check */
307 #include <sys/types.h>
308 #ifdef _WIN32
309 #include <ws2tcpip.h>
310 #else
311 #include <sys/socket.h>
312 #include <netinet/in.h>
313 #endif
314 #ifdef AF_INET6
315 void
316 foo(struct in6_addr *addr)
317 {
318 memset(addr, 0, sizeof (struct in6_addr));
319 }
320 #else
321 #error "AF_INET6 not defined"
322 #endif
323 ]])
324 ],
325 [
326 AC_MSG_RESULT(yes)
327 AC_DEFINE(HAVE_OS_IPV6_SUPPORT, 1,
328 [define if the OS provides AF_INET6 and struct in6_addr])
329 ipv6=yes
330 ],
331 [
332 AC_MSG_RESULT(no)
333 ipv6=no
334 ]
335 )
336
337 ipv6type=unknown
338 ipv6lib=none
339 ipv6trylibc=no
340
341 if test "$ipv6" = "yes"; then
342 AC_MSG_CHECKING([ipv6 stack type])
343 for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
344 case $i in
345 inria)
346 dnl http://www.kame.net/
347 AC_EGREP_CPP(yes,
348 [#include <netinet/in.h>
349 #ifdef IPV6_INRIA_VERSION
350 yes
351 #endif],
352 [ipv6type=$i])
353 ;;
354 kame)
355 dnl http://www.kame.net/
356 AC_EGREP_CPP(yes,
357 [#include <netinet/in.h>
358 #ifdef __KAME__
359 yes
360 #endif],
361 [ipv6type=$i;
362 ipv6lib=inet6;
363 ipv6libdir=/usr/local/v6/lib;
364 ipv6trylibc=yes])
365 ;;
366 linux-glibc)
367 dnl http://www.v6.linux.or.jp/
368 AC_EGREP_CPP(yes,
369 [#include <features.h>
370 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
371 yes
372 #endif],
373 [ipv6type=$i])
374 ;;
375 linux-libinet6)
376 dnl http://www.v6.linux.or.jp/
377 dnl
378 dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
379 dnl and possibly other versions of those OSes
380 dnl
381 if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
382 ipv6type=$i
383 ipv6lib=inet6
384 ipv6libdir=/usr/inet6/lib
385 ipv6trylibc=yes;
386 CFLAGS="-I/usr/inet6/include $CFLAGS"
387 fi
388 ;;
389 toshiba)
390 AC_EGREP_CPP(yes,
391 [#include <sys/param.h>
392 #ifdef _TOSHIBA_INET6
393 yes
394 #endif],
395 [ipv6type=$i;
396 ipv6lib=inet6;
397 ipv6libdir=/usr/local/v6/lib])
398 ;;
399 v6d)
400 AC_EGREP_CPP(yes,
401 [#include </usr/local/v6/include/sys/v6config.h>
402 #ifdef __V6D__
403 yes
404 #endif],
405 [ipv6type=$i;
406 ipv6lib=v6;
407 ipv6libdir=/usr/local/v6/lib;
408 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
409 ;;
410 zeta)
411 AC_EGREP_CPP(yes,
412 [#include <sys/param.h>
413 #ifdef _ZETA_MINAMI_INET6
414 yes
415 #endif],
416 [ipv6type=$i;
417 ipv6lib=inet6;
418 ipv6libdir=/usr/local/v6/lib])
419 ;;
420 esac
421 if test "$ipv6type" != "unknown"; then
422 break
423 fi
424 done
425 AC_MSG_RESULT($ipv6type)
426 fi
427
428 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
429 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
430 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
431 echo "You have $ipv6lib library, using it"
432 else
433 if test "$ipv6trylibc" = "yes"; then
434 echo "You do not have $ipv6lib library, using libc"
435 else
436 echo 'Fatal: no $ipv6lib library found. cannot continue.'
437 echo "You need to fetch lib$ipv6lib.a from appropriate"
438 echo 'ipv6 kit and compile beforehand.'
439 exit 1
440 fi
441 fi
442 fi
443
444 AC_REPLACE_FUNCS(strlcat strlcpy strdup strsep getservent getopt_long)
445 AC_CHECK_FUNCS(fork vfork)
446 AC_CHECK_FUNCS(setlinebuf)
447
448 #
449 # It became apparent at some point that using a suitable C99 compiler does not
450 # automatically mean snprintf(3) implementation in the libc supports all the
451 # modifiers and specifiers used in the project, so let's test that before the
452 # build, not after.
453 #
454 # Testing the sizeof_t length modifier takes making an snprintf() call and
455 # comparing the actual result with the expected result. If this fails, it will
456 # most likely happen at run time, not compile time.
457 #
458 # Testing the 64-bit conversion specifiers in addition to that requires the
459 # <inttypes.h> header to be present and the macros to be defined, so if this
460 # fails, it will more likely happen at compile time.
461 #
462 AC_MSG_CHECKING([whether snprintf is suitable])
463 AC_RUN_IFELSE(
464 [
465 AC_LANG_SOURCE([[
466 #include <stdio.h>
467 #include <string.h>
468 #include <inttypes.h>
469 #include <sys/types.h>
470
471 int main()
472 {
473 char buf[100];
474 uint64_t t = (uint64_t)1 << 32;
475
476 snprintf(buf, sizeof(buf), "%zu", sizeof(buf));
477 if (strncmp(buf, "100", sizeof(buf)))
478 return 1;
479
480 snprintf(buf, sizeof(buf), "%zd", -sizeof(buf));
481 if (strncmp(buf, "-100", sizeof(buf)))
482 return 2;
483
484 snprintf(buf, sizeof(buf), "%" PRId64, -t);
485 if (strncmp(buf, "-4294967296", sizeof(buf)))
486 return 3;
487
488 snprintf(buf, sizeof(buf), "0o%" PRIo64, t);
489 if (strncmp(buf, "0o40000000000", sizeof(buf)))
490 return 4;
491
492 snprintf(buf, sizeof(buf), "0x%" PRIx64, t);
493 if (strncmp(buf, "0x100000000", sizeof(buf)))
494 return 5;
495
496 snprintf(buf, sizeof(buf), "%" PRIu64, t);
497 if (strncmp(buf, "4294967296", sizeof(buf)))
498 return 6;
499
500 return 0;
501 }
502 ]])
503 ],
504 [
505 AC_MSG_RESULT(yes)
506 ],
507 [
508 AC_MSG_RESULT(no)
509 AC_MSG_ERROR(
510 [The snprintf(3) implementation in this libc is not suitable,
511 tcpdump would not work correctly even if it managed to compile.])
512 ],
513 [
514 AC_MSG_RESULT(not while cross-compiling)
515 ]
516 )
517
518 AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc
519
520 dnl Some platforms may need -lnsl for getrpcbynumber.
521 AC_SEARCH_LIBS(getrpcbynumber, nsl,
522 AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()]))
523
524 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
525
526 #
527 # Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
528 # libraries (e.g., "-lsocket -lnsl" on Solaris).
529 #
530 # You are in a twisty little maze of UN*Xes, all different.
531 # Some might not have ether_ntohost().
532 # Some might have it and declare it in <net/ethernet.h>.
533 # Some might have it and declare it in <netinet/ether.h>
534 # Some might have it and declare it in <sys/ethernet.h>.
535 # Some might have it and declare it in <arpa/inet.h>.
536 # Some might have it and declare it in <netinet/if_ether.h>.
537 # Some might have it and not declare it in any header file.
538 #
539 # Before you is a C compiler.
540 #
541 AC_CHECK_FUNCS(ether_ntohost, [
542 AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
543 AC_RUN_IFELSE([AC_LANG_SOURCE([[
544 #include <netdb.h>
545 #include <netinet/ether.h>
546 #include <stdlib.h>
547 #include <sys/types.h>
548 #include <sys/param.h>
549 #include <sys/socket.h>
550
551 int
552 main(int argc, char **argv)
553 {
554 u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
555 char name[MAXHOSTNAMELEN];
556
557 ether_ntohost(name, (struct ether_addr *)ea);
558 exit(0);
559 }
560 ]])
561 ], [ac_cv_buggy_ether_ntohost=no],
562 [ac_cv_buggy_ether_ntohost=yes],
563 [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
564 if test "$ac_cv_buggy_ether_ntohost" = "no"; then
565 AC_DEFINE(USE_ETHER_NTOHOST, 1,
566 [define if you have ether_ntohost() and it works])
567 fi
568 ])
569 if test "$ac_cv_func_ether_ntohost" = yes -a \
570 "$ac_cv_buggy_ether_ntohost" = "no"; then
571 #
572 # OK, we have ether_ntohost(). Is it declared in <net/ethernet.h>?
573 #
574 # This test fails if we don't have <net/ethernet.h> or if we do
575 # but it doesn't declare ether_ntohost().
576 #
577 AC_CHECK_DECL(ether_ntohost,
578 [
579 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_NTOHOST,,
580 [Define to 1 if net/ethernet.h declares `ether_ntohost'])
581 ],,
582 [
583 #include <net/ethernet.h>
584 ])
585 #
586 # Did that succeed?
587 #
588 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
589 #
590 # No, how about <netinet/ether.h>, as on Linux?
591 #
592 # This test fails if we don't have <netinet/ether.h>
593 # or if we do but it doesn't declare ether_ntohost().
594 #
595 # Unset ac_cv_have_decl_ether_ntohost so we don't
596 # treat the previous failure as a cached value and
597 # suppress the next test.
598 #
599 unset ac_cv_have_decl_ether_ntohost
600 AC_CHECK_DECL(ether_ntohost,
601 [
602 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,1,
603 [Define to 1 if netinet/ether.h declares `ether_ntohost'])
604 ],,
605 [
606 #include <netinet/ether.h>
607 ])
608 fi
609 #
610 # Did that succeed?
611 #
612 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
613 #
614 # No, how about <sys/ethernet.h>, as on Solaris 10
615 # and later?
616 #
617 # This test fails if we don't have <sys/ethernet.h>
618 # or if we do but it doesn't declare ether_ntohost().
619 #
620 # Unset ac_cv_have_decl_ether_ntohost so we don't
621 # treat the previous failure as a cached value and
622 # suppress the next test.
623 #
624 unset ac_cv_have_decl_ether_ntohost
625 AC_CHECK_DECL(ether_ntohost,
626 [
627 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST,,
628 [Define to 1 if sys/ethernet.h declares `ether_ntohost'])
629 ],,
630 [
631 #include <sys/ethernet.h>
632 ])
633 fi
634 #
635 # Did that succeed?
636 #
637 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
638 #
639 # No, how about <arpa/inet.h>, as in AIX?
640 #
641 # This test fails if we don't have <arpa/inet.h>
642 # (if we have ether_ntohost(), we should have
643 # networking, and if we have networking, we should
644 # have <arpa/inet.h>) or if we do but it doesn't
645 # declare ether_ntohost().
646 #
647 # Unset ac_cv_have_decl_ether_ntohost so we don't
648 # treat the previous failure as a cached value and
649 # suppress the next test.
650 #
651 unset ac_cv_have_decl_ether_ntohost
652 AC_CHECK_DECL(ether_ntohost,
653 [
654 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_NTOHOST,,
655 [Define to 1 if arpa/inet.h declares `ether_ntohost'])
656 ],,
657 [
658 #include <arpa/inet.h>
659 ])
660 fi
661 #
662 # Did that succeed?
663 #
664 if test "$ac_cv_have_decl_ether_ntohost" != yes; then
665 #
666 # No, how about <netinet/if_ether.h>?
667 # On some platforms, it requires <net/if.h> and
668 # <netinet/in.h>, and we always include it with
669 # both of them, so test it with both of them.
670 #
671 # This test fails if we don't have <netinet/if_ether.h>
672 # and the headers we include before it, or if we do but
673 # <netinet/if_ether.h> doesn't declare ether_hostton().
674 #
675 # Unset ac_cv_have_decl_ether_ntohost so we don't
676 # treat the previous failure as a cached value and
677 # suppress the next test.
678 #
679 unset ac_cv_have_decl_ether_ntohost
680 AC_CHECK_DECL(ether_ntohost,
681 [
682 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
683 [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
684 ],,
685 [
686 #include <sys/types.h>
687 #include <sys/socket.h>
688 #include <net/if.h>
689 #include <netinet/in.h>
690 #include <netinet/if_ether.h>
691 ])
692 fi
693 #
694 # After all that, is ether_ntohost() declared?
695 #
696 if test "$ac_cv_have_decl_ether_ntohost" = yes; then
697 #
698 # Yes.
699 #
700 AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
701 [Define to 1 if you have the declaration of `ether_ntohost'])
702 else
703 #
704 # No, we'll have to declare it ourselves.
705 # Do we have "struct ether_addr" if we include
706 # <netinet/if_ether.h>?
707 #
708 AC_CHECK_TYPES(struct ether_addr,,,
709 [
710 #include <sys/types.h>
711 #include <sys/socket.h>
712 #include <net/if.h>
713 #include <netinet/in.h>
714 #include <netinet/if_ether.h>
715 ])
716 fi
717 fi
718
719 dnl
720 dnl Check for "pcap_list_datalinks()" and use a substitute version if
721 dnl it's not present. If it is present, check for "pcap_free_datalinks()";
722 dnl if it's not present, we don't replace it for now. (We could do so
723 dnl on UN*X, but not on Windows, where hilarity ensues if a program
724 dnl built with one version of the MSVC support library tries to free
725 dnl something allocated by a library built with another version of
726 dnl the MSVC support library.)
727 dnl
728 AC_CHECK_FUNC(pcap_list_datalinks,
729 [
730 AC_DEFINE(HAVE_PCAP_LIST_DATALINKS, 1,
731 [define if libpcap has pcap_list_datalinks()])
732 AC_CHECK_FUNCS(pcap_free_datalinks)
733 ],
734 [
735 AC_LIBOBJ(datalinks)
736 ])
737
738 dnl
739 dnl Check for "pcap_datalink_name_to_val()", and use a substitute
740 dnl version if it's not present. If it is present, check for
741 dnl "pcap_datalink_val_to_description()", and if we don't have it,
742 dnl use a substitute version.
743 dnl
744 AC_CHECK_FUNC(pcap_datalink_name_to_val,
745 [
746 AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL, 1,
747 [define if libpcap has pcap_datalink_name_to_val()])
748 AC_CHECK_FUNC(pcap_datalink_val_to_description,
749 AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION, 1,
750 [define if libpcap has pcap_datalink_val_to_description()]),
751 [
752 AC_LIBOBJ(dlnames)
753 ])
754 ],
755 [
756 AC_LIBOBJ(dlnames)
757 ])
758
759 dnl
760 dnl Check for "pcap_set_datalink()"; you can't substitute for it if
761 dnl it's absent (it has hooks into libpcap), so just define the
762 dnl HAVE_ value if it's there.
763 dnl
764 AC_CHECK_FUNCS(pcap_set_datalink)
765
766 dnl
767 dnl Check for "pcap_breakloop()"; you can't substitute for it if
768 dnl it's absent (it has hooks into the live capture routines),
769 dnl so just define the HAVE_ value if it's there.
770 dnl
771 AC_CHECK_FUNCS(pcap_breakloop)
772
773 #
774 # Do we have the new open API? Check for pcap_create, and assume that,
775 # if we do, we also have pcap_activate() and the other new routines
776 # introduced in libpcap 1.0.0.
777 #
778 AC_CHECK_FUNCS(pcap_create)
779 if test $ac_cv_func_pcap_create = "yes" ; then
780 #
781 # OK, do we have pcap_set_tstamp_type? If so, assume we have
782 # pcap_list_tstamp_types and pcap_free_tstamp_types as well.
783 #
784 AC_CHECK_FUNCS(pcap_set_tstamp_type)
785 #
786 # And do we have pcap_set_tstamp_precision? If so, we assume
787 # we also have pcap_open_offline_with_tstamp_precision.
788 #
789 AC_CHECK_FUNCS(pcap_set_tstamp_precision)
790 fi
791
792 #
793 # Check for a miscellaneous collection of functions which we use
794 # if we have them.
795 #
796 AC_CHECK_FUNCS(pcap_findalldevs)
797 AC_CHECK_FUNCS(pcap_dump_flush pcap_lib_version)
798 if test $ac_cv_func_pcap_lib_version = "no" ; then
799 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
800 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
801 extern char pcap_version[];
802
803 return (int)pcap_version;
804 ]])
805 ],
806 [ac_lbl_cv_pcap_version_defined=yes],
807 [ac_lbl_cv_pcap_version_defined=no])
808 if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
809 AC_MSG_RESULT(yes)
810 AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version])
811 else
812 AC_MSG_RESULT(no)
813 fi
814 fi
815 AC_CHECK_FUNCS(pcap_setdirection pcap_set_immediate_mode pcap_dump_ftell64)
816 #
817 # See the comment in AC_LBL_LIBPCAP in aclocal.m4 for the reason
818 # why we don't check for remote-capture APIs if we're building
819 # with the system libpcap on macOS.
820 #
821 if test "$_dont_check_for_remote_apis" != "yes"; then
822 AC_CHECK_FUNCS(pcap_open pcap_findalldevs_ex)
823 fi
824 AC_REPLACE_FUNCS(pcap_dump_ftell)
825
826 #
827 # Check for special debugging functions
828 #
829 AC_CHECK_FUNCS(pcap_set_parser_debug)
830 if test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then
831 #
832 # OK, we don't have pcap_set_parser_debug() to set the libpcap
833 # filter expression parser debug flag; can we directly set the
834 # flag?
835 AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
836 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
837 extern int pcap_debug;
838
839 return pcap_debug;
840 ]])
841 ],
842 [ac_lbl_cv_pcap_debug_defined=yes],
843 [ac_lbl_cv_pcap_debug_defined=no])
844 if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
845 AC_MSG_RESULT(yes)
846 AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug])
847 else
848 AC_MSG_RESULT(no)
849 #
850 # OK, what about "yydebug"?
851 #
852 AC_MSG_CHECKING(whether yydebug is defined by libpcap)
853 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
854 extern int yydebug;
855
856 return yydebug;
857 ]])
858 ],
859 [ac_lbl_cv_yydebug_defined=yes],
860 [ac_lbl_cv_yydebug_defined=no])
861 if test "$ac_lbl_cv_yydebug_defined" = yes ; then
862 AC_MSG_RESULT(yes)
863 AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug])
864 else
865 AC_MSG_RESULT(no)
866 fi
867 fi
868 fi
869 AC_CHECK_FUNCS(pcap_set_optimizer_debug)
870 AC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6
871
872 #
873 # Assume V7/BSD convention for man pages (file formats in section 5,
874 # miscellaneous info in section 7).
875 #
876 MAN_FILE_FORMATS=5
877 MAN_MISC_INFO=7
878 case "$host_os" in
879
880 aix*)
881 dnl Workaround to enable certain features
882 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
883 ;;
884
885 hpux*)
886 #
887 # Use System V conventions for man pages.
888 #
889 MAN_FILE_FORMATS=4
890 MAN_MISC_INFO=5
891 ;;
892
893 irix*)
894 V_GROUP=sys
895
896 #
897 # Use System V conventions for man pages.
898 #
899 MAN_FILE_FORMATS=4
900 MAN_MISC_INFO=5
901 ;;
902
903 osf*)
904 V_GROUP=system
905
906 #
907 # Use System V conventions for man pages.
908 #
909 MAN_FILE_FORMATS=4
910 MAN_MISC_INFO=5
911 ;;
912
913 solaris*)
914 #
915 # Use System V conventions for man pages.
916 #
917 MAN_FILE_FORMATS=4
918 MAN_MISC_INFO=5
919 ;;
920 esac
921
922 #
923 # Make sure we have a definition for C99's uintptr_t (regardless of
924 # whether the environment is a C99 environment or not).
925 #
926 AC_TYPE_UINTPTR_T
927
928 savedcppflags="$CPPFLAGS"
929 CPPFLAGS="$CPPFLAGS $V_INCLS"
930
931 #
932 # Check whether we have pcap/pcap-inttypes.h.
933 # If we do, we use that to get the C99 types defined.
934 #
935 AC_CHECK_HEADERS(pcap/pcap-inttypes.h)
936
937 #
938 # At compile time HAVE_PCAP_FINDALLDEVS depends on HAVE_PCAP_IF_T.
939 #
940 AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
941
942 CPPFLAGS="$savedcppflags"
943
944 #
945 # Define the old BSD specified-width types in terms of the C99 types;
946 # we may need them with libpcap include files.
947 #
948 AC_CHECK_TYPE([u_int8_t], ,
949 [AC_DEFINE([u_int8_t], [uint8_t],
950 [Define to `uint8_t' if u_int8_t not defined.])],
951 [AC_INCLUDES_DEFAULT
952 #include <sys/types.h>
953 ])
954 AC_CHECK_TYPE([u_int16_t], ,
955 [AC_DEFINE([u_int16_t], [uint16_t],
956 [Define to `uint16_t' if u_int16_t not defined.])],
957 [AC_INCLUDES_DEFAULT
958 #include <sys/types.h>
959 ])
960 AC_CHECK_TYPE([u_int32_t], ,
961 [AC_DEFINE([u_int32_t], [uint32_t],
962 [Define to `uint32_t' if u_int32_t not defined.])],
963 [AC_INCLUDES_DEFAULT
964 #include <sys/types.h>
965 ])
966 AC_CHECK_TYPE([u_int64_t], ,
967 [AC_DEFINE([u_int64_t], [uint64_t],
968 [Define to `uint64_t' if u_int64_t not defined.])],
969 [AC_INCLUDES_DEFAULT
970 #include <sys/types.h>
971 ])
972
973 AC_PROG_RANLIB
974 AC_CHECK_TOOL([AR], [ar])
975
976 AC_LBL_DEVEL(V_CCOPT)
977
978 # Check for OpenSSL/libressl libcrypto
979 AC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto)
980 # Specify location for both includes and libraries.
981 want_libcrypto=ifavailable
982 AC_ARG_WITH(crypto,
983 AS_HELP_STRING([--with-crypto]@<:@=DIR@:>@,
984 [use OpenSSL/libressl libcrypto (located in directory DIR, if specified) @<:@default=yes, if available@:>@]),
985 [
986 if test $withval = no
987 then
988 # User doesn't want to link with libcrypto.
989 want_libcrypto=no
990 AC_MSG_RESULT(no)
991 elif test $withval = yes
992 then
993 # User wants to link with libcrypto but hasn't specified
994 # a directory.
995 want_libcrypto=yes
996 AC_MSG_RESULT(yes)
997 else
998 # User wants to link with libcrypto and has specified
999 # a directory, so use the provided value.
1000 want_libcrypto=yes
1001 libcrypto_root=$withval
1002 AC_MSG_RESULT([yes, using the version installed in $withval])
1003 fi
1004 ],[
1005 #
1006 # Use libcrypto if it's present, otherwise don't; no directory
1007 # was specified.
1008 #
1009 want_libcrypto=ifavailable
1010 AC_MSG_RESULT([yes, if available])
1011 ])
1012 if test "$want_libcrypto" != "no"; then
1013 #
1014 # Were we told where to look for libcrypto?
1015 #
1016 if test -z "$libcrypto_root"; then
1017 #
1018 # No.
1019 #
1020 # First, try looking for it with pkg-config, if we have it.
1021 #
1022 # Homebrew's pkg-config does not, by default, look for
1023 # pkg-config files for packages it has installed.
1024 # Furthermore, at least for OpenSSL, they appear to be
1025 # dumped in package-specific directories whose paths are
1026 # not only package-specific but package-version-specific.
1027 #
1028 # So the only way to find openssl is to get the value of
1029 # PKG_CONFIG_PATH from "brew --env openssl" and add that
1030 # to PKG_CONFIG_PATH. (No, we can't just assume it's under
1031 # /usr/local; Homebrew have conveniently chosen to put it
1032 # under /opt/homebrew on ARM.)
1033 #
1034 # That's the nice thing about Homebrew - it makes things easier!
1035 # Thanks!
1036 #
1037 save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
1038 if test -n "$BREW"; then
1039 openssl_pkgconfig_dir=`$BREW --env --plain openssl | sed -n 's/PKG_CONFIG_PATH: //p'`
1040 PKG_CONFIG_PATH="$openssl_pkgconfig_dir:$PKG_CONFIG_PATH"
1041 fi
1042 PKG_CHECK_MODULE(LIBCRYPTO, libcrypto,
1043 [
1044 #
1045 # We found OpenSSL/libressl libcrypto.
1046 #
1047 HAVE_LIBCRYPTO=yes
1048 ])
1049 PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
1050
1051 #
1052 # If it wasn't found, and we have Homebrew installed, see
1053 # if it's in Homebrew.
1054 #
1055 if test "x$HAVE_LIBCRYPTO" != "xyes" -a -n "$BREW"; then
1056 AC_MSG_CHECKING(for openssl in Homebrew)
1057 #
1058 # The brew man page lies when it speaks of
1059 # $BREW --prefix --installed <formula>
1060 # outputting nothing. In Homebrew 3.3.16,
1061 # it produces output regardless of whether
1062 # the formula is installed or not, so we
1063 # send the standard output and error to
1064 # the bit bucket.
1065 #
1066 # libcrypto isn't a formula, openssl is a formula.
1067 #
1068 if $BREW --prefix --installed openssl >/dev/null 2>&1; then
1069 #
1070 # Yes. Get the include directory and library
1071 # directory. (No, we can't just assume it's
1072 # under /usr/local; Homebrew have conveniently
1073 # chosen to put it under /opt/homebrew on ARM.)
1074 #
1075 AC_MSG_RESULT(yes)
1076 HAVE_LIBCRYPTO=yes
1077 openssl_path=`$BREW --prefix openssl`
1078 LIBCRYPTO_CFLAGS="-I$openssl_path/include"
1079 LIBCRYPTO_LIBS="-L$openssl_path/lib -lcrypto"
1080 else
1081 AC_MSG_RESULT(no)
1082 fi
1083 fi
1084
1085 #
1086 # If it wasn't found, and /usr/local/include and /usr/local/lib
1087 # exist, check if it's in /usr/local. (We check whether they
1088 # exist because, if they don't exist, the compiler will warn
1089 # about that and then ignore the argument, so they test
1090 # using just the system header files and libraries.)
1091 #
1092 # We include the standard include file to 1) make sure that
1093 # it's installed (if it's just a shared library for the
1094 # benefit of existing programs, that's not useful) and 2)
1095 # because SSL_library_init() is a library routine in some
1096 # versions and a #defined wrapper around OPENSSL_init_ssl()
1097 # in others.
1098 #
1099 if test "x$HAVE_LIBCRYPTO" != "xyes" -a -d "/usr/local/include" -a -d "/usr/local/lib"; then
1100 AC_LBL_SAVE_CHECK_STATE
1101 CFLAGS="$CFLAGS -I/usr/local/include"
1102 LIBS="$LIBS -L/usr/local/lib -lcrypto"
1103 AC_MSG_CHECKING(whether we have an OpenSSL/libressl libcrypto in /usr/local that we can use)
1104 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1105 [[
1106 #include <openssl/evp.h>
1107 ]],
1108 [[
1109 EVP_CIPHER_CTX_block_size((EVP_CIPHER_CTX *)0);
1110 return 0;
1111 ]])],
1112 [
1113 AC_MSG_RESULT(yes)
1114 HAVE_LIBCRYPTO=yes
1115 LIBCRYPTO_CFLAGS="-I/usr/local/include"
1116 LIBCRYPTO_LIBS="-L/usr/local/lib -lcrypto"
1117 ],
1118 AC_MSG_RESULT(no))
1119 AC_LBL_RESTORE_CHECK_STATE
1120 fi
1121
1122 #
1123 # If it wasn't found, check if it's a system library.
1124 #
1125 # We include the standard include file to 1) make sure that
1126 # it's installed (if it's just a shared library for the
1127 # benefit of existing programs, that's not useful) and 2)
1128 # make sure this isn't a newer macOS that provides libcrypto
1129 # as a shared library but doesn't provide headers - Apple,
1130 # bless their pointy little heads, apparently ship libcrypto
1131 # as a library, but not the header files, in El Capitan and
1132 # later, probably because they don't want you writing nasty
1133 # portable code that could run on other UN*Xes, they want you
1134 # writing code that uses their Shiny New Crypto Library and
1135 # that thus only runs on macOS.
1136 #
1137 if test "x$HAVE_LIBCRYPTO" != "xyes"; then
1138 AC_LBL_SAVE_CHECK_STATE
1139 LIBS="$LIBS -lcrypto"
1140 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1141 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1142 [[
1143 #include <openssl/evp.h>
1144 ]],
1145 [[
1146 EVP_CIPHER_CTX_block_size((EVP_CIPHER_CTX *)0);
1147 return 0;
1148 ]])],
1149 [
1150 AC_MSG_RESULT(yes)
1151 HAVE_LIBCRYPTO=yes
1152 LIBCRYPTO_LIBS="-lcrypto"
1153 ],
1154 AC_MSG_RESULT(no))
1155 AC_LBL_RESTORE_CHECK_STATE
1156 fi
1157 else
1158 #
1159 # Yes.
1160 #
1161 # Look for it there.
1162 #
1163 AC_LBL_SAVE_CHECK_STATE
1164 CFLAGS="$CFLAGS -I$libcrypto_root/include"
1165 LIBS="$LIBS -L$libcrypto_root/lib -lcrypto"
1166 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1167 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1168 [[
1169 #include <openssl/evp.h>
1170 ]],
1171 [[
1172 EVP_CIPHER_CTX_block_size((EVP_CIPHER_CTX *)0);
1173 return 0;
1174 ]])],
1175 [
1176 AC_MSG_RESULT(yes)
1177 HAVE_LIBCRYPTO=yes
1178 LIBCRYPTO_CFLAGS="-I$libcrypto_root/include"
1179 LIBCRYPTO_LIBS="-L$libcrypto_root/lib -lcrypto"
1180 ],
1181 AC_MSG_RESULT(no))
1182 AC_LBL_RESTORE_CHECK_STATE
1183 fi
1184
1185 #
1186 # OK, did we find it?
1187 #
1188 if test "x$HAVE_LIBCRYPTO" = "xyes"; then
1189 AC_DEFINE([HAVE_LIBCRYPTO], [1], [Define to 1 if you have a usable `crypto' library (-lcrypto).])
1190
1191 #
1192 # Put the subdirectories of the libcrypto root directory
1193 # at the end of the header and library search path, to
1194 # make sure they come after any -I or -L flags for
1195 # a local libpcap - those must take precedence of any
1196 # directory that might contain an installed version of
1197 # libpcap.
1198 #
1199 V_INCLS="$V_INCLS $LIBCRYPTO_CFLAGS"
1200 LIBS="$LIBS $LIBCRYPTO_LIBS"
1201
1202 #
1203 # OK, then:
1204 #
1205 # 1) do we have EVP_CIPHER_CTX_new?
1206 # If so, we use it to allocate an EVP_CIPHER_CTX, as
1207 # EVP_CIPHER_CTX may be opaque; otherwise, we allocate it
1208 # ourselves.
1209 #
1210 # 2) do we have EVP_DecryptInit_ex()?
1211 # If so, we use it, because we need to be able to make
1212 # two "initialize the cipher" calls, one with the cipher
1213 # and key, and one with the IV, and, as of OpenSSL 1.1,
1214 # You Can't Do That with EVP_DecryptInit(), because a
1215 # call to EVP_DecryptInit() will unconditionally clear
1216 # the context, and if you don't supply a cipher, it'll
1217 # clear the cipher, rendering the context unusable and
1218 # causing a crash.
1219 #
1220 AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_DecryptInit_ex)
1221 else
1222 AC_MSG_NOTICE(OpenSSL/libressl libcrypto not found)
1223 fi
1224 fi
1225
1226 # Check for libcap-ng
1227 AC_MSG_CHECKING(whether to use libcap-ng)
1228 # Specify location for both includes and libraries.
1229 want_libcap_ng=ifavailable
1230 AC_ARG_WITH(cap_ng,
1231 AS_HELP_STRING([--with-cap-ng],
1232 [use libcap-ng @<:@default=yes, if available@:>@]),
1233 [
1234 if test $withval = no
1235 then
1236 want_libcap_ng=no
1237 AC_MSG_RESULT(no)
1238 elif test $withval = yes
1239 then
1240 want_libcap_ng=yes
1241 AC_MSG_RESULT(yes)
1242 fi
1243 ],[
1244 #
1245 # Use libcap-ng if it's present, otherwise don't.
1246 #
1247 want_libcap_ng=ifavailable
1248 AC_MSG_RESULT([yes, if available])
1249 ])
1250 if test "$want_libcap_ng" != "no"; then
1251 AC_CHECK_LIB(cap-ng, capng_change_id)
1252 AC_CHECK_HEADERS(cap-ng.h)
1253 fi
1254
1255 dnl
1256 dnl set additional include path if necessary
1257 if test "$missing_includes" = "yes"; then
1258 CPPFLAGS="$CPPFLAGS -I$srcdir/missing"
1259 V_INCLS="$V_INCLS -I$srcdir/missing"
1260 fi
1261
1262 AC_SUBST(V_CCOPT)
1263 AC_SUBST(V_DEFS)
1264 AC_SUBST(V_INCLS)
1265 AC_SUBST(V_PCAPDEP)
1266 AC_SUBST(LOCALSRC)
1267 AC_SUBST(MAN_FILE_FORMATS)
1268 AC_SUBST(MAN_MISC_INFO)
1269
1270 AC_PROG_INSTALL
1271
1272 AC_CONFIG_HEADER(config.h)
1273
1274 AC_CONFIG_COMMANDS([.devel],[[if test -f .devel; then
1275 echo timestamp > stamp-h
1276 cat $srcdir/Makefile-devel-adds >> Makefile
1277 make depend || exit 1
1278 fi]],[[]])
1279 AC_CONFIG_FILES([Makefile tcpdump.1])
1280 AC_OUTPUT
1281 exit 0