Solaris 中的 PKG_CHECK_MODULES 损坏
我的项目需要 libxml2
的依赖项,我使用自动工具来检查依赖项和依赖项。安装相同的。我在configure.ac中声明了使用以下宏的依赖关系,
echo -n "checking if libxml2 is present... "
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.19],
[echo "yes (features requiring libxml2 enabled)" AC_DEFINE(HAVE_LIB_XML, 1, [define if libxml2 is present])],
[echo "no"] )
该宏在GNU/Linux
中按预期工作。
但不知何故,它在 Solaris 中失败,并出现以下错误
checking if libxml2 is present... ./configure: line 11586: syntax error near unexpected token `LIBXML2,'
./configure: line 11586: `PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.6.19,'
,在 Google 上搜索解决方案,大多数人抱怨未安装 pkg-config
。但在我的测试机中它实际安装了,通过执行以下命令进行检查。
bash-3.00# pkg-config libxml-2.0 --modversion
2.6.23
一些建议将受到欢迎。
My project requires dependency of libxml2
am using autotools to check the dependencies & install the same. I declare the dependency of using the following macro in configure.ac
echo -n "checking if libxml2 is present... "
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.19],
[echo "yes (features requiring libxml2 enabled)" AC_DEFINE(HAVE_LIB_XML, 1, [define if libxml2 is present])],
[echo "no"] )
The macro works as desired in GNU/Linux
.
But somehow it fails in Solaris
with the following error
checking if libxml2 is present... ./configure: line 11586: syntax error near unexpected token `LIBXML2,'
./configure: line 11586: `PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.6.19,'
Googled for a solution, most of them complain of pkg-config
not being installed. But in my test machine its actually installed, checked it by executing the following command.
bash-3.00# pkg-config libxml-2.0 --modversion
2.6.23
Some suggestions would be welcomed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PKG_CHECK_MODULES
宏似乎没有正确扩展。当您安装pkg-config
时,它是否安装了pkg.m4
(在/usr/share/aclocal
之类的地方)?如果是这样,请尝试再次运行aclocal
(如果您在m4
子目录中有自定义 m4 代码,则可以使用-I m4
),然后运行autoconf
。如果这不起作用并且已安装
pkg.m4
,请尝试运行autoreconf -f
(也可能运行autoreconf -i -f
)。如果这不起作用,您需要将
pkg.m4
复制到您的包的目录中。通常这是m4
子目录。在Makefile.am
中设置ACLOCAL_AMFLAGS = -I m4
(或ACLOCAL_AMFLAGS = -I m4 --install
)(如果您使用的是 automake) ,以及configure.ac
中的AC_CONFIG_MACRO_DIR([m4])
。然后运行 aclocal -I m4
和autoconf
以及./configure
。The
PKG_CHECK_MODULES
macro doesn't seem to be expanded properly. When you installedpkg-config
, did it installpkg.m4
(in somewhere like/usr/share/aclocal
)? If so, try runningaclocal
again (maybe with-I m4
, if you've got custom m4 code in them4
subdirectory) and then runautoconf
.If that doesn't work and
pkg.m4
was installed, try runningautoreconf -f
(and maybeautoreconf -i -f
).If that doesn't work, you'll need to copy
pkg.m4
to a directory for your package. Usually this is them4
subdirectory. SetACLOCAL_AMFLAGS = -I m4
(orACLOCAL_AMFLAGS = -I m4 --install
) inMakefile.am
(if you're using automake), andAC_CONFIG_MACRO_DIR([m4])
inconfigure.ac
. Then runaclocal -I m4
andautoconf
and./configure
.