我的项目要求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"] )
Run Code Online (Sandbox Code Playgroud)
宏按照需要工作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,'
Run Code Online (Sandbox Code Playgroud)
谷歌搜索解决方案,他们中的大多数抱怨pkg-config没有安装.但是在我的测试机器中实际安装了它,通过执行以下命令来检查它.
bash-3.00# pkg-config libxml-2.0 --modversion
2.6.23
Run Code Online (Sandbox Code Playgroud)
一些建议会受到欢迎.