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