Autoconf — including a static library (newbie)

这一生的挚爱 提交于 2019-12-03 05:28:32

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.ams 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!