wip on struct authobj interface
[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.0.1)
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 PKG_CHECK_MODULES([PCSC], [libpcsclite])
23 AC_ARG_WITH(pcsclite-include-path,
24         [  --with-pcsclite-include-path=PATH path to pcsclite includes],
25         [PCSC_CFLAGS="-I $withval"],
26         [])
27 AC_ARG_WITH(pcsclite-lib-path,
28         [  --with-pcsclite-lib-path=PATH path to pcsclite libs],
29         [PCSC_LIBS="-L $withval -lpcsclite"],
30         [])
31
32 CPPFLAGS="$PCSC_CFLAGS $CPPFLAGS"
33 LIBS="$PCSC_LIBS $LIBS"
34
35 PKG_CHECK_MODULES([OPENSSL], [libcrypto], [], [:])
36 AC_ARG_WITH(openssl-include-path,
37         [  --with-openssl-include-path=PATH path to openssl includes],
38         [OPENSSL_CFLAGS="-I $withval"],
39         [])
40 AC_ARG_WITH(openssl-lib-path,
41         [  --with-openssl-lib-path=PATH path to openssl libs],
42         [OPENSSL_LIBS="-L $withval -lcrypto"],
43         [])
44 AS_IF([test "x$OPENSSL_CFLAGS" != "x" -o "x$OPENSSL_LIBS" != "x" ], [
45   use_openssl=yes
46 ])
47 CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
48 LIBS="$OPENSSL_LIBS $LIBS"
49
50 AC_ARG_ENABLE(tomcrypt,
51         [  --enable-tomcrypt       use libtomcrypt even when openssl present])
52
53 AS_IF([test "x$use_openssl" != "xyes" -o "x$enable_tomcrypt" = "xyes"], [
54   PKG_CHECK_MODULES([TOMCRYPT], [libtomcrypt], [], [:])
55 ])
56 AC_ARG_WITH(libtomcrypt-include-path,
57         [  --with-libtomcrypt-include-path=PATH path to libtomcrypt includes],
58         [TOMCRYPT_CFLAGS="-I $withval"],
59         [])
60 AC_ARG_WITH(libtomcrypt-lib-path,
61         [  --with-libtomcrypt-lib-path=PATH path to libtomcrypt libs],
62         [TOMCRYPT_LIBS="-L $withval -ltomcrypt"],
63         [])
64 AS_IF([test "x$TOMCRYPT_CFLAGS" != "x" -o "x$TOMCRYPT_LIBS" != "x" ], [
65   use_tomcrypt=yes
66 ])
67 CPPFLAGS="$TOMCRYPT_CFLAGS $CPPFLAGS"
68 LIBS="$TOMCRYPT_LIBS $LIBS"
69
70 AC_ARG_ENABLE(gcrypt,
71         [  --enable-gcrypt         use libgcrypt even when openssl present])
72
73 AS_IF([test "x$use_openssl" != "xyes" && test "x$use_tomcrypt" != "xyes" || \
74         test "x$enable_tomcrypt" = "xyes"], [
75   AM_PATH_LIBGCRYPT()
76 ])
77 AC_ARG_WITH(libgcrypt-include-path,
78         [  --with-libgcrypt-include-path=PATH path to libgcrypt includes],
79         [LIBGCRYPT_CFLAGS="-I $withval"],
80         [])
81 AC_ARG_WITH(libgcrypt-lib-path,
82         [  --with-libgcrypt-lib-path=PATH path to libgcrypt libs],
83         [LIBGCRYPT_LIBS="-L $withval -lgcrypt"],
84         [])
85 AS_IF([test "x$LIBGCRYPT_CFLAGS" != "x" -o "x$LIBGCRYPT_LIBS" != "x" ], [
86   use_gcrypt=yes
87 ])
88 CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
89 LIBS="$LIBGCRYPT_LIBS $LIBS"
90
91 AS_IF([test "x$use_openssl" != "xyes" -a "x$use_tomcrypt" != "xyes" -a "x$use_gcrypt" != "xyes"], [
92   AC_MSG_ERROR([[Neither openssl, tomcrypt or gcrypt libraries present]])
93 ])
94
95 AS_IF([test "x$use_openssl" = "xyes"], [
96   CRYPTO_OBJS+=" ossl_crypto.lo"
97   AC_DEFINE([HAVE_OPENSSL], [1], [Use openssl libcrypto])
98 ])
99 AS_IF([test "x$use_tomcrypt" = "xyes"], [
100   CRYPTO_OBJS+=" tom_crypto.lo"
101   AC_DEFINE([HAVE_TOMCRYPT], [1], [Use libtomcrypt])
102 ])
103 AS_IF([test "x$use_gcrypt" = "xyes"], [
104   CRYPTO_OBJS+=" gnu_crypto.lo"
105   AC_DEFINE([HAVE_GCRYPT], [1], [Use libgcrypt])
106 ])
107 AC_SUBST(CRYPTO_OBJS)
108
109 dnl Checks for header files.
110 AC_HEADER_STDC
111 AC_HEADER_TIME
112
113 AC_CHECK_HEADERS([winscard.h reader.h], [],
114   [AC_MSG_ERROR([[pcsclite headers not found]])])
115 AC_CHECK_LIB([pcsclite], [SCardEstablishContext], [],
116   [AC_MSG_ERROR([[pcsclite library not useable]])])
117
118 AC_CONFIG_FILES([Makefile])
119 AC_OUTPUT