本文介绍了PKG_CHECK_MODULES在日光浴中破裂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目需要libxml2的依赖关系,正在使用自动工具检查依赖关系&安装相同.我声明在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,'

通过Google搜索解决方案,其中大多数人抱怨未安装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(如果在m4子目录中有自定义的m4代码,则可能是-I 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)(如果使用自动制作),在configure.ac中设置AC_CONFIG_MACRO_DIR([m4]).然后运行aclocal -I m4autoconf./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在日光浴中破裂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-31 23:25