autoconf
[Top][All Lists]
Advanced

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

Re: FAQ? C++-based AC_CHECK_LIB?


From: Patrik Jonsson
Subject: Re: FAQ? C++-based AC_CHECK_LIB?
Date: Thu, 07 Sep 2006 18:30:10 -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();
};

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) will not accept calling main.

So, can anyone give me another way of testing for a C++ library, without
using main or 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


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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