[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AC_CHECK_LIB, C++ and the use of main
From: |
Patrik Jonsson |
Subject: |
AC_CHECK_LIB, C++ and the use of main |
Date: |
Fri, 08 Sep 2006 15:12:54 -0700 |
User-agent: |
Thunderbird 1.5.0.5 (Windows/20060719) |
Hi,
A while ago I wanted to find out how to check for C++ libraries using
autoconf, and came across this old post from the archives:
>On Thu, Mar 28, 2002 at 07:13:14PM -0500, Allan Clark wrote:
>
>> How do I make a AC_CHECK_LIB for a C++ library?
>>
>> My example looks for cgi_base::configureForServer on different systems
>> like this:
>> > AC_CHECK_LIB(cgi, configureForServer__8cgi_basePci)
>> > AC_CHECK_LIB(cgi, configureForServer__8cgi_baseFPci)
>
>First do AC_LANG_CPLUSPLUS (or the equivalent) to switch to compiling >in
>C++).
>
>Then you can simply do :
>
>AC_CHECK_LIB(cgi, main)
>
>(yes, using "main" works - it's a special value in this context).
I've used this happily until now. What this test seems to do is try a
program like the following:
int
main ()
{
return main ();
;
return 0;
}
The problem is that this is illegal in ISO C++. gcc doesn't complain
unless run with --pedantic, but the compiler I'm using now (IBM Visual
Age C++ xlC v8) will not accept calling main, so the test always fails.
Since gcc is taking a more and more restrictive view of the standards,
it seems it's just going to be a matter of time before the test fails
with gcc, too.
Can anyone give me another (standards-compliant) way of testing for a
C++ library, without using main or knowledge about mangled function
names? I've searched around the web for this and found nothing, but it
seems it should be a pretty obvious issue.
Thanks,
/Patrik Jonsson
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- AC_CHECK_LIB, C++ and the use of main,
Patrik Jonsson <=