如何修复“PKG_PROG_PKG_CONFIG:command not found”错误?

我有Ubuntu 13.10 32位系统。 最近,当我尝试通过运行./autogen.sh./configure进行编译时,我得到了

  PKG_PROG_PKG_CONFIG: command not found 

错误。 我安装了libtool 。 我在usr/share/ like alocalaclocal-1.13aclocal-1.4有三个aclocal文件

我该如何解决这个本地错误?

编辑:

前段时间我从源代码编译了最新版本的automake并安装了它,因为源代码需要最新版本的automake来运行配置过程。 从那以后每当我在源目录中运行标准的./autogen/configure命令来生成makefile我就会得到

  PKG_PROG_PKG_CONFIG: command not found 

错误

  find /usr -name "pkg.m4" 

给我

  /usr/share/aclocal/pkg.m4 

  aclocal --print-ac-dir 

给我

  /usr/local/share/aclocal 

PKG_PROG_PKG_CONFIG变量是指作为pkg-config软件包的一部分提供的宏pkg.m4 ,因此要检查的第一件事是安装pkg-config并且宏文件位于默认位置(并且可读,当然)

 dpkg -l pkg-config ls -l /usr/share/aclocal/pkg.m4 

如果检查出来,那么问题就变成为什么aclocal没有找到它? 您可以使用--print-ac-dir开关检查aclocal的配置位置以查找第三方m4文件

 aclocal --print-ac-dir 

如果这与上面的位置不同,则表明您的系统上存在非标准版本的automake – 如果您无法解决该问题,那么可能的解决方法是在运行autogen之前设置或导出ACLOCAL_PATH环境变量.sh脚本例如

 ACLOCAL_PATH=/usr/share/aclocal ./autogen.sh 

要么

 export ACLOCAL_PATH=/usr/share/aclocal ./autogen.sh ./configure 

请参阅GNU automake手册的宏搜索路径部分。