在 autoconf/automake 中可移植地包含 GLib 头文件 [英] Portably include GLib headers in autoconf/automake
问题描述
我需要为使用自动配置构建的项目包含 GLib 标头 -基于系统的可移植性.
I need to include the GLib headers for a project that is built with an autoconf-based system for portability.
如何以可移植的方式安全地导入 GLib 标头?我知道 pkg-config,但这并不完全可移植(因为有些系统不没有它,我宁愿只依靠 autoconf 进行配置).
How can I safely import the GLib headers in a portable manner? I know about pkg-config, but that is not entirely portable (since some systems don't have it and I would prefer to only rely on autoconf for configuration).
推荐答案
GLib 2.22 INSTALL
文件指出 pkg-config
是安装此库的必要条件.我不是 GLib(双关语!);此要求的声明是 INSTALL
文件顶部的第一件事.
The GLib 2.22 INSTALL
file states that pkg-config
is a requirement for installing this library. I am not being GLib (pun intended!); statement of this requirement is one of the first things on the top of the INSTALL
file.
从周围的文本中不清楚是否需要 pkg-config
来编译 GLib 本身,但是很明显 GLib 2.22 作者不打算让任何用户在没有 pkg- 的情况下针对 GLib 进行编译配置.特别是,GLib 的 make install
将适当地安装 .pc
文件.
From the text surrounding it is unclear whether pkg-config
is needed to compile GLib itself, however it is clear that GLib 2.22 authors do not intend for any users to compile against GLib without having pkg-config. In particular, GLib's make install
will install .pc
files appropriately.
为了平台的可移植性,请指导用户适当地设置$PKG_CONFIG_PATH
.
For platform portability, instruct the user to set $PKG_CONFIG_PATH
appropriately.
这篇关于在 autoconf/automake 中可移植地包含 GLib 头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!