[Top][All Lists]

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

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

From: John Calcote
Subject: Re: Finding library procedures in /usr/local/lib/
Date: Thu, 02 Apr 2009 19:23:48 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2


On 4/2/2009 3:45 PM, Gerald I. Evenden wrote:
After trying so many options related to libraries I am exhausted.

I have a simple program that needs to link with a shared library installed
in /usr/local/lib.

When using my own simple Makefile and simply adding "-lproject -lm" everything
works fine (libproject is the shared library).

But regardless of how many tests, etc., I do in the .ac and .am files I cannot
get the final Makefile to link with "project."
I presume that the reason you link with both libproject and the math library is because libproject requires libm. This could explain why your tests are failing to "find" libproject. Try adding this test to


Tests in "look" for libraries by actually building programs that attempt to link the specified symbol from the specified list of libraries. If the program links, then the test succeeds. The default action in successful cases for AC_SEARCH_LIBS is to add "-lprojects" to the LIBS variable, which is automatically added to your compiler command line (at least by Automake-generated makefiles). If the library that AC_SEARCH_LIBS attempts to link to requires other non-default libraries (like libm, for instance), then you have to add this list of linker commands to the "other-libraries" argument, or the test will fail, even if the function is found in the desired library.

The documentation for AC_SEARCH_LIBS indicates that, on successfully testing for the desired library, this macro prepends -lproject to LIBS, and then executes the shell code in the "action-if-found" parameter, thus, you don't need to add -lproject to LIBS, because this is done by the macro before any additional shell code you specify is executed.

You can also use the following macro, which generates shell code that is a little less complex. But it's a bit harder to use correctly, as you have to write the entire "action-if-found" functionality yourself. The carriage returns are fairly important here:

[LIBS=-lproject $LIBS

AC_CHECK_LIB has no success functionality that executes even if you supply the "action-if-found" argument. All of it's success functionality is given by the default value of the argument. Thus, if you supply the argument, you have to supply all of the appropriate functionality for a successful check. In this case, the macro is supposed to prepend -lproject to LIBS, and then define HAVE_LIBPROJECT.


reply via email to

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