autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _AC_PROG_CXX_EXIT_DECLARATION: don't `#include <stdlib.h>'


From: Paul Eggert
Subject: Re: _AC_PROG_CXX_EXIT_DECLARATION: don't `#include <stdlib.h>'
Date: 22 May 2003 17:24:25 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Jim Meyering <address@hidden> writes:

> Your question suggests that this macro deserves more comments :-)

OK, and thanks for cleaning up my misconceptions.  How about this
patch instead?

2003-05-22  Jim Meyering  <address@hidden>
            and Paul Eggert <address@hidden>

        * lib/autoconf/c.m4 (_AC_PROG_CXX_EXIT_DECLARATION):
        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.

--- c.m4.~1.178.~       Thu May 22 12:09:14 2003
+++ c.m4        Thu May 22 17:17:32 2003
@@ -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(address@hidden:@include <stdlib.h>
-$ac_declaration],
+  _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration
address@hidden:@include <stdlib.h>],
                                      [exit (42);])],
                     [],
                     [continue])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]