|
From: Hans-Bernhard B. <HBB...@t-...> - 2011-02-20 13:51:55
|
On 18.02.2011 21:42, Ethan A Merritt wrote: >> In practice this means that the variable LUA_LIBS will be set to "-llua" >> even if it was explicitly overridden on the command line. > > That's not what the AC_SEARCH_LIBS macro is supposed to do, > according to its documentation. I don't think the problem is what AC_SEARCH_LIBS does by itself. It's what we do with the result in our call of it. In our ACTION-IF-FOUND we explicitly set LUA_LIBS='-llua' if AC_SEARCH_LIBS succeeded, even though we don't know if -llua actually was the library that fulfilled the test. Then later we append $(LUA_LIBS) to TERMLIBS. > That's because it had already constructed a correct environment by > executing pkgconfig. But we don't trust it, and thus decide to override the result. That's where the problem is. We need to check the result variable ac_cv_search_luaL_openlibs. If it contains "none_needed", we should leave alone LUA_LIBS, otherweise append $(ac_cv_search_luaL_openlibs) instead of a hardcoded value. > The intent is that even if we failed to find or invoke pkgconfig, we can > still test if -llua is sufficient to pull in the library. But as-is we unconditionally pull in -llua, even if the actual library name is a different one. > OK. That line > LUA_LIBS='-llua' > is quite possibly wrong. But if you remove it, then you also have to > also remove the fourth line below it: > LIBS='$_libs" It should suffice to move the line into the ACTION-IF-NOT-FOUND branch of the AC_SEARCH_LIBS call. Or maybe just move the entire AC_SEARCH_LIBS call into the else branch of the PKG_CHECK_MODULES one. |