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

Re: autoconf macros and C++



On Thu, Feb 15, 2001 at 10:24:33AM +0200, Richard Braakman wrote:
> On Thu, Feb 15, 2001 at 01:49:34AM -0500, Jaldhar H. Vyas wrote:
> > I hope this helps anyone who has faced the problem themselves.  I have a
> > question too, is there anyway to use the unmangled name?  AFAIK, mangling
> > isn't portable and unportability kind of defeats the whole purpose of
> > using autoconf don't you think?

The place to ask this question is autoconf@gnu.org, really.

 
> You could probably use the unmangled name if you convince autoconf
> to compile the program fragment as a C++ program.

I don't think that will work.  In the current autoconf
documentation, under AC_CHECK_FUNC we see

     This macro checks for functions with C linkage even when
     `AC_LANG_CPLUSPLUS' has been called, since C++ is more
     standardized than C is.

The test program that gets generated has 'extern "C"' around the 
function declaration.  

While AC_CHECK_LIB claims to work for C++ functions, it generates the same
"extern C" declaration in the test function.  This is probably a bug.


> The best solution is probably to have an autoconf macro specifically
> for testing for C++ functions.

There is a whole raft of macros for various things available at
http://research.cys.de/autoconf-archive/.  Lots of them are C++
specific, but unfortunately, I don't see one that checks for functions.



> Note that using C++ kind of defeats the whole purpose of using
> autoconf :-)  Autoconf is not even very happy about using ANSI C,
> because it's not available everywhere.  

Although support for languages other than C is weak, this statement
is mostly nonsense.  Most C code these days is ANSI, and autoconf
seems to work just fine with it.

-Steve



Reply to: