|
|
|
@ -373,68 +373,16 @@ EOF |
|
|
|
|
AC_DEFUN([AX_PKG_REQUIRE], [ |
|
|
|
|
PKG_PROG_PKG_CONFIG |
|
|
|
|
PKG_CHECK_MODULES([$1], [$2], [ |
|
|
|
|
if test -n "$3"; then |
|
|
|
|
$1_found=0; |
|
|
|
|
for p in ${$1_CFLAGS}; do |
|
|
|
|
if test -e ${p#-I}/$3; then |
|
|
|
|
$1_found=1 |
|
|
|
|
break |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
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 of $2 as ${$1_file}]) |
|
|
|
|
$1_CFLAGS="${$1_CFLAGS} -I${$1_file%/$3}" |
|
|
|
|
$1_found=1 |
|
|
|
|
break |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
fi |
|
|
|
|
if test ${$1_found} -eq 0; then |
|
|
|
|
AC_MSG_ERROR([Header file $3 not found in $2 with $1_CFLAGS = ${$1_CFLAGS}]) |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
AM_CPPFLAGS+=" ${$1_CFLAGS}" |
|
|
|
|
AM_CXXFLAGS+=" ${$1_CFLAGS}" |
|
|
|
|
LIBS+=" ${$1_LIBS}" |
|
|
|
|
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], [ |
|
|
|
|
if test -n "$3"; then |
|
|
|
|
$1_found=0; |
|
|
|
|
for p in ${$1_CFLAGS}; do |
|
|
|
|
if test -e ${p#-I}/$3; then |
|
|
|
|
$1_found=1 |
|
|
|
|
break |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
if test ${$1_found} -eq 0; then |
|
|
|
|
for p in /usr/include ${$1_CFLAGS}; do |
|
|
|
|
$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 of ${pkg} as ${$1_file}]) |
|
|
|
|
$1_CFLAGS="${$1_CFLAGS} -I${$1_file%/$3}" |
|
|
|
|
$1_found=1 |
|
|
|
|
break |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
fi |
|
|
|
|
if test ${$1_found} -eq 0; then |
|
|
|
|
AC_MSG_WARN([Header file $3 not found in ${pkg} with $1_CFLAGS = ${$1_CFLAGS}]) |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
AM_CPPFLAGS+=" ${$1_CFLAGS}" |
|
|
|
|
AM_CXXFLAGS+=" ${$1_CFLAGS}" |
|
|
|
|
LIBS+=" ${$1_LIBS}" |
|
|
|
|
PKG_REQUIREMENTS+=" $pkg" |
|
|
|
|
$1_found=1 |
|
|
|
|
break; |
|
|
|
|
], [ |
|
|
|
|
AC_MSG_WARN([Recommended package $pkg for feature $1 not installed]) |
|
|
|
|
]) |
|
|
|
@ -442,6 +390,8 @@ AC_DEFUN([AX_PKG_REQUIRE], [ |
|
|
|
|
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) |
|
|
|
@ -452,12 +402,30 @@ AC_DEFUN([AX_PKG_REQUIRE], [ |
|
|
|
|
CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}" |
|
|
|
|
AC_CHECK_HEADER([$3], [ |
|
|
|
|
], [ |
|
|
|
|
AC_MSG_ERROR([Required header $3 for feature $1 not found]) |
|
|
|
|
$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 |
|
|
|
|
if test -f "$f"; then |
|
|
|
|
$1_found=1 |
|
|
|
|
$1_CFLAGS+=" -I${f%/*}" |
|
|
|
|
AC_MSG_NOTICE([added path ${f%/*}]) |
|
|
|
|
break; |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
if test ${$1_found} -eq 1; then |
|
|
|
|
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} |
|
|
|
|
elif test ${$1_found} -eq 0; then |
|
|
|
|
AC_MSG_ERROR([Required package $2 for feature $1 not installed]) |
|
|
|
|
fi |
|
|
|
|
AM_CPPFLAGS+=" ${$1_CFLAGS}" |
|
|
|
|
AM_CXXFLAGS+=" ${$1_CFLAGS}" |
|
|
|
|
LIBS+=" ${$1_LIBS}" |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
# check if a specific package exists |
|
|
|
|