I am trying to migrate my application from manual build to autoconf, which is working very nicely so far. But I have one static library that I can\'t figure out how to integrat
You can set the location in configure.ac
:
LOCATION=/home/john/mystuff
AC_SUBST(LOCATION)
AC_SUBST
defines the variable $LOCATION
in all your Makefile.am
s and also replaces all occurrences of @LOCATION@
with the contents of $LOCATION
. So then in your Makefile.am
you can do
myprog_CPPFLAGS="-I$LOCATION"
myprog_LDADD="$LOCATION/helper.a"
PS. The reason why you need to reference the library directly is because -l
looks for a properly-named library (e.g. libhelper.a
) in the system library directories. However, since there's not all that much difference between a static library and an object file, there's no need to magically reference it using -l
; you can just compile it into your program like you are doing now.