PKG_CHECK_MODULES 在solaris 中被破坏 [英] PKG_CHECK_MODULES breaking in solaris
问题描述
我的项目需要依赖 libxml2
我正在使用 autotools 检查依赖项 &安装一样.我在 configure.ac 中声明了使用以下宏的依赖
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"] )
宏在 GNU/Linux
中按需要工作.
The macro works as desired in GNU/Linux
.
但不知何故它在 Solaris
中失败并出现以下错误
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,'
谷歌搜索解决方案,他们中的大多数人抱怨没有安装 pkg-config
.但在我的测试机上实际安装了,通过执行以下命令进行检查.
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
欢迎提出一些建议.
推荐答案
PKG_CHECK_MODULES
宏似乎没有正确展开.当您安装 pkg-config
时,它是否安装了 pkg.m4
(在类似 /usr/share/aclocal
的地方)?如果是这样,请再次尝试运行 aclocal
(也许使用 -I m4
,如果您在 m4
子目录中有自定义 m4 代码),然后运行 autoconf
.
The PKG_CHECK_MODULES
macro doesn't seem to be expanded properly. When you installed pkg-config
, did it install pkg.m4
(in somewhere like /usr/share/aclocal
)? If so, try running aclocal
again (maybe with -I m4
, if you've got custom m4 code in the m4
subdirectory) and then run autoconf
.
如果这不起作用并且 pkg.m4
已安装,请尝试运行 autoreconf -f
(也许 autoreconf -i -f
).
If that doesn't work and pkg.m4
was installed, try running autoreconf -f
(and maybe 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
.
If that doesn't work, you'll need to copy pkg.m4
to a directory for your package. Usually this is the m4
subdirectory. Set ACLOCAL_AMFLAGS = -I m4
(or ACLOCAL_AMFLAGS = -I m4 --install
) in Makefile.am
(if you're using automake), and AC_CONFIG_MACRO_DIR([m4])
in configure.ac
. Then run aclocal -I m4
and autoconf
and ./configure
.
这篇关于PKG_CHECK_MODULES 在solaris 中被破坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!