From bb206a855505645e416072114b5f0f67ca114f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Tue, 23 Jun 2015 08:48:40 +0000 Subject: [PATCH] even more improved way to find the necessary include path --- ax_init_standard_project.m4 | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 00409d5..ab1cf65 100644 --- a/ax_init_standard_project.m4 +++ b/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}"