]> www.average.org Git - pam_pcsc_cr.git/blob - configure.ac
autoconf: update to newer autotools
[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.6])
4 AC_CONFIG_SRCDIR([pam_pcsc_cr.c])
5 AC_CONFIG_MACRO_DIR([m4])
6 AM_INIT_AUTOMAKE
7 AC_CONFIG_HEADERS([config.h])
8 AC_LANG([C])
9 AC_PROG_CC
10
11 if test "X$CC" = "Xgcc"; then
12   CFLAGS="$CFLAGS -Wall -fstack-protector-all -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"
13 fi
14 dnl make CFLAGS="-fsanitize=address -fno-omit-frame-pointer -g" LDFLAGS="-static-libasan"
15
16 AC_PROG_MAKE_SET
17 AC_SUBST(PROGS)dnl
18 AC_SUBST(LIBPROGS)dnl
19 AC_PROG_INSTALL
20 LT_INIT
21 PKG_PROG_PKG_CONFIG
22
23 AC_CHECK_HEADERS([security/pam_appl.h], [], [
24   AC_MSG_ERROR([[PAM headers not found]])
25 ])
26 AC_CHECK_HEADERS([security/pam_modules.h security/pam_ext.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_get_authtok])
32 pamdir=/lib/${host_cpu}-${host_os}/security
33 AC_ARG_WITH(pam-dir,
34         [  --with-pam-dir=DIR      path to install the PAM module (${pamdir})],
35         [PAMDIR="$withval"],
36         [
37 case $prefix in
38 */_inst) PAMDIR="${prefix}${pamdir}" ;;
39 *)       PAMDIR=${pamdir} ;;
40 esac
41 ])
42 AC_SUBST(PAMDIR)
43 AC_MSG_NOTICE([Installation target PAMDIR=${PAMDIR}])
44
45 PKG_CHECK_MODULES([PCSC], [libpcsclite])
46 CPPFLAGS="$PCSC_CFLAGS $CPPFLAGS"
47 LIBS="$PCSC_LIBS $LIBS"
48
49 AC_ARG_ENABLE(openssl,
50         [  --disable-openssl       do not use openssl even when it is present],
51         [], [enable_openssl=yes]
52 )
53 AS_IF([test "x$enable_openssl" = "xyes"], [
54   PKG_CHECK_MODULES([OPENSSL], [libcrypto], [], [:])
55 ])
56 AS_IF([test "x$OPENSSL_CFLAGS" != "x" -o "x$OPENSSL_LIBS" != "x" ], [
57   use_openssl=yes
58 ])
59 CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
60 LIBS="$OPENSSL_LIBS $LIBS"
61
62 AC_ARG_ENABLE(tomcrypt,
63         [  --enable-tomcrypt       use libtomcrypt even when openssl is present])
64
65 AS_IF([test "x$use_openssl" != "xyes" -o "x$enable_tomcrypt" = "xyes"], [
66   PKG_CHECK_MODULES([TOMCRYPT], [libtomcrypt], [], [:])
67 ])
68 AS_IF([test "x$TOMCRYPT_CFLAGS" != "x" -o "x$TOMCRYPT_LIBS" != "x" ], [
69   use_tomcrypt=yes
70 ])
71 CPPFLAGS="$TOMCRYPT_CFLAGS $CPPFLAGS"
72 LIBS="$TOMCRYPT_LIBS $LIBS"
73
74 AC_ARG_ENABLE(gcrypt,
75         [  --enable-gcrypt         use libgcrypt even when openssl or libtomcrypt
76                           is present])
77
78 AS_IF([test "x$use_openssl" != "xyes" && test "x$use_tomcrypt" != "xyes" || \
79         test "x$enable_tomcrypt" = "xyes"], [
80   AM_PATH_LIBGCRYPT()
81 ])
82 AS_IF([test "x$LIBGCRYPT_CFLAGS" != "x" -o "x$LIBGCRYPT_LIBS" != "x" ], [
83   use_gcrypt=yes
84 ])
85 CPPFLAGS="$LIBGCRYPT_CFLAGS $CPPFLAGS"
86 LIBS="$LIBGCRYPT_LIBS $LIBS"
87
88 AS_IF([test "x$use_openssl" != "xyes" -a "x$use_tomcrypt" != "xyes" -a "x$use_gcrypt" != "xyes"], [
89   AC_MSG_ERROR([[Neither openssl, tomcrypt or gcrypt libraries present]])
90 ])
91
92 AS_IF([test "x$use_openssl" = "xyes"], [
93   CRYPTO_OBJS+=" ossl_crypto.lo"
94   AC_DEFINE([HAVE_OPENSSL], [1], [Use openssl libcrypto])
95 ])
96 AS_IF([test "x$use_tomcrypt" = "xyes"], [
97   CRYPTO_OBJS+=" tom_crypto.lo"
98   AC_DEFINE([HAVE_TOMCRYPT], [1], [Use libtomcrypt])
99 ])
100 AS_IF([test "x$use_gcrypt" = "xyes"], [
101   CRYPTO_OBJS+=" gnu_crypto.lo"
102   AC_DEFINE([HAVE_GCRYPT], [1], [Use libgcrypt])
103 ])
104 AC_SUBST(CRYPTO_OBJS)
105
106 dnl Checks for header files.
107
108 AC_CHECK_HEADERS([winscard.h reader.h], [],
109   [AC_MSG_ERROR([[pcsclite headers not found]])])
110 AC_CHECK_LIB([pcsclite], [SCardEstablishContext], [],
111   [AC_MSG_ERROR([[pcsclite library not useable]])])
112
113 AC_CONFIG_FILES([Makefile])
114 AC_OUTPUT