-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathconfigure.ac
166 lines (137 loc) · 3.66 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
AC_PREREQ([2.69])
define([PACKAGE_VERSION_MAJOR], [0])
define([PACKAGE_VERSION_MINOR], [6])
define([PACKAGE_VERSION_FIX], [0])
define([PACKAGE_SUFFIX], [])
define([PRODUCT_BUGREPORT], [https://github.com/OpenSC/pam_p11/issues])
AC_INIT([pam_p11],[PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX[]PACKAGE_SUFFIX],[PRODUCT_BUGREPORT])
AC_CONFIG_AUX_DIR([.])
AM_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/pam_p11.c])
AC_CANONICAL_HOST
AC_PROG_CC
PKG_PROG_PKG_CONFIG
AC_C_BIGENDIAN
AC_ARG_ENABLE(
[strict],
[AS_HELP_STRING([--disable-strict],[disable strict compile mode @<:@enabled@:>@])],
,
[enable_strict="yes"]
)
AC_ARG_ENABLE(
[pedantic],
[AS_HELP_STRING([--enable-pedantic],[enable pedantic compile mode @<:@disabled@:>@])],
,
[enable_pedantic="no"]
)
AC_ARG_WITH(
[pamdir],
[AS_HELP_STRING([--with-pamdir=PATH],[Specify the directory where PAM modules are stored])],
[pamdir="${withval}"],
[
if test "${prefix}" = "/usr"; then
pamdir="/lib${libdir##*/lib}/security"
else
pamdir="\$(libdir)/security"
fi
]
)
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.18.3)
dnl Add the languages which your application supports here.
ALL_LINGUAS="de it ru ja"
dnl Checks for programs.
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_SED
AC_PROG_MAKE_SET
dnl Add libtool support.
ifdef(
[LT_INIT],
[LT_INIT],
[AC_PROG_LIBTOOL]
)
PKG_CHECK_MODULES([LIBP11], [libp11 >= 0.2.4],, [AC_MSG_ERROR([libp11 is required])])
PKG_CHECK_MODULES(
[OPENSSL],
[libcrypto >= 1.1.1],
,
[PKG_CHECK_MODULES(
[OPENSSL],
[openssl >= 1.1.1],
,
[AC_CHECK_LIB(
[crypto],
[RSA_version],
[OPENSSL_LIBS="-lcrypto"],
[AC_MSG_ERROR([Cannot find OpenSSL])]
)]
)]
)
#saved_LIBS="$LIBS"
#LIBS="$OPENSSL_LIBS $LIBS"
#AC_CHECK_FUNCS(EVP_MD_CTX_new EVP_MD_CTX_free EVP_MD_CTX_reset)
#LIBS="$saved_LIBS"
if test -z "${PAM_LIBS}"; then
AC_ARG_VAR([PAM_CFLAGS], [C compiler flags for pam])
AC_ARG_VAR([PAM_LIBS], [linker flags for pam])
AC_CHECK_LIB(
[pam],
[pam_authenticate],
[PAM_LIBS="-lpam"],
[AC_MSG_ERROR([Cannot find pam])]
)
fi
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS} ${LIBP11_CFLAGS} ${PAM_CFLAGS}"
LIBS="$LIBS ${OPENSSL_LIBS} ${LIBP11_LIBS} ${PAM_LIBS}"
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([ \
string.h syslog.h fcntl.h unistd.h security/pam_ext.h security/pam_misc.h \
])
AC_TYPE_SIZE_T
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memset strdup strerror PKCS11_enumerate_public_keys PKCS11_is_logged_in pam_vprompt openpam_ttyconv])
AC_CHECK_LIB([pam_misc], [misc_conv])
AM_CONDITIONAL([HAVE_PAM_MISC], [test "$ac_cv_lib_pam_misc_misc_conv" = yes])
CFLAGS="${saved_CFLAGS}"
LIBS="$saved_LIBS"
AC_SUBST([pamdir])
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes";
CFLAGS="${CFLAGS} -pedantic"
fi
if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wextra -Wno-unused-parameter -Werror"
fi
AC_CONFIG_FILES([
Makefile
src/Makefile
po/Makefile.in
])
AC_OUTPUT
cat <<EOF
pam_p11 has been configured with the following options:
Version: ${PACKAGE_VERSION}
Libraries: $(eval eval eval echo "${libdir}")
Host: ${host}
Compiler: ${CC}
Preprocessor flags: ${CPPFLAGS}
Compiler flags: ${CFLAGS}
Linker flags: ${LDFLAGS}
Libraries: ${LIBS}
pamdir ${pamdir}
PAM_CFLAGS: ${PAM_CFLAGS}
PAM_LIBS: ${PAM_LIBS}
LIBP11_CFLAGS: ${LIBP11_CFLAGS}
LIBP11_LIBS: ${LIBP11_LIBS}
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
OPENSSL_LIBS: ${OPENSSL_LIBS}
EOF