even more improved way to find the necessary include path

master
Marc Wäckerlin 10 years ago
parent 45589f204c
commit 3a0471de5b
  1. 17
      ax_init_standard_project.m4

@ -372,12 +372,13 @@ EOF
# fails if not found
AC_DEFUN([AX_PKG_REQUIRE], [
PKG_PROG_PKG_CONFIG
$1_found=0
PKG_CHECK_MODULES([$1], [$2], [
$1_found=1
PKG_REQUIREMENTS+=" $2"
], [
if test -n "$4"; then
AC_MSG_WARN([Recommended package $2 for feature $1 not installed, trying $4])
$1_found=0
for pkg in $4; do
PKG_CHECK_MODULES([$1], [$pkg], [
PKG_REQUIREMENTS+=" $pkg"
@ -387,22 +388,18 @@ AC_DEFUN([AX_PKG_REQUIRE], [
AC_MSG_WARN([Recommended package $pkg for feature $1 not installed])
])
done
if test ${$1_found} -eq 0; then
AC_MSG_ERROR([Required package $2 or $4 for feature $1 not installed])
fi
else
AC_MSG_ERROR([Required package $2 for feature $1 not installed])
fi
])
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS)
AC_SUBST(PKG_REQUIREMENTS)
if test -n "$3"; then
$1_found=0
old_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}"
AC_CHECK_HEADER([$3], [
$1_found=1
], [
$1_found=0
for x in ${$1_CFLAGS}; do
AC_MSG_NOTICE([search for $3 in ${x[#]-I}])
for f in $(find ${x[#]-I} -name "$3"); do
@ -417,12 +414,12 @@ AC_DEFUN([AX_PKG_REQUIRE], [
break;
fi
done
if test ${$1_found} -eq 0; then
AC_MSG_ERROR([Required header $3 for feature $1 with ${$1_CFLAGS} not found])
fi
])
CPPFLAGS=${old_CPPFLAGS}
fi
if test ${$1_found} -eq 0; then
AC_MSG_ERROR([Feature $1 not found, need header $3 in module $2 $4])
fi
AM_CPPFLAGS+=" ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}"

Loading…
Cancel
Save