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