3 # Copyright (C) 2006-2014 wolfSSL Inc.
5 # This file is part of CyaSSL.
9 AC_INIT([cyassl],[3.1.0],[https://github.com/cyassl/cyassl/issues],[cyassl],[http://www.wolfssl.com])
11 AC_CONFIG_AUX_DIR([build-aux])
16 AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
20 AC_DEFUN([PROTECT_AC_USE_SYSTEM_EXTENSIONS],
23 AC_USE_SYSTEM_EXTENSIONS
27 #PROTECT_AC_USE_SYSTEM_EXTENSIONS
29 AC_CONFIG_MACRO_DIR([m4])
31 AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
33 #shared library versioning
34 CYASSL_LIBRARY_VERSION=5:6:0
38 # current:revision:age
40 # | | +- increment if interfaces have been added
41 # | | set to zero if interfaces have been removed
43 # | +- increment if source code has changed
44 # | set to zero if current is incremented
45 # +- increment if interfaces have been added, removed or changed
46 AC_SUBST([CYASSL_LIBRARY_VERSION])
48 # capture user C_EXTRA_FLAGS from ./configure line, CFLAGS may hold -g -O2 even
49 # if user doesn't override, no way to tell
50 USER_C_EXTRA_FLAGS="$C_EXTRA_FLAGS"
53 LT_INIT([disable-static],[win32-dll])
58 AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
59 AM_CPPFLAGS="$AM_CPPFLAGS $CFLAG_VISIBILITY"
60 CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"
63 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
65 AC_CHECK_FUNCS([gethostbyname])
66 AC_CHECK_FUNCS([getaddrinfo])
67 AC_CHECK_FUNCS([gettimeofday])
68 AC_CHECK_FUNCS([inet_ntoa])
69 AC_CHECK_FUNCS([memset])
70 AC_CHECK_FUNCS([socket])
71 AC_CHECK_HEADERS([arpa/inet.h])
72 AC_CHECK_HEADERS([fcntl.h])
73 AC_CHECK_HEADERS([limits.h])
74 AC_CHECK_HEADERS([netdb.h])
75 AC_CHECK_HEADERS([netinet/in.h])
76 AC_CHECK_HEADERS([stddef.h])
77 AC_CHECK_HEADERS([sys/ioctl.h])
78 AC_CHECK_HEADERS([sys/socket.h])
79 AC_CHECK_HEADERS([sys/time.h])
80 AC_CHECK_HEADERS([errno.h])
81 AC_CHECK_LIB(network,socket)
82 AC_CHECK_SIZEOF(long long, 8)
83 AC_CHECK_SIZEOF(long, 4)
84 AC_CHECK_TYPES(__uint128_t)
86 # mktime check takes forever on some systems, if time supported it would be
87 # highly unusual for mktime to be missing
100 OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
101 OPTIMIZE_FAST_CFLAGS="-O2 -fomit-frame-pointer"
102 OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
103 DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_CYASSL"
106 # Thread local storage
108 [AM_CFLAGS="$AM_CFLAGS -DHAVE_THREAD_LS"]
115 AS_IF([test "$ax_enable_debug" = "yes"],
116 [AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"],
117 [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
121 AC_ARG_ENABLE([singlethreaded],
122 [ --enable-singlethreaded Enable CyaSSL single threaded (default: disabled)],
123 [ ENABLED_SINGLETHREADED=$enableval ],
124 [ ENABLED_SINGLETHREADED=no ])
126 AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
128 AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
129 AM_CFLAGS="-D_POSIX_THREADS $AM_CFLAGS $PTHREAD_CFLAGS"
130 LIBS="$LIBS $PTHREAD_LIBS"
132 ENABLED_SINGLETHREADED=yes
136 AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="-DSINGLE_THREADED $AM_CFLAGS" ])
140 AC_ARG_ENABLE([dtls],
141 [ --enable-dtls Enable CyaSSL DTLS (default: disabled)],
142 [ ENABLED_DTLS=$enableval ],
145 if test "$ENABLED_DTLS" = "yes"
147 AM_CFLAGS="-DCYASSL_DTLS $AM_CFLAGS"
151 # OPENSSL Extra Compatibility
152 AC_ARG_ENABLE([opensslextra],
153 [ --enable-opensslextra Enable extra OpenSSL API, size+ (default: disabled)],
154 [ ENABLED_OPENSSLEXTRA=$enableval ],
155 [ ENABLED_OPENSSLEXTRA=no ]
157 if test "$ENABLED_OPENSSLEXTRA" = "yes"
159 AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
162 if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
164 AC_MSG_ERROR([cannot enable small and opensslextra, only one or the other.])
169 AC_ARG_ENABLE([ipv6],
170 [ --enable-ipv6 Enable testing of IPV6 (default: disabled)],
171 [ ENABLED_IPV6=$enableval ],
175 if test "$ENABLED_IPV6" = "yes"
177 AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6"
182 AC_ARG_ENABLE([fortress],
183 [ --enable-fortress Enable SSL fortress build (default: disabled)],
184 [ ENABLED_FORTRESS=$enableval ],
185 [ ENABLED_FORTRESS=no ]
188 if test "$ENABLED_FORTRESS" = "yes"
190 AM_CFLAGS="$AM_CFLAGS -DFORTRESS -DCYASSL_ALWAYS_VERIFY_CB -DOPENSSL_EXTRA -DCYASSL_DES_ECB -DCYASSL_AES_COUNTER -DCYASSL_AES_DIRECT -DCYASSL_DER_LOAD -DCYASSL_SHA512 -DCYASSL_SHA384 -DCYASSL_KEY_GEN"
195 AC_ARG_ENABLE([bump],
196 [ --enable-bump Enable SSL Bump build (default: disabled)],
197 [ ENABLED_BUMP=$enableval ],
201 if test "$ENABLED_BUMP" = "yes"
203 AM_CFLAGS="$AM_CFLAGS -DLARGE_STATIC_BUFFERS -DCYASSL_CERT_GEN -DCYASSL_KEY_GEN -DHUGE_SESSION_CACHE -DOPENSSL_EXTRA -DFP_MAX_BITS=8192 -DCYASSL_DER_LOAD -DCYASSL_ALT_NAMES -DCYASSL_TEST_CERT"
206 ENABLED_SLOWMATH="yes"
209 AC_ARG_ENABLE([leanpsk],
210 [ --enable-leanpsk Enable Lean PSK build (default: disabled)],
211 [ ENABLED_LEANPSK=$enableval ],
212 [ ENABLED_LEANPSK=no ]
215 if test "$ENABLED_LEANPSK" = "yes"
217 AM_CFLAGS="$AM_CFLAGS -DCYASSL_LEANPSK -DHAVE_NULL_CIPHER -DSINGLE_THREADED -DNO_AES -DNO_FILESYSTEM -DNO_RABBIT -DNO_RSA -DNO_DSA -DNO_DH -DNO_CERTS -DNO_PWDBASED -DNO_DES3 -DNO_MD4 -DNO_MD5 -DNO_ERROR_STRINGS -DNO_OLD_TLS -DNO_RC4 -DNO_WRITEV -DNO_SESSION_CACHE -DNO_DEV_RANDOM -DCYASSL_USER_IO -DNO_SHA -DUSE_SLOW_SHA"
218 ENABLED_SLOWMATH="no"
219 ENABLED_SINGLETHREADED="yes"
222 AM_CONDITIONAL([BUILD_LEANPSK], [test "x$ENABLED_LEANPSK" = "xyes"])
226 AC_ARG_ENABLE([bigcache],
227 [ --enable-bigcache Enable big session cache (default: disabled)],
228 [ ENABLED_BIGCACHE=$enableval ],
229 [ ENABLED_BIGCACHE=no ]
232 if test "$ENABLED_BIGCACHE" = "yes"
234 AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
239 AC_ARG_ENABLE([hugecache],
240 [ --enable-hugecache Enable huge session cache (default: disabled)],
241 [ ENABLED_HUGECACHE=$enableval ],
242 [ ENABLED_HUGECACHE=no ]
245 if test "$ENABLED_HUGECACHE" = "yes"
247 AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
252 AC_ARG_ENABLE([smallcache],
253 [ --enable-smallcache Enable small session cache (default: disabled)],
254 [ ENABLED_SMALLCACHE=$enableval ],
255 [ ENABLED_SMALLCACHE=no ]
258 if test "$ENABLED_SMALLCACHE" = "yes"
260 AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
264 # Persistent session cache
265 AC_ARG_ENABLE([savesession],
266 [ --enable-savesession Enable persistent session cache (default: disabled)],
267 [ ENABLED_SAVESESSION=$enableval ],
268 [ ENABLED_SAVESESSION=no ]
271 if test "$ENABLED_SAVESESSION" = "yes"
273 AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
277 # Persistent cert cache
278 AC_ARG_ENABLE([savecert],
279 [ --enable-savecert Enable persistent cert cache (default: disabled)],
280 [ ENABLED_SAVECERT=$enableval ],
281 [ ENABLED_SAVECERT=no ]
284 if test "$ENABLED_SAVECERT" = "yes"
286 AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
290 # Atomic User Record Layer
291 AC_ARG_ENABLE([atomicuser],
292 [ --enable-atomicuser Enable Atomic User Record Layer (default: disabled)],
293 [ ENABLED_ATOMICUSER=$enableval ],
294 [ ENABLED_ATOMICUSER=no ]
297 if test "$ENABLED_ATOMICUSER" = "yes"
299 AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
303 # Public Key Callbacks
304 AC_ARG_ENABLE([pkcallbacks],
305 [ --enable-pkcallbacks Enable Public Key Callbacks (default: disabled)],
306 [ ENABLED_PKCALLBACKS=$enableval ],
307 [ ENABLED_PKCALLBACKS=no ]
310 if test "$ENABLED_PKCALLBACKS" = "yes"
312 AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
318 AC_ARG_ENABLE([sniffer],
319 [AS_HELP_STRING([--enable-sniffer],[ Enable CyaSSL sniffer support (default: disabled) ])],[
321 AM_CFLAGS="$AM_CFLAGS -DCYASSL_SNIFFER -DOPENSSL_EXTRA"
322 AS_IF([ test "x$enableval" = "xyes" ],[ AC_CHECK_HEADERS([pcap/pcap.h],[
323 ENABLED_SNIFFTEST=yes
324 ],[ AC_MSG_WARN([cannot enable sniffer test without having libpcap available.]) ]) ])
329 AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" ])
330 AM_CONDITIONAL([BUILD_SNIFFTEST], [ test "x$ENABLED_SNIFFTEST" = "xyes" ])
333 AC_ARG_ENABLE([aesgcm],
334 [ --enable-aesgcm Enable CyaSSL AES-GCM support (default: disabled)],
335 [ ENABLED_AESGCM=$enableval ],
336 [ ENABLED_AESGCM=no ]
339 if test "$ENABLED_AESGCM" = "word32"
341 AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
345 if test "$ENABLED_AESGCM" = "small"
347 AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
351 if test "$ENABLED_AESGCM" = "table"
353 AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
357 if test "$ENABLED_AESGCM" = "yes"
359 AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
362 AM_CONDITIONAL([BUILD_AESGCM], [test "x$ENABLED_AESGCM" = "xyes"])
366 AC_ARG_ENABLE([aesccm],
367 [ --enable-aesccm Enable CyaSSL AES-CCM support (default: disabled)],
368 [ ENABLED_AESCCM=$enableval ],
369 [ ENABLED_AESCCM=no ]
372 if test "$ENABLED_AESCCM" = "yes"
374 AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
377 AM_CONDITIONAL([BUILD_AESCCM], [test "x$ENABLED_AESCCM" = "xyes"])
381 AC_ARG_ENABLE([aesni],
382 [ --enable-aesni Enable CyaSSL AES-NI support (default: disabled)],
383 [ ENABLED_AESNI=$enableval ],
387 if test "$ENABLED_AESNI" = "yes"
389 AM_CFLAGS="$AM_CFLAGS -DCYASSL_AESNI"
390 if test "$GCC" = "yes"
392 # GCC needs these flags, icc doesn't
393 # opt levels greater than 2 may cause problems on systems w/o aesni
394 if test "$CC" != "icc"
396 AM_CFLAGS="$AM_CFLAGS -maes -msse4"
401 AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
405 AC_ARG_ENABLE([camellia],
406 [ --enable-camellia Enable CyaSSL Camellia support (default: disabled)],
407 [ ENABLED_CAMELLIA=$enableval ],
408 [ ENABLED_CAMELLIA=no ]
411 if test "$ENABLED_CAMELLIA" = "yes"
413 AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
416 AM_CONDITIONAL([BUILD_CAMELLIA], [test "x$ENABLED_CAMELLIA" = "xyes"])
421 [ --enable-md2 Enable CyaSSL MD2 support (default: disabled)],
422 [ ENABLED_MD2=$enableval ],
426 if test "$ENABLED_BUMP" = "yes"
431 if test "$ENABLED_MD2" = "yes"
433 AM_CFLAGS="$AM_CFLAGS -DCYASSL_MD2"
436 AM_CONDITIONAL([BUILD_MD2], [test "x$ENABLED_MD2" = "xyes"])
440 AC_ARG_ENABLE([nullcipher],
441 [ --enable-nullcipher Enable CyaSSL NULL cipher support (default: disabled)],
442 [ ENABLED_NULL_CIPHER=$enableval ],
443 [ ENABLED_NULL_CIPHER=no ]
446 if test "$ENABLED_NULL_CIPHER" = "yes"
448 AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
452 AC_ARG_ENABLE([ripemd],
453 [ --enable-ripemd Enable CyaSSL RIPEMD-160 support (default: disabled)],
454 [ ENABLED_RIPEMD=$enableval ],
455 [ ENABLED_RIPEMD=no ]
458 if test "$ENABLED_RIPEMD" = "yes"
460 AM_CFLAGS="$AM_CFLAGS -DCYASSL_RIPEMD"
463 AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
467 AC_ARG_ENABLE([blake2],
468 [ --enable-blake2 Enable CyaSSL BLAKE2 support (default: disabled)],
469 [ ENABLED_BLAKE2=$enableval ],
470 [ ENABLED_BLAKE2=no ]
473 if test "$ENABLED_BLAKE2" = "yes"
475 AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2"
478 AM_CONDITIONAL([BUILD_BLAKE2], [test "x$ENABLED_BLAKE2" = "xyes"])
482 AC_ARG_ENABLE([sha512],
483 [ --enable-sha512 Enable CyaSSL SHA-512 support (default: disabled)],
484 [ ENABLED_SHA512=$enableval ],
485 [ ENABLED_SHA512=no ]
488 if test "$ENABLED_SHA512" = "yes"
490 AM_CFLAGS="$AM_CFLAGS -DCYASSL_SHA512 -DCYASSL_SHA384"
493 if test "$ENABLED_FORTRESS" = "yes"
499 AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
503 AC_ARG_ENABLE([sessioncerts],
504 [ --enable-sessioncerts Enable session cert storing (default: disabled)],
505 [ ENABLED_SESSIONCERTS=$enableval ],
506 [ ENABLED_SESSIONCERTS=no ]
509 if test "$ENABLED_SESSIONCERTS" = "yes"
511 AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
516 AC_ARG_ENABLE([keygen],
517 [ --enable-keygen Enable key generation (default: disabled)],
518 [ ENABLED_KEYGEN=$enableval ],
519 [ ENABLED_KEYGEN=no ]
522 if test "$ENABLED_KEYGEN" = "yes"
524 AM_CFLAGS="$AM_CFLAGS -DCYASSL_KEY_GEN"
529 AC_ARG_ENABLE([certgen],
530 [ --enable-certgen Enable cert generation (default: disabled)],
531 [ ENABLED_CERTGEN=$enableval ],
532 [ ENABLED_CERTGEN=no ]
535 if test "$ENABLED_CERTGEN" = "yes"
537 AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_GEN"
541 # CERT REQUEST GENERATION
542 AC_ARG_ENABLE([certreq],
543 [ --enable-certreq Enable cert request generation (default: disabled)],
544 [ ENABLED_CERTREQ=$enableval ],
545 [ ENABLED_CERTREQ=no ]
548 if test "$ENABLED_CERTREQ" = "yes"
550 if test "$ENABLED_CERTGEN" = "no"
552 AC_MSG_ERROR([cannot enable certreq without enabling certgen.])
554 AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_REQ"
560 [ --enable-sep Enable sep extensions (default: disabled)],
561 [ ENABLED_SEP=$enableval ],
564 if test "$ENABLED_SEP" = "yes"
566 AM_CFLAGS="-DCYASSL_SEP -DKEEP_PEER_CERT $AM_CFLAGS"
571 AC_ARG_ENABLE([hkdf],
572 [ --enable-hkdf Enable HKDF (HMAC-KDF) support (default: disabled)],
573 [ ENABLED_HKDF=$enableval ],
576 if test "$ENABLED_HKDF" = "yes"
578 AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
584 [ --enable-dsa Enable DSA (default: disabled)],
585 [ ENABLED_DSA=$enableval ],
589 if test "$ENABLED_DSA" = "no"
591 AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
594 AM_CONDITIONAL([BUILD_DSA], [test "x$ENABLED_DSA" = "xyes"])
599 [ --enable-ecc Enable ECC (default: disabled)],
600 [ ENABLED_ECC=$enableval ],
604 if test "$ENABLED_ECC" = "yes"
606 AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
609 AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
612 if test "$ENABLED_ECC" = "yes" && test "$ENABLED_SMALL" = "yes"
614 AC_MSG_ERROR([cannot enable ecc and small, ecc requires TLS which small turns off.])
618 # FP ECC, Fixed Point cache ECC
619 AC_ARG_ENABLE([fpecc],
620 [ --enable-fpecc Enable Fixed Point cache ECC (default: disabled)],
621 [ ENABLED_FPECC=$enableval ],
625 if test "$ENABLED_FPECC" = "yes"
627 if test "$ENABLED_ECC" = "no"
629 AC_MSG_ERROR([cannot enable fpecc without enabling ecc.])
631 AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
636 AC_ARG_ENABLE([eccencrypt],
637 [ --enable-eccencrypt Enable ECC encrypt (default: disabled)],
638 [ ENABLED_ECC_ENCRYPT=$enableval ],
639 [ ENABLED_ECC_ENCRYPT=no ]
642 if test "$ENABLED_ECC_ENCRYPT" = "yes"
644 if test "$ENABLED_ECC" = "no"
646 AC_MSG_ERROR([cannot enable eccencrypt without enabling ecc.])
648 if test "$ENABLED_HKDF" = "no"
650 AC_MSG_ERROR([cannot enable eccencrypt without enabling hkdf.])
652 AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_ENCRYPT"
658 [ --enable-psk Enable PSK (default: disabled)],
659 [ ENABLED_PSK=$enableval ],
663 if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no"
665 AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
668 if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "yes"
675 AC_ARG_ENABLE([errorstrings],
676 [ --enable-errorstrings Enable error strings table (default: enabled)],
677 [ ENABLED_ERROR_STRINGS=$enableval ],
678 [ ENABLED_ERROR_STRINGS=yes ]
681 if test "$ENABLED_ERROR_STRINGS" = "no"
683 AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
685 # turn off error strings if leanpsk on
686 if test "$ENABLED_LEANPSK" = "yes"
688 AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
689 ENABLED_ERROR_STRINGS=no
695 AC_ARG_ENABLE([oldtls],
696 [ --enable-oldtls Enable old TLS versions < 1.2 (default: enabled)],
697 [ ENABLED_OLD_TLS=$enableval ],
698 [ ENABLED_OLD_TLS=yes ]
701 if test "$ENABLED_OLD_TLS" = "no"
703 AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
705 # turn off old if leanpsk on
706 if test "$ENABLED_LEANPSK" = "yes"
708 AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
714 # STACK SIZE info for examples
715 AC_ARG_ENABLE([stacksize],
716 [ --enable-stacksize Enable stack size info on examples (default: disabled)],
717 [ ENABLED_STACKSIZE=$enableval ],
718 [ ENABLED_STACKSIZE=no ]
721 if test "$ENABLED_STACKSIZE" = "yes"
723 AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
724 AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
725 AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE -DCYASSL_LOW_MEMORY"
730 AC_ARG_ENABLE([memory],
731 [ --enable-memory Enable memory callbacks (default: enabled)],
732 [ ENABLED_MEMORY=$enableval ],
733 [ ENABLED_MEMORY=yes ]
736 if test "$ENABLED_MEMORY" = "no"
738 AM_CFLAGS="$AM_CFLAGS -DNO_CYASSL_MEMORY"
740 # turn off memory cb if leanpsk on
741 if test "$ENABLED_LEANPSK" = "yes"
743 # but don't turn on NO_CYASSL_MEMORY because using own
748 AM_CONDITIONAL([BUILD_MEMORY], [test "x$ENABLED_MEMORY" = "xyes"])
753 [ --enable-rsa Enable RSA (default: enabled)],
754 [ ENABLED_RSA=$enableval ],
758 if test "$ENABLED_RSA" = "no"
760 AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
762 # turn off RSA if leanpsk on
763 if test "$ENABLED_LEANPSK" = "yes"
765 AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
770 AM_CONDITIONAL([BUILD_RSA], [test "x$ENABLED_RSA" = "xyes"])
775 [ --enable-dh Enable DH (default: disabled)],
776 [ ENABLED_DH=$enableval ],
780 if test "$ENABLED_DH" = "no"
782 AM_CFLAGS="$AM_CFLAGS -DNO_DH"
784 # turn off DH if leanpsk on
785 if test "$ENABLED_LEANPSK" = "yes"
787 AM_CFLAGS="$AM_CFLAGS -DNO_DH"
792 AM_CONDITIONAL([BUILD_DH], [test "x$ENABLED_DH" = "xyes"])
796 # turn off asn, which means no certs, no rsa, no dh, no dsa, no ecc,
797 # and no big int, use this to disable all public key stuff
799 [ --enable-asn Enable ASN (default: enabled)],
800 [ ENABLED_ASN=$enableval ],
804 if test "$ENABLED_ASN" = "no"
806 AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
808 # turn off ASN if leanpsk on
809 if test "$ENABLED_LEANPSK" = "yes"
811 AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
816 if test "$ENABLED_RSA" = "yes" && test "$ENABLED_ASN" = "no"
818 AC_MSG_ERROR([please disable rsa if disabling asn.])
821 if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
823 AC_MSG_ERROR([please disable dsa if disabling asn.])
826 if test "$ENABLED_DH" = "yes" && test "$ENABLED_ASN" = "no"
828 AC_MSG_ERROR([please disable dh if disabling asn.])
831 if test "$ENABLED_ECC" = "yes" && test "$ENABLED_ASN" = "no"
833 AC_MSG_ERROR([please disable ecc if disabling asn.])
836 if test "$ENABLED_PSK" = "no" && test "$ENABLED_ASN" = "no"
838 AC_MSG_ERROR([please enable psk if disabling asn.])
841 if test "$ENABLED_ASN" = "no"
847 AM_CONDITIONAL([BUILD_ASN], [test "x$ENABLED_ASN" = "xyes"])
852 [ --enable-aes Enable AES (default: enabled)],
853 [ ENABLED_AES=$enableval ],
857 if test "$ENABLED_AES" = "no"
859 AM_CFLAGS="$AM_CFLAGS -DNO_AES"
861 # turn off AES if leanpsk on
862 if test "$ENABLED_LEANPSK" = "yes"
864 AM_CFLAGS="$AM_CFLAGS -DNO_AES"
869 AM_CONDITIONAL([BUILD_AES], [test "x$ENABLED_AES" = "xyes"])
873 AC_ARG_ENABLE([coding],
874 [ --enable-coding Enable Coding base 16/64 (default: enabled)],
875 [ ENABLED_CODING=$enableval ],
876 [ ENABLED_CODING=yes ]
879 if test "$ENABLED_CODING" = "no"
881 AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
883 # turn off CODING if leanpsk on
884 if test "$ENABLED_LEANPSK" = "yes"
886 AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
891 AM_CONDITIONAL([BUILD_CODING], [test "x$ENABLED_CODING" = "xyes"])
895 AC_ARG_ENABLE([des3],
896 [ --enable-des3 Enable DES3 (default: enabled)],
897 [ ENABLED_DES3=$enableval ],
901 if test "$ENABLED_DES3" = "no"
903 AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
905 # turn off DES3 if leanpsk on
906 if test "$ENABLED_LEANPSK" = "yes"
908 AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
913 AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"])
917 AC_ARG_ENABLE([arc4],
918 [ --enable-arc4 Enable ARC4 (default: enabled)],
919 [ ENABLED_ARC4=$enableval ],
923 if test "$ENABLED_ARC4" = "no"
925 AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
927 # turn off ARC4 if leanpsk on
928 if test "$ENABLED_LEANPSK" = "yes"
930 AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
935 AM_CONDITIONAL([BUILD_RC4], [test "x$ENABLED_ARC4" = "xyes"])
940 [ --enable-md5 Enable MD5 (default: enabled)],
941 [ ENABLED_MD5=$enableval ],
945 if test "$ENABLED_MD5" = "no"
947 AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
949 # turn off MD5 if leanpsk on
950 if test "$ENABLED_LEANPSK" = "yes"
952 AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
957 AM_CONDITIONAL([BUILD_MD5], [test "x$ENABLED_MD5" = "xyes"])
962 [ --enable-sha Enable SHA (default: enabled)],
963 [ ENABLED_SHA=$enableval ],
967 if test "$ENABLED_SHA" = "no"
969 AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
971 # turn off SHA if leanpsk on
972 if test "$ENABLED_LEANPSK" = "yes"
974 AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
979 AM_CONDITIONAL([BUILD_SHA], [test "x$ENABLED_SHA" = "xyes"])
984 [ --enable-md4 Enable MD4 (default: disabled)],
985 [ ENABLED_MD4=$enableval ],
989 if test "$ENABLED_MD4" = "no"
991 AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
994 AM_CONDITIONAL([BUILD_MD4], [test "x$ENABLED_MD4" = "xyes"])
998 AC_ARG_ENABLE([webserver],
999 [ --enable-webserver Enable Web Server (default: disabled)],
1000 [ ENABLED_WEBSERVER=$enableval ],
1001 [ ENABLED_WEBSERVER=no ]
1004 if test "$ENABLED_WEBSERVER" = "yes"
1006 AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
1011 AC_ARG_ENABLE([pwdbased],
1012 [ --enable-pwdbased Enable PWDBASED (default: disabled)],
1013 [ ENABLED_PWDBASED=$enableval ],
1014 [ ENABLED_PWDBASED=no ]
1017 if test "$ENABLED_PWDBASED" = "no"
1019 if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes"
1021 # opensslextra and webserver needs pwdbased
1022 ENABLED_PWDBASED=yes
1024 AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
1028 AM_CONDITIONAL([BUILD_PWDBASED], [test "x$ENABLED_PWDBASED" = "xyes"])
1032 AC_ARG_ENABLE([hc128],
1033 [ --enable-hc128 Enable HC-128 (default: disabled)],
1034 [ ENABLED_HC128=$enableval ],
1035 [ ENABLED_HC128=no ]
1038 if test "$ENABLED_HC128" = "no"
1040 AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
1042 AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
1045 AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
1049 AC_ARG_ENABLE([rabbit],
1050 [ --enable-rabbit Enable RABBIT (default: disabled)],
1051 [ ENABLED_RABBIT=$enableval ],
1052 [ ENABLED_RABBIT=no ]
1055 if test "$ENABLED_RABBIT" = "no"
1057 AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
1059 AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
1062 AM_CONDITIONAL([BUILD_RABBIT], [test "x$ENABLED_RABBIT" = "xyes"])
1066 AC_ARG_ENABLE([fips],
1067 [ --enable-fips Enable FIPS 140-2 (default: disabled)],
1068 [ ENABLED_FIPS=$enableval ],
1072 if test "x$ENABLED_FIPS" = "xyes"
1074 # requires thread local storage
1075 if test "$thread_ls_on" = "no"
1077 AC_MSG_ERROR([FIPS requires Thread Local Storage])
1080 if test "x$ENABLED_SHA512" = "xno"
1082 ENABLED_SHA512="yes"
1083 AM_CFLAGS="$AM_CFLAGS -DCYASSL_SHA512 -DCYASSL_SHA384"
1084 AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
1086 AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
1089 AM_CONDITIONAL([BUILD_FIPS], [test "x$ENABLED_FIPS" = "xyes"])
1093 AC_ARG_ENABLE([hashdrbg],
1094 [ --enable-hashdrbg Enable Hash DRBG support (default: disabled)],
1095 [ ENABLED_HASHDRBG=$enableval ],
1096 [ ENABLED_HASHDRBG=no ]
1099 if test "x$ENABLED_HASHDRBG" = "xyes"
1101 AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
1103 # turn on Hash DRBG if FIPS is on or ARC4 is off
1104 if test "x$ENABLED_FIPS" = "xyes" || test "x$ENABLED_ARC4" = "xno"
1106 AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
1107 ENABLED_HASHDRBG=yes
1113 AC_ARG_ENABLE([filesystem],
1114 [ --enable-filesystem Enable Filesystem support (default: enabled)],
1115 [ ENABLED_FILESYSTEM=$enableval ],
1116 [ ENABLED_FILESYSTEM=yes ]
1119 if test "$ENABLED_FILESYSTEM" = "no"
1121 AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
1123 # turn off filesystem if leanpsk on
1124 if test "$ENABLED_LEANPSK" = "yes"
1126 AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
1127 ENABLED_FILESYSTEM=no
1133 AC_ARG_ENABLE([inline],
1134 [ --enable-inline Enable inline functions (default: enabled)],
1135 [ ENABLED_INLINE=$enableval ],
1136 [ ENABLED_INLINE=yes ]
1139 if test "$ENABLED_INLINE" = "no"
1141 AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
1144 AM_CONDITIONAL([BUILD_INLINE], [test "x$ENABLED_INLINE" = "xyes"])
1148 AC_ARG_ENABLE([ocsp],
1149 [ --enable-ocsp Enable OCSP (default: disabled)],
1150 [ ENABLED_OCSP=$enableval ],
1151 [ ENABLED_OCSP=no ],
1154 if test "$ENABLED_OCSP" = "yes"
1156 AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
1159 AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
1162 if test "$ENABLED_OCSP" = "yes"
1164 # check openssl command tool for testing ocsp
1165 AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
1167 if test "$HAVE_OPENSSL_CMD" = "yes"
1169 AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
1171 AC_MSG_WARN([openssl command line tool not available for testing ocsp])
1177 AC_ARG_ENABLE([crl],
1178 [ --enable-crl Enable CRL (default: disabled)],
1179 [ ENABLED_CRL=$enableval ],
1183 if test "$ENABLED_CRL" = "yes"
1185 AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
1188 AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
1192 AC_ARG_ENABLE([crl-monitor],
1193 [ --enable-crl-monitor Enable CRL Monitor (default: disabled)],
1194 [ ENABLED_CRL_MONITOR=$enableval ],
1195 [ ENABLED_CRL_MONITOR=no ],
1198 if test "$ENABLED_CRL_MONITOR" = "yes"
1201 *linux* | *darwin* | *freebsd*)
1202 AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
1204 AC_MSG_ERROR([crl monitor only allowed on linux, OS X, or freebsd]) ;;
1208 AM_CONDITIONAL([BUILD_CRL_MONITOR], [test "x$ENABLED_CRL_MONITOR" = "xyes"])
1215 [ --with-ntru=PATH Path to NTRU install (default /usr/) ],
1217 AC_MSG_CHECKING([for NTRU])
1218 CPPFLAGS="$CPPFLAGS -DHAVE_NTRU"
1219 LIBS="$LIBS -lNTRUEncrypt"
1221 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ntru_crypto_drbg.h>]], [[ ntru_crypto_drbg_instantiate(0, 0, 0, 0, 0); ]])], [ ntru_linked=yes ],[ ntru_linked=no ])
1223 if test "x$ntru_linked" == "xno" ; then
1224 if test "x$withval" != "xno" ; then
1227 if test "x$withval" == "xyes" ; then
1231 LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
1232 CPPFLAGS="$CPPFLAGS -I$tryntrudir/include"
1234 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ntru_crypto_drbg.h>]], [[ ntru_crypto_drbg_instantiate(0, 0, 0, 0, 0); ]])], [ ntru_linked=yes ],[ ntru_linked=no ])
1236 if test "x$ntru_linked" == "xno" ; then
1237 AC_MSG_ERROR([NTRU isn't found.
1238 If it's already installed, specify its path using --with-ntru=/dir/])
1240 AC_MSG_RESULT([yes])
1241 AM_LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
1243 AC_MSG_RESULT([yes])
1246 AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU"
1251 AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
1253 if test "$ENABLED_NTRU" = "yes" && test "$ENABLED_SMALL" = "yes"
1255 AC_MSG_ERROR([cannot enable ntru and small, ntru requires TLS which small turns off.])
1259 AC_ARG_ENABLE([sni],
1260 [ --enable-sni Enable SNI (default: disabled)],
1261 [ ENABLED_SNI=$enableval ],
1265 if test "x$ENABLED_SNI" = "xyes"
1267 AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
1270 # Maximum Fragment Length
1271 AC_ARG_ENABLE([maxfragment],
1272 [ --enable-maxfragment Enable Maximum Fragment Length (default: disabled)],
1273 [ ENABLED_MAX_FRAGMENT=$enableval ],
1274 [ ENABLED_MAX_FRAGMENT=no ]
1277 if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
1279 AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
1283 AC_ARG_ENABLE([truncatedhmac],
1284 [ --enable-truncatedhmac Enable Truncated HMAC (default: disabled)],
1285 [ ENABLED_TRUNCATED_HMAC=$enableval ],
1286 [ ENABLED_TRUNCATED_HMAC=no ]
1289 if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
1291 AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
1294 # Renegotiation Indication
1295 AC_ARG_ENABLE([renegotiation-indication],
1296 [ --enable-renegotiation-indication Enable Renegotiation Indication (default: disabled)],
1297 [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
1298 [ ENABLED_RENEGOTIATION_INDICATION=no ]
1301 if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
1303 AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_RENEGOTIATION_INDICATION"
1306 # Supported Elliptic Curves Extensions
1307 AC_ARG_ENABLE([supportedcurves],
1308 [ --enable-supportedcurves Enable Supported Elliptic Curves (default: disabled)],
1309 [ ENABLED_SUPPORTED_CURVES=$enableval ],
1310 [ ENABLED_SUPPORTED_CURVES=no ]
1313 if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
1315 AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"
1319 AC_ARG_ENABLE([tlsx],
1320 [ --enable-tlsx Enable all TLS Extensions (default: disabled)],
1321 [ ENABLED_TLSX=$enableval ],
1325 if test "x$ENABLED_TLSX" = "xyes"
1328 ENABLED_MAX_FRAGMENT=yes
1329 ENABLED_TRUNCATED_HMAC=yes
1330 ENABLED_RENEGOTIATION_INDICATION=yes
1331 ENABLED_SUPPORTED_CURVES=yes
1332 AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_RENEGOTIATION_INDICATION -DHAVE_SUPPORTED_CURVES"
1336 AC_ARG_ENABLE([pkcs7],
1337 [ --enable-pkcs7 Enable PKCS7 (default: disabled)],
1338 [ ENABLED_PKCS7=$enableval ],
1339 [ ENABLED_PKCS7=no ],
1342 if test "$ENABLED_PKCS7" = "yes"
1344 AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
1347 AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
1350 # Simple Certificate Enrollment Protocol (SCEP)
1351 AC_ARG_ENABLE([scep],
1352 [ --enable-scep Enable wolfSCEP (default: disabled)],
1353 [ ENABLED_WOLFSCEP=$enableval ],
1354 [ ENABLED_WOLFSCEP=no ]
1356 if test "$ENABLED_WOLFSCEP" = "yes"
1358 # Enable prereqs if not already enabled
1359 if test "x$ENABLED_KEYGEN" = "xno"
1361 ENABLED_KEYGEN="yes"
1362 AM_CFLAGS="$AM_CFLAGS -DCYASSL_KEY_GEN"
1364 if test "x$ENABLED_CERTGEN" = "xno"
1366 ENABLED_CERTGEN="yes"
1367 AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_GEN"
1369 if test "x$ENABLED_CERTREQ" = "xno"
1371 ENABLED_CERTREQ="yes"
1372 AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_REQ"
1374 if test "x$ENABLED_PKCS7" = "xno"
1377 AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
1378 AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
1380 AM_CFLAGS="$AM_CFLAGS -DCYASSL_HAVE_WOLFSCEP"
1385 AC_ARG_ENABLE([smallstack],
1386 [ --enable-smallstack Enable Small Stack Usage (default: disabled)],
1387 [ ENABLED_SMALL_STACK=$enableval ],
1388 [ ENABLED_SMALL_STACK=no ]
1391 if test "x$ENABLED_SMALL_STACK" = "xyes"
1393 AM_CFLAGS="$AM_CFLAGS -DCYASSL_SMALL_STACK"
1398 AC_ARG_ENABLE([valgrind],
1399 [ --enable-valgrind Enable valgrind for unit tests (default: disabled)],
1400 [ ENABLED_VALGRIND=$enableval ],
1401 [ ENABLED_VALGRIND=no ]
1404 if test "$ENABLED_VALGRIND" = "yes"
1406 AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
1408 if test "$HAVE_VALGRIND" = "no"
1410 AC_MSG_ERROR([Valgrind not found.])
1414 AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
1417 AM_CONDITIONAL([USE_VALGRIND], [test "x$ENABLED_VALGRIND" = "xyes"])
1420 # Test certs, use internal cert functions for extra testing
1421 AC_ARG_ENABLE([testcert],
1422 [ --enable-testcert Enable Test Cert (default: disabled)],
1423 [ ENABLED_TESTCERT=$enableval ],
1424 [ ENABLED_TESTCERT=no ]
1427 if test "$ENABLED_TESTCERT" = "yes"
1429 AM_CFLAGS="$AM_CFLAGS -DCYASSL_TEST_CERT"
1433 # I/O Pool, an example to show user how to override memory handler and use
1434 # a pool for the input/output buffer requests
1435 AC_ARG_ENABLE([iopool],
1436 [ --enable-iopool Enable I/O Pool example (default: disabled)],
1437 [ ENABLED_IOPOOL=$enableval ],
1438 [ ENABLED_IOPOOL=no ]
1441 if test "$ENABLED_IOPOOL" = "yes"
1443 if test "$thread_ls_on" = "no"
1445 AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
1447 AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
1451 # Certificate Service Support
1452 AC_ARG_ENABLE([certservice],
1453 [ --enable-certservice Enable cert service (default: disabled)],
1454 [ ENABLED_CERT_SERVICE=$enableval ],
1455 [ ENABLED_CERT_SERVICE=no ]
1457 if test "$ENABLED_CERT_SERVICE" = "yes"
1459 # Requires ecc,certgen, and opensslextra make sure on
1460 if test "x$ENABLED_CERTGEN" = "xno"
1462 ENABLED_CERTGEN="yes"
1463 AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_GEN"
1465 if test "x$ENABLED_ECC" = "xno"
1468 AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
1469 AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
1471 if test "x$ENABLED_OPENSSLEXTRA" = "xno"
1473 ENABLED_OPENSSLEXTRA="yes"
1474 AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
1476 AM_CFLAGS="$AM_CFLAGS -DCYASSL_HAVE_CERT_SERVICE"
1480 # set fastmath default
1483 if test "$host_cpu" = "x86_64"
1485 FASTMATH_DEFAULT=yes
1489 AC_ARG_ENABLE([fastmath],
1490 [ --enable-fastmath Enable fast math ops (default: enabled on x86_64)],
1491 [ ENABLED_FASTMATH=$enableval ],
1492 [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
1495 if test "x$ENABLED_FASTMATH" = "xyes"
1497 # turn off fastmth if leanpsk on or asn off
1498 if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
1502 AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
1503 ENABLED_SLOWMATH="no"
1509 AC_ARG_ENABLE([fasthugemath],
1510 [ --enable-fasthugemath Enable fast math + huge code (default: disabled)],
1511 [ ENABLED_FASTHUGEMATH=$enableval ],
1512 [ ENABLED_FASTHUGEMATH=no ]
1515 if test "$ENABLED_BUMP" = "yes"
1517 ENABLED_FASTHUGEMATH="yes"
1520 if test "$ENABLED_FASTHUGEMATH" = "yes"
1522 ENABLED_FASTMATH="yes"
1523 AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
1524 ENABLED_SLOWMATH="no"
1527 AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
1528 AM_CONDITIONAL([BUILD_SLOWMATH], [test "x$ENABLED_SLOWMATH" = "xyes"])
1531 # Enable Examples, used to disable examples
1532 AC_ARG_ENABLE([examples],
1533 [ --enable-examples Enable Examples (default: enabled)],
1534 [ ENABLED_EXAMPLES=$enableval ],
1535 [ ENABLED_EXAMPLES=yes ]
1538 AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
1539 AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
1540 # certs still have sha signatures for now
1541 AS_IF([test "x$ENABLED_SHA" = "xno"], [ENABLED_EXAMPLES="no"])
1542 AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$ENABLED_EXAMPLES" = "xyes"])
1549 [ --with-libz=PATH PATH to libz install (default /usr/) ],
1551 AC_MSG_CHECKING([for libz])
1552 CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
1555 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
1557 if test "x$libz_linked" == "xno" ; then
1558 if test "x$withval" != "xno" ; then
1561 if test "x$withval" == "xyes" ; then
1565 AM_LDFLAGS="$AM_LDFLAGS -L$trylibzdir/lib"
1566 CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
1568 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
1570 if test "x$libz_linked" == "xno" ; then
1571 AC_MSG_ERROR([libz isn't found.
1572 If it's already installed, specify its path using --with-libz=/dir/])
1574 AC_MSG_RESULT([yes])
1576 AC_MSG_RESULT([yes])
1581 AM_CONDITIONAL([BUILD_LIBZ], [test "x$ENABLED_LIBZ" = "xyes"])
1586 AC_ARG_WITH([cavium],
1587 [ --with-cavium=PATH PATH to cavium/software dir ],
1589 AC_MSG_CHECKING([for cavium])
1590 CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
1592 if test "x$withval" == "xyes" ; then
1593 AC_MSG_ERROR([need a PATH for --with-cavium])
1595 if test "x$withval" != "xno" ; then
1596 trycaviumdir=$withval
1599 LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
1600 CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
1602 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
1604 if test "x$cavium_linked" == "xno" ; then
1605 AC_MSG_ERROR([cavium isn't found.
1606 If it's already installed, specify its path using --with-cavium=/dir/])
1608 AC_MSG_RESULT([yes])
1616 AC_ARG_ENABLE([mcapi],
1617 [ --enable-mcapi Enable Microchip API (default: disabled)],
1618 [ ENABLED_MCAPI=$enableval ],
1619 [ ENABLED_MCAPI=no ]
1622 if test "$ENABLED_MCAPI" = "yes"
1624 AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI -DCYASSL_AES_COUNTER -DCYASSL_AES_DIRECT"
1627 if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
1629 AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
1632 if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
1634 AC_MSG_ERROR([please enable ecc if enabling mcapi.])
1637 if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
1639 AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
1642 AM_CONDITIONAL([BUILD_MCAPI], [test "x$ENABLED_MCAPI" = "xyes"])
1647 if test "$GCC" = "yes"
1649 AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
1650 if test "$ax_enable_debug" = "no"
1652 if test "$ENABLED_FASTMATH" = "yes"
1654 AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
1655 if test "$ENABLED_FASTHUGEMATH" = "yes"
1657 AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
1660 AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
1665 # ICC command line warning for non supported warning flags
1666 if test "$CC" = "icc"
1668 AM_CFLAGS="$AM_CFLAGS -wd10006"
1673 AX_HARDEN_CC_COMPILER_FLAGS
1675 # link to ws2_32 if on mingw
1678 LDFLAGS="$LDFLAGS -lws2_32" ;;
1681 # add user C_EXTRA_FLAGS back
1682 CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
1683 OPTION_FLAGS="$USER_C_EXTRA_FLAGS $AM_CFLAGS"
1686 AC_SUBST([AM_CPPFLAGS])
1687 AC_SUBST([AM_CFLAGS])
1688 AC_SUBST([AM_LDFLAGS])
1691 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1692 AC_CONFIG_FILES([Makefile])
1693 AC_CONFIG_FILES([cyassl/version.h])
1694 AC_CONFIG_FILES([cyassl/options.h])
1695 AC_CONFIG_FILES([support/cyassl.pc])
1696 AC_CONFIG_FILES([rpm/spec])
1698 AX_CREATE_GENERIC_CONFIG
1699 AX_AM_JOBSERVER([yes])
1706 echo "Running make clean..."
1707 make clean >/dev/null 2>&1
1708 # Touch files that may not be in repository
1709 echo "Touching File..."
1710 touch ctaocrypt/src/fips.c
1711 touch ctaocrypt/src/fips_test.c
1714 # generate user options header
1716 echo "Generating user options header..."
1717 OPTION_FILE="cyassl/options.h"
1720 echo "/* cyassl options.h" > $OPTION_FILE
1721 echo " * generated from configure options" >> $OPTION_FILE
1722 echo " *" >> $OPTION_FILE
1723 echo " * Copyright (C) 2006-2014 wolfSSL Inc." >> $OPTION_FILE
1724 echo " *" >> $OPTION_FILE
1725 echo " * This file is part of CyaSSL." >> $OPTION_FILE
1726 echo " *" >> $OPTION_FILE
1727 echo " */" >> $OPTION_FILE
1729 echo "" >> $OPTION_FILE
1730 echo "#pragma once" >> $OPTION_FILE
1731 echo "" >> $OPTION_FILE
1732 echo "#ifdef __cplusplus" >> $OPTION_FILE
1733 echo "extern \"C\" {" >> $OPTION_FILE
1734 echo "#endif" >> $OPTION_FILE
1735 echo "" >> $OPTION_FILE
1737 for option in $OPTION_FLAGS; do
1738 defonly=`echo $option | sed 's/-D//'`
1739 if test "$defonly" != "$option"
1741 noequalsign=`echo $defonly | sed 's/=/ /'`
1742 echo "#undef $noequalsign" >> $OPTION_FILE
1743 echo "#define $noequalsign" >> $OPTION_FILE
1744 echo "" >> $OPTION_FILE
1746 echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
1750 echo "" >> $OPTION_FILE
1751 echo "#ifdef __cplusplus" >> $OPTION_FILE
1752 echo "}" >> $OPTION_FILE
1753 echo "#endif" >> $OPTION_FILE
1754 echo "" >> $OPTION_FILE
1757 # output config summary
1759 echo "Configuration summary for $PACKAGE_NAME version $VERSION"
1761 echo " * Installation prefix: $prefix"
1762 echo " * System type: $host_vendor-$host_os"
1763 echo " * Host CPU: $host_cpu"
1764 echo " * C Compiler: $CC"
1765 echo " * C Flags: $CFLAGS"
1766 echo " * C++ Compiler: $CXX"
1767 echo " * C++ Flags: $CXXFLAGS"
1768 echo " * CPP Flags: $CPPFLAGS"
1769 echo " * LIB Flags: $LIB"
1770 echo " * Debug enabled: $ax_enable_debug"
1771 echo " * Warnings as failure: $ac_cv_warnings_as_errors"
1772 echo " * make -j: $enable_jobserver"
1773 echo " * VCS checkout: $ac_cv_vcs_checkout"
1776 echo " * Single threaded: $ENABLED_SINGLETHREADED"
1777 echo " * Filesystem: $ENABLED_FILESYSTEM"
1778 echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
1779 echo " * fastmath: $ENABLED_FASTMATH"
1780 echo " * sniffer: $ENABLED_SNIFFER"
1781 echo " * snifftest: $ENABLED_SNIFFTEST"
1782 echo " * ARC4: $ENABLED_ARC4"
1783 echo " * AES: $ENABLED_AES"
1784 echo " * AES-NI: $ENABLED_AESNI"
1785 echo " * AES-GCM: $ENABLED_AESGCM"
1786 echo " * AES-CCM: $ENABLED_AESCCM"
1787 echo " * DES3: $ENABLED_DES3"
1788 echo " * Camellia: $ENABLED_CAMELLIA"
1789 echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
1790 echo " * MD5: $ENABLED_MD5"
1791 echo " * RIPEMD: $ENABLED_RIPEMD"
1792 echo " * SHA: $ENABLED_SHA"
1793 echo " * SHA-512: $ENABLED_SHA512"
1794 echo " * BLAKE2: $ENABLED_BLAKE2"
1795 echo " * keygen: $ENABLED_KEYGEN"
1796 echo " * certgen: $ENABLED_CERTGEN"
1797 echo " * certreq: $ENABLED_CERTREQ"
1798 echo " * HC-128: $ENABLED_HC128"
1799 echo " * RABBIT: $ENABLED_RABBIT"
1800 echo " * Hash DRBG: $ENABLED_HASHDRBG"
1801 echo " * PWDBASED: $ENABLED_PWDBASED"
1802 echo " * HKDF: $ENABLED_HKDF"
1803 echo " * MD4: $ENABLED_MD4"
1804 echo " * PSK: $ENABLED_PSK"
1805 echo " * LEANPSK: $ENABLED_LEANPSK"
1806 echo " * RSA: $ENABLED_RSA"
1807 echo " * DSA: $ENABLED_DSA"
1808 echo " * DH: $ENABLED_DH"
1809 echo " * ECC: $ENABLED_ECC"
1810 echo " * FPECC: $ENABLED_FPECC"
1811 echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
1812 echo " * ASN: $ENABLED_ASN"
1813 echo " * CODING: $ENABLED_CODING"
1814 echo " * MEMORY: $ENABLED_MEMORY"
1815 echo " * I/O POOL: $ENABLED_IOPOOL"
1816 echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
1817 echo " * DTLS: $ENABLED_DTLS"
1818 echo " * Old TLS Versions: $ENABLED_OLD_TLS"
1819 echo " * OCSP: $ENABLED_OCSP"
1820 echo " * CRL: $ENABLED_CRL"
1821 echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
1822 echo " * Persistent session cache: $ENABLED_SAVESESSION"
1823 echo " * Persistent cert cache: $ENABLED_SAVECERT"
1824 echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
1825 echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
1826 echo " * NTRU: $ENABLED_NTRU"
1827 echo " * SNI: $ENABLED_SNI"
1828 echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
1829 echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
1830 echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
1831 echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
1832 echo " * All TLS Extensions: $ENABLED_TLSX"
1833 echo " * PKCS#7 $ENABLED_PKCS7"
1834 echo " * wolfSCEP $ENABLED_WOLFSCEP"
1835 echo " * Small Stack: $ENABLED_SMALL_STACK"
1836 echo " * valgrind unit tests: $ENABLED_VALGRIND"
1837 echo " * LIBZ: $ENABLED_LIBZ"
1838 echo " * Examples: $ENABLED_EXAMPLES"