-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
385 lines (345 loc) · 10.5 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
AC_PREREQ([2.60])
define([PACKAGE_VERSION_MAJOR], [0])
define([PACKAGE_VERSION_MINOR], [3])
define([PACKAGE_VERSION_FIX], [0])
define([PACKAGE_VERSION_REVISION], [0])
define([PACKAGE_SUFFIX], [_master])
AC_INIT([mycms], [PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX[]PACKAGE_SUFFIX])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_SRCDIR([include/mycms/mycms.h])
AM_INIT_AUTOMAKE
MYCMS_VERSION_MAJOR="PACKAGE_VERSION_MAJOR"
MYCMS_VERSION_MINOR="PACKAGE_VERSION_MINOR"
MYCMS_VERSION_FIX="PACKAGE_VERSION_FIX"
MYCMS_VERSION_REVISION="PACKAGE_VERSION_REVISION"
AC_SUBST([MYCMS_VERSION_MAJOR])
AC_SUBST([MYCMS_VERSION_MINOR])
AC_SUBST([MYCMS_VERSION_FIX])
AC_SUBST([MYCMS_VERSION_REVISION])
LIBMYCMS_LT_CURRENT="1"
LIBMYCMS_LT_OLDEST="1"
LIBMYCMS_LT_REVISION="0"
LIBMYCMS_LT_AGE="$((${LIBMYCMS_LT_CURRENT}-${LIBMYCMS_LT_OLDEST}))"
AC_CANONICAL_HOST
AC_ARG_ENABLE(
[strict],
[AS_HELP_STRING([--enable-strict], [enable strict compiler warnings])],
,
[enable_strict="no"]
)
AC_ARG_ENABLE(
[pedantic],
[AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings])],
,
[enable_pedantic="no"]
)
AC_ARG_ENABLE(
[all-static],
[AS_HELP_STRING([--enable-all-static], [enable all static mode])],
,
[enable_all_static="no"]
)
AC_ARG_ENABLE(
[system-driver-default],
[AS_HELP_STRING([--disable-system-driver-default], [disable default system driver])],
,
[enable_system_driver_default="yes"]
)
AC_ARG_ENABLE(
[tests],
[AS_HELP_STRING([--enable-tests], [enable tests])],
,
[enable_tests="no"]
)
AC_ARG_ENABLE(
[tool],
[AS_HELP_STRING([--enable-tool], [enable tool])],
,
[enable_tool="no"]
)
AC_ARG_ENABLE(
[openssl-err-strings],
[AS_HELP_STRING([--enable-openssl-err-strings], [enable openssl error strings])],
,
[enable_openssl_err_strings="no"]
)
AC_ARG_ENABLE(
[pinentry],
[AS_HELP_STRING([--enable-pinentry], [enable pinentry support])],
,
[enable_pinentry="no"]
)
AC_ARG_ENABLE(
[cms-sign],
[AS_HELP_STRING([--enable-cms-sign], [enable cms sign support])],
,
[enable_cms_sign="no"]
)
AC_ARG_ENABLE(
[cms-verify],
[AS_HELP_STRING([--enable-cms-verify], [enable cms verify support])],
,
[enable_cms_verify="no"]
)
AC_ARG_ENABLE(
[cms-decrypt],
[AS_HELP_STRING([--enable-cms-decrypt], [enable cms decrypt support])],
,
[enable_cms_decrypt="no"]
)
AC_ARG_ENABLE(
[cms-encrypt],
[AS_HELP_STRING([--enable-cms-encrypt], [enable cms encrypt support])],
,
[enable_cms_encrypt="no"]
)
AC_ARG_ENABLE(
[io-driver-file],
[AS_HELP_STRING([--enable-io-driver-file], [enable io file driver support])],
,
[enable_io_driver_file="no"]
)
AC_ARG_ENABLE(
[certificate-driver-file],
[AS_HELP_STRING([--enable-certificate-driver-file], [enable certificate file driver support])],
,
[enable_certificate_driver_file="no"]
)
AC_ARG_ENABLE(
[certificate-driver-pkcs11],
[AS_HELP_STRING([--enable-certificate-driver-pkcs11], [enable certificate PKCS@%:@11 driver support])],
,
[enable_certificate_driver_pkcs11="no"]
)
AC_ARG_WITH(
[build-id],
[AS_HELP_STRING([--with-build-id=STR], [use this as build identifier])],
,
[with_build_id=""]
)
AC_ARG_WITH(
[md-suffix],
[AS_HELP_STRING([--with-md-suffix=STR], [use this suffix as netadata file suffix @<:@default=.mycms@:>@])],
,
[with_md_suffix=".mycms"]
)
AC_PROG_CC
AC_PROG_INSTALL
PKG_PROG_PKG_CONFIG
LT_INIT([win32-dll])
LT_LANG([Windows Resource])
AC_CHECK_FUNCS([ \
getopt_long \
])
AC_MSG_CHECKING([Checking C99 vararg macros])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#define test(x, ...) xxx(x __VA_OPT__(,) __VA_ARGS__)
void xxx(int, ...);
]],
[[
test(1);
]]
)],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_C99_VARARGS_MACROS], [1], [Have C99 varargs macros])
],
[
AC_MSG_RESULT([no])
AC_MSG_CHECKING([Checking GCC vararg macros])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#define test(x, ...) xxx(x, ##__VA_ARGS__)
void xxx(int, ...);
]],
[[
test(1);
]]
)],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_GCC_VARARGS_MACROS], [1], [Have GCC varags macros])
],
[AC_MSG_ERROR([cannot find supported varargs macros])]
)
]
)
if test "${enable_all_static}" = "yes"; then
ifdef(
[PKG_CHECK_MODULES_STATIC],
[PKG_CHECK_MODULES_STATIC(
[OPENSSLCRYPTO],
[libcrypto >= 1.1.0],
,
[AC_MSG_ERROR([Cannot locate openssl libcrypto])]
)],
[
# Old pkg.m4 hack
saved_PKG_CONFIG="${PKG_CONFIG}"
PKG_CONFIG="${PKG_CONFIG} --static"
PKG_CHECK_MODULES(
[OPENSSLCRYPTO],
[libcrypto >= 1.1.0],
,
[AC_MSG_ERROR([Cannot locate openssl libcrypto])]
)
PKG_CONFIG="${saved_PKG_CONFIG}"
]
)
# Fix segmentation error per pthread_setspecific is linked but pthread_mutex_lock is not
if echo "${OPENSSLCRYPTO_LIBS}" | grep -q pthread; then
LDFLAGS="${LDFLAGS} -Wl,-u,pthread_mutex_lock -Wl,-u,pthread_mutex_unlock"
fi
else
PKG_CHECK_MODULES(
[OPENSSLCRYPTO],
[libcrypto >= 1.1.0],
,
[AC_MSG_ERROR([Cannot locate openssl libcrypto])]
)
fi
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes"
CFLAGS="${CFLAGS} -pedantic -D_ISOC99_SOURCE -D_DEFAULT_SOURCE"
fi
if test "${enable_strict}" = "yes"; then
CFLAGS="${CFLAGS} -Wall -Wextra"
fi
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_CHECK_HEADERS([ \
dnfcn.h \
])
AC_CHECK_FUNCS([ \
explicit_bzero \
])
case "${host}" in
*-mingw*)
BUILD_WINDOWS=yes
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
AC_DEFINE([BUILD_WINDOWS], [1], [Build windows])
AC_DEFINE([strerror_r(n, b, s)], [strerror_s((b), (s), (n))], [strerror_r])
AC_DEFINE([HAVE_SECUREZEROMEMORY], [1], [Have SecureZeroMemory])
;;
esac
AC_PROG_AWK
AC_ARG_VAR([VALGRIND], [path to valgrind utility])
AC_PATH_PROGS([VALGRIND], [valgrind])
AC_ARG_VAR([PKCS11_TOOL], [path to pkcs11-tool utility])
AC_PATH_PROGS([PKCS11_TOOL], [pkcs11-tool])
AC_ARG_VAR([OPENSSL], [path to openssl utility])
AC_PATH_PROGS([OPENSSL], [openssl])
AC_ARG_VAR([EASYRSA], [path to easyrsa utility])
AC_PATH_PROGS([EASYRSA], [easyrsa],, [/usr/share/easy-rsa])
AC_ARG_VAR([SOFTHSM2_UTIL], [path to softhsm2-util utility])
AC_PATH_PROGS([SOFTHSM2_UTIL], [softhsm2-util])
AC_ARG_VAR([SOFTHSM2_MODULE], [path to SoftHSM2 module])
AC_MSG_CHECKING([path to SoftHSM2 module])
if test -z "${SOFTHSM2_MODULE}"; then
for x in /usr/lib*/softhsm/libsofthsm2.so /usr/lib*/*/softhsm/libsofthsm2.so; do
if test -r "${x}"; then
SOFTHSM2_MODULE="${x}"
break
fi
done
fi
AC_MSG_RESULT([${SOFTHSM2_MODULE}])
test "${enable_all_static}" = "yes" && \
LDFLAGS="${LDFLAGS} -all-static"
if test "${cross_compiling}" = "yes"; then
enable_tests="no"
fi
test "${enable_system_driver_default}" = "yes" && AC_DEFINE([ENABLE_SYSTEM_DRIVER_DEFAULT], [1], [Enable default system driver])
test "${enable_tool}" = "yes" && AC_DEFINE([ENABLE_TOOL], [1], [Enable tool])
test "${enable_openssl_err_strings}" = "yes" && AC_DEFINE([ENABLE_OPENSSL_ERR_STRINGS], [1], [Enable openssl error strings])
test "${enable_pinentry}" = "yes" && AC_DEFINE([ENABLE_PINENTRY], [1], [Enable pinentry])
test "${enable_cms_sign}" = "yes" && AC_DEFINE([ENABLE_CMS_SIGN], [1], [Enable cms sign])
test "${enable_cms_verify}" = "yes" && AC_DEFINE([ENABLE_CMS_VERIFY], [1], [Enable cms verify])
test "${enable_cms_decrypt}" = "yes" && AC_DEFINE([ENABLE_CMS_DECRYPT], [1], [Enable cms decrypt])
test "${enable_cms_encrypt}" = "yes" && AC_DEFINE([ENABLE_CMS_ENCRYPT], [1], [Enable cms encrypt])
test "${enable_io_driver_file}" = "yes" && AC_DEFINE([ENABLE_IO_DRIVER_FILE], [1], [Enable io file driver])
test "${enable_certificate_driver_file}" = "yes" && AC_DEFINE([ENABLE_CERTIFICATE_DRIVER_FILE], [1], [Enable cms certificate file driver])
if test "${enable_certificate_driver_pkcs11}" = "yes"; then
AC_DEFINE([ENABLE_CERTIFICATE_DRIVER_PKCS11], [1], [Enable cms pkcs11 file driver])
LIBS="${LIBS} ${LIBDL_LIBS}"
fi
if test "${enable_tests}" = "yes"; then
test -z "${OPENSSL}" && \
AC_MSG_ERROR([openssl is required for test])
test -z "${EASYRSA}" && \
AC_MSG_ERROR([easyrsa is required for test])
test -z "${AWK}" && \
AC_MSG_ERROR([awk is required for easyrsa])
if test "${enable_certificate_driver_pkcs11}" = "yes" -a "${BUILD_WINDOWS}" != "yes"; then
test -z "${SOFTHSM2_UTIL}" &&
AC_MSG_ERROR([softhsm2 is required for PKCS@%:@11 tests])
test -z "${SOFTHSM2_MODULE}" &&
AC_MSG_ERROR([softhsm2 module is required for PKCS@%:@11 tests])
test -z "${PKCS11_TOOL}" &&
AC_MSG_ERROR([pkcs11-tool (opensc) is required for PKCS@%:@11 tests])
fi
fi
test "${enable_tool}" = "yes" -a "${enable_io_driver_file}" != "yes" && \
AC_MSG_ERROR([IO file driver is required for tool])
test "${enable_all_static}" = "yes" -a "${enable_certificate_driver_pkcs11}" = "yes" && \
AC_MSG_ERROR([PKCS11 uses dynamic library])
AC_DEFINE_UNQUOTED([PACKAGE_BUILD_ID], ["${with_build_id}"], [Build identifier])
pkgconfigdir="\$(libdir)/pkgconfig"
mycmsincludedir="\$(includedir)/mycms"
AC_SUBST([pkgconfigdir])
AC_SUBST([mycmsincludedir])
AC_SUBST([LIBMYCMS_LT_CURRENT])
AC_SUBST([LIBMYCMS_LT_REVISION])
AC_SUBST([LIBMYCMS_LT_AGE])
AC_SUBST([LIBMYCMS_LT_OLDEST])
AC_SUBST([PACKAGE_BUILD_ID])
AM_CONDITIONAL([CROSS_COMPILING], [test "${cross_compiling}" = "yes"])
AM_CONDITIONAL([BUILD_WINDOWS], [test "${BUILD_WINDOWS}" = "yes"])
AM_CONDITIONAL([ENABLE_TESTS], [test "${enable_tests}" = "yes"])
AM_CONDITIONAL([ENABLE_TOOL], [test "${enable_tool}" = "yes"])
AM_CONDITIONAL([ENABLE_PINENTRY], [test "${enable_pinentry}" = "yes"])
AM_CONDITIONAL([ENABLE_CMS_SIGN], [test "${enable_cms_sign}" = "yes"])
AM_CONDITIONAL([ENABLE_CMS_VERIFY], [test "${enable_cms_verify}" = "yes"])
AM_CONDITIONAL([ENABLE_CMS_DECRYPT], [test "${enable_cms_decrypt}" = "yes"])
AM_CONDITIONAL([ENABLE_CMS_ENCRYPT], [test "${enable_cms_encrypt}" = "yes"])
AM_CONDITIONAL([ENABLE_IO_DRIVER_FILE], [test "${enable_io_driver_file}" = "yes"])
AM_CONDITIONAL([ENABLE_CERTIFICATE_DRIVER_FILE], [test "${enable_certificate_driver_file}" = "yes"])
AM_CONDITIONAL([ENABLE_CERTIFICATE_DRIVER_PKCS11], [test "${enable_certificate_driver_pkcs11}" = "yes"])
AC_CONFIG_FILES([
Makefile
build/Makefile
include/Makefile
include/mycms/Makefile
package.info
packaging/Makefile
packaging/debian/Makefile
packaging/windows-nsis/Makefile
src/Makefile
src/libmycms-util/Makefile
src/libmycms-util/libmycms-util.pc
src/libmycms-util/versioninfo.rc
src/libmycms/Makefile
src/libmycms/libmycms.pc
src/libmycms/versioninfo.rc
src/mycms-tool/Makefile
src/mycms-tool/versioninfo.rc
test/Makefile
test/ca/Makefile
test/ca/rootca.vars
test/ca/subca.vars
test/ca/ca-vars
test/mycms-tool/Makefile
test/mycms-tool/encrypt/Makefile
test/mycms-tool/sign/Makefile
test/mycms-tool/windows/Makefile
])
AC_OUTPUT