forked from cyassl/cyassl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
484 lines (377 loc) · 11.7 KB
/
configure.in
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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
AC_INIT(cyassl,2.0.0rc2,http://www.yassl.com) # !!! also change in ssl.h !!!
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(ctaocrypt/include/config.h)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(subdir-objects)
#shared library versioning
CYASSL_LIBRARY_VERSION=2:0:0
# | | |
# +------+ | +---+
# | | |
# current:revision:age
# | | |
# | | +- increment if interfaces have been added
# | | set to zero if interfaces have been removed or changed
# | +- increment if source code has changed
# | set to zero if current is incremented
# +- increment if interfaces have been added, removed or changed
AC_SUBST(CYASSL_LIBRARY_VERSION)
# make sure configure doesn't add to CFLAGS
CFLAGS="$CFLAGS $C_EXTRA_FLAGS"
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CC_C_O
AM_PROG_AS
AC_PROG_INSTALL
AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PREFIX_DEFAULT(/usr/local/cyassl)
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
AC_CHECK_LIB(network,socket)
AC_CHECK_LIBM
AC_CHECK_HEADERS(errno.h)
OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
OPTIMIZE_FAST_CFLAGS="-O3 -fomit-frame-pointer"
OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET"
DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_CYASSL"
# DEBUG
AC_ARG_ENABLE(debug,
[ --enable-debug Enable CyaSSL debugging support (default: disabled)],
[ ENABLED_DEBUG=$enableval ],
[ ENABLED_DEBUG=no ]
)
if test "$ENABLED_DEBUG" = "yes"
then
# Full debug. Very slow in some cases
CFLAGS="$DEBUG_CFLAGS $CFLAGS"
else
# Optimized version. No debug
CFLAGS="$CFLAGS -DNDEBUG"
fi
# SMALL BUILD
AC_ARG_ENABLE(small,
[ --enable-small Enable smallest build (default: disabled)],
[ ENABLED_SMALL=$enableval ],
[ ENABLED_SMALL=no ]
)
if test "$ENABLED_SMALL" = "yes"
then
# make small no tls build with smallest cipher
# if you only want server or client you can define NO_CYASSL_SERVER or
# NO_CYASSL_CLIENT but then some of the examples and testsuite won't build
# note that TLS needs HMAC
CFLAGS="-DNO_TLS -DNO_HMAC -DNO_AES -DNO_DES3 -DNO_SHA256 -DNO_ERROR_STRINGS -DNO_HC128 -DNO_RABBIT -DNO_PSK -DNO_DSA -DNO_DH -DNO_PWDBASED $CFLAGS"
fi
# SINGLE THREADED
AC_ARG_ENABLE(singleThreaded,
[ --enable-singleThreaded Enable CyaSSL single threaded (default: disabled)],
[ ENABLED_SINGLETHREADED=$enableval ],
[ ENABLED_SINGLETHREADED=no ]
)
if test "$ENABLED_SINGLETHREADED" = "yes"
then
CFLAGS="-DSINGLE_THREADED $CFLAGS"
fi
# DTLS
AC_ARG_ENABLE(dtls,
[ --enable-dtls Enable CyaSSL DTLS (default: disabled)],
[ ENABLED_DTLS=$enableval ],
[ ENABLED_DTLS=no ]
)
if test "$ENABLED_DTLS" = "yes"
then
CFLAGS="-DCYASSL_DTLS $CFLAGS"
fi
# OPENSSL Extra Compatibility
AC_ARG_ENABLE(opensslExtra,
[ --enable-opensslExtra Enable extra OpenSSL API, size+ (default: disabled)],
[ ENABLED_OPENSSLEXTRA=$enableval ],
[ ENABLED_OPENSSLEXTRA=no ]
)
if test "$ENABLED_OPENSSLEXTRA" = "yes"
then
CFLAGS="-DOPENSSL_EXTRA $CFLAGS"
fi
# IPv6 Test Apps
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 Enable testing of IPV6 (default: disabled)],
[ ENABLED_IPV6=$enableval ],
[ ENABLED_IPV6=no ]
)
if test "$ENABLED_IPV6" = "yes"
then
CFLAGS="$CFLAGS -DTEST_IPV6"
fi
# fastmath
AC_ARG_ENABLE(fastmath,
[ --enable-fastmath Enable fast math for BigInts(default: disabled)],
[ ENABLED_FASTMATH=$enableval ],
[ ENABLED_FASTMATH=no ]
)
if test "$ENABLED_FASTMATH" = "yes"
then
CFLAGS="$CFLAGS -DUSE_FAST_MATH"
fi
# fast HUGE math
AC_ARG_ENABLE(fasthugemath,
[ --enable-fasthugemath Enable fast math + huge code for BigInts(def: off)],
[ ENABLED_FASTHUGEMATH=$enableval ],
[ ENABLED_FASTHUGEMATH=no ]
)
if test "$ENABLED_FASTHUGEMATH" = "yes"
then
ENABLED_FASTMATH="yes"
CFLAGS="$CFLAGS -DUSE_FAST_MATH"
fi
AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
# big cache
AC_ARG_ENABLE(bigcache,
[ --enable-bigcache Enable big session cache (default: disabled)],
[ ENABLED_BIGCACHE=$enableval ],
[ ENABLED_BIGCACHE=no ]
)
if test "$ENABLED_BIGCACHE" = "yes"
then
CFLAGS="$CFLAGS -DBIG_SESSION_CACHE"
fi
# HUGE cache
AC_ARG_ENABLE(hugecache,
[ --enable-hugecache Enable huge session cache (default: disabled)],
[ ENABLED_HUGECACHE=$enableval ],
[ ENABLED_HUGECACHE=no ]
)
if test "$ENABLED_HUGECACHE" = "yes"
then
CFLAGS="$CFLAGS -DHUGE_SESSION_CACHE"
fi
# SNIFFER
AC_ARG_ENABLE(sniffer,
[ --enable-sniffer Enable CyaSSL sniffer support (default: disabled)],
[ ENABLED_SNIFFER=$enableval ],
[ ENABLED_SNIFFER=no ]
)
if test "$ENABLED_SNIFFER" = "yes"
then
CFLAGS="$CFLAGS -DCYASSL_SNIFFER -DOPENSSL_EXTRA"
fi
AM_CONDITIONAL([BUILD_SNIFFER], [test "x$ENABLED_SNIFFER" = "xyes"])
# AES-NI
AC_ARG_ENABLE(aesni,
[ --enable-aesni Enable CyaSSL AES-NI support (default: disabled)],
[ ENABLED_AESNI=$enableval ],
[ ENABLED_AESNI=no ]
)
if test "$ENABLED_AESNI" = "yes"
then
CFLAGS="$CFLAGS -DCYASSL_AESNI"
if test "$GCC" = "yes"
then
# GCC needs these flags, icc doesn't
CFLAGS="$CFLAGS -maes -msse4"
fi
fi
AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
# RIPEMD
AC_ARG_ENABLE(ripemd,
[ --enable-ripemd Enable CyaSSL RIPEMD-160 support (default: disabled)],
[ ENABLED_RIPEMD=$enableval ],
[ ENABLED_RIPEMD=no ]
)
if test "$ENABLED_RIPEMD" = "yes"
then
CFLAGS="$CFLAGS -DCYASSL_RIPEMD"
fi
AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
# SHA512
AC_ARG_ENABLE(sha512,
[ --enable-sha512 Enable CyaSSL SHA-160 support (default: disabled)],
[ ENABLED_SHA512=$enableval ],
[ ENABLED_SHA512=no ]
)
if test "$ENABLED_SHA512" = "yes"
then
CFLAGS="$CFLAGS -DCYASSL_SHA512"
fi
AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
# SESSION CERTS
AC_ARG_ENABLE(sessioncerts,
[ --enable-sessioncerts Enable session cert storing (default: disabled)],
[ ENABLED_SESSIONCERTS=$enableval ],
[ ENABLED_SESSIONCERTS=no ]
)
if test "$ENABLED_SESSIONCERTS" = "yes"
then
CFLAGS="$CFLAGS -DSESSION_CERTS"
fi
# KEY GENERATION
AC_ARG_ENABLE(keygen,
[ --enable-keygen Enable key generation (default: disabled)],
[ ENABLED_KEYGEN=$enableval ],
[ ENABLED_KEYGEN=no ]
)
if test "$ENABLED_KEYGEN" = "yes"
then
CFLAGS="$CFLAGS -DCYASSL_KEY_GEN"
fi
# CERT GENERATION
AC_ARG_ENABLE(certgen,
[ --enable-certgen Enable cert generation (default: disabled)],
[ ENABLED_CERTGEN=$enableval ],
[ ENABLED_CERTGEN=no ]
)
if test "$ENABLED_CERTGEN" = "yes"
then
CFLAGS="$CFLAGS -DCYASSL_CERT_GEN"
fi
# HC128
AC_ARG_ENABLE(hc128,
[ --enable-hc128 Enable HC-128 (default: disabled)],
[ ENABLED_HC128=$enableval ],
[ ENABLED_HC128=no ]
)
if test "$ENABLED_HC128" = "no"
then
CFLAGS="$CFLAGS -DNO_HC128"
fi
AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
# PSK
AC_ARG_ENABLE(psk,
[ --enable-psk Enable PSK (default: disabled)],
[ ENABLED_PSK=$enableval ],
[ ENABLED_PSK=no ]
)
if test "$ENABLED_PSK" = "no"
then
CFLAGS="$CFLAGS -DNO_PSK"
fi
# Web Server Build
AC_ARG_ENABLE(webServer,
[ --enable-webServer Enable Web Server (default: disabled)],
[ ENABLED_WEBSERVER=$enableval ],
[ ENABLED_WEBSERVER=no ]
)
if test "$ENABLED_WEBSERVER" = "yes"
then
CFLAGS="$CFLAGS -DHAVE_WEBSERVER"
fi
# ECC
AC_ARG_ENABLE(ecc,
[ --enable-ecc Enable ECC (default: disabled)],
[ ENABLED_ECC=$enableval ],
[ ENABLED_ECC=no ]
)
if test "$ENABLED_ECC" = "yes"
then
CFLAGS="$CFLAGS -DHAVE_ECC"
fi
AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
# NTRU
ntruHome=`pwd`/NTRU_algorithm
ntruInclude=$ntruHome/cryptolib
ntruLib=$ntruHome
AC_ARG_ENABLE(ntru,
[ --enable-ntru Enable NTRU (default: disabled)],
[ ENABLED_NTRU=$enableval ],
[ ENABLED_NTRU=no ]
)
if test "$ENABLED_NTRU" = "yes"
then
CFLAGS="$CFLAGS -DHAVE_NTRU -I$ntruInclude"
LDFLAGS="$LDFLAGS -L$ntruLib"
LIBS="$LIBS -lntru_encrypt"
fi
AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
# LIBZ
trylibzdir=""
AC_ARG_WITH(libz,
[ --with-libz=PATH PATH to libz install (default /usr/) ],
[
AC_MSG_CHECKING([for libz])
CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
LIBS="$LIBS -lz"
AC_TRY_LINK([#include <zlib.h>], [ deflateInit(NULL, 8); ],
[ libz_linked=yes ], [ libz_linked=no ])
if test "x$libz_linked" == "xno" ; then
if test "x$withval" != "xno" ; then
trylibzdir=$withval
fi
if test "x$withval" == "xyes" ; then
trylibzdir="/usr"
fi
LDFLAGS="$LDFLAGS -L$trylibzdir/lib"
CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
AC_TRY_LINK([#include <zlib.h>], [ deflateInit(NULL, 8); ],
[ libz_linked=yes ], [ libz_linked=no ])
if test "x$libz_linked" == "xno" ; then
AC_MSG_ERROR([libz isn't found.
If it's already installed, specify its path using --with-libz=/dir/])
fi
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([yes])
fi
]
)
# OPTIMIZE FLAGS
if test "$GCC" = "yes"
then
CFLAGS="$CFLAGS -Wall -Wno-unused"
if test "$ENABLED_DEBUG" = "no"
then
if test "$ENABLED_FASTMATH" = "yes"
then
CFLAGS="$CFLAGS $OPTIMIZE_FAST_CFLAGS"
if test "$ENABLED_FASTHUGEMATH" = "yes"
then
CFLAGS="$CFLAGS $OPTIMIZE_HUGE_CFLAGS"
fi
else
CFLAGS="$CFLAGS $OPTIMIZE_CFLAGS"
fi
fi
fi
ACX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBM $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIB_SOCKET_NSL
dnl Various GCC warnings that should never fire for release quality code
GCCWARNINGS="-Wall -fno-strict-aliasing -W -Wfloat-equal -Wundef \
-Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
-Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment \
-Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls \
-Wnested-externs -Wbad-function-cast -Wswitch-enum -Winit-self \
-Wmissing-field-initializers -Wdeclaration-after-statement \
-Wold-style-definition -Waddress -Wmissing-noreturn -Wnormalized=id \
-Woverride-init -Wstrict-overflow=1 -Wextra -Warray-bounds \
-Wstack-protector -Wformat -Wformat-security -Wpointer-sign"
AC_ARG_ENABLE(gcc-lots-o-warnings,
AS_HELP_STRING(--enable-gcc-lots-o-warnings, enable lots of gcc warnings),
[if test x$enableval = xyes; then
CFLAGS="$CFLAGS $GCCWARNINGS"
fi])
AC_ARG_ENABLE(gcc-hardening,
AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
[if test x$enableval = xyes; then
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all"
CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
CFLAGS="$CFLAGS --param ssp-buffer-size=1"
LDFLAGS="$LDFLAGS -pie"
fi])
dnl Linker hardening options
dnl Currently these options are ELF specific - you can't use this with MacOSX
AC_ARG_ENABLE(linker-hardening,
AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
[if test x$enableval = xyes; then
LDFLAGS="$LDFLAGS -z relro -z now"
fi])
PANDORA_VISIBILITY
CFLAGS="$CFLAGS $CFLAG_VISIBILITY"
AC_SUBST(CFLAGS)
AC_SUBST(LIBS)
# FINAL
AC_CONFIG_FILES([Makefile])
AC_OUTPUT