Yes, I figured that the weird looking symbol is compiler specific. Then it also means that I won't be able to use the c++filt command with anything other than symbols created by the GNU C++ compiler right? I mean, if I compile the code with the Intel compiler, most likely this function won't work.
The fact that there is no macro for C++ functions indicate that either a) people do not use autotools when working with with C++ programs; b) they do, but they are very good writing m4 macros for testing C++ code, macros that are not published anywhere in the web; c) the developers of autotools do not write C++ code and they don't care about implementing a macro to test for them. As for me, I'm just a user, and it would be very difficult to implement a macro to do these tests. Even if I come up with a test, it might be very nasty. aa John Calcote-2 wrote: > > Aragon, > > As you've already figured out, AC_CHECK_LIB was designed for C linkage. > That > means that you'd need to name your function exactly as it is exported by > your library - eg., ZN8cpputils4flipEd (minus the leading underscore > character) - in order to trick the macro into finding it. This is a hack, > but it's better than redefining your function with C linkage in your > library. > > Autoconf does appear to provide a framework for different languages. But a > quick examination of /usr/share/autoconf/autoconf/c.m4 shows that the C++ > version of AC_LANG_CALL (used by AC_CHECK_LIB) is just a copy of the C > version of that macro. Other languages can't get away with such a cavalier > attitude (as they're not as close to the C language). But it would be nice > if someone would rewrite AC_LANG_CALL(C++) to actually handle C++ linkage. > > In fairness, this may cause more problems than it would solve, because > while > some might want to look for a function exported with C++ linkage, MOST C++ > libraries provide at least ONE global function that is exported with C > linkage. The idea with AC_CHECK_LIB isn't to find the function you want to > call here, but rather to simply be pretty sure that the library you've > found > is the one you're interested in. If you want to find a specific function, > then try AC_SEARCH_LIBS. But be careful, you'll find some of the same > issues > with that macro, as well as some issues of its own. > > Kind regards, > John > > -----Original Message----- > From: autoconf-bounces+john.calcote=gmail....@gnu.org > [mailto:autoconf-bounces+john.calcote=gmail....@gnu.org] On Behalf Of > aaragon > Sent: Sunday, February 22, 2009 8:31 PM > To: Autoconf@gnu.org > Subject: Re: library search test fails, please help > > > cpputils is a C++ library I wrote. The result from that command is > > aara...@aaragon-laptop:~/Lib/lib$ nm -g libcpputils.so | grep flip > 00003c20 T _ZN8cpputils4flipEd > > and if I filter that using c++filt: > > aara...@aaragon-laptop:~/Lib/lib$ nm -g libcpputils.so | grep flip | > c++filt > 00003c20 T cpputils::flip(double) > > Is there a way to make this macro work with C++ functions??? for the time > being, I thought that it might be a very good idea to create a function > with > C linkage, so for example in my library I wrote: > > extern "C" { > int cpputils_autotools() { > return 0; > } > } > > so I can use that function in the test for autotools. This I guess is > something that should be done automatically by autotools when creating C++ > libraries, so that people don't break their head agains the wall trying to > find out why the macros to test for libraries don't work. > > aa > > > > Peter O'Gorman wrote: >> >> aaragon wrote: >>> Hello, >>> >>> I found working with autoconf sometimes very frustrating. This is an >>> example. I want to check for a particular static library that I created. >>> Thus, I put the following in the configure.ac file >> >>> configure:15785: g++-mp-4.3 -g -O3 -o conftest -g -O2 >>> -I/Users/aaragon/Lib/include -L/Users/aaragon/Lib/lib conftest.cpp >>> -lcpputils >&5 >>> Undefined symbols: >>> "_flip", referenced from: >> >> >> I'm guessing that the cpputils library does not define "_flip". Does nm >> -g libcpputils.a | grep _flip show it with a capital letter? >> >> Peter >> -- >> Peter O'Gorman >> http://pogma.com >> >> >> _______________________________________________ >> Autoconf mailing list >> Autoconf@gnu.org >> http://lists.gnu.org/mailman/listinfo/autoconf >> >> > > -- > View this message in context: > http://www.nabble.com/library-search-test-fails%2C-please-help-tp22140739p22 > 155024.html > Sent from the Gnu - Autoconf - General mailing list archive at Nabble.com. > > > > _______________________________________________ > Autoconf mailing list > Autoconf@gnu.org > http://lists.gnu.org/mailman/listinfo/autoconf > > > > _______________________________________________ > Autoconf mailing list > Autoconf@gnu.org > http://lists.gnu.org/mailman/listinfo/autoconf > > -- View this message in context: http://www.nabble.com/library-search-test-fails%2C-please-help-tp22140739p22169786.html Sent from the Gnu - Autoconf - General mailing list archive at Nabble.com. _______________________________________________ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf