even more improved way to find the necessary include path
This commit is contained in:
		@@ -372,12 +372,13 @@ EOF
 | 
				
			|||||||
# fails if not found
 | 
					# fails if not found
 | 
				
			||||||
AC_DEFUN([AX_PKG_REQUIRE], [
 | 
					AC_DEFUN([AX_PKG_REQUIRE], [
 | 
				
			||||||
  PKG_PROG_PKG_CONFIG
 | 
					  PKG_PROG_PKG_CONFIG
 | 
				
			||||||
 | 
					  $1_found=0
 | 
				
			||||||
  PKG_CHECK_MODULES([$1], [$2], [
 | 
					  PKG_CHECK_MODULES([$1], [$2], [
 | 
				
			||||||
 | 
					    $1_found=1
 | 
				
			||||||
    PKG_REQUIREMENTS+=" $2"
 | 
					    PKG_REQUIREMENTS+=" $2"
 | 
				
			||||||
  ], [
 | 
					  ], [
 | 
				
			||||||
    if test -n "$4"; then
 | 
					    if test -n "$4"; then
 | 
				
			||||||
      AC_MSG_WARN([Recommended package $2 for feature $1 not installed, trying $4])
 | 
					      AC_MSG_WARN([Recommended package $2 for feature $1 not installed, trying $4])
 | 
				
			||||||
      $1_found=0
 | 
					 | 
				
			||||||
      for pkg in $4; do
 | 
					      for pkg in $4; do
 | 
				
			||||||
        PKG_CHECK_MODULES([$1], [$pkg], [
 | 
					        PKG_CHECK_MODULES([$1], [$pkg], [
 | 
				
			||||||
          PKG_REQUIREMENTS+=" $pkg"
 | 
					          PKG_REQUIREMENTS+=" $pkg"
 | 
				
			||||||
@@ -387,22 +388,18 @@ AC_DEFUN([AX_PKG_REQUIRE], [
 | 
				
			|||||||
          AC_MSG_WARN([Recommended package $pkg for feature $1 not installed])
 | 
					          AC_MSG_WARN([Recommended package $pkg for feature $1 not installed])
 | 
				
			||||||
        ])
 | 
					        ])
 | 
				
			||||||
      done
 | 
					      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
 | 
					    fi
 | 
				
			||||||
  ])
 | 
					  ])
 | 
				
			||||||
  AC_SUBST(AM_CPPFLAGS)
 | 
					  AC_SUBST(AM_CPPFLAGS)
 | 
				
			||||||
  AC_SUBST(AM_CXXFLAGS)
 | 
					  AC_SUBST(AM_CXXFLAGS)
 | 
				
			||||||
  AC_SUBST(PKG_REQUIREMENTS)
 | 
					  AC_SUBST(PKG_REQUIREMENTS)
 | 
				
			||||||
  if test -n "$3"; then
 | 
					  if test -n "$3"; then
 | 
				
			||||||
 | 
					    $1_found=0
 | 
				
			||||||
    old_CPPFLAGS=${CPPFLAGS}
 | 
					    old_CPPFLAGS=${CPPFLAGS}
 | 
				
			||||||
    CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}"
 | 
					    CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}"
 | 
				
			||||||
    AC_CHECK_HEADER([$3], [
 | 
					    AC_CHECK_HEADER([$3], [
 | 
				
			||||||
 | 
					      $1_found=1
 | 
				
			||||||
    ], [
 | 
					    ], [
 | 
				
			||||||
      $1_found=0
 | 
					 | 
				
			||||||
      for x in ${$1_CFLAGS}; do
 | 
					      for x in ${$1_CFLAGS}; do
 | 
				
			||||||
        AC_MSG_NOTICE([search for $3 in ${x[#]-I}])
 | 
					        AC_MSG_NOTICE([search for $3 in ${x[#]-I}])
 | 
				
			||||||
        for f in $(find ${x[#]-I} -name "$3"); do
 | 
					        for f in $(find ${x[#]-I} -name "$3"); do
 | 
				
			||||||
@@ -417,12 +414,12 @@ AC_DEFUN([AX_PKG_REQUIRE], [
 | 
				
			|||||||
          break;
 | 
					          break;
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
      done
 | 
					      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}
 | 
					    CPPFLAGS=${old_CPPFLAGS}
 | 
				
			||||||
  fi
 | 
					  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_CPPFLAGS+=" ${$1_CFLAGS}"
 | 
				
			||||||
  AM_CXXFLAGS+=" ${$1_CFLAGS}"
 | 
					  AM_CXXFLAGS+=" ${$1_CFLAGS}"
 | 
				
			||||||
  LIBS+=" ${$1_LIBS}"
 | 
					  LIBS+=" ${$1_LIBS}"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user