even more support for weird and sloppy packages

master
Marc Wäckerlin 10 years ago
parent 980a5127d7
commit 40c0b23126
  1. 34
      ax_init_standard_project.m4

@ -372,9 +372,9 @@ EOF
# fails if not found
AC_DEFUN([AX_PKG_REQUIRE], [
PKG_PROG_PKG_CONFIG
$1_found=0
$1_found=no
PKG_CHECK_MODULES([$1], [$2], [
$1_found=1
$1_found=$2
PKG_REQUIREMENTS+=" $2"
], [
if test -n "$4"; then
@ -382,7 +382,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [
for pkg in $4; do
PKG_CHECK_MODULES([$1], [$pkg], [
PKG_REQUIREMENTS+=" $pkg"
$1_found=1
$1_found=$pkg
break;
], [
AC_MSG_WARN([Recommended package $pkg for feature $1 not installed])
@ -394,30 +394,48 @@ AC_DEFUN([AX_PKG_REQUIRE], [
AC_SUBST(AM_CXXFLAGS)
AC_SUBST(PKG_REQUIREMENTS)
if test -n "$3"; then
$1_found=0
tmp_package=${$1_found}
$1_found=no
old_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}"
AC_CHECK_HEADER([$3], [
$1_found=1
$1_found=yes
], [
for x in ${$1_CFLAGS}; do
AC_MSG_NOTICE([search for $3 in ${x[#]-I}])
for f in $(find ${x[#]-I} -name "$3"); do
if test -f "$f"; then
$1_found=1
$1_found=yes
$1_CFLAGS+=" -I${f%/*}"
AC_MSG_NOTICE([added path ${f%/*}])
break;
fi
done
if test ${$1_found} -eq 1; then
if test "${$1_found}" != "no"; then
break;
fi
done
if test "${$1_found}" = "no"; then
tmp_includedir=$(pkg-config --variable=includedir $tmp_package)
for x in ${tmp_includedir}; do
AC_MSG_NOTICE([search for $3 in $x])
for f in $(find ${x} -name "$3"); do
if test -f "$f"; then
$1_found=yes
$1_CFLAGS+=" -I${f%/*}"
AC_MSG_NOTICE([added path ${f%/*}])
break;
fi
done
if test "${$1_found}" != "no"; then
break;
fi
done
fi
])
CPPFLAGS=${old_CPPFLAGS}
fi
if test ${$1_found} -eq 0; then
if test "${$1_found}" = "no"; then
if test -n "$3"; then
if test -n "$4"; then
AC_MSG_ERROR([Feature $1 not found, need header $3 in modules $2 or $4])

Loading…
Cancel
Save