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

aclocal.m4
configure

index 24e483d3c38ba52eb4c4bb00ce1d422cf4f02fd4..6c8e3b0edbe6f2a392318f74b35402b5e64d5f0b 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.109 2005-04-21 02:21:47 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.110 2005-04-21 03:50:29 guy Exp $ (LBL)
 dnl
 dnl Copyright (c) 1995, 1996, 1997, 1998
 dnl    The Regents of the University of California.  All rights reserved.
 dnl
 dnl Copyright (c) 1995, 1996, 1997, 1998
 dnl    The Regents of the University of California.  All rights reserved.
@@ -1211,10 +1211,10 @@ dnl
 AC_DEFUN(AC_C___ATTRIBUTE__, [
 AC_MSG_CHECKING(for __attribute__)
 AC_CACHE_VAL(ac_cv___attribute__, [
 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>
 #include <stdlib.h>
-],
-[
+
 static void foo(void) __attribute__ ((noreturn));
 
 static void
 static void foo(void) __attribute__ ((noreturn));
 
 static void
@@ -1222,7 +1222,13 @@ foo(void)
 {
   exit(1);
 }
 {
   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_cv___attribute__=yes,
 ac_cv___attribute__=no)])
 if test "$ac_cv___attribute__" = "yes"; then
index b14bce26766e102efd6c9ac04247c0e0da3f4290..168a1a93207db13fdf518ac7367541beb8e1d672 100755 (executable)
--- a/configure
+++ b/configure
@@ -2597,10 +2597,6 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 #include <stdlib.h>
 
 
 #include <stdlib.h>
 
-int
-main ()
-{
-
 static void foo(void) __attribute__ ((noreturn));
 
 static void
 static void foo(void) __attribute__ ((noreturn));
 
 static void
@@ -2609,9 +2605,12 @@ foo(void)
   exit(1);
 }
 
   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
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5