# $Id$
m4_define(x_package_name, libpcscxx)
m4_define(x_major, 3)
m4_define(x_minor, 4)
m4_include(ax_init_standard_project.m4)
AC_INIT(x_package_name, x_version, x_bugreport, x_package_name)
AM_INIT_AUTOMAKE([1.9 tar-pax])
AX_INIT_STANDARD_PROJECT
# languages
AX_USE_CXX
AX_USE_LIBTOOL
AX_USE_DOXYGEN
AX_USE_DEBIAN_PACKAGING
AX_USE_RPM_PACKAGING
#AX_USE_CPPUNIT
AX_BUILD_EXAMPLES
# special optional library download
AC_ARG_ENABLE(pkcs11-download,
[AS_HELP_STRING([--enable-pkcs11-download],
[download pkcs11 header])],
[download_pkcs11="$enableval"],
[if test -z "$MINGW"; then download_pkcs11="no"; else download_pkcs11="yes"; fi])
if test "$download_pkcs11" != "no"; then
AC_MSG_NOTICE([downloading pkcs11 library headers])
test -d ${prefix}/include || mkdir -p ${prefix}/include
cd ${prefix}/include
for f in $(wget -qO- ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/ 2>&1 | html2 | sed -n 's,.*/a/@href=\(.*\.h\)$,\1,gp'); do
if test -f "${f##*/}"; then
rm "${f##*/}"
fi
wget --unlink $f
if ! test -f "${f##*/}"; then
AC_MSG_ERROR([download failed of pkcs11 header file: $f])
fi
done
if ! test -f cryptoki.h; then
AC_MSG_ERROR([download failed of pkcs11 headers - have you installed xml2?])
fi
AM_CPPFLAGS+=" -I$(pwd)"
cd -
fi
# qt features
AX_CHECK_QT([QTGUI], [QtCore QtGui], [QtWidgets])
AX_CHECK_QT([QTNETWORK], [Qt5Network >= 5.2])
CPPFLAGS="${CPPFLAGS} -DQT_NO_KEYWORDS"
# libraries used
if test -z "$MINGW"; then
AX_PKG_REQUIRE([pcsc], [libpcsclite], [pcsclite.h], [], [], [DEV_DIST_PKG=libpcsclite;DEV_RPM_DIST_PKG=pcsc-lite-devel])
AX_PKG_REQUIRE([pkcs11], [p11-kit-1], [pkcs11.h], [p11-kit libpkcs11-helper-1 libp11], [], [DEV_DIST_PKG=pkcs11-helper;DEV_DEB_DIST_PKG=libpkcs11-helper1-dev])
AX_PKG_REQUIRE([ssl], [libssl], [openssl/crypto.h], [openssl], [], [DEV_RPM_DIST_PKG=libopenssl-devel])
AX_PKG_REQUIRE([crypto], [libcrypto], [openssl/crypto.h], [openssl], [], [DEV_DIST_PKG=libssl;DEV_RPM_DIST_PKG=libopenssl-devel])
else
LDFLAGS+=" -lwinscard -lssl -lcrypto"
fi
AX_PKG_REQUIRE([mrwcxx], [mrw-c++], [mrw/checkcxx11.hxx])
# create output
AX_OUTPUT
if test "${HAVE_QTGUI}" -ne 1; then
AC_MSG_WARN([QtGui not found, ${HAVE_QTGUI} Qt GUI features disabled])
fi
if test "${HAVE_QTNETWORK}" -ne 1; then
AC_MSG_WARN([QtNetwork5 not found, ${HAVE_QTNETWORK} Qt Network features disabled])
fi