PKG_CHECK_MODULES breaking in solaris

橙三吉。 提交于 2019-12-08 04:09:00

问题


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.


回答1:


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.

If that doesn't work and pkg.m4 was installed, try running autoreconf -f (and maybe autoreconf -i -f).

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.



来源:https://stackoverflow.com/questions/6758442/pkg-check-modules-breaking-in-solaris

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!