aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2008-02-07 18:19:08 +0000
committerGuy Harris <guy@alum.mit.edu>2008-02-07 18:19:08 +0000
commit454fbec234bff772f7ed8427f2a33bfc94217fec (patch)
treeb9d62a8ee81a1e00602b9e96362c87d0f1c76a9b /acinclude.m4
parent28ae535b009c9301e885a4e17bfa55861288f2f9 (diff)
Only check for pcap_breakloop()'s "usability" if it might be present but
unusable; it'd only be unusable if we require that functions be declared before they're used (i.e., if we check for that with -Wimplicit and if we fail if the check produces a warning because we're using -Werror). Always checking doesn't necessarily work if, for example, you're not compiling with GCC, as -Werror and -Wimplicit might not be recognized by other compilers. svn path=/trunk/; revision=24287
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m453
1 files changed, 33 insertions, 20 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index d711fe8361..8277f2ff84 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -467,13 +467,20 @@ and did you also install that package?]]))
fi
AC_CHECK_FUNCS(pcap_open_dead pcap_freecode)
#
- # pcap_breakloop may be present in the library and not declared in the
- # header file. We are therefore testing whether the function is present
- # first and then if it is usable. It is usable if it compiles without
- # an implicit warning. If it is not usable, we output a warning telling
- # the user to update his pcap header.
+ # pcap_breakloop may be present in the library but not declared
+ # in the pcap.h header file. If it's not declared in the header
+ # file, attempts to use it will get warnings, and, if we're
+ # building with warnings treated as errors, that warning will
+ # cause compilation to fail.
+ #
+ # We are therefore first testing whether the function is present
+ # and then, if we're compiling with warnings as errors, testing
+ # whether it is usable. It is usable if it compiles without
+ # a -Wimplicit warning (the "compile with warnings as errors"
+ # option requires GCC). If it is not usable, we fail and tell
+ # the user that the pcap.h header needs to be updated.
#
- # Ceteris paribus, it should only happen with Mac OS X 10.3[.x] which
+ # Ceteris paribus, this should only happen with Mac OS X 10.3[.x] which
# can have an up-to-date pcap library without the corresponding pcap
# header.
#
@@ -482,25 +489,31 @@ and did you also install that package?]]))
# e.g. hand made symbolic link from libpcap.so -> libpcap.so.0.8 but
# having the pcap header version 0.7.
#
- AC_MSG_CHECKING([whether pcap_breakloop is present and usable])
+ AC_MSG_CHECKING([whether pcap_breakloop is present])
ac_CFLAGS_saved="$CFLAGS"
AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK
if test "x$ws_breakloop_compiled" = "xyes"; then
- CFLAGS="$CFLAGS -Werror -Wimplicit"
- AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK
- if test "x$ws_breakloop_compiled" = "xyes"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PCAP_BREAKLOOP, 1, [Define if pcap_breakloop is known])
- else
- AC_MSG_RESULT(broken)
- AC_MSG_WARN([Your pcap library is more recent than your pcap header.])
- AC_MSG_WARN([Wireshark won't be able to use functions not declared])
- AC_MSG_WARN([in that header. You should install a newer version of])
- AC_MSG_WARN([the header file.])
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PCAP_BREAKLOOP, 1, [Define if pcap_breakloop is known])
+ if test "x$with_warnings_as_errors" = "xyes"; then
+ AC_MSG_CHECKING([whether pcap_breakloop is usable])
+ CFLAGS="$CFLAGS -Werror -Wimplicit"
+ AC_WIRESHARK_PCAP_BREAKLOOP_TRY_LINK
+ if test "x$ws_breakloop_compiled" = "xyes"; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(
+[Your pcap library is more recent than your pcap header.
+As you are building with compiler warnings treated as errors, Wireshark
+won't be able to use functions not declared in that header.
+If you wish to build with compiler warnings treated as errors, You should
+install a newer version of the header file.])
+ fi
+ CFLAGS="$ac_CFLAGS_saved"
fi
- CFLAGS="$ac_CFLAGS_saved"
else
- AC_MSG_RESULT(function not present)
+ AC_MSG_RESULT(no)
fi
#