如何在 autoconf 配置脚本/makefile 中添加指向库的链接 [英] Howto add a link to a library in autoconf configure script / makefile

查看:29
本文介绍了如何在 autoconf 配置脚本/makefile 中添加指向库的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 autotools 新手我很难弄清楚如何轻松地将特定库链接到配置的目标之一.

I am an autotools newb and I have difficulties figuring out howto easily link a specific library into one of the configured targets.

我有一个源包,我想以通常的方式构建:./configure &&制作&&进行安装

I have a source package that I want to build the usual way: ./configure && make && make install

不幸的是,其中一个 cpps 缺少对另一个库的引用.手动编译(调整命令行)有效.但我宁愿修补"编译脚本.编辑链接引用的标准位置在哪里?

Unfortunately one of the cpps has a missing reference to another library. Compiling it by hand (adjusting the commandline) works. But I would rather "patch" the compile script. Where is the standard place to edit linking references?

 undefined reference to `boost::system::get_system_category()

顺便说一下,这是我的错误信息.

That is my error message btw.

推荐答案

你需要在Makefile.amAM_LDFLAGS中添加相关的-l标志/代码>;例如:

You need to add the relevant -l flag to AM_LDFLAGS in Makefile.am; e.g.:

AM_LDFLAGS = -lboost_system-mt

请注意,Boost 库通常以后缀结尾——表示构建配置的字母序列.在上面的例子中,后缀是-mt.这在您的安装中可能会有所不同(尽管 -mt 变体通常在 POSIXy 系统、IME 上可用).

Note that Boost libraries generally end in a suffix—a sequence of letters that indicates the build configuration. In the above example, the suffix is -mt. This could be different in your installation (though the -mt variant is commonly available on POSIXy systems, IME).

我做这样的事情:

AM_LDFLAGS = -lboost_system$(BOOST_LIB_SUFFIX)

BOOST_LIB_SUFFIX 是一个珍贵的变量(见 AC_ARG_VAR),默认为 -mt.

BOOST_LIB_SUFFIX is a precious variable (see AC_ARG_VAR) that defaults to -mt.

这篇关于如何在 autoconf 配置脚本/makefile 中添加指向库的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆