]> The Tcpdump Group git mirrors - libpcap/commitdiff
Don't test for __attribute__ in the configure script.
authorGuy Harris <[email protected]>
Mon, 22 Jan 2018 01:59:07 +0000 (17:59 -0800)
committerGuy Harris <[email protected]>
Mon, 22 Jan 2018 01:59:07 +0000 (17:59 -0800)
Instead, use compiler test macros for the one remaining case where we
tested for __attribute__ to check whether that *particular* attribute is
supported.

aclocal.m4
cmakeconfig.h.in
config.h.in
configure
configure.ac
extract.h

index 243203c4621200b49ee89f5294a1881a046291f8..3689f6c8e277a917110d54297ff0a2262b24d421 100644 (file)
@@ -1062,36 +1062,3 @@ AC_DEFUN(AC_LBL_LIBRARY_NET, [
     # DLPI needs putmsg under HPUX so test for -lstr while we're at it
     AC_SEARCH_LIBS(putmsg, str)
 ])
-
-dnl
-dnl Test for __attribute__
-dnl
-
-AC_DEFUN(AC_C___ATTRIBUTE__, [
-AC_MSG_CHECKING(for __attribute__)
-AC_CACHE_VAL(ac_cv___attribute__, [
-AC_COMPILE_IFELSE([
-  AC_LANG_SOURCE([[
-#include <stdlib.h>
-
-static void foo(void) __attribute__ ((noreturn));
-
-static void
-foo(void)
-{
-  exit(1);
-}
-
-int
-main(int argc, char **argv)
-{
-  foo();
-}
-  ]])],
-ac_cv___attribute__=yes,
-ac_cv___attribute__=no)])
-if test "$ac_cv___attribute__" = "yes"; then
-  AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
-fi
-AC_MSG_RESULT($ac_cv___attribute__)
-])
index a406cd94633bbb427aab42cfb52d4aa7b37fbf1e..095bcf8eca4c9909fd4be4e5ef0ce660fbc2824b 100644 (file)
 /* Define to 1 if you have the `PacketIsLoopbackAdapter' function. */
 #cmakedefine HAVE_PACKET_IS_LOOPBACK_ADAPTER 1
 
-/* define if your compiler has __attribute__ */
-#cmakedefine HAVE___ATTRIBUTE__ 1
-
 /* IPv6 */
 #cmakedefine INET6 1
 
index 13d0bd7ee31687f9c4cd9d2a0c5ba3d6217b6a00..042fb756fc821545a0e7e89685cb7f9715eb3936 100644 (file)
 /* Define to 1 if you have the `vsnprintf' function. */
 #undef HAVE_VSNPRINTF
 
-/* define if your compiler has __attribute__ */
-#undef HAVE___ATTRIBUTE__
-
 /* IPv6 */
 #undef INET6
 
index 7428e08b76caf24117f2a42bbd4ee7837dd6e863..c9bb8a83a66ba3109459b663dab8b9f99ac9975e 100755 (executable)
--- a/configure
+++ b/configure
@@ -4070,50 +4070,6 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__" >&5
-$as_echo_n "checking for __attribute__... " >&6; }
-if ${ac_cv___attribute__+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-
-#include <stdlib.h>
-
-static void foo(void) __attribute__ ((noreturn));
-
-static void
-foo(void)
-{
-  exit(1);
-}
-
-int
-main(int argc, char **argv)
-{
-  foo();
-}
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv___attribute__=yes
-else
-  ac_cv___attribute__=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-if test "$ac_cv___attribute__" = "yes"; then
-
-$as_echo "#define HAVE___ATTRIBUTE__ 1" >>confdefs.h
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv___attribute__" >&5
-$as_echo "$ac_cv___attribute__" >&6; }
-
-
 #
 # Try to arrange for large file support.
 #
index b008689fe731fe27aaca7809e8dd7a631b76692c..5e46cf5458b1019d1212ad91e5d24dcad569cbcf 100644 (file)
@@ -31,7 +31,6 @@ AC_PROG_CC_C99
 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
 AC_LBL_SHLIBS_INIT
 AC_LBL_C_INLINE
-AC_C___ATTRIBUTE__
 
 #
 # Try to arrange for large file support.
index 8a8b60247cfd0c0af8cc838bb64811cd505d1e75..aa3ff99196e3a538a9c94912e25c10c3635e8457 100644 (file)
--- a/extract.h
+++ b/extract.h
@@ -24,6 +24,7 @@
 #endif
 
 #include <pcap/pcap-inttypes.h>
+#include <pcap/compiler-tests.h>
 
 /*
  * Macros to extract possibly-unaligned big-endian integral values.
 /*
  * The processor doesn't natively handle unaligned loads.
  */
-#if defined(__GNUC__) && defined(HAVE___ATTRIBUTE__) && \
+#if PCAP_IS_AT_LEAST_GNUC_VERSION(2,0) && \
     (defined(__alpha) || defined(__alpha__) || \
      defined(__mips) || defined(__mips__))
-
 /*
- * This is a GCC-compatible compiler and we have __attribute__, which
- * we assume that mean we have __attribute__((packed)), and this is
- * MIPS or Alpha, which has instructions that can help when doing
- * unaligned loads.
+ * This is MIPS or Alpha, which don't natively handle unaligned loads,
+ * but which have instructions that can help when doing unaligned
+ * loads, and this is GCC 2.0 or later or a compiler that claims to
+ * be GCC 2.0 or later, which we assume that mean we have
+ * __attribute__((packed)), which we can use to convince the compiler
+ * to generate those instructions.
  *
  * Declare packed structures containing a uint16_t and a uint32_t,
  * cast the pointer to point to one of those, and fetch through it;