]> The Tcpdump Group git mirrors - libpcap/commitdiff
AC_TRY_COMPILE works only for code that fits inside "main()"; the test
authorguy <guy>
Thu, 21 Apr 2005 03:41:24 +0000 (03:41 +0000)
committerguy <guy>
Thu, 21 Apr 2005 03:41:24 +0000 (03:41 +0000)
for __attribute__ doesn't fit inside "main()" with GCC 4.0, as it
defines a function.

aclocal.m4
configure

index d500140e7833b742fe7f7db2803e3a3bc72b9268..9e211cf8172c77d8cc62969bf4ac9564c20c555f 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/libpcap/aclocal.m4,v 1.85 2005-03-27 03:27:09 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/libpcap/aclocal.m4,v 1.86 2005-04-21 03:41:24 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1995, 1996, 1997, 1998
 dnl    The Regents of the University of California.  All rights reserved.
@@ -851,10 +851,10 @@ dnl
 AC_DEFUN(AC_C___ATTRIBUTE__, [
 AC_MSG_CHECKING(for __attribute__)
 AC_CACHE_VAL(ac_cv___attribute__, [
-AC_TRY_COMPILE([
+AC_COMPILE_IFELSE(
+  AC_LANG_SOURCE([[
 #include <stdlib.h>
-],
-[
+
 static void foo(void) __attribute__ ((noreturn));
 
 static void
@@ -862,7 +862,13 @@ 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
index 2fbf9f11d55a97e1085c6774bb2bfbac129c9fd8..a6e622724a0902ae1dbdcd50fe13e004ea38f01f 100755 (executable)
--- a/configure
+++ b/configure
@@ -2633,10 +2633,6 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 #include <stdlib.h>
 
-int
-main ()
-{
-
 static void foo(void) __attribute__ ((noreturn));
 
 static void
@@ -2645,9 +2641,12 @@ foo(void)
   exit(1);
 }
 
-  ;
-  return 0;
+int
+main(int argc, char **argv)
+{
+  foo();
 }
+
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5