3 AM_INIT_AUTOMAKE(cyassl,1.9.0) # !!! also change in ssl.h !!!
4 AM_CONFIG_HEADER(ctaocrypt/include/config.h)
8 #sinclude(lib_socket_nsl.m4)
9 #sinclude(acx_pthread.m4)
10 AC_CONFIG_MACRO_DIR([m4])
13 # make sure configure doesn't add to CFLAGS
14 CFLAGS="$CFLAGS $C_EXTRA_FLAGS"
23 AC_PREFIX_DEFAULT(/usr/local/cyassl)
27 AC_CHECK_SIZEOF(long, 4)
28 AC_CHECK_SIZEOF(long long, 8)
30 AC_CHECK_LIB(network,socket)
33 AC_CHECK_HEADERS(errno.h)
35 OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
36 OPTIMIZE_FAST_CFLAGS="-O3 -fomit-frame-pointer"
37 OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET"
38 DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_CYASSL"
43 [ --enable-debug Enable CyaSSL debugging support (default: disabled)],
44 [ ENABLED_DEBUG=$enableval ],
47 if test "$ENABLED_DEBUG" = "yes"
49 # Full debug. Very slow in some cases
50 CFLAGS="$DEBUG_CFLAGS $CFLAGS"
52 # Optimized version. No debug
53 CFLAGS="$CFLAGS -DNDEBUG"
59 [ --enable-small Enable smallest build (default: disabled)],
60 [ ENABLED_SMALL=$enableval ],
63 if test "$ENABLED_SMALL" = "yes"
65 # make small no tls build with smallest cipher
66 # if you only want server or client you can define NO_CYASSL_SERVER or
67 # NO_CYASSL_CLIENT but then some of the examples and testsuite won't build
68 # note that TLS needs HMAC
69 CFLAGS="-DNO_TLS -DNO_HMAC -DNO_AES -DNO_DES3 -DNO_SHA256 -DNO_ERROR_STRINGS -DNO_HC128 -DNO_RABBIT -DNO_PSK -DNO_DSA -DNO_DH $CFLAGS"
74 AC_ARG_ENABLE(singleThreaded,
75 [ --enable-singleThreaded Enable CyaSSL single threaded (default: disabled)],
76 [ ENABLED_SINGLETHREADED=$enableval ],
77 [ ENABLED_SINGLETHREADED=no ]
79 if test "$ENABLED_SINGLETHREADED" = "yes"
81 CFLAGS="-DSINGLE_THREADED $CFLAGS"
87 [ --enable-dtls Enable CyaSSL DTLS (default: disabled)],
88 [ ENABLED_DTLS=$enableval ],
91 if test "$ENABLED_DTLS" = "yes"
93 CFLAGS="-DCYASSL_DTLS $CFLAGS"
97 # OPENSSL Extra Compatibility
98 AC_ARG_ENABLE(opensslExtra,
99 [ --enable-opensslExtra Enable extra OpenSSL API, size+ (default: disabled)],
100 [ ENABLED_OPENSSLEXTRA=$enableval ],
101 [ ENABLED_OPENSSLEXTRA=no ]
103 if test "$ENABLED_OPENSSLEXTRA" = "yes"
105 CFLAGS="-DOPENSSL_EXTRA $CFLAGS"
111 [ --enable-ipv6 Enable testing of IPV6 (default: disabled)],
112 [ ENABLED_IPV6=$enableval ],
116 if test "$ENABLED_IPV6" = "yes"
118 CFLAGS="$CFLAGS -DTEST_IPV6"
123 AC_ARG_ENABLE(fastmath,
124 [ --enable-fastmath Enable fast math for BigInts(default: disabled)],
125 [ ENABLED_FASTMATH=$enableval ],
126 [ ENABLED_FASTMATH=no ]
129 if test "$ENABLED_FASTMATH" = "yes"
131 CFLAGS="$CFLAGS -DUSE_FAST_MATH"
136 AC_ARG_ENABLE(fasthugemath,
137 [ --enable-fasthugemath Enable fast math + huge code for BigInts(def: off)],
138 [ ENABLED_FASTHUGEMATH=$enableval ],
139 [ ENABLED_FASTHUGEMATH=no ]
142 if test "$ENABLED_FASTHUGEMATH" = "yes"
144 ENABLED_FASTMATH="yes"
145 CFLAGS="$CFLAGS -DUSE_FAST_MATH"
148 AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
152 AC_ARG_ENABLE(bigcache,
153 [ --enable-bigcache Enable big session cache (default: disabled)],
154 [ ENABLED_BIGCACHE=$enableval ],
155 [ ENABLED_BIGCACHE=no ]
158 if test "$ENABLED_BIGCACHE" = "yes"
160 CFLAGS="$CFLAGS -DBIG_SESSION_CACHE"
165 AC_ARG_ENABLE(hugecache,
166 [ --enable-hugecache Enable huge session cache (default: disabled)],
167 [ ENABLED_HUGECACHE=$enableval ],
168 [ ENABLED_HUGECACHE=no ]
171 if test "$ENABLED_HUGECACHE" = "yes"
173 CFLAGS="$CFLAGS -DHUGE_SESSION_CACHE"
178 AC_ARG_ENABLE(sniffer,
179 [ --enable-sniffer Enable CyaSSL sniffer support (default: disabled)],
180 [ ENABLED_SNIFFER=$enableval ],
181 [ ENABLED_SNIFFER=no ]
184 if test "$ENABLED_SNIFFER" = "yes"
186 CFLAGS="$CFLAGS -DCYASSL_SNIFFER -DOPENSSL_EXTRA"
189 AM_CONDITIONAL([BUILD_SNIFFER], [test "x$ENABLED_SNIFFER" = "xyes"])
193 [ --enable-aesni Enable CyaSSL AES-NI support (default: disabled)],
194 [ ENABLED_AESNI=$enableval ],
198 if test "$ENABLED_AESNI" = "yes"
200 CFLAGS="$CFLAGS -DCYASSL_AESNI"
201 if test "$GCC" = "yes"
203 # GCC needs these flags, icc doesn't
204 CFLAGS="$CFLAGS -maes -msse4"
208 AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
212 AC_ARG_ENABLE(ripemd,
213 [ --enable-ripemd Enable CyaSSL RIPEMD-160 support (default: disabled)],
214 [ ENABLED_RIPEMD=$enableval ],
215 [ ENABLED_RIPEMD=no ]
218 if test "$ENABLED_RIPEMD" = "yes"
220 CFLAGS="$CFLAGS -DCYASSL_RIPEMD"
223 AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
227 AC_ARG_ENABLE(sha512,
228 [ --enable-sha512 Enable CyaSSL SHA-160 support (default: disabled)],
229 [ ENABLED_SHA512=$enableval ],
230 [ ENABLED_SHA512=no ]
233 if test "$ENABLED_SHA512" = "yes"
235 CFLAGS="$CFLAGS -DCYASSL_SHA512"
238 AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
242 AC_ARG_ENABLE(sessioncerts,
243 [ --enable-sessioncerts Enable session cert storing (default: disabled)],
244 [ ENABLED_SESSIONCERTS=$enableval ],
245 [ ENABLED_SESSIONCERTS=no ]
248 if test "$ENABLED_SESSIONCERTS" = "yes"
250 CFLAGS="$CFLAGS -DSESSION_CERTS"
255 AC_ARG_ENABLE(keygen,
256 [ --enable-keygen Enable key generation (default: disabled)],
257 [ ENABLED_KEYGEN=$enableval ],
258 [ ENABLED_KEYGEN=no ]
261 if test "$ENABLED_KEYGEN" = "yes"
263 CFLAGS="$CFLAGS -DCYASSL_KEY_GEN"
268 AC_ARG_ENABLE(certgen,
269 [ --enable-certgen Enable cert generation (default: disabled)],
270 [ ENABLED_CERTGEN=$enableval ],
271 [ ENABLED_CERTGEN=no ]
274 if test "$ENABLED_CERTGEN" = "yes"
276 CFLAGS="$CFLAGS -DCYASSL_CERT_GEN"
282 [ --enable-hc128 Enable HC-128 (default: disabled)],
283 [ ENABLED_HC128=$enableval ],
287 if test "$ENABLED_HC128" = "no"
289 CFLAGS="$CFLAGS -DNO_HC128"
292 AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
297 [ --enable-psk Enable PSK (default: disabled)],
298 [ ENABLED_PSK=$enableval ],
302 if test "$ENABLED_PSK" = "no"
304 CFLAGS="$CFLAGS -DNO_PSK"
309 AC_ARG_ENABLE(webServer,
310 [ --enable-webServer Enable Web Server (default: disabled)],
311 [ ENABLED_WEBSERVER=$enableval ],
312 [ ENABLED_WEBSERVER=no ]
315 if test "$ENABLED_WEBSERVER" = "yes"
317 CFLAGS="$CFLAGS -DHAVE_WEBSERVER"
323 [ --enable-ecc Enable ECC (default: disabled)],
324 [ ENABLED_ECC=$enableval ],
328 if test "$ENABLED_ECC" = "yes"
330 CFLAGS="$CFLAGS -DHAVE_ECC"
333 AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
337 ntruHome=`pwd`/NTRU_algorithm
338 ntruInclude=$ntruHome/cryptolib
341 [ --enable-ntru Enable NTRU (default: disabled)],
342 [ ENABLED_NTRU=$enableval ],
346 if test "$ENABLED_NTRU" = "yes"
348 CFLAGS="$CFLAGS -DHAVE_NTRU -I$ntruInclude"
349 LDFLAGS="$LDFLAGS -L$ntruLib"
350 LIBS="$LIBS -lntru_encrypt"
353 AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
359 [ --with-libz=PATH PATH to libz install (default /usr/) ],
361 AC_MSG_CHECKING([for libz])
362 if test "x$withval" == "xno" ; then
365 CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
368 AC_TRY_LINK([#include <zlib.h>], [ deflateInit(NULL, 8); ],
369 [ libz_linked=yes ], [ libz_linked=no ])
371 if test "x$libz_linked" == "xno" ; then
372 if test "x$withval" != "xno" ; then
375 if test "x$withval" == "xyes" ; then
379 LDFLAGS="$LDFLAGS -L$trylibzdir/lib"
380 CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
382 AC_TRY_LINK([#include <zlib.h>], [ deflateInit(NULL, 8); ],
383 [ libz_linked=yes ], [ libz_linked=no ])
385 if test "x$libz_linked" == "xno" ; then
386 AC_MSG_ERROR([libz isn't found.
387 If it's already installed, specify its path using --with-libz=/dir/])
400 if test "$GCC" = "yes"
402 CFLAGS="$CFLAGS -Wall -Wno-unused"
403 if test "$ENABLED_DEBUG" = "no"
405 if test "$ENABLED_FASTMATH" = "yes"
407 CFLAGS="$CFLAGS $OPTIMIZE_FAST_CFLAGS"
408 if test "$ENABLED_FASTHUGEMATH" = "yes"
410 CFLAGS="$CFLAGS $OPTIMIZE_HUGE_CFLAGS"
413 CFLAGS="$CFLAGS $OPTIMIZE_CFLAGS"
423 LIBS="$PTHREAD_LIBS $LIBM $LIBS"
424 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
434 AC_CONFIG_FILES(Makefile dnl
435 ctaocrypt/Makefile dnl
436 ctaocrypt/src/Makefile dnl
437 ctaocrypt/test/Makefile dnl
438 ctaocrypt/benchmark/Makefile dnl
440 examples/Makefile dnl
441 examples/client/Makefile dnl
442 examples/server/Makefile dnl
443 examples/echoclient/Makefile dnl
444 examples/echoserver/Makefile dnl
445 testsuite/Makefile dnl
446 sslSniffer/Makefile dnl
447 sslSniffer/sslSnifferTest/Makefile)