]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
(_AC_PROG_CXX_EXIT_DECLARATION):
authorJim Meyering <meyering@lucent.com>
Fri, 23 May 2003 09:36:17 +0000 (09:36 +0000)
committerJim Meyering <meyering@lucent.com>
Fri, 23 May 2003 09:36:17 +0000 (09:36 +0000)
Remove `#include <stdlib.h>' from the list; we should never
make confdefs.h include <stdlib.h> or <cstdlib>, because the
resulting namespace pollution would cause other tests to fail.
Configure scripts run with some older versions of g++ and HP's
aCC would fail due to such an #include.  Problems reported by
Matthew Mueller in <http://bugs.debian.org/120704> and by
Keith Bostic in
<http://mail.gnu.org/archive/html/autoconf/2003-05/msg00063.html>.
In the test, use the test declaration before including <stdlib.h>,
as that's closer to how it'll be used.

lib/autoconf/c.m4

index 3ef894e913bf603b6266343cfde0764857cfd403..248bc644b3ecaafce089e7dacb49d758b9ee06c0 100644 (file)
@@ -723,19 +723,24 @@ fi[]dnl
 
 # _AC_PROG_CXX_EXIT_DECLARATION
 # -----------------------------
-# Find a valid prototype for exit and declare it in confdefs.h.
+# If <stdlib.h> doesn't already provide a valid prototype for exit,
+# determine the appropriate prototype and put it in confdefs.h.
+# This macro is run only when testing a C++ compiler, but it generates
+# a prototype that is also appropriate for C compilers in order to
+# support a mixed C/C++ configuration environment.
+# We don't need to worry about this for C, since we include <stdlib.h>
+# if it is available, and that method works for all C compilers.
 m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
 [for ac_declaration in \
-   ''\
-   '#include <stdlib.h>' \
+   '' \
    'extern "C" void std::exit (int) throw (); using std::exit;' \
    'extern "C" void std::exit (int); using std::exit;' \
    'extern "C" void exit (int) throw ();' \
    'extern "C" void exit (int);' \
    'void exit (int);'
 do
-  _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <stdlib.h>
-$ac_declaration],
+  _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration
+@%:@include <stdlib.h>],
                                      [exit (42);])],
                     [],
                     [continue])