问题描述
我正在构建我的第一个自动配置托管软件包.
I'm building my first autoconf managed package.
但是,我找不到任何简单的示例来说明如何指定所需的库,并找到该库可能在各个不同位置的位置.
However I can't find any simple examples anywhere of how to specify a required library, and find that library where it might be in various different places.
我目前有:
AC_CHECK_LIB(['event'], ['event_init'])
但是:
- 找不到在
/opt/local/lib
中安装的版本 - 如果没有找到该库,它不会抱怨
- 我也需要将include路径设置为
/opt/local/include
- It doesn't find the version installed in
/opt/local/lib
- It doesn't complain if the library isn't actually found
- I need to set the include path to
/opt/local/include
too
任何帮助,或链接到体面的教程的链接,深表感谢...
any help, or links to decent tutorials much appreciated...
推荐答案
如果希望gcc/g ++在非标准位置查看,则需要手动设置CFLAGS
,CXXFLAGS
和LDFLAGS
.
You need to manually set CFLAGS
, CXXFLAGS
and LDFLAGS
if you want gcc/g++ to look in non-standard locations.
因此,在调用AC_CHECK_LIB()
之前,请先做类似的事情
So, before calling AC_CHECK_LIB()
, do something like
CFLAGS="$CFLAGS -I/opt/local/include"
CXXFLAGS="$CXXFLAGS -I/opt/local/include"
LDFLAGS="$LDFLAGS -L/opt/local/lib"
如果在整个配置脚本中仅使用gcc,则不需要CXXFLAGS.
You don't need CXXFLAGS if you're only using gcc throughout your configure script.
这篇关于使用autoconf进行库解析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!