forked from OpenSC/engine_pkcs11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
226 lines (195 loc) · 5.33 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
AC_PREREQ(2.60)
define([PACKAGE_VERSION_MAJOR], [0])
define([PACKAGE_VERSION_MINOR], [2])
define([PACKAGE_VERSION_FIX], [1])
define([PACKAGE_SUFFIX], [_git])
AC_INIT([engine_pkcs11],[PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX[]PACKAGE_SUFFIX])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
ENGINE_PKCS11_VERSION_MAJOR="PACKAGE_VERSION_MAJOR"
ENGINE_PKCS11_VERSION_MINOR="PACKAGE_VERSION_MINOR"
ENGINE_PKCS11_VERSION_FIX="PACKAGE_VERSION_FIX"
AC_CONFIG_SRCDIR([src/engine_pkcs11.c])
# silent build by default
ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CANONICAL_HOST
AC_PROG_CC
PKG_PROG_PKG_CONFIG
AC_C_BIGENDIAN
AC_ARG_WITH(
[cygwin-native],
[AS_HELP_STRING([--with-cygwin-native],[compile native win32])],
,
[with_cygwin_native="no"]
)
dnl Check for some target-specific stuff
test -z "${WIN32}" && WIN32="no"
test -z "${CYGWIN}" && CYGWIN="no"
case "${host}" in
*-mingw*|*-winnt*)
WIN32="yes"
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
WIN_LIBPREFIX="lib"
;;
*-cygwin*)
AC_MSG_CHECKING([cygwin mode to use])
CYGWIN="yes"
if test "${with_cygwin_native}" = "yes"; then
AC_MSG_RESULT([Using native win32])
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
CFLAGS="${CFLAGS} -mno-cygwin"
WIN32="yes"
else
AC_MSG_RESULT([Using cygwin])
CPPFLAGS="${CPPFLAGS} -DCRYPTOKI_FORCE_WIN32"
WIN_LIBPREFIX="cyg"
AC_DEFINE([USE_CYGWIN], [1], [Define if you are on Cygwin.])
fi
;;
esac
AC_ARG_ENABLE(
[strict],
[AS_HELP_STRING([--enable-strict],[enable strict compile mode @<:@disabled@:>@])],
,
[enable_strict="no"]
)
AC_ARG_ENABLE(
[pedantic],
[AS_HELP_STRING([--enable-pedantic],[enable pedantic compile mode @<:@disabled@:>@])],
,
[enable_pedantic="no"]
)
AC_ARG_WITH(
[enginesdir],
[AS_HELP_STRING([--with-enginesdir], [OpenSSL engines directory])],
[enginesdir="${withval}"],
[
libcryptodir="`$PKG_CONFIG --variable=libdir --silence-errors libcrypto || \
$PKG_CONFIG --variable=libdir openssl`"
case "`$PKG_CONFIG --modversion --silence-errors libcrypto || \
$PKG_CONFIG --modversion openssl`" in
1.1.*) # Predicted engines directory prefix for OpenSSL 1.1.x
debian_ssl_prefix="openssl-1.1.0";;
1.0.*) # Engines directory prefix for OpenSSL 1.0.x
debian_ssl_prefix="openssl-1.0.0";;
*) # Engines directory prefix for OpenSSL 0.9.x
debian_ssl_prefix="ssl";;
esac
if test -d "$libcryptodir/$debian_ssl_prefix/engines"; then
# Debian-based OpenSSL package (for example Ubuntu)
enginesdir="$libcryptodir/$debian_ssl_prefix/engines"
else # Default OpenSSL engines directory
enginesdir="$libcryptodir/engines"
fi
if test "${prefix}" != "NONE" -o "${exec_prefix}" != "NONE"; then
# Override the autodetected value with the default
enginesdir="${libdir}"
fi
]
)
AC_ARG_WITH(
[pkcs11-module],
[AS_HELP_STRING([--with-pkcs11-module], [default PKCS11 module])],
[pkcs11_module="${withval}"],
[pkcs11_module="`$PKG_CONFIG --variable=proxy_module --silence-errors p11-kit-1`"])
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([win32-dll])
LT_LANG([Windows Resource])
],
[
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_RC
AC_PROG_LIBTOOL
]
)
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([ \
errno.h fcntl.h malloc.h stdlib.h inttypes.h \
string.h strings.h sys/time.h unistd.h \
locale.h getopt.h dlfcn.h utmp.h \
])
PKG_CHECK_MODULES(
[LIBP11],
[libp11 >= 0.3.1],
,
[AC_MSG_ERROR([libp11 >= 0.3.1 is required])])
saved_LIBS=$LIBS
LIBS="$LIBP11_LIBS"
AC_CHECK_LIB(
[p11],
[PKCS11_ecdsa_method_free],
,
[AC_DEFINE([OPENSSL_NO_ECDSA], [1],
[ECDSA support was not detected in libp11.])])
LIBS=$saved_LIBS
# The "libcrypto" module is not defined in OpenSSL 0.9.7
# TODO: Deprecate OpenSSL 0.9.7 and stop checking for the "openssl" module
PKG_CHECK_MODULES(
[OPENSSL],
[libcrypto >= 0.9.7],
,
[PKG_CHECK_MODULES(
[OPENSSL],
[openssl >= 0.9.7],
,
[AC_MSG_ERROR([libcrypto >= 0.9.7 is required])]
)]
)
if test -n "${pkcs11_module}"; then
AC_DEFINE_UNQUOTED(
[DEFAULT_PKCS11_MODULE],
"${pkcs11_module}",
[Default PKCS#11 module.])
fi
AC_SUBST([enginesdir])
AC_SUBST([ENGINE_PKCS11_VERSION_MAJOR])
AC_SUBST([ENGINE_PKCS11_VERSION_MINOR])
AC_SUBST([ENGINE_PKCS11_VERSION_FIX])
AC_SUBST([WIN_LIBPREFIX])
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
AM_CONDITIONAL([CYGWIN], [test "${CYGWIN}" = "yes"])
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes";
CFLAGS="${CFLAGS} -pedantic"
fi
if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wextra"
fi
AC_CONFIG_FILES([
Makefile
src/Makefile
src/versioninfo.rc
tests/Makefile
])
AC_OUTPUT
cat <<EOF
engine_pkcs11 has been configured with the following options:
Version: ${PACKAGE_VERSION}
Installation directory: ${enginesdir}
Default PKCS11 module: ${pkcs11_module}
Host: ${host}
Compiler: ${CC}
Preprocessor flags: ${CPPFLAGS}
Compiler flags: ${CFLAGS}
Linker flags: ${LDFLAGS}
Libraries: ${LIBS}
LIBP11_CFLAGS: ${LIBP11_CFLAGS}
LIBP11_LIBS: ${LIBP11_LIBS}
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
OPENSSL_LIBS: ${OPENSSL_LIBS}
EOF
# vim: set noexpandtab: