much more flexible and stable package dependency checks

master
Marc Wäckerlin 10 years ago
parent 6d7f5c80fb
commit 59ec792c2c
  1. 68
      ax_init_standard_project.m4
  2. 27
      configure.ac

@ -298,15 +298,79 @@ EOF
AC_DEFUN([AX_PKG_REQUIRE], [ AC_DEFUN([AX_PKG_REQUIRE], [
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([$1], [$1], [ 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; then
for p in /usr/include ${$1_CFLAGS}; do
$1_file=$(find ${p#-I} -name $3)
if test -e ${$1_file}; then
$1_CFLAGS="${$1_CFLAGS} -I${$1_file%/*}"
$1_found=1
break
fi
done
fi
if test ${$1_found} -eq 0; then
AC_MSG_WARN([Header file $3 not found in $1_CFLAGS = ${$1_CFLAGS}])
fi
fi
AM_CPPFLAGS+=" ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}"
], [
AC_MSG_WARN([Recommended package $2 for feature $1 not installed])
if test -n "$4"; then
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 $3)
if test -e ${$1_file}; then
$1_CFLAGS="${$1_CFLAGS} -I${$1_file%/*}"
$1_found=1
break
fi
done
fi
if test ${$1_found} -eq 0; then
AC_MSG_WARN([Header file $3 not found in $1_CFLAGS = ${$1_CFLAGS}])
fi
fi
AM_CPPFLAGS+=" ${$1_CFLAGS}" AM_CPPFLAGS+=" ${$1_CFLAGS}"
AM_CXXFLAGS+=" ${$1_CFLAGS}" AM_CXXFLAGS+=" ${$1_CFLAGS}"
LIBS+=" ${$1_LIBS}" LIBS+=" ${$1_LIBS}"
], [ ], [
AC_MSG_ERROR([Required package $1 not found]) AC_MSG_WARN([Recommended package $pkg for feature $1 not installed])
])
done
fi
]) ])
AC_SUBST(AM_CPPFLAGS) AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CXXFLAGS)
if test -n "$3"; then
old_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}"
AC_CHECK_HEADER([$3], [
], [
AC_MSG_ERROR([Required header $3 for feature $1 not found])
])
CPPFLAGS=${old_CPPFLAGS}
fi
]) ])
AC_DEFUN([AX_PKG_CHECK], [ AC_DEFUN([AX_PKG_CHECK], [

@ -17,17 +17,7 @@ AX_USE_RPM_PACKAGING
#AX_USE_CPPUNIT #AX_USE_CPPUNIT
AX_BUILD_EXAMPLES AX_BUILD_EXAMPLES
# qt features # special optional library download
AX_CHECK_QT([QTGUI], [QtCore QtGui], [QtWidgets])
AX_CHECK_QT([QTNETWORK], [QtNetwork])
CPPFLAGS="${CPPFLAGS} -DQT_NO_KEYWORDS"
# libraries used
AX_PKG_REQUIRE([libpcsclite])
AX_PKG_REQUIRE([libssl])
#AX_PKG_REQUIRE([libmrw-c++])
# libraries
AC_ARG_ENABLE(pkcs11-download, AC_ARG_ENABLE(pkcs11-download,
[AS_HELP_STRING([--enable-pkcs11-download], [AS_HELP_STRING([--enable-pkcs11-download],
[download pkcs11 header])], [download pkcs11 header])],
@ -42,10 +32,17 @@ AC_ARG_ENABLE(pkcs11-download,
cd - cd -
fi fi
]) ])
dnl problem in libs: -Wshadow -Wcast-qual
dnl auto.hpp: -Wno-ctor-dtor-privacy (removed) # qt features
AC_CHECK_HEADER([pkcs11.h], [], [AC_MSG_ERROR([Header pkcs11.h is required])]) AX_CHECK_QT([QTGUI], [QtCore QtGui], [QtWidgets])
AC_CHECK_HEADER([mrw/checkcxx11.hxx], [], [AC_MSG_ERROR([please install mrw-c++])]) AX_CHECK_QT([QTNETWORK], [QtNetwork])
CPPFLAGS="${CPPFLAGS} -DQT_NO_KEYWORDS"
# libraries used
AX_PKG_REQUIRE([pcsc], [libpcsclite], [pcsclite.h])
AX_PKG_REQUIRE([ssl], [libssl], [openssl/crypto.h])
AX_PKG_REQUIRE([mrwcxx], [mrw-c++])
AX_PKG_REQUIRE([pkcs11], [p11-kit-1], [pkcs11.h], [gnutls libpkcs11-helper-1])
# create output # create output
AC_OUTPUT AC_OUTPUT

Loading…
Cancel
Save