]> 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:51:19 +0000 (03:51 +0000)
committerguy <guy>
Thu, 21 Apr 2005 03:51:19 +0000 (03:51 +0000)
for __attribute__ doesn't fit inside "main()" with GCC 4.0, as it
defines a function.

aclocal.m4
configure

index 5c63556630c3c632bd652885da536d6a26e8d87e..97ac29ae7767c67ff174447a49260bb7b50bdf2c 100644 (file)
@@ -1,4 +1,4 @@
-dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106.2.3 2005-04-21 02:22:38 guy Exp $ (LBL)
+dnl @(#) $Header: /tcpdump/master/tcpdump/aclocal.m4,v 1.106.2.4 2005-04-21 03:51:19 guy Exp $ (LBL)
 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_TRY_COMPILE([
+AC_COMPILE_IFELSE(
+  AC_LANG_SOURCE([[
 #include <stdlib.h>
-],
-[
+
 static void foo(void) __attribute__ ((noreturn));
 
 static void
@@ -1222,7 +1222,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 9a6fd2c814533d4e6b639834bf549eee344069c9..38a753a9fa0909df15abfe3775fd3571a8f2d53b 100755 (executable)
--- a/configure
+++ b/configure
@@ -2597,10 +2597,6 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 #include <stdlib.h>
 
-int
-main ()
-{
-
 static void foo(void) __attribute__ ((noreturn));
 
 static void
@@ -2609,9 +2605,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