1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([pam_pcsc_cr], 0.9.5)
4 AC_CONFIG_SRCDIR([pam_pcsc_cr.c])
5 AC_CONFIG_MACRO_DIR([m4])
7 AM_CONFIG_HEADER([config.h])
11 if test "X$CC" = "Xgcc"; then
12 CFLAGS="$CFLAGS -Wall"
22 AC_CHECK_HEADERS([security/pam_appl.h], [], [
23 AC_MSG_ERROR([[PAM headers not found]])
25 AC_CHECK_HEADERS([security/pam_modules.h security/pam_ext.h], [], [], [
26 #include <sys/types.h>
27 #include <security/pam_appl.h>
29 AC_CHECK_LIB([pam], [pam_start])
30 AC_CHECK_FUNCS([pam_get_authtok])
31 pamdir=/lib/${host_cpu}-${host_os}/security
33 [ --with-pam-dir=DIR path to install the PAM module (${pamdir})],
37 */_inst) PAMDIR="${prefix}${pamdir}" ;;
38 *) PAMDIR=${pamdir} ;;
42 AC_MSG_NOTICE([Installation target PAMDIR=${PAMDIR}])
44 PKG_CHECK_MODULES([PCSC], [libpcsclite])
45 CPPFLAGS="$PCSC_CFLAGS $CPPFLAGS"
46 LIBS="$PCSC_LIBS $LIBS"
48 AC_ARG_ENABLE(openssl,
49 [ --disable-openssl do not use openssl even when it is present],
50 [], [enable_openssl=yes]
52 AS_IF([test "x$enable_openssl" = "xyes"], [
53 PKG_CHECK_MODULES([OPENSSL], [libcrypto], [], [:])
55 AS_IF([test "x$OPENSSL_CFLAGS" != "x" -o "x$OPENSSL_LIBS" != "x" ], [
58 CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
59 LIBS="$OPENSSL_LIBS $LIBS"
61 AC_ARG_ENABLE(tomcrypt,
62 [ --enable-tomcrypt use libtomcrypt even when openssl is present])
64 AS_IF([test "x$use_openssl" != "xyes" -o "x$enable_tomcrypt" = "xyes"], [
65 PKG_CHECK_MODULES([TOMCRYPT], [libtomcrypt], [], [:])
67 AS_IF([test "x$TOMCRYPT_CFLAGS" != "x" -o "x$TOMCRYPT_LIBS" != "x" ], [
70 CPPFLAGS="$TOMCRYPT_CFLAGS $CPPFLAGS"
71 LIBS="$TOMCRYPT_LIBS $LIBS"
74 [ --enable-gcrypt use libgcrypt even when openssl or libtomcrypt
77 AS_IF([test "x$use_openssl" != "xyes" && test "x$use_tomcrypt" != "xyes" || \
78 test "x$enable_tomcrypt" = "xyes"], [
81 AS_IF([test "x$LIBGCRYPT_CFLAGS" != "x" -o "x$LIBGCRYPT_LIBS" != "x" ], [
84 CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
85 LIBS="$LIBGCRYPT_LIBS $LIBS"
87 AS_IF([test "x$use_openssl" != "xyes" -a "x$use_tomcrypt" != "xyes" -a "x$use_gcrypt" != "xyes"], [
88 AC_MSG_ERROR([[Neither openssl, tomcrypt or gcrypt libraries present]])
91 AS_IF([test "x$use_openssl" = "xyes"], [
92 CRYPTO_OBJS+=" ossl_crypto.lo"
93 AC_DEFINE([HAVE_OPENSSL], [1], [Use openssl libcrypto])
95 AS_IF([test "x$use_tomcrypt" = "xyes"], [
96 CRYPTO_OBJS+=" tom_crypto.lo"
97 AC_DEFINE([HAVE_TOMCRYPT], [1], [Use libtomcrypt])
99 AS_IF([test "x$use_gcrypt" = "xyes"], [
100 CRYPTO_OBJS+=" gnu_crypto.lo"
101 AC_DEFINE([HAVE_GCRYPT], [1], [Use libgcrypt])
103 AC_SUBST(CRYPTO_OBJS)
105 dnl Checks for header files.
109 AC_CHECK_HEADERS([winscard.h reader.h], [],
110 [AC_MSG_ERROR([[pcsclite headers not found]])])
111 AC_CHECK_LIB([pcsclite], [SCardEstablishContext], [],
112 [AC_MSG_ERROR([[pcsclite library not useable]])])
114 AC_CONFIG_FILES([Makefile])