Autotools knows about target_LDFLAGS
and target_LDADD
. The difference is that LDADD gets added later to the command line than LDFLAGS, and its the right place to put libraries (-lfoo
). See also this question.
Now, I can set the environment variable LDFLAGS
before running ./configure
, and it is picked up. Is there something similar for LDADD
? I want to do something like:
export LDADD="-lfoo"
./configure
make
and have -lfoo
appear after all the object files while linking. I tried the above but it didn't work. LDFLAGS works, but puts the library at the wrong place. What can I do?