autoconf
[Top][All Lists]
Advanced

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

Re: library search test fails, please help


From: aaragon
Subject: Re: library search test fails, please help
Date: Mon, 23 Feb 2009 16:09:56 -0800 (PST)

I tried what you suggested and it works just fine, so I guess this is the
correct way to implement C++ functions. It is way more complicated than the
C functions.

Thanks for the help, I really appreciate it.

aa


Peter Johansson-6 wrote:
> 
> Hello,
> 
> [adding autoconf list again]
> 
> Alejandro Marcos Aragón wrote:
>> Well, I tried to put the namespace as well, but the test failed.
>>
>>   
> I suppose you mean that you tried
> 
> AC_SEARCH_LIBS([cpputils::flip], [cpputils],,[AC_MSG_ERROR(library
> cpputils not
> found)])
> 
> 
> which would result in test code:
> 
> char cpputils::flip ();
>  int
>  main ()
>  {
>  return cpputils::flip ();
>    ;
>    return 0;
> }
> 
> 
> which is not what we desired. We would like something like (I'm not 
> certain of your exact signature):
> 
> namespace cpputils {
> void flip (double);
> }
>  int
>  main ()
>  {
>  using namespace cpputils;
>  flip (1.0);
>    ;
>    return 0;
> }
> 
> 
> You could achieve this by rather calling AC_LINK_IFELSE as below
> 
> LIBS="$LIBS -lcpputils"
> AC_MSG_CHECKING([for flip in cpputils])
> AC_LINK_IFELSE([AC_LANG_PROGRAM([[
>                                   namespace cpputils {
>                                   void flip(double);
>                                   }
>                                 ]],
>                                 [using namespace cpputils;
>                                  flip(1.0);])
>                ],
>                [AC_MSG_RESULT([yes])],
>                [AC_MSG_RESULT([no])
>                 AC_MSG_ERROR([library cpputils not found])
>                ]
>               )
> 
> 
> Hope that helps.
> 
> 
> Peter
> 
> 
> 
>> aa
>>
>> On Sun, 2009-02-22 at 23:26 -0500, Peter Johansson wrote:
>>   
>>> aaragon wrote:
>>>     
>>>> address@hidden:~/Lib/lib$ nm -g libcpputils.so | grep flip |
>>>> c++filt
>>>> 00003c20 T cpputils::flip(double)
>>>>
>>>>   
>>>>       
>>> Isn't the problem that flip(double) is in namespace cpputils?
>>>
>>> Peter
>>>     
>>
>>   
> 
> 
> -- 
> Peter Johansson
> 
> svndigest maintainer, http://dev.thep.lu.se/svndigest
> yat maintainer,       http://dev.thep.lu.se/yat
> 
> 
> 
> _______________________________________________
> Autoconf mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/autoconf
> 
> 

-- 
View this message in context: 
http://www.nabble.com/library-search-test-fails%2C-please-help-tp22140739p22173158.html
Sent from the Gnu - Autoconf - General mailing list archive at Nabble.com.





reply via email to

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