automake
[Top][All Lists]
Advanced

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

Re: Finding library procedures in /usr/local/lib/


From: Gerald I. Evenden
Subject: Re: Finding library procedures in /usr/local/lib/
Date: Fri, 3 Apr 2009 14:48:22 -0400
User-agent: KMail/1.9.10

On Friday 03 April 2009 2:29:36 pm Ralf Wildenhues wrote:
> Hello Gerald,
>
> * Gerald I. Evenden wrote on Fri, Apr 03, 2009 at 08:11:22PM CEST:
> > One added note, that bothers me a little.
> >
> > If the system checks for an entry being present in a particular iibrary
> > by compiling/linking a test program using the function *and* linking to
> > the specified library,----> what if the library under test heavily
> > references another library such as -lm??  IF -lm is not in the test run
> > would the test not fail???????  Thus the entry under test fails also.
>
> I haven't read the thread in full, but this is probably the issue
> bothering you:
>
> AC_CHECK_LIB and AC_SEARCH_LIBS both have an optional 5th argument where
> one can supply additional needed libraries.  So of libfoo needs libm,
> then a check for libfoo could look like
>
>   AC_SEARCH_LIBS([function_from_libfoo], [foo], [], [], [-lm])
>
> and after this macro, $LIBS would contain -lfoo if the test was
> successful.  Of course, you can check for both in sequence,
>   AC_SEARCH_LIBS([cos], [m])
>   AC_SEARCH_LIBS([function_from_libfoo], [foo])
>
> and in this case you don't need to specify -lm in the second macro,
> because the first macro will have added that to $LIBS (and $LIBS is used
> for linking).
>
> And yes, library linking order *always* matters.  The bugs are just more
> obscure with GNU/Linux and shared linking than they are under other
> circumstances.
>
> Cheers,
> Ralf

Many, many thanks.  That did it so everything looks pretty now.

I used the second method rather than use an undocumented feature.

-- 
The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939) British psychologist




reply via email to

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