当没有 .pc 文件时,让 Autoconf 手动检查库
我对使用 Autoconf 比较陌生,到目前为止我只使用过 PKG_CHECK_MODULES ,这对我很有用。我遇到过一个软件包,特别是 Debian libmhash-dev v0.9.9.9-1
,它不包含 pkg 的
使用。.pc
文件-config
我如何告诉 Autoconf 检查 mhash
并将正确的标志传递给 g++?
I'm relatively new to using Autoconf and so far I've only used PKG_CHECK_MODULES
and that's worked for me. I've come across a package, specifically the Debian libmhash-dev v0.9.9.9-1
, that doesn't include a .pc
file for pkg-config
to use.
How do I tell Autoconf to check for mhash
and pass the correct flags onto g++?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不确定这是否是这个谩骂的地方(很确定不是!),但我很长一段时间的学习曲线看起来像:foo 是个好主意,但很多老勒德分子说它不好,但我'我会使用它,因为它很棒。 (等几个月)哦,不,那些说 foo 不好的人是对的,但现在我已经投入了几个月的工作,而且我面前还有很多额外的工作来修复它。真糟糕。
简而言之,PKG_CHECK_MODULES 是一个坏主意,但您可能不会意识到它,直到您使用它几个月(或几年)并且拥有大量依赖于它的代码。为了避免将来给您带来麻烦,请立即开始从您的configure.ac 文件中清除PKG_CHECK_MODULES。
使用 AC_CHECK_LIB、AC_SEARCH_LIBS 和 AC_CHECK_FUNC,但不要使用 PKG_CHECK_MODULES。
pkg-config 当然有一席之地,精明的管理员可以在 CONFIG_SITE 或脚本中使用它来帮助设置配置运行,但不应使用 PKG_CHECK_MODULES。
Not sure if this is the place for this diatribe (pretty sure it's not!), but my learning curve for a long time has looked like: foo is a great idea, but a lot of the old luddites say its bad, but I'm going to use it because it's great. (wait a few months) Oh, no, the people who said foo was bad were right, but now I've got several months of work committed and I'll have a lot of extra work in front of me to fix it. Bummer.
In short, PKG_CHECK_MODULES is a bad idea, but you may not realize it until you have used it for several months (or years) and have a whole lot of code that depends on it. Save yourself trouble in the future, and start purging PKG_CHECK_MODULES from your configure.ac files today.
Use AC_CHECK_LIB and AC_SEARCH_LIBS and AC_CHECK_FUNC, but do not use PKG_CHECK_MODULES.
pkg-config certainly has a place, and a savvy administrator can use it in a CONFIG_SITE or in scripts to help in setting up configure runs, but PKG_CHECK_MODULES should not be used.
但最好使用
AC_SEARCH_LIBS
- 正如手册建议的那样。But it's better to use
AC_SEARCH_LIBS
- as manual advises.使用
AC_CHECK_LIB
。Use
AC_CHECK_LIB
.