improved check for required packages

master
Marc Wäckerlin 10 years ago
parent 8676b818d7
commit 4464c85eae
  1. 28
      ax_init_standard_project.m4

@ -242,7 +242,7 @@ EOF
# use this in configure.ac to support C++ libraries
AC_DEFUN([AX_USE_LIBTOOL], [
# libtool versioning
LIB_MAJOR=m4_eval(x_major+x_minor)
LIB_MAJOR=m4_eval(x_major+x_minor_fixed)
LIB_MINOR=x_least
LIB_LEAST=x_minor_fixed
LIB_VERSION="${LIB_MAJOR}:${LIB_MINOR}:${LIB_LEAST}"
@ -381,11 +381,14 @@ AC_DEFUN([AX_PKG_REQUIRE], [
break
fi
done
if test ${$1_found} -eq 0; then
for p in /usr/include ${$1_CFLAGS}; do
$1_file=$(find ${p#-I} -name $3)
if test ${$1_found} -eq 0 -a -n "$3"; then
for p in "/usr/include" ${$1_CFLAGS}; do
AC_MSG_NOTICE([checking: [${p}] with [${p#-I}]])
$1_file=$(find ${p#-I} -name $(echo "$3" | sed 's,.*/,,') | grep "$3" | head -1)
AC_MSG_NOTICE([call: $1_file=[\$](find [$]{p[#]-I} -name "$3")])
AC_MSG_NOTICE([found: ${$1_file}])
if test -e "${$1_file}"; then
AC_MSG_NOTICE([Header file $3 found in sub path as ${$1_file}])
AC_MSG_NOTICE([Header file $3 found in sub path of $2 as ${$1_file}])
$1_CFLAGS="${$1_CFLAGS} -I${$1_file%/$3}"
$1_found=1
break
@ -393,7 +396,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [
done
fi
if test ${$1_found} -eq 0; then
AC_MSG_WARN([Header file $3 not found in $1_CFLAGS = ${$1_CFLAGS}])
AC_MSG_ERROR([Header file $3 not found in $2 with $1_CFLAGS = ${$1_CFLAGS}])
fi
fi
AM_CPPFLAGS+=" ${$1_CFLAGS}"
@ -401,8 +404,8 @@ AC_DEFUN([AX_PKG_REQUIRE], [
LIBS+=" ${$1_LIBS}"
PKG_REQUIREMENTS+=" $2"
], [
AC_MSG_WARN([Recommended package $2 for feature $1 not installed])
if test -n "$4"; then
AC_MSG_WARN([Recommended package $2 for feature $1 not installed, trying $4])
for pkg in $4; do
PKG_CHECK_MODULES([$1], [$pkg], [
if test -n "$3"; then
@ -415,9 +418,9 @@ AC_DEFUN([AX_PKG_REQUIRE], [
done
if test ${$1_found} -eq 0; then
for p in /usr/include ${$1_CFLAGS}; do
$1_file=$(find ${p#-I} -name $3)
$1_file=$(find ${p#-I} -name $(echo "$3" | sed 's,.*/,,') | grep "$3" | head -1)
if test -e ${$1_file}; then
AC_MSG_NOTICE([Header file $3 found in sub path as ${$1_file}])
AC_MSG_NOTICE([Header file $3 found in sub path of ${pkg} as ${$1_file}])
$1_CFLAGS="${$1_CFLAGS} -I${$1_file%/$3}"
$1_found=1
break
@ -425,7 +428,7 @@ AC_DEFUN([AX_PKG_REQUIRE], [
done
fi
if test ${$1_found} -eq 0; then
AC_MSG_WARN([Header file $3 not found in $1_CFLAGS = ${$1_CFLAGS}])
AC_MSG_WARN([Header file $3 not found in ${pkg} with $1_CFLAGS = ${$1_CFLAGS}])
fi
fi
AM_CPPFLAGS+=" ${$1_CFLAGS}"
@ -436,6 +439,11 @@ 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)

Loading…
Cancel
Save