akheron/autotoolized-lua — pull request #4 by morfoh (2012-02-25 12:55:38+00:00)
Title: fix to not link liblua and luac against libreadline

There is no need to link liblua and luac against libreadline and friends.
It makes only sense to link the lua interpreter itself against readline
as it is the only one which can be run interactively.

Please note that by setting setting use_readline=yes as action-if-found
within the AC_CHECK_LIB macro, is a kind of workaround for not leaking
in -lreadline via the LIBS variable which is used globaly within Makefiles
when linking is done.

see: http://www.gnu.org/software/autoconf/manual/autoconf.html#Libraries

Note for the Fedora package maintainers:

Most probably you can omit following hackery within the lua.spec file by
using this patch.

http://pkgs.fedoraproject.org/gitweb/?p=lua.git;a=blob;f=lua.spec;h=8629717abaf46dbbe3497c26e39baaaf4dfa51e2;hb=HEAD#l61

-------------------snip--------------------------------------------------
make %{?_smp_mflags} LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl"
sed -i 's/-lreadline -lncurses //g' etc/lua.pc
-------------------snip--------------------------------------------------

Most probably there will be no need anymore for passing the make options
LIBS="-lm -ldl" luac_LDADD="liblua.la -lm -ldl".

Same applies to the mangling of the lua.pc file via sed, as the resulting
lua.pc file won't include '-lreadline -lncurses' anymore.