autoconf
[Top][All Lists]
Advanced

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

Re: Contents of <confdefs.h> for C++


From: Raja R Harinath
Subject: Re: Contents of <confdefs.h> for C++
Date: Fri, 05 Jul 2002 18:10:44 -0500
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (i686-pc-linux-gnu)

"Walter E. Brown" <address@hidden> writes:

> harinath wrote:

>> ... the loop in _AC_PROG_CXX_EXIT_DECLARATION
>>
>>   for ac_declaration in \
>>    ''\
>>    '#include <stdlib.h>' \
[snip]
>> This whole section is necessary since AC_LANG_PROGRAM supports the
>> use of exit() in C/C++ program test fragments.
>
> Ah, we're making progress; thank you!  This is the first I've heard
> that "AC_LANG_PROGRAM supports the use of exit() in C/C++ program test
> fragments" -- I haven't found any documentation to this effect.  Does
> anyone know the rationale for this decision?  If so, let's please
> ensure it's written down somewhere.

In my view, you would have to provide a rationale for _not_ providing
support for exit().  Yes, you can use "return foo;" in the main()
function.  But, why not 'exit()'?

> More to the point:  Assuming this feature is indeed an autoconf
> requirement, could its logic be encapsulated so that test programs
> that want or need to call exit() can enable this feature?  I can
> imagine, for example, requiring such a test program to contain the
> equivalent of:
>
>     #define I_NEED_TO_CALL_EXIT
>
> so that <confdefs.h> could be expressed:
>
>     #if defined(__cplusplus)  &&  defined(I_NEED_TO_CALL_EXIT)
>       #include <stdlib.h>
>     #endif
>
> Perhaps negative logic would be preferable for reasons of backward
> compatibility:
>
>     #if defined(__cplusplus)  &&  ! defined(I_DONT_NEED_TO_CALL_EXIT)
>       #include <stdlib.h>
>     #endif
>
> I could adapt to either.

Both seem unweildly.  You'll need to provide more reasons why this is
essential: especially if we use my other suggestion to try <cstdlib>
first.

If you are so concerned with this, you should put

  m4_define([_AC_PROG_CXX_EXIT_DECLARATION],[])

somewhere early in your configure.in and be done with it.

> In any case, I can't live with the status quo, since even my little
> tests require complete control over headers that are included.
>
> (Since the search paths in our environment are non-standard, all of
> my little tests are innocently being given the wrong <stdlib.h> --
> when they really don't need any such header!

It seems the right thing is to invoke configure with the right
directories listed in CXXFLAGS so that it picks up the correct
headers.  You can even create a directory with a dummy stdlib.h
that contains only an #error, and put that ahead in your include
search path.

- Hari
-- 
Raja R Harinath ------------------------------ address@hidden



reply via email to

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