autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Serious problem with Autoconf on RedHat 7


From: Akim Demaille
Subject: Re: [PATCH] Serious problem with Autoconf on RedHat 7
Date: 03 Oct 2000 16:01:44 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

>>>>> "Alexandre" == Alexandre Oliva <address@hidden> writes:

Alexandre> On Oct 2, 2000, Morten Eriksen <address@hidden> wrote:
>> * aclang.m4 (AC_LANG_SOURCE(C++)): don't define exit(), it'll
>> mismatch with the native exit() definition on some platforms
>> (happens at least with g++ 2.96 and glibc 2.1.92 on Red Hat Linux
>> v7).

Alexandre> The problem is that, if we don't define it, we risk getting
Alexandre> the tests rejected due to the lack of a declaration of
Alexandre> exit().  IIRC, the declaration was put in because some C++
Alexandre> compiler wouldn't declare exit(int) in stdlib.h and would
Alexandre> reject translation units that called exit() without
Alexandre> declaring it.  Even though your particular example doesn't
Alexandre> call exit(int), some other tests do, and they don't take
Alexandre> the trouble of declaring exit(int) themselves.

Alexandre> I'm not sure what is the best way to go here.  Another
Alexandre> potential source of trouble is if a compiler only declares
Alexandre> exit(int) in namespace std.

Alexandre> Maybe AC_PROG_CXX should automatically check whether a
Alexandre> translation unit that #includes <stdlib.h> and calls exit()
Alexandre> fails to compile, and attempt to declare exit() otherwise.
Alexandre> Our Standard C++ template would become:

Alexandre> #include "confdefs.h" #if CXX_NEEDS_EXIT_DECL extern "C"
Alexandre> void exit (int); #endif #include <stdlib.h>

Alexandre> The first program we'd attempt to compile would determine
Alexandre> wehther CXX_NEEDS_EXIT_DECL, and #define it in confdefs.h,
Alexandre> so that further compilations would be able to tell whether
Alexandre> to declare it or not.

This is again a lot of deep work that should be delayed til we
completely revamp some aspects of Autoconf (as we intend to do that
catch up with C99).

My personal preference is not to use exit, and to encourage the use of
return in main.

Nevertheless, I don't have your experience, so if you think this is
not the way to go, if you think we will face such C++ compilers, then
yes, using AC_CHECK_DECL seems required.

But again, we're going onto a slippery road with lots of problems of
interdependency between macros.

        Akim



reply via email to

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