]> www.average.org Git - pam_pcsc_cr.git/blob - configure.ac
openssl: make it use 'shortcut' function HMAC()
[pam_pcsc_cr.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT([pam_pcsc_cr], 0.9.5)
4 AC_CONFIG_SRCDIR([pam_pcsc_cr.c])
5 AC_CONFIG_MACRO_DIR([m4])
6 AM_INIT_AUTOMAKE
7 AM_CONFIG_HEADER([config.h])
8 AC_LANG_C
9 AC_PROG_CC
10
11 if test "X$CC" = "Xgcc"; then
12   CFLAGS="$CFLAGS -Wall"
13 fi
14
15 AC_PROG_MAKE_SET
16 AC_SUBST(PROGS)dnl
17 AC_SUBST(LIBPROGS)dnl
18 AC_PROG_INSTALL
19 AM_PROG_LIBTOOL
20 PKG_PROG_PKG_CONFIG
21
22 AC_CHECK_HEADERS([security/pam_appl.h], [], [
23   AC_MSG_ERROR([[PAM headers not found]])
24 ])
25 AC_CHECK_HEADERS([security/pam_modules.h security/pam_ext.h], [], [], [
26 #include <sys/types.h>
27 #include <security/pam_appl.h>
28 ])
29 AC_CHECK_LIB([pam], [pam_start])
30 AC_CHECK_FUNCS([pam_get_authtok])
31 pamdir=/lib/${host_cpu}-${host_os}/security
32 AC_ARG_WITH(pam-dir,
33         [  --with-pam-dir=DIR      path to install the PAM module (${pamdir})],
34         [PAMDIR="$withval"],
35         [
36 case $prefix in
37 */_inst) PAMDIR="${prefix}${pamdir}" ;;
38 *)       PAMDIR=${pamdir} ;;
39 esac
40 ])
41 AC_SUBST(PAMDIR)
42 AC_MSG_NOTICE([Installation target PAMDIR=${PAMDIR}])
43
44 PKG_CHECK_MODULES([PCSC], [libpcsclite])
45 CPPFLAGS="$PCSC_CFLAGS $CPPFLAGS"
46 LIBS="$PCSC_LIBS $LIBS"
47
48 AC_ARG_ENABLE(openssl,
49         [  --disable-openssl       do not use openssl even when it is present],
50         [], [enable_openssl=yes]
51 )
52 AS_IF([test "x$enable_openssl" = "xyes"], [
53   PKG_CHECK_MODULES([OPENSSL], [libcrypto], [], [:])
54 ])
55 AS_IF([test "x$OPENSSL_CFLAGS" != "x" -o "x$OPENSSL_LIBS" != "x" ], [
56   use_openssl=yes
57 ])
58 CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
59 LIBS="$OPENSSL_LIBS $LIBS"
60
61 AC_ARG_ENABLE(tomcrypt,
62         [  --enable-tomcrypt       use libtomcrypt even when openssl is present])
63
64 AS_IF([test "x$use_openssl" != "xyes" -o "x$enable_tomcrypt" = "xyes"], [
65   PKG_CHECK_MODULES([TOMCRYPT], [libtomcrypt], [], [:])
66 ])
67 AS_IF([test "x$TOMCRYPT_CFLAGS" != "x" -o "x$TOMCRYPT_LIBS" != "x" ], [
68   use_tomcrypt=yes
69 ])
70 CPPFLAGS="$TOMCRYPT_CFLAGS $CPPFLAGS"
71 LIBS="$TOMCRYPT_LIBS $LIBS"
72
73 AC_ARG_ENABLE(gcrypt,
74         [  --enable-gcrypt         use libgcrypt even when openssl or libtomcrypt
75                           is present])
76
77 AS_IF([test "x$use_openssl" != "xyes" && test "x$use_tomcrypt" != "xyes" || \
78         test "x$enable_tomcrypt" = "xyes"], [
79   AM_PATH_LIBGCRYPT()
80 ])
81 AS_IF([test "x$LIBGCRYPT_CFLAGS" != "x" -o "x$LIBGCRYPT_LIBS" != "x" ], [
82   use_gcrypt=yes
83 ])
84 CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
85 LIBS="$LIBGCRYPT_LIBS $LIBS"
86
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]])
89 ])
90
91 AS_IF([test "x$use_openssl" = "xyes"], [
92   CRYPTO_OBJS+=" ossl_crypto.lo"
93   AC_DEFINE([HAVE_OPENSSL], [1], [Use openssl libcrypto])
94 ])
95 AS_IF([test "x$use_tomcrypt" = "xyes"], [
96   CRYPTO_OBJS+=" tom_crypto.lo"
97   AC_DEFINE([HAVE_TOMCRYPT], [1], [Use libtomcrypt])
98 ])
99 AS_IF([test "x$use_gcrypt" = "xyes"], [
100   CRYPTO_OBJS+=" gnu_crypto.lo"
101   AC_DEFINE([HAVE_GCRYPT], [1], [Use libgcrypt])
102 ])
103 AC_SUBST(CRYPTO_OBJS)
104
105 dnl Checks for header files.
106 AC_HEADER_STDC
107 AC_HEADER_TIME
108
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]])])
113
114 AC_CONFIG_FILES([Makefile])
115 AC_OUTPUT