diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index 26735b3..9fdc7dd 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -298,15 +298,79 @@ EOF AC_DEFUN([AX_PKG_REQUIRE], [ 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_ERROR([Required package $1 not found]) + 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_CXXFLAGS+=" ${$1_CFLAGS}" + LIBS+=" ${$1_LIBS}" + ], [ + AC_MSG_WARN([Recommended package $pkg for feature $1 not installed]) + ]) + done + fi ]) AC_SUBST(AM_CPPFLAGS) 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], [ diff --git a/configure.ac b/configure.ac index dd41277..8994caf 100644 --- a/configure.ac +++ b/configure.ac @@ -17,17 +17,7 @@ AX_USE_RPM_PACKAGING #AX_USE_CPPUNIT AX_BUILD_EXAMPLES -# qt features -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 +# special optional library download AC_ARG_ENABLE(pkcs11-download, [AS_HELP_STRING([--enable-pkcs11-download], [download pkcs11 header])], @@ -42,10 +32,17 @@ AC_ARG_ENABLE(pkcs11-download, cd - fi ]) -dnl problem in libs: -Wshadow -Wcast-qual -dnl auto.hpp: -Wno-ctor-dtor-privacy (removed) -AC_CHECK_HEADER([pkcs11.h], [], [AC_MSG_ERROR([Header pkcs11.h is required])]) -AC_CHECK_HEADER([mrw/checkcxx11.hxx], [], [AC_MSG_ERROR([please install mrw-c++])]) + +# qt features +AX_CHECK_QT([QTGUI], [QtCore QtGui], [QtWidgets]) +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 AC_OUTPUT