1 dnl Copyright (c) 1995, 1996, 1997, 1998
2 dnl The Regents of the University of California. All rights reserved.
4 dnl Redistribution and use in source and binary forms, with or without
5 dnl modification, are permitted provided that: (1) source code distributions
6 dnl retain the above copyright notice and this paragraph in its entirety, (2)
7 dnl distributions including binary code include the above copyright notice and
8 dnl this paragraph in its entirety in the documentation or other materials
9 dnl provided with the distribution, and (3) all advertising materials mentioning
10 dnl features or use of this software display the following acknowledgement:
11 dnl ``This product includes software developed by the University of California,
12 dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13 dnl the University nor the names of its contributors may be used to endorse
14 dnl or promote products derived from this software without specific prior
15 dnl written permission.
16 dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17 dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 dnl LBL autoconf macros
24 dnl Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC.
26 dnl It appears that newer versions of autoconf (2.64 and later) will,
27 dnl if you use AC_TRY_COMPILE in a macro, stick AC_PROG_CC at the
28 dnl beginning of the macro, even if the macro itself calls AC_PROG_CC.
29 dnl See the "Prerequisite Macros" and "Expanded Before Required" sections
30 dnl in the Autoconf documentation.
32 dnl This causes a steaming heap of fail in our case, as we were, in
33 dnl AC_LBL_C_INIT, doing the tests we now do in AC_LBL_C_INIT_BEFORE_CC,
34 dnl calling AC_PROG_CC, and then doing the tests we now do in
35 dnl AC_LBL_C_INIT. Now, we run AC_LBL_C_INIT_BEFORE_CC, AC_PROG_CC,
36 dnl and AC_LBL_C_INIT at the top level.
38 AC_DEFUN(AC_LBL_C_INIT_BEFORE_CC,
40 AC_BEFORE([$0], [AC_LBL_C_INIT])
41 AC_BEFORE([$0], [AC_PROG_CC])
42 AC_BEFORE([$0], [AC_LBL_DEVEL])
43 AC_ARG_WITH(gcc, [ --without-gcc don't use gcc])
45 if test "${srcdir}" != "." ; then
48 if test "${CFLAGS+set}" = set; then
51 if test -z "$CC" -a "$with_gcc" = no ; then
58 dnl Determine which compiler we're using (cc or gcc)
59 dnl If using gcc, determine the version number
61 dnl require that it support ansi prototypes
62 dnl use -O (AC_PROG_CC will use -g -O2 on gcc, so we don't need to
63 dnl do that ourselves for gcc)
64 dnl add -g flags, as appropriate
65 dnl explicitly specify /usr/local/include
67 dnl NOTE WELL: with newer versions of autoconf, "gcc" means any compiler
68 dnl that defines __GNUC__, which means clang, for example, counts as "gcc".
72 dnl AC_LBL_C_INIT(copt, incls)
82 AC_DEFUN(AC_LBL_C_INIT,
84 AC_BEFORE([$0], [AC_LBL_DEVEL])
85 if test "$GCC" = yes ; then
87 # -Werror forces warnings to be errors.
89 ac_lbl_cc_force_warning_errors=-Werror
91 $2="$$2 -I/usr/local/include"
92 LDFLAGS="$LDFLAGS -L/usr/local/lib"
98 # This is assumed either to be GCC or clang, both
99 # of which use -Werror to force warnings to be errors.
101 # XXX - they also both cause GCC to be set to yes,
102 # so we should never get here in the first place.
104 ac_lbl_cc_force_warning_errors=-Werror
109 # HP C, which is what we presume we're using, doesn't
110 # exit with a non-zero exit status if we hand it an
111 # invalid -W flag, can't be forced to do so even with
112 # +We, and doesn't handle GCC-style -W flags, so we
113 # don't want to try using GCC-style -W flags.
115 ac_lbl_cc_dont_try_gcc_dashW=yes
120 # Assumed to be Sun C, which requires -errwarn to force
121 # warnings to be treated as errors.
123 ac_lbl_cc_force_warning_errors=-errwarn
131 dnl Check whether the compiler option specified as the second argument
132 dnl is supported by the compiler and, if so, add it to the macro
133 dnl specified as the first argument
135 AC_DEFUN(AC_LBL_CHECK_COMPILER_OPT,
137 AC_MSG_CHECKING([whether the compiler supports the $2 option])
138 save_CFLAGS="$CFLAGS"
141 # XXX - yes, this depends on the way AC_LANG_WERROR works,
142 # but no mechanism is provided to turn AC_LANG_WERROR on
143 # *and then turn it back off*, so that we *only* do it when
144 # testing compiler options - 15 years after somebody asked
147 # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror
149 save_ac_c_werror_flag="$ac_c_werror_flag"
152 # We use AC_LANG_SOURCE() so that we can control the complete
153 # content of the program being compiled. We do not, for example,
154 # want the default "int main()" that AC_LANG_PROGRAM() generates,
155 # as it will generate a warning with -Wold-style-definition, meaning
156 # that we would treat it as not working, as the test will fail if
157 # *any* error output, including a warning due to the flag we're
158 # testing, is generated; see
160 # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
161 # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us
163 # This may, as per those two messages, be fixed in autoconf 2.70,
164 # but we only require 2.69 or newer for now.
167 [AC_LANG_SOURCE([[int main(void) { return 0; }]])],
170 CFLAGS="$save_CFLAGS"
175 CFLAGS="$save_CFLAGS"
177 ac_c_werror_flag="$save_ac_c_werror_flag"
181 dnl Check whether the compiler supports an option to generate
182 dnl Makefile-style dependency lines
184 dnl GCC uses -M for this. Non-GCC compilers that support this
185 dnl use a variety of flags, including but not limited to -M.
187 dnl We test whether the flag in question is supported, as older
188 dnl versions of compilers might not support it.
190 dnl We don't try all the possible flags, just in case some flag means
191 dnl "generate dependencies" on one compiler but means something else
192 dnl on another compiler.
194 dnl Most compilers that support this send the output to the standard
195 dnl output by default. IBM's XLC, however, supports -M but sends
196 dnl the output to {sourcefile-basename}.u, and AIX has no /dev/stdout
197 dnl to work around that, so we don't bother with XLC.
199 AC_DEFUN(AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT,
201 AC_MSG_CHECKING([whether the compiler supports generating dependencies])
202 if test "$GCC" = yes ; then
204 # GCC, or a compiler deemed to be GCC by AC_PROG_CC (even
205 # though it's not); we assume that, in this case, the flag
208 ac_lbl_dependency_flag="-M"
211 # Not GCC or a compiler deemed to be GCC; what platform is
212 # this? (We're assuming that if the compiler isn't GCC
213 # it's the compiler from the vendor of the OS; that won't
214 # necessarily be true for x86 platforms, where it might be
215 # the Intel C compiler.)
223 ac_lbl_dependency_flag="-M"
230 ac_lbl_dependency_flag="-xM"
235 # HP's older C compilers don't support this.
236 # HP's newer C compilers support this with
237 # either +M or +Make; the older compilers
238 # interpret +M as something completely
239 # different, so we use +Make so we don't
240 # think it works with the older compilers.
242 ac_lbl_dependency_flag="+Make"
247 # Not one of the above; assume no support for
248 # generating dependencies.
250 ac_lbl_dependency_flag=""
256 # Is ac_lbl_dependency_flag defined and, if so, does the compiler
259 # Note: clang doesn't seem to exit with an error status when handed
260 # an unknown non-warning error, even if you pass it
261 # -Werror=unknown-warning-option. However, it always supports
262 # -M, so the fact that this test always succeeds with clang
265 if test ! -z "$ac_lbl_dependency_flag"; then
267 [AC_LANG_SOURCE([[int main(void) { return 0; }]])])
268 if AC_RUN_LOG([eval "$CC $ac_lbl_dependency_flag conftest.c >/dev/null 2>&1"]); then
269 AC_MSG_RESULT([yes, with $ac_lbl_dependency_flag])
270 DEPENDENCY_CFLAG="$ac_lbl_dependency_flag"
271 MKDEP='${top_srcdir}/mkdep'
275 # We can't run mkdep, so have "make depend" do
284 # We can't run mkdep, so have "make depend" do
289 AC_SUBST(DEPENDENCY_CFLAG)
295 dnl Look for libpcap in directories under ..; those are local versions.
296 dnl Look for an installed libpcap if there is no local version or if
297 dnl the user said not to look for a local version.
301 dnl AC_LBL_LIBPCAP(pcapdep, incls)
306 dnl $2 (incls appended)
309 AC_DEFUN(AC_LBL_LIBPCAP,
311 AC_REQUIRE([AC_PROG_EGREP])
312 AC_REQUIRE([AC_LBL_LIBRARY_NET])
314 AC_MSG_CHECKING([whether to look for a local libpcap])
315 AC_ARG_ENABLE(local-libpcap,
316 AS_HELP_STRING([--disable-local-libpcap],
317 [don't look for a local libpcap @<:@default=check for a local libpcap@:>@]),,
324 # Don't look for a local libpcap.
326 using_local_libpcap=no
332 # Look for a local pcap library.
334 AC_MSG_CHECKING(for local pcap library)
336 places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
337 $EGREP '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT|rc.)?$'`
338 places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
339 $EGREP '/libpcap-[[0-9]]+\.[[0-9]]+(\.[[0-9]]*)?([[ab]][[0-9]]*|-PRE-GIT|rc.)?$'`
340 for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
341 basedir=`echo $dir | sed -e 's/[[ab]][[0-9]]*$//' | \
342 sed -e 's/-PRE-GIT$//' `
343 if test $lastdir = $basedir ; then
344 dnl skip alphas when an actual release is present
348 if test -r $dir/libpcap.a ; then
349 libpcap=$dir/libpcap.a
351 dnl continue and select the last one that exists
354 if test $libpcap = FAIL ; then
356 # We didn't find a local libpcap.
358 AC_MSG_RESULT(not found)
359 using_local_libpcap=no;
362 # We found a local libpcap.
364 AC_MSG_RESULT($libpcap)
365 using_local_libpcap=yes
370 if test $using_local_libpcap = no ; then
372 # We didn't find a local libpcap.
373 # Look for an installed pkg-config.
375 AC_PATH_TOOL(PKG_CONFIG, pkg-config)
376 if test -n "$PKG_CONFIG" ; then
378 # We have it. Are there .pc files for libpcap?
380 # --exists was introduced in pkg-config 0.4.0; that
381 # dates back to late 2000, so we won't worry about
382 # earlier releases that lack it.
384 AC_MSG_CHECKING(whether there are .pc files for libpcap)
385 if "$PKG_CONFIG" libpcap --exists ; then
387 # Yes, so we can use pkg-config to get configuration
388 # information for libpcap.
391 pkg_config_usable=yes
394 # No, so we can't use pkg-config to get configuration
395 # information for libpcap.
402 # We don't have it, so we obviously can't use it.
406 if test "$pkg_config_usable" = "yes" ; then
408 # Found both - use pkg-config to get the include flags for
409 # libpcap and the flags to link with libpcap.
411 # Please read section 11.6 "Shell Substitutions"
412 # in the autoconf manual before doing anything
413 # to this that involves quoting. Especially note
414 # the statement "There is just no portable way to use
415 # double-quoted strings inside double-quoted back-quoted
416 # expressions (pfew!)."
418 cflags=`"$PKG_CONFIG" libpcap --cflags`
420 libpcap=`"$PKG_CONFIG" libpcap --libs`
424 # Look for an installed pcap-config.
426 AC_PATH_TOOL(PCAP_CONFIG, pcap-config)
427 if test -n "$PCAP_CONFIG" ; then
429 # Found - use it to get the include flags for
430 # libpcap and the flags to link with libpcap.
432 # If this is a vendor-supplied pcap-config, which
433 # we define as being "a pcap-config in /usr/bin
434 # or /usr/ccs/bin" (the latter is for Solaris and
435 # Sun/Oracle Studio), there are some issues. Work
438 if test \( "$PCAP_CONFIG" = "/usr/bin/pcap-config" \) -o \
439 \( "$PCAP_CONFIG" = "/usr/ccs/bin/pcap-config" \) ; then
441 # It's vendor-supplied.
447 # This is macOS or another Darwin-based OS.
449 # That means that /usr/bin/pcap-config it
450 # may provide -I/usr/local/include with --cflags
451 # and -L/usr/local/lib with --libs, rather than
452 # pointing to the OS-supplied library and
453 # Xcode-supplied headers. Remember that, so we
454 # ignore those values.
456 _broken_apple_pcap_config=yes
461 # This is Solaris 2 or later, i.e. SunOS 5.x.
463 # At least on Solaris 11; there's /usr/bin/pcap-config,
464 # which reports -L/usr/lib with --libs, causing
465 # the 32-bit libraries to be found, and there's
466 # /usr/bin/{64bitarch}/pcap-config, where {64bitarch}
467 # is a name for the 64-bit version of the instruction
468 # set, which reports -L /usr/lib/{64bitarch}, causing
469 # the 64-bit libraries to be found.
471 # So if we're building 64-bit targets, we replace
472 # PCAP_CONFIG with /usr/bin/{64bitarch}; we get
473 # {64bitarch} as the output of "isainfo -n".
475 # Are we building 32-bit or 64-bit? Get the
476 # size of void *, and check that.
478 AC_CHECK_SIZEOF([void *])
479 if test ac_cv_sizeof_void_p -eq 8 ; then
480 isainfo_output=`isainfo -n`
481 if test ! -z "$isainfo_output" ; then
483 # Success - change PCAP_CONFIG.
485 PCAP_CONFIG=`echo $PCAP_CONFIG | sed "s;/bin/;/bin/$isainfo_output/;"`
492 # Please read section 11.6 "Shell Substitutions"
493 # in the autoconf manual before doing anything
494 # to this that involves quoting. Especially note
495 # the statement "There is just no portable way to use
496 # double-quoted strings inside double-quoted back-quoted
497 # expressions (pfew!)."
499 cflags=`"$PCAP_CONFIG" --cflags`
501 # Work around macOS (and probably other Darwin) brokenness,
502 # by not adding /usr/local/include if it's from the broken
505 if test "$_broken_apple_pcap_config" = "yes" ; then
507 # Strip -I/usr/local/include with sed.
509 cflags=`echo $cflags | sed 's;-I/usr/local/include;;'`
512 libpcap=`"$PCAP_CONFIG" --libs`
514 # Work around macOS (and probably other Darwin) brokenness,
515 # by not adding /usr/local/lib if it's from the broken
518 if test "$_broken_apple_pcap_config" = "yes" ; then
520 # Strip -L/usr/local/lib with sed.
522 libpcap=`echo $libpcap | sed 's;-L/usr/local/lib;;'`
526 # Not found; look for an installed pcap.
528 AC_CHECK_LIB(pcap, main, libpcap="-lpcap")
529 if test $libpcap = FAIL ; then
530 AC_MSG_ERROR(see the INSTALL.md file for more info)
533 dnl Some versions of Red Hat Linux put "pcap.h" in
534 dnl "/usr/include/pcap"; had the LBL folks done so,
535 dnl that would have been a good idea, but for
536 dnl the Red Hat folks to do so just breaks source
537 dnl compatibility with other systems.
539 dnl We work around this by assuming that, as we didn't
540 dnl find a local libpcap, libpcap is in /usr/lib or
541 dnl /usr/local/lib and that the corresponding header
542 dnl file is under one of those directories; if we don't
543 dnl find it in either of those directories, we check to
544 dnl see if it's in a "pcap" subdirectory of them and,
545 dnl if so, add that subdirectory to the "-I" list.
547 dnl (We now also put pcap.h in /usr/include/pcap, but we
548 dnl leave behind a /usr/include/pcap.h that includes it,
549 dnl so you can still just include <pcap.h>.)
551 AC_MSG_CHECKING(for extraneous pcap header directories)
552 if test \( ! -r /usr/local/include/pcap.h \) -a \
553 \( ! -r /usr/include/pcap.h \); then
554 if test -r /usr/local/include/pcap/pcap.h; then
555 d="/usr/local/include/pcap"
556 elif test -r /usr/include/pcap/pcap.h; then
557 d="/usr/include/pcap"
560 if test -z "$d" ; then
561 AC_MSG_RESULT(not found)
564 AC_MSG_RESULT(found -- -I$d added)
570 # We found a local libpcap. Add it to the dependencies for
576 # Look for its pcap-config script.
578 AC_PATH_PROG(PCAP_CONFIG, pcap-config,, $local_pcap_dir)
580 if test -n "$PCAP_CONFIG"; then
582 # We don't want its --cflags or --libs output, because
583 # those presume it's installed. For the C compiler flags,
584 # we add the source directory for the local libpcap, so
585 # we pick up its header files.
587 # We do, however, want its additional libraries, as required
588 # when linking statically, because it makes calls to
589 # routines in those libraries, so we'll need to link with
590 # them, because we'll be linking statically with it.
592 # If it supports --static-pcap-only. use that, as we will be
593 # linking with a static libpcap but won't be linking
594 # statically with any of the libraries on which it depends;
595 # those libraries might not even have static versions
598 # That means we need to find out the libraries on which
599 # libpcap directly depends, so we can link with them, but we
600 # don't need to link with the libraries on which those
601 # libraries depend as, on all UN*Xes with which I'm
602 # familiar, the libraries on which a shared library depends
603 # are stored in the library and are automatically loaded by
604 # the run-time linker, without the executable having to be
605 # linked with those libraries. (This allows a library to be
606 # changed to depend on more libraries without breaking that
609 # The only way to test for that support is to see if the
610 # script contains the string "static-pcap-only"; we can't
611 # try using that flag and checking for errors, as the
612 # versions of the script that didn't have that flag wouldn't
613 # report or return an error for an unsupported command-line
614 # flag. Those older versions provided, with --static, only
615 # the libraries on which libpcap depends, not the
616 # dependencies of those libraries; the versions with
617 # --static-pcap-only provide all the dependencies with
618 # --static, for the benefit of programs that are completely
619 # statically linked, and provide only the direct
620 # dependencies with --static-pcap-only.
622 if grep "static-pcap-only" "$PCAP_CONFIG" >/dev/null 2>&1
624 static_opt="--static-pcap-only"
626 static_opt="--static"
628 $2="-I$local_pcap_dir $$2"
629 additional_libs=`"$PCAP_CONFIG" $static_opt --additional-libs`
630 libpcap="$libpcap $additional_libs"
633 # It doesn't have a pcap-config script.
634 # Make sure it has a pcap.h file.
636 places=`ls $srcdir/.. | sed -e 's,/$,,' -e "s,^,$srcdir/../," | \
637 $EGREP '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
638 places2=`ls .. | sed -e 's,/$,,' -e "s,^,../," | \
639 $EGREP '/libpcap-[[0-9]]*.[[0-9]]*(.[[0-9]]*)?([[ab]][[0-9]]*)?$'`
641 if test -r $local_pcap_dir/pcap.h; then
642 pcapH=$local_pcap_dir
644 for dir in $places $srcdir/../libpcap ../libpcap $srcdir/libpcap $places2 ; do
645 if test -r $dir/pcap.h ; then
651 if test $pcapH = FAIL ; then
652 AC_MSG_ERROR(cannot find pcap.h: see the INSTALL.md file)
656 # Force the compiler to look for header files in the
657 # directory containing pcap.h.
663 if test -z "$PKG_CONFIG" -a -z "$PCAP_CONFIG"; then
665 # We don't have pkg-config or pcap-config; find out any additional
666 # link flags we need. (If we have pkg-config or pcap-config, we
667 # assume it tells us what we need.)
673 # If libpcap is DLPI-based, we have to use /lib/pse.exp if
674 # present, as we use the STREAMS routines.
676 # (XXX - true only if we're linking with a static libpcap?)
678 pseexe="/lib/pse.exp"
679 AC_MSG_CHECKING(for $pseexe)
680 if test -f $pseexe ; then
682 LIBS="$LIBS -I:$pseexe"
686 # If libpcap is BPF-based, we need "-lodm" and "-lcfg", as
687 # we use them to load the BPF module.
689 # (XXX - true only if we're linking with a static libpcap?)
691 LIBS="$LIBS -lodm -lcfg"
695 # libdlpi is needed for Solaris 11 and later.
696 AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)
701 LIBS="$libpcap $LIBS"
704 dnl Check for "pcap_loop()", to make sure we found a working
705 dnl libpcap and have all the right other libraries with which
706 dnl to link. (Otherwise, the checks below will fail, not
707 dnl because the routines are missing from the library, but
708 dnl because we aren't linking properly with libpcap, and
709 dnl that will cause confusing errors at build time.)
711 AC_CHECK_FUNC(pcap_loop,,
714 [This is a bug, please follow the guidelines in CONTRIBUTING.md and include the
715 config.log file in your report. If you have downloaded libpcap from
716 tcpdump.org, and built it yourself, please also include the config.log
717 file from the libpcap source directory, the Makefile from the libpcap
718 source directory, and the output of the make process for libpcap, as
719 this could be a problem with the libpcap that was built, and we will
720 not be able to determine why this is happening, and thus will not be
721 able to fix it, without that information, as we have not been able to
722 reproduce this problem ourselves.])
727 dnl If the file .devel exists:
728 dnl Add some warning flags if the compiler supports them
729 dnl If an os prototype include exists, symlink os-proto.h to it
733 dnl AC_LBL_DEVEL(copt)
737 dnl $1 (copt appended)
738 dnl HAVE_OS_PROTO_H (defined)
739 dnl os-proto.h (symlinked)
741 AC_DEFUN(AC_LBL_DEVEL,
743 if test "${LBL_CFLAGS+set}" = set; then
744 $1="$$1 ${LBL_CFLAGS}"
746 if test -f .devel ; then
748 # Skip all the warning option stuff on some compilers.
750 if test "$ac_lbl_cc_dont_try_gcc_dashW" != yes; then
751 AC_LBL_CHECK_COMPILER_OPT($1, -W)
752 AC_LBL_CHECK_COMPILER_OPT($1, -Wall)
753 AC_LBL_CHECK_COMPILER_OPT($1, -Wassign-enum)
754 AC_LBL_CHECK_COMPILER_OPT($1, -Wcast-qual)
755 AC_LBL_CHECK_COMPILER_OPT($1, -Wmissing-prototypes)
756 AC_LBL_CHECK_COMPILER_OPT($1, -Wmissing-variable-declarations)
757 AC_LBL_CHECK_COMPILER_OPT($1, -Wnull-pointer-subtraction)
758 AC_LBL_CHECK_COMPILER_OPT($1, -Wold-style-definition)
759 AC_LBL_CHECK_COMPILER_OPT($1, -Wpedantic)
760 AC_LBL_CHECK_COMPILER_OPT($1, -Wpointer-arith)
761 AC_LBL_CHECK_COMPILER_OPT($1, -Wpointer-sign)
762 AC_LBL_CHECK_COMPILER_OPT($1, -Wshadow)
763 AC_LBL_CHECK_COMPILER_OPT($1, -Wsign-compare)
764 AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes)
765 AC_LBL_CHECK_COMPILER_OPT($1, -Wunreachable-code-return)
766 AC_LBL_CHECK_COMPILER_OPT($1, -Wunused-but-set-parameter)
767 AC_LBL_CHECK_COMPILER_OPT($1, -Wunused-but-set-variable)
768 AC_LBL_CHECK_COMPILER_OPT($1, -Wused-but-marked-unused)
769 AC_LBL_CHECK_COMPILER_OPT($1, -Wwrite-strings)
771 AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT()
772 AC_MSG_CHECKING([whether to use an os-proto.h header])
773 os=`echo $host_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
775 if test -f $name ; then
776 AC_MSG_RESULT([yes, at "$name"])
777 ln -s $name os-proto.h
778 AC_DEFINE(HAVE_OS_PROTO_H, 1,
779 [if there's an os-proto.h for this platform, to use additional prototypes])
786 dnl This is a simplified adaptation of AC_LBL_LIBRARY_NET from libpcap.
787 dnl In this context tcpdump needs gethostbyaddr() only.
789 AC_DEFUN(AC_LBL_LIBRARY_NET, [
790 AC_CHECK_FUNC(gethostbyaddr,,
792 AC_CHECK_LIB(socket, gethostbyaddr,
794 LIBS="-lsocket -lnsl $LIBS"
797 AC_CHECK_LIB(network, gethostbyaddr,
799 LIBS="-lnetwork $LIBS"
802 AC_MSG_ERROR([gethostbyaddr is required, but wasn't found])