configure: check for pkg-config presence

On a fresh installation, I was puzzled by a configure.ac 'syntax error' for
PKG_CHECK_MODULES(TALLOC). It took me some time to figure out that merely
pkg-config was missing.

Add a check for pkg-config, which isn't as straightforward as I would wish,
so comment generously.

Change-Id: I2e7cdc37eb59f9947a45fbc5baddbaf71b655bc0
This commit is contained in:
Neels Hofmeyr 2016-08-08 15:38:35 +02:00 committed by Neels Hofmeyr
parent d1dcda01f8
commit fef2fa224a
1 changed files with 15 additions and 0 deletions

View File

@ -17,6 +17,21 @@ LT_INIT([pic-only disable-static])
AC_CONFIG_MACRO_DIR([m4])
dnl check for pkg-config
dnl * If pkg-config is missing, we get a "syntax error" for PKG_CHECK_MODULES.
dnl Instead, we want to say that pkg-config and pkg.m4 are missing.
dnl * The proper way is PKG_PROG_PKG_CONFIG() but unfortunately that does not
dnl produce an intelligible error message if pkg-config is missing entirely
dnl ("syntax error near unexpected token `0.20'").
dnl * To produce a hint that pkg-config is missing, check for the pkg-config
dnl binary; but AC_PATH_PROG breaks if the distribution provides only
dnl prefixed (<arch>-pkg-config) versions, so just print a warning.
AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
AC_MSG_WARN([You need to install pkg-config])
fi
PKG_PROG_PKG_CONFIG([0.20])
dnl check os: some linker flags not available on osx
case $host in
*-darwin*)