configure.ac 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909
  1. # configure.ac
  2. #
  3. # Copyright (C) 2006-2014 wolfSSL Inc.
  4. #
  5. # This file is part of CyaSSL.
  6. #
  7. #
  8. AC_INIT([cyassl],[3.2.6],[https://github.com/cyassl/cyassl/issues],[cyassl],[http://www.wolfssl.com])
  9. AC_CONFIG_AUX_DIR([build-aux])
  10. AC_CANONICAL_HOST
  11. AC_CANONICAL_BUILD
  12. AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
  13. AC_PREREQ([2.63])
  14. AC_ARG_PROGRAM
  15. AC_DEFUN([PROTECT_AC_USE_SYSTEM_EXTENSIONS],
  16. [AX_SAVE_FLAGS
  17. AC_LANG_PUSH([C])
  18. AC_USE_SYSTEM_EXTENSIONS
  19. AC_LANG_POP([C])
  20. AX_RESTORE_FLAGS
  21. ])
  22. #PROTECT_AC_USE_SYSTEM_EXTENSIONS
  23. AC_CONFIG_MACRO_DIR([m4])
  24. AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
  25. #shared library versioning
  26. CYASSL_LIBRARY_VERSION=6:0:1
  27. # | | |
  28. # +------+ | +---+
  29. # | | |
  30. # current:revision:age
  31. # | | |
  32. # | | +- increment if interfaces have been added
  33. # | | set to zero if interfaces have been removed
  34. # | or changed
  35. # | +- increment if source code has changed
  36. # | set to zero if current is incremented
  37. # +- increment if interfaces have been added, removed or changed
  38. AC_SUBST([CYASSL_LIBRARY_VERSION])
  39. # capture user C_EXTRA_FLAGS from ./configure line, CFLAGS may hold -g -O2 even
  40. # if user doesn't override, no way to tell
  41. USER_C_EXTRA_FLAGS="$C_EXTRA_FLAGS"
  42. LT_PREREQ([2.2])
  43. LT_INIT([disable-static],[win32-dll])
  44. LT_LANG([C++])
  45. LT_LANG([C])
  46. gl_VISIBILITY
  47. AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
  48. AM_CPPFLAGS="$AM_CPPFLAGS $CFLAG_VISIBILITY"
  49. CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"
  50. ])
  51. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  52. AC_CHECK_FUNCS([gethostbyname])
  53. AC_CHECK_FUNCS([getaddrinfo])
  54. AC_CHECK_FUNCS([gettimeofday])
  55. AC_CHECK_FUNCS([inet_ntoa])
  56. AC_CHECK_FUNCS([memset])
  57. AC_CHECK_FUNCS([socket])
  58. AC_CHECK_HEADERS([arpa/inet.h])
  59. AC_CHECK_HEADERS([fcntl.h])
  60. AC_CHECK_HEADERS([limits.h])
  61. AC_CHECK_HEADERS([netdb.h])
  62. AC_CHECK_HEADERS([netinet/in.h])
  63. AC_CHECK_HEADERS([stddef.h])
  64. AC_CHECK_HEADERS([sys/ioctl.h])
  65. AC_CHECK_HEADERS([sys/socket.h])
  66. AC_CHECK_HEADERS([sys/time.h])
  67. AC_CHECK_HEADERS([errno.h])
  68. AC_CHECK_LIB(network,socket)
  69. AC_CHECK_SIZEOF(long long, 8)
  70. AC_CHECK_SIZEOF(long, 4)
  71. AC_CHECK_TYPES(__uint128_t)
  72. AC_C_BIGENDIAN
  73. # mktime check takes forever on some systems, if time supported it would be
  74. # highly unusual for mktime to be missing
  75. #AC_FUNC_MKTIME
  76. AC_PROG_CC
  77. AC_PROG_CC_C_O
  78. AC_PROG_CXX
  79. AC_PROG_INSTALL
  80. AC_TYPE_SIZE_T
  81. AC_TYPE_UINT8_T
  82. AM_PROG_AS
  83. AM_PROG_CC_C_O
  84. LT_LIB_M
  85. OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
  86. OPTIMIZE_FAST_CFLAGS="-O2 -fomit-frame-pointer"
  87. OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
  88. DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_CYASSL"
  89. thread_ls_on=no
  90. # Thread local storage
  91. AX_TLS([
  92. [AM_CFLAGS="$AM_CFLAGS -DHAVE_THREAD_LS"]
  93. [thread_ls_on=yes]
  94. ] , [:])
  95. # DEBUG
  96. AX_DEBUG
  97. AS_IF([test "$ax_enable_debug" = "yes"],
  98. [AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"],
  99. [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
  100. # SINGLE THREADED
  101. AC_ARG_ENABLE([singlethreaded],
  102. [ --enable-singlethreaded Enable CyaSSL single threaded (default: disabled)],
  103. [ ENABLED_SINGLETHREADED=$enableval ],
  104. [ ENABLED_SINGLETHREADED=no ])
  105. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
  106. AX_PTHREAD([
  107. AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
  108. AM_CFLAGS="-D_POSIX_THREADS $AM_CFLAGS $PTHREAD_CFLAGS"
  109. LIBS="$LIBS $PTHREAD_LIBS"
  110. ],[
  111. ENABLED_SINGLETHREADED=yes
  112. ])
  113. ])
  114. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="-DSINGLE_THREADED $AM_CFLAGS" ])
  115. # DTLS
  116. AC_ARG_ENABLE([dtls],
  117. [ --enable-dtls Enable CyaSSL DTLS (default: disabled)],
  118. [ ENABLED_DTLS=$enableval ],
  119. [ ENABLED_DTLS=no ]
  120. )
  121. if test "$ENABLED_DTLS" = "yes"
  122. then
  123. AM_CFLAGS="-DCYASSL_DTLS $AM_CFLAGS"
  124. fi
  125. # OPENSSL Extra Compatibility
  126. AC_ARG_ENABLE([opensslextra],
  127. [ --enable-opensslextra Enable extra OpenSSL API, size+ (default: disabled)],
  128. [ ENABLED_OPENSSLEXTRA=$enableval ],
  129. [ ENABLED_OPENSSLEXTRA=no ]
  130. )
  131. if test "$ENABLED_OPENSSLEXTRA" = "yes"
  132. then
  133. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  134. fi
  135. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
  136. then
  137. AC_MSG_ERROR([cannot enable small and opensslextra, only one or the other.])
  138. fi
  139. # IPv6 Test Apps
  140. AC_ARG_ENABLE([ipv6],
  141. [ --enable-ipv6 Enable testing of IPV6 (default: disabled)],
  142. [ ENABLED_IPV6=$enableval ],
  143. [ ENABLED_IPV6=no ]
  144. )
  145. if test "$ENABLED_IPV6" = "yes"
  146. then
  147. AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6"
  148. fi
  149. # Fortress build
  150. AC_ARG_ENABLE([fortress],
  151. [ --enable-fortress Enable SSL fortress build (default: disabled)],
  152. [ ENABLED_FORTRESS=$enableval ],
  153. [ ENABLED_FORTRESS=no ]
  154. )
  155. if test "$ENABLED_FORTRESS" = "yes"
  156. then
  157. 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"
  158. fi
  159. # ssl bump build
  160. AC_ARG_ENABLE([bump],
  161. [ --enable-bump Enable SSL Bump build (default: disabled)],
  162. [ ENABLED_BUMP=$enableval ],
  163. [ ENABLED_BUMP=no ]
  164. )
  165. if test "$ENABLED_BUMP" = "yes"
  166. then
  167. 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"
  168. fi
  169. ENABLED_SLOWMATH="yes"
  170. # lean psk build
  171. AC_ARG_ENABLE([leanpsk],
  172. [ --enable-leanpsk Enable Lean PSK build (default: disabled)],
  173. [ ENABLED_LEANPSK=$enableval ],
  174. [ ENABLED_LEANPSK=no ]
  175. )
  176. if test "$ENABLED_LEANPSK" = "yes"
  177. then
  178. 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"
  179. ENABLED_SLOWMATH="no"
  180. ENABLED_SINGLETHREADED="yes"
  181. fi
  182. AM_CONDITIONAL([BUILD_LEANPSK], [test "x$ENABLED_LEANPSK" = "xyes"])
  183. # big cache
  184. AC_ARG_ENABLE([bigcache],
  185. [ --enable-bigcache Enable big session cache (default: disabled)],
  186. [ ENABLED_BIGCACHE=$enableval ],
  187. [ ENABLED_BIGCACHE=no ]
  188. )
  189. if test "$ENABLED_BIGCACHE" = "yes"
  190. then
  191. AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
  192. fi
  193. # HUGE cache
  194. AC_ARG_ENABLE([hugecache],
  195. [ --enable-hugecache Enable huge session cache (default: disabled)],
  196. [ ENABLED_HUGECACHE=$enableval ],
  197. [ ENABLED_HUGECACHE=no ]
  198. )
  199. if test "$ENABLED_HUGECACHE" = "yes"
  200. then
  201. AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
  202. fi
  203. # SMALL cache
  204. AC_ARG_ENABLE([smallcache],
  205. [ --enable-smallcache Enable small session cache (default: disabled)],
  206. [ ENABLED_SMALLCACHE=$enableval ],
  207. [ ENABLED_SMALLCACHE=no ]
  208. )
  209. if test "$ENABLED_SMALLCACHE" = "yes"
  210. then
  211. AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
  212. fi
  213. # Persistent session cache
  214. AC_ARG_ENABLE([savesession],
  215. [ --enable-savesession Enable persistent session cache (default: disabled)],
  216. [ ENABLED_SAVESESSION=$enableval ],
  217. [ ENABLED_SAVESESSION=no ]
  218. )
  219. if test "$ENABLED_SAVESESSION" = "yes"
  220. then
  221. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  222. fi
  223. # Persistent cert cache
  224. AC_ARG_ENABLE([savecert],
  225. [ --enable-savecert Enable persistent cert cache (default: disabled)],
  226. [ ENABLED_SAVECERT=$enableval ],
  227. [ ENABLED_SAVECERT=no ]
  228. )
  229. if test "$ENABLED_SAVECERT" = "yes"
  230. then
  231. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  232. fi
  233. # Atomic User Record Layer
  234. AC_ARG_ENABLE([atomicuser],
  235. [ --enable-atomicuser Enable Atomic User Record Layer (default: disabled)],
  236. [ ENABLED_ATOMICUSER=$enableval ],
  237. [ ENABLED_ATOMICUSER=no ]
  238. )
  239. if test "$ENABLED_ATOMICUSER" = "yes"
  240. then
  241. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  242. fi
  243. # Public Key Callbacks
  244. AC_ARG_ENABLE([pkcallbacks],
  245. [ --enable-pkcallbacks Enable Public Key Callbacks (default: disabled)],
  246. [ ENABLED_PKCALLBACKS=$enableval ],
  247. [ ENABLED_PKCALLBACKS=no ]
  248. )
  249. if test "$ENABLED_PKCALLBACKS" = "yes"
  250. then
  251. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  252. fi
  253. # SNIFFER
  254. ENABLED_SNIFFTEST=no
  255. AC_ARG_ENABLE([sniffer],
  256. [AS_HELP_STRING([--enable-sniffer],[ Enable CyaSSL sniffer support (default: disabled) ])],[
  257. ENABLED_SNIFFER=yes
  258. AM_CFLAGS="$AM_CFLAGS -DCYASSL_SNIFFER -DOPENSSL_EXTRA"
  259. AS_IF([ test "x$enableval" = "xyes" ],[ AC_CHECK_HEADERS([pcap/pcap.h],[
  260. ENABLED_SNIFFTEST=yes
  261. ],[ AC_MSG_WARN([cannot enable sniffer test without having libpcap available.]) ]) ])
  262. ],[
  263. ENABLED_SNIFFER=no
  264. ])
  265. AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" ])
  266. AM_CONDITIONAL([BUILD_SNIFFTEST], [ test "x$ENABLED_SNIFFTEST" = "xyes" ])
  267. # AES-GCM
  268. AC_ARG_ENABLE([aesgcm],
  269. [ --enable-aesgcm Enable CyaSSL AES-GCM support (default: disabled)],
  270. [ ENABLED_AESGCM=$enableval ],
  271. [ ENABLED_AESGCM=no ]
  272. )
  273. if test "$ENABLED_AESGCM" = "word32"
  274. then
  275. AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
  276. ENABLED_AESGCM=yes
  277. fi
  278. if test "$ENABLED_AESGCM" = "small"
  279. then
  280. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
  281. ENABLED_AESGCM=yes
  282. fi
  283. if test "$ENABLED_AESGCM" = "table"
  284. then
  285. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
  286. ENABLED_AESGCM=yes
  287. fi
  288. if test "$ENABLED_AESGCM" = "yes"
  289. then
  290. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  291. fi
  292. AM_CONDITIONAL([BUILD_AESGCM], [test "x$ENABLED_AESGCM" = "xyes"])
  293. # AES-CCM
  294. AC_ARG_ENABLE([aesccm],
  295. [ --enable-aesccm Enable CyaSSL AES-CCM support (default: disabled)],
  296. [ ENABLED_AESCCM=$enableval ],
  297. [ ENABLED_AESCCM=no ]
  298. )
  299. if test "$ENABLED_AESCCM" = "yes"
  300. then
  301. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
  302. fi
  303. AM_CONDITIONAL([BUILD_AESCCM], [test "x$ENABLED_AESCCM" = "xyes"])
  304. # AES-NI
  305. AC_ARG_ENABLE([aesni],
  306. [ --enable-aesni Enable CyaSSL AES-NI support (default: disabled)],
  307. [ ENABLED_AESNI=$enableval ],
  308. [ ENABLED_AESNI=no ]
  309. )
  310. if test "$ENABLED_AESNI" = "yes"
  311. then
  312. AM_CFLAGS="$AM_CFLAGS -DCYASSL_AESNI"
  313. if test "$GCC" = "yes"
  314. then
  315. # GCC needs these flags, icc doesn't
  316. # opt levels greater than 2 may cause problems on systems w/o aesni
  317. if test "$CC" != "icc"
  318. then
  319. AM_CFLAGS="$AM_CFLAGS -maes -msse4"
  320. fi
  321. fi
  322. fi
  323. AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
  324. # POLY1305
  325. AC_ARG_ENABLE([poly1305],
  326. [ --enable-poly1305 Enable CyaSSL POLY1305 support (default: disabled)],
  327. [ ENABLED_POLY1305=$enableval ],
  328. [ ENABLED_POLY1305=no ]
  329. )
  330. if test "$ENABLED_POLY1305" = "yes"
  331. then
  332. AM_CFLAGS="$AM_CFLAGS -DHAVE_POLY1305 -DHAVE_ONE_TIME_AUTH"
  333. fi
  334. AM_CONDITIONAL([BUILD_POLY1305], [test "x$ENABLED_POLY1305" = "xyes"])
  335. # Camellia
  336. AC_ARG_ENABLE([camellia],
  337. [ --enable-camellia Enable CyaSSL Camellia support (default: disabled)],
  338. [ ENABLED_CAMELLIA=$enableval ],
  339. [ ENABLED_CAMELLIA=no ]
  340. )
  341. if test "$ENABLED_CAMELLIA" = "yes"
  342. then
  343. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
  344. fi
  345. AM_CONDITIONAL([BUILD_CAMELLIA], [test "x$ENABLED_CAMELLIA" = "xyes"])
  346. # MD2
  347. AC_ARG_ENABLE([md2],
  348. [ --enable-md2 Enable CyaSSL MD2 support (default: disabled)],
  349. [ ENABLED_MD2=$enableval ],
  350. [ ENABLED_MD2=no ]
  351. )
  352. if test "$ENABLED_BUMP" = "yes"
  353. then
  354. ENABLED_MD2="yes"
  355. fi
  356. if test "$ENABLED_MD2" = "yes"
  357. then
  358. AM_CFLAGS="$AM_CFLAGS -DCYASSL_MD2"
  359. fi
  360. AM_CONDITIONAL([BUILD_MD2], [test "x$ENABLED_MD2" = "xyes"])
  361. # NULL CIPHER
  362. AC_ARG_ENABLE([nullcipher],
  363. [ --enable-nullcipher Enable CyaSSL NULL cipher support (default: disabled)],
  364. [ ENABLED_NULL_CIPHER=$enableval ],
  365. [ ENABLED_NULL_CIPHER=no ]
  366. )
  367. if test "$ENABLED_NULL_CIPHER" = "yes"
  368. then
  369. AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  370. fi
  371. # RIPEMD
  372. AC_ARG_ENABLE([ripemd],
  373. [ --enable-ripemd Enable CyaSSL RIPEMD-160 support (default: disabled)],
  374. [ ENABLED_RIPEMD=$enableval ],
  375. [ ENABLED_RIPEMD=no ]
  376. )
  377. if test "$ENABLED_RIPEMD" = "yes"
  378. then
  379. AM_CFLAGS="$AM_CFLAGS -DCYASSL_RIPEMD"
  380. fi
  381. AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
  382. # BLAKE2
  383. AC_ARG_ENABLE([blake2],
  384. [ --enable-blake2 Enable CyaSSL BLAKE2 support (default: disabled)],
  385. [ ENABLED_BLAKE2=$enableval ],
  386. [ ENABLED_BLAKE2=no ]
  387. )
  388. if test "$ENABLED_BLAKE2" = "yes"
  389. then
  390. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2"
  391. fi
  392. AM_CONDITIONAL([BUILD_BLAKE2], [test "x$ENABLED_BLAKE2" = "xyes"])
  393. # SHA512
  394. AC_ARG_ENABLE([sha512],
  395. [ --enable-sha512 Enable CyaSSL SHA-512 support (default: disabled)],
  396. [ ENABLED_SHA512=$enableval ],
  397. [ ENABLED_SHA512=no ]
  398. )
  399. if test "$ENABLED_SHA512" = "yes"
  400. then
  401. AM_CFLAGS="$AM_CFLAGS -DCYASSL_SHA512 -DCYASSL_SHA384"
  402. fi
  403. if test "$ENABLED_FORTRESS" = "yes"
  404. then
  405. ENABLED_SHA512="yes"
  406. fi
  407. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  408. # SESSION CERTS
  409. AC_ARG_ENABLE([sessioncerts],
  410. [ --enable-sessioncerts Enable session cert storing (default: disabled)],
  411. [ ENABLED_SESSIONCERTS=$enableval ],
  412. [ ENABLED_SESSIONCERTS=no ]
  413. )
  414. if test "$ENABLED_SESSIONCERTS" = "yes"
  415. then
  416. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  417. fi
  418. # KEY GENERATION
  419. AC_ARG_ENABLE([keygen],
  420. [ --enable-keygen Enable key generation (default: disabled)],
  421. [ ENABLED_KEYGEN=$enableval ],
  422. [ ENABLED_KEYGEN=no ]
  423. )
  424. if test "$ENABLED_KEYGEN" = "yes"
  425. then
  426. AM_CFLAGS="$AM_CFLAGS -DCYASSL_KEY_GEN"
  427. fi
  428. # CERT GENERATION
  429. AC_ARG_ENABLE([certgen],
  430. [ --enable-certgen Enable cert generation (default: disabled)],
  431. [ ENABLED_CERTGEN=$enableval ],
  432. [ ENABLED_CERTGEN=no ]
  433. )
  434. if test "$ENABLED_CERTGEN" = "yes"
  435. then
  436. AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_GEN"
  437. fi
  438. # CERT REQUEST GENERATION
  439. AC_ARG_ENABLE([certreq],
  440. [ --enable-certreq Enable cert request generation (default: disabled)],
  441. [ ENABLED_CERTREQ=$enableval ],
  442. [ ENABLED_CERTREQ=no ]
  443. )
  444. if test "$ENABLED_CERTREQ" = "yes"
  445. then
  446. if test "$ENABLED_CERTGEN" = "no"
  447. then
  448. AC_MSG_ERROR([cannot enable certreq without enabling certgen.])
  449. fi
  450. AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_REQ"
  451. fi
  452. # SEP
  453. AC_ARG_ENABLE([sep],
  454. [ --enable-sep Enable sep extensions (default: disabled)],
  455. [ ENABLED_SEP=$enableval ],
  456. [ ENABLED_SEP=no ]
  457. )
  458. if test "$ENABLED_SEP" = "yes"
  459. then
  460. AM_CFLAGS="-DCYASSL_SEP -DKEEP_PEER_CERT $AM_CFLAGS"
  461. fi
  462. # HKDF
  463. AC_ARG_ENABLE([hkdf],
  464. [ --enable-hkdf Enable HKDF (HMAC-KDF) support (default: disabled)],
  465. [ ENABLED_HKDF=$enableval ],
  466. [ ENABLED_HKDF=no ]
  467. )
  468. if test "$ENABLED_HKDF" = "yes"
  469. then
  470. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
  471. fi
  472. # DSA
  473. AC_ARG_ENABLE([dsa],
  474. [ --enable-dsa Enable DSA (default: disabled)],
  475. [ ENABLED_DSA=$enableval ],
  476. [ ENABLED_DSA=no ]
  477. )
  478. if test "$ENABLED_DSA" = "no"
  479. then
  480. AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
  481. fi
  482. AM_CONDITIONAL([BUILD_DSA], [test "x$ENABLED_DSA" = "xyes"])
  483. # ECC
  484. AC_ARG_ENABLE([ecc],
  485. [ --enable-ecc Enable ECC (default: disabled)],
  486. [ ENABLED_ECC=$enableval ],
  487. [ ENABLED_ECC=no ]
  488. )
  489. if test "$ENABLED_ECC" = "yes"
  490. then
  491. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
  492. fi
  493. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  494. if test "$ENABLED_ECC" = "yes" && test "$ENABLED_SMALL" = "yes"
  495. then
  496. AC_MSG_ERROR([cannot enable ecc and small, ecc requires TLS which small turns off.])
  497. fi
  498. # FP ECC, Fixed Point cache ECC
  499. AC_ARG_ENABLE([fpecc],
  500. [ --enable-fpecc Enable Fixed Point cache ECC (default: disabled)],
  501. [ ENABLED_FPECC=$enableval ],
  502. [ ENABLED_FPECC=no ]
  503. )
  504. if test "$ENABLED_FPECC" = "yes"
  505. then
  506. if test "$ENABLED_ECC" = "no"
  507. then
  508. AC_MSG_ERROR([cannot enable fpecc without enabling ecc.])
  509. fi
  510. AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
  511. fi
  512. # ECC encrypt
  513. AC_ARG_ENABLE([eccencrypt],
  514. [ --enable-eccencrypt Enable ECC encrypt (default: disabled)],
  515. [ ENABLED_ECC_ENCRYPT=$enableval ],
  516. [ ENABLED_ECC_ENCRYPT=no ]
  517. )
  518. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  519. then
  520. if test "$ENABLED_ECC" = "no"
  521. then
  522. AC_MSG_ERROR([cannot enable eccencrypt without enabling ecc.])
  523. fi
  524. if test "$ENABLED_HKDF" = "no"
  525. then
  526. AC_MSG_ERROR([cannot enable eccencrypt without enabling hkdf.])
  527. fi
  528. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_ENCRYPT"
  529. fi
  530. # PSK
  531. AC_ARG_ENABLE([psk],
  532. [ --enable-psk Enable PSK (default: disabled)],
  533. [ ENABLED_PSK=$enableval ],
  534. [ ENABLED_PSK=no ]
  535. )
  536. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no"
  537. then
  538. AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
  539. fi
  540. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "yes"
  541. then
  542. ENABLED_PSK=yes
  543. fi
  544. # ERROR STRINGS
  545. AC_ARG_ENABLE([errorstrings],
  546. [ --enable-errorstrings Enable error strings table (default: enabled)],
  547. [ ENABLED_ERROR_STRINGS=$enableval ],
  548. [ ENABLED_ERROR_STRINGS=yes ]
  549. )
  550. if test "$ENABLED_ERROR_STRINGS" = "no"
  551. then
  552. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  553. else
  554. # turn off error strings if leanpsk on
  555. if test "$ENABLED_LEANPSK" = "yes"
  556. then
  557. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  558. ENABLED_ERROR_STRINGS=no
  559. fi
  560. fi
  561. # OLD TLS
  562. AC_ARG_ENABLE([oldtls],
  563. [ --enable-oldtls Enable old TLS versions < 1.2 (default: enabled)],
  564. [ ENABLED_OLD_TLS=$enableval ],
  565. [ ENABLED_OLD_TLS=yes ]
  566. )
  567. if test "$ENABLED_OLD_TLS" = "no"
  568. then
  569. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  570. else
  571. # turn off old if leanpsk on
  572. if test "$ENABLED_LEANPSK" = "yes"
  573. then
  574. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  575. ENABLED_OLD_TLS=no
  576. fi
  577. fi
  578. # STACK SIZE info for examples
  579. AC_ARG_ENABLE([stacksize],
  580. [ --enable-stacksize Enable stack size info on examples (default: disabled)],
  581. [ ENABLED_STACKSIZE=$enableval ],
  582. [ ENABLED_STACKSIZE=no ]
  583. )
  584. if test "$ENABLED_STACKSIZE" = "yes"
  585. then
  586. AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  587. AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
  588. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE -DCYASSL_LOW_MEMORY"
  589. fi
  590. # MEMORY
  591. AC_ARG_ENABLE([memory],
  592. [ --enable-memory Enable memory callbacks (default: enabled)],
  593. [ ENABLED_MEMORY=$enableval ],
  594. [ ENABLED_MEMORY=yes ]
  595. )
  596. if test "$ENABLED_MEMORY" = "no"
  597. then
  598. AM_CFLAGS="$AM_CFLAGS -DNO_CYASSL_MEMORY"
  599. else
  600. # turn off memory cb if leanpsk on
  601. if test "$ENABLED_LEANPSK" = "yes"
  602. then
  603. # but don't turn on NO_CYASSL_MEMORY because using own
  604. ENABLED_MEMORY=no
  605. fi
  606. fi
  607. AM_CONDITIONAL([BUILD_MEMORY], [test "x$ENABLED_MEMORY" = "xyes"])
  608. # RSA
  609. AC_ARG_ENABLE([rsa],
  610. [ --enable-rsa Enable RSA (default: enabled)],
  611. [ ENABLED_RSA=$enableval ],
  612. [ ENABLED_RSA=yes ]
  613. )
  614. if test "$ENABLED_RSA" = "no"
  615. then
  616. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  617. else
  618. # turn off RSA if leanpsk on
  619. if test "$ENABLED_LEANPSK" = "yes"
  620. then
  621. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  622. ENABLED_RSA=no
  623. fi
  624. fi
  625. AM_CONDITIONAL([BUILD_RSA], [test "x$ENABLED_RSA" = "xyes"])
  626. # DH
  627. AC_ARG_ENABLE([dh],
  628. [ --enable-dh Enable DH (default: disabled)],
  629. [ ENABLED_DH=$enableval ],
  630. [ ENABLED_DH=no ]
  631. )
  632. if test "$ENABLED_DH" = "no"
  633. then
  634. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  635. else
  636. # turn off DH if leanpsk on
  637. if test "$ENABLED_LEANPSK" = "yes"
  638. then
  639. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  640. ENABLED_DH=no
  641. fi
  642. fi
  643. AM_CONDITIONAL([BUILD_DH], [test "x$ENABLED_DH" = "xyes"])
  644. # ASN
  645. # turn off asn, which means no certs, no rsa, no dh, no dsa, no ecc,
  646. # and no big int, use this to disable all public key stuff
  647. AC_ARG_ENABLE([asn],
  648. [ --enable-asn Enable ASN (default: enabled)],
  649. [ ENABLED_ASN=$enableval ],
  650. [ ENABLED_ASN=yes ]
  651. )
  652. if test "$ENABLED_ASN" = "no"
  653. then
  654. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  655. else
  656. # turn off ASN if leanpsk on
  657. if test "$ENABLED_LEANPSK" = "yes"
  658. then
  659. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  660. ENABLED_ASN=no
  661. fi
  662. fi
  663. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_ASN" = "no"
  664. then
  665. AC_MSG_ERROR([please disable rsa if disabling asn.])
  666. fi
  667. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  668. then
  669. AC_MSG_ERROR([please disable dsa if disabling asn.])
  670. fi
  671. if test "$ENABLED_DH" = "yes" && test "$ENABLED_ASN" = "no"
  672. then
  673. AC_MSG_ERROR([please disable dh if disabling asn.])
  674. fi
  675. if test "$ENABLED_ECC" = "yes" && test "$ENABLED_ASN" = "no"
  676. then
  677. AC_MSG_ERROR([please disable ecc if disabling asn.])
  678. fi
  679. if test "$ENABLED_PSK" = "no" && test "$ENABLED_ASN" = "no"
  680. then
  681. AC_MSG_ERROR([please enable psk if disabling asn.])
  682. fi
  683. if test "$ENABLED_ASN" = "no"
  684. then
  685. ENABLED_FASTMATH=no
  686. ENABLED_SLOWMATH=no
  687. fi
  688. AM_CONDITIONAL([BUILD_ASN], [test "x$ENABLED_ASN" = "xyes"])
  689. # AES
  690. AC_ARG_ENABLE([aes],
  691. [ --enable-aes Enable AES (default: enabled)],
  692. [ ENABLED_AES=$enableval ],
  693. [ ENABLED_AES=yes ]
  694. )
  695. if test "$ENABLED_AES" = "no"
  696. then
  697. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  698. else
  699. # turn off AES if leanpsk on
  700. if test "$ENABLED_LEANPSK" = "yes"
  701. then
  702. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  703. ENABLED_AES=no
  704. fi
  705. fi
  706. AM_CONDITIONAL([BUILD_AES], [test "x$ENABLED_AES" = "xyes"])
  707. # CODING
  708. AC_ARG_ENABLE([coding],
  709. [ --enable-coding Enable Coding base 16/64 (default: enabled)],
  710. [ ENABLED_CODING=$enableval ],
  711. [ ENABLED_CODING=yes ]
  712. )
  713. if test "$ENABLED_CODING" = "no"
  714. then
  715. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  716. else
  717. # turn off CODING if leanpsk on
  718. if test "$ENABLED_LEANPSK" = "yes"
  719. then
  720. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  721. ENABLED_CODING=no
  722. fi
  723. fi
  724. AM_CONDITIONAL([BUILD_CODING], [test "x$ENABLED_CODING" = "xyes"])
  725. # DES3
  726. AC_ARG_ENABLE([des3],
  727. [ --enable-des3 Enable DES3 (default: enabled)],
  728. [ ENABLED_DES3=$enableval ],
  729. [ ENABLED_DES3=yes ]
  730. )
  731. if test "$ENABLED_DES3" = "no"
  732. then
  733. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  734. else
  735. # turn off DES3 if leanpsk on
  736. if test "$ENABLED_LEANPSK" = "yes"
  737. then
  738. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  739. ENABLED_DES3=no
  740. fi
  741. fi
  742. AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"])
  743. # ARC4
  744. AC_ARG_ENABLE([arc4],
  745. [ --enable-arc4 Enable ARC4 (default: enabled)],
  746. [ ENABLED_ARC4=$enableval ],
  747. [ ENABLED_ARC4=yes ]
  748. )
  749. if test "$ENABLED_ARC4" = "no"
  750. then
  751. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  752. else
  753. # turn off ARC4 if leanpsk on
  754. if test "$ENABLED_LEANPSK" = "yes"
  755. then
  756. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  757. ENABLED_ARC4=no
  758. fi
  759. fi
  760. AM_CONDITIONAL([BUILD_RC4], [test "x$ENABLED_ARC4" = "xyes"])
  761. # MD5
  762. AC_ARG_ENABLE([md5],
  763. [ --enable-md5 Enable MD5 (default: enabled)],
  764. [ ENABLED_MD5=$enableval ],
  765. [ ENABLED_MD5=yes ]
  766. )
  767. if test "$ENABLED_MD5" = "no"
  768. then
  769. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  770. else
  771. # turn off MD5 if leanpsk on
  772. if test "$ENABLED_LEANPSK" = "yes"
  773. then
  774. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  775. ENABLED_MD5=no
  776. fi
  777. fi
  778. AM_CONDITIONAL([BUILD_MD5], [test "x$ENABLED_MD5" = "xyes"])
  779. # SHA
  780. AC_ARG_ENABLE([sha],
  781. [ --enable-sha Enable SHA (default: enabled)],
  782. [ ENABLED_SHA=$enableval ],
  783. [ ENABLED_SHA=yes ]
  784. )
  785. if test "$ENABLED_SHA" = "no"
  786. then
  787. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  788. else
  789. # turn off SHA if leanpsk on
  790. if test "$ENABLED_LEANPSK" = "yes"
  791. then
  792. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  793. ENABLED_SHA=no
  794. fi
  795. fi
  796. AM_CONDITIONAL([BUILD_SHA], [test "x$ENABLED_SHA" = "xyes"])
  797. # MD4
  798. AC_ARG_ENABLE([md4],
  799. [ --enable-md4 Enable MD4 (default: disabled)],
  800. [ ENABLED_MD4=$enableval ],
  801. [ ENABLED_MD4=no ]
  802. )
  803. if test "$ENABLED_MD4" = "no"
  804. then
  805. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  806. fi
  807. AM_CONDITIONAL([BUILD_MD4], [test "x$ENABLED_MD4" = "xyes"])
  808. # Web Server Build
  809. AC_ARG_ENABLE([webserver],
  810. [ --enable-webserver Enable Web Server (default: disabled)],
  811. [ ENABLED_WEBSERVER=$enableval ],
  812. [ ENABLED_WEBSERVER=no ]
  813. )
  814. if test "$ENABLED_WEBSERVER" = "yes"
  815. then
  816. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  817. fi
  818. # PWDBASED
  819. AC_ARG_ENABLE([pwdbased],
  820. [ --enable-pwdbased Enable PWDBASED (default: disabled)],
  821. [ ENABLED_PWDBASED=$enableval ],
  822. [ ENABLED_PWDBASED=no ]
  823. )
  824. if test "$ENABLED_PWDBASED" = "no"
  825. then
  826. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes"
  827. then
  828. # opensslextra and webserver needs pwdbased
  829. ENABLED_PWDBASED=yes
  830. else
  831. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  832. fi
  833. fi
  834. AM_CONDITIONAL([BUILD_PWDBASED], [test "x$ENABLED_PWDBASED" = "xyes"])
  835. # HC128
  836. AC_ARG_ENABLE([hc128],
  837. [ --enable-hc128 Enable HC-128 (default: disabled)],
  838. [ ENABLED_HC128=$enableval ],
  839. [ ENABLED_HC128=no ]
  840. )
  841. if test "$ENABLED_HC128" = "no"
  842. then
  843. AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
  844. else
  845. AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
  846. fi
  847. AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
  848. # RABBIT
  849. AC_ARG_ENABLE([rabbit],
  850. [ --enable-rabbit Enable RABBIT (default: disabled)],
  851. [ ENABLED_RABBIT=$enableval ],
  852. [ ENABLED_RABBIT=no ]
  853. )
  854. if test "$ENABLED_RABBIT" = "no"
  855. then
  856. AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
  857. else
  858. AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
  859. fi
  860. AM_CONDITIONAL([BUILD_RABBIT], [test "x$ENABLED_RABBIT" = "xyes"])
  861. # CHACHA
  862. AC_ARG_ENABLE([chacha],
  863. [ --enable-chacha Enable CHACHA (default: disabled)],
  864. [ ENABLED_CHACHA=$enableval ],
  865. [ ENABLED_CHACHA=no ]
  866. )
  867. if test "$ENABLED_CHACHA" = "yes"
  868. then
  869. AM_CFLAGS="$AM_CFLAGS -DHAVE_CHACHA"
  870. fi
  871. AM_CONDITIONAL([BUILD_CHACHA], [test "x$ENABLED_CHACHA" = "xyes"])
  872. # FIPS
  873. AC_ARG_ENABLE([fips],
  874. [ --enable-fips Enable FIPS 140-2 (default: disabled)],
  875. [ ENABLED_FIPS=$enableval ],
  876. [ ENABLED_FIPS=no ]
  877. )
  878. if test "x$ENABLED_FIPS" = "xyes"
  879. then
  880. # requires thread local storage
  881. if test "$thread_ls_on" = "no"
  882. then
  883. AC_MSG_ERROR([FIPS requires Thread Local Storage])
  884. fi
  885. # requires SHA512
  886. if test "x$ENABLED_SHA512" = "xno"
  887. then
  888. ENABLED_SHA512="yes"
  889. AM_CFLAGS="$AM_CFLAGS -DCYASSL_SHA512 -DCYASSL_SHA384"
  890. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  891. fi
  892. # requires AESGCM
  893. if test "x$ENABLED_AESGCM" != "xyes"
  894. then
  895. ENABLED_AESGCM="yes"
  896. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  897. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  898. fi
  899. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
  900. fi
  901. AM_CONDITIONAL([BUILD_FIPS], [test "x$ENABLED_FIPS" = "xyes"])
  902. # Hash DRBG
  903. AC_ARG_ENABLE([hashdrbg],
  904. [ --enable-hashdrbg Enable Hash DRBG support (default: disabled)],
  905. [ ENABLED_HASHDRBG=$enableval ],
  906. [ ENABLED_HASHDRBG=no ]
  907. )
  908. if test "x$ENABLED_HASHDRBG" = "xyes"
  909. then
  910. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  911. else
  912. # turn on Hash DRBG if FIPS is on or ARC4 is off
  913. if test "x$ENABLED_FIPS" = "xyes" || test "x$ENABLED_ARC4" = "xno"
  914. then
  915. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  916. ENABLED_HASHDRBG=yes
  917. fi
  918. fi
  919. # Filesystem Build
  920. AC_ARG_ENABLE([filesystem],
  921. [ --enable-filesystem Enable Filesystem support (default: enabled)],
  922. [ ENABLED_FILESYSTEM=$enableval ],
  923. [ ENABLED_FILESYSTEM=yes ]
  924. )
  925. if test "$ENABLED_FILESYSTEM" = "no"
  926. then
  927. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  928. else
  929. # turn off filesystem if leanpsk on
  930. if test "$ENABLED_LEANPSK" = "yes"
  931. then
  932. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  933. ENABLED_FILESYSTEM=no
  934. fi
  935. fi
  936. # inline Build
  937. AC_ARG_ENABLE([inline],
  938. [ --enable-inline Enable inline functions (default: enabled)],
  939. [ ENABLED_INLINE=$enableval ],
  940. [ ENABLED_INLINE=yes ]
  941. )
  942. if test "$ENABLED_INLINE" = "no"
  943. then
  944. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  945. fi
  946. AM_CONDITIONAL([BUILD_INLINE], [test "x$ENABLED_INLINE" = "xyes"])
  947. # OCSP
  948. AC_ARG_ENABLE([ocsp],
  949. [ --enable-ocsp Enable OCSP (default: disabled)],
  950. [ ENABLED_OCSP=$enableval ],
  951. [ ENABLED_OCSP=no ],
  952. )
  953. if test "$ENABLED_OCSP" = "yes"
  954. then
  955. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  956. fi
  957. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  958. if test "$ENABLED_OCSP" = "yes"
  959. then
  960. # check openssl command tool for testing ocsp
  961. AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
  962. if test "$HAVE_OPENSSL_CMD" = "yes"
  963. then
  964. AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
  965. else
  966. AC_MSG_WARN([openssl command line tool not available for testing ocsp])
  967. fi
  968. fi
  969. # CRL
  970. AC_ARG_ENABLE([crl],
  971. [ --enable-crl Enable CRL (default: disabled)],
  972. [ ENABLED_CRL=$enableval ],
  973. [ ENABLED_CRL=no ],
  974. )
  975. if test "$ENABLED_CRL" = "yes"
  976. then
  977. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  978. fi
  979. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  980. # CRL Monitor
  981. AC_ARG_ENABLE([crl-monitor],
  982. [ --enable-crl-monitor Enable CRL Monitor (default: disabled)],
  983. [ ENABLED_CRL_MONITOR=$enableval ],
  984. [ ENABLED_CRL_MONITOR=no ],
  985. )
  986. if test "$ENABLED_CRL_MONITOR" = "yes"
  987. then
  988. case $host_os in
  989. *linux* | *darwin* | *freebsd*)
  990. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
  991. *)
  992. AC_MSG_ERROR([crl monitor only allowed on linux, OS X, or freebsd]) ;;
  993. esac
  994. fi
  995. AM_CONDITIONAL([BUILD_CRL_MONITOR], [test "x$ENABLED_CRL_MONITOR" = "xyes"])
  996. # NTRU
  997. ENABLED_NTRU="no"
  998. tryntrudir=""
  999. AC_ARG_WITH([ntru],
  1000. [ --with-ntru=PATH Path to NTRU install (default /usr/) ],
  1001. [
  1002. AC_MSG_CHECKING([for NTRU])
  1003. CPPFLAGS="$CPPFLAGS -DHAVE_NTRU"
  1004. LIBS="$LIBS -lNTRUEncrypt"
  1005. 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 ])
  1006. if test "x$ntru_linked" == "xno" ; then
  1007. if test "x$withval" != "xno" ; then
  1008. tryntrudir=$withval
  1009. fi
  1010. if test "x$withval" == "xyes" ; then
  1011. tryntrudir="/usr"
  1012. fi
  1013. LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  1014. CPPFLAGS="$CPPFLAGS -I$tryntrudir/include"
  1015. 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 ])
  1016. if test "x$ntru_linked" == "xno" ; then
  1017. AC_MSG_ERROR([NTRU isn't found.
  1018. If it's already installed, specify its path using --with-ntru=/dir/])
  1019. fi
  1020. AC_MSG_RESULT([yes])
  1021. AM_LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  1022. else
  1023. AC_MSG_RESULT([yes])
  1024. fi
  1025. AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU"
  1026. ENABLED_NTRU="yes"
  1027. ]
  1028. )
  1029. AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
  1030. if test "$ENABLED_NTRU" = "yes" && test "$ENABLED_SMALL" = "yes"
  1031. then
  1032. AC_MSG_ERROR([cannot enable ntru and small, ntru requires TLS which small turns off.])
  1033. fi
  1034. # SNI
  1035. AC_ARG_ENABLE([sni],
  1036. [ --enable-sni Enable SNI (default: disabled)],
  1037. [ ENABLED_SNI=$enableval ],
  1038. [ ENABLED_SNI=no ]
  1039. )
  1040. if test "x$ENABLED_SNI" = "xyes"
  1041. then
  1042. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  1043. fi
  1044. # Maximum Fragment Length
  1045. AC_ARG_ENABLE([maxfragment],
  1046. [ --enable-maxfragment Enable Maximum Fragment Length (default: disabled)],
  1047. [ ENABLED_MAX_FRAGMENT=$enableval ],
  1048. [ ENABLED_MAX_FRAGMENT=no ]
  1049. )
  1050. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  1051. then
  1052. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  1053. fi
  1054. # Truncated HMAC
  1055. AC_ARG_ENABLE([truncatedhmac],
  1056. [ --enable-truncatedhmac Enable Truncated HMAC (default: disabled)],
  1057. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  1058. [ ENABLED_TRUNCATED_HMAC=no ]
  1059. )
  1060. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  1061. then
  1062. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  1063. fi
  1064. # Renegotiation Indication - (FAKE Secure Renegotiation)
  1065. AC_ARG_ENABLE([renegotiation-indication],
  1066. [ --enable-renegotiation-indication Enable Renegotiation Indication (default: disabled)],
  1067. [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
  1068. [ ENABLED_RENEGOTIATION_INDICATION=no ]
  1069. )
  1070. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  1071. then
  1072. AM_CFLAGS="$AM_CFLAGS -DHAVE_RENEGOTIATION_INDICATION"
  1073. fi
  1074. # Secure Renegotiation
  1075. AC_ARG_ENABLE([secure-renegotiation],
  1076. [ --enable-secure-renegotiation Enable Secure Renegotiation (default: disabled)],
  1077. [ ENABLED_SECURE_RENEGOTIATION=$enableval ],
  1078. [ ENABLED_SECURE_RENEGOTIATION=no ]
  1079. )
  1080. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes"
  1081. then
  1082. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  1083. then
  1084. AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.])
  1085. fi
  1086. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION"
  1087. fi
  1088. # Supported Elliptic Curves Extensions
  1089. AC_ARG_ENABLE([supportedcurves],
  1090. [ --enable-supportedcurves Enable Supported Elliptic Curves (default: disabled)],
  1091. [ ENABLED_SUPPORTED_CURVES=$enableval ],
  1092. [ ENABLED_SUPPORTED_CURVES=no ]
  1093. )
  1094. if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
  1095. then
  1096. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"
  1097. fi
  1098. # Session Ticket Extension
  1099. AC_ARG_ENABLE([session-ticket],
  1100. [ --enable-session-ticket Enable Session Ticket (default: disabled)],
  1101. [ ENABLED_SESSION_TICKET=$enableval ],
  1102. [ ENABLED_SESSION_TICKET=no ]
  1103. )
  1104. if test "x$ENABLED_SESSION_TICKET" = "xyes"
  1105. then
  1106. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  1107. fi
  1108. # TLS Extensions
  1109. AC_ARG_ENABLE([tlsx],
  1110. [ --enable-tlsx Enable all TLS Extensions (default: disabled)],
  1111. [ ENABLED_TLSX=$enableval ],
  1112. [ ENABLED_TLSX=no ]
  1113. )
  1114. if test "x$ENABLED_TLSX" = "xyes"
  1115. then
  1116. ENABLED_SNI=yes
  1117. ENABLED_MAX_FRAGMENT=yes
  1118. ENABLED_TRUNCATED_HMAC=yes
  1119. ENABLED_SUPPORTED_CURVES=yes
  1120. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES"
  1121. fi
  1122. # PKCS7
  1123. AC_ARG_ENABLE([pkcs7],
  1124. [ --enable-pkcs7 Enable PKCS7 (default: disabled)],
  1125. [ ENABLED_PKCS7=$enableval ],
  1126. [ ENABLED_PKCS7=no ],
  1127. )
  1128. if test "$ENABLED_PKCS7" = "yes"
  1129. then
  1130. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  1131. fi
  1132. AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
  1133. # Simple Certificate Enrollment Protocol (SCEP)
  1134. AC_ARG_ENABLE([scep],
  1135. [ --enable-scep Enable wolfSCEP (default: disabled)],
  1136. [ ENABLED_WOLFSCEP=$enableval ],
  1137. [ ENABLED_WOLFSCEP=no ]
  1138. )
  1139. if test "$ENABLED_WOLFSCEP" = "yes"
  1140. then
  1141. # Enable prereqs if not already enabled
  1142. if test "x$ENABLED_KEYGEN" = "xno"
  1143. then
  1144. ENABLED_KEYGEN="yes"
  1145. AM_CFLAGS="$AM_CFLAGS -DCYASSL_KEY_GEN"
  1146. fi
  1147. if test "x$ENABLED_CERTGEN" = "xno"
  1148. then
  1149. ENABLED_CERTGEN="yes"
  1150. AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_GEN"
  1151. fi
  1152. if test "x$ENABLED_CERTREQ" = "xno"
  1153. then
  1154. ENABLED_CERTREQ="yes"
  1155. AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_REQ"
  1156. fi
  1157. if test "x$ENABLED_PKCS7" = "xno"
  1158. then
  1159. ENABLED_PKCS7="yes"
  1160. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  1161. AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
  1162. fi
  1163. AM_CFLAGS="$AM_CFLAGS -DCYASSL_HAVE_WOLFSCEP"
  1164. fi
  1165. # Small Stack
  1166. AC_ARG_ENABLE([smallstack],
  1167. [ --enable-smallstack Enable Small Stack Usage (default: disabled)],
  1168. [ ENABLED_SMALL_STACK=$enableval ],
  1169. [ ENABLED_SMALL_STACK=no ]
  1170. )
  1171. if test "x$ENABLED_SMALL_STACK" = "xyes"
  1172. then
  1173. AM_CFLAGS="$AM_CFLAGS -DCYASSL_SMALL_STACK"
  1174. fi
  1175. #valgrind
  1176. AC_ARG_ENABLE([valgrind],
  1177. [ --enable-valgrind Enable valgrind for unit tests (default: disabled)],
  1178. [ ENABLED_VALGRIND=$enableval ],
  1179. [ ENABLED_VALGRIND=no ]
  1180. )
  1181. if test "$ENABLED_VALGRIND" = "yes"
  1182. then
  1183. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  1184. if test "$HAVE_VALGRIND" = "no"
  1185. then
  1186. AC_MSG_ERROR([Valgrind not found.])
  1187. fi
  1188. enable_shared=no
  1189. enable_static=yes
  1190. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  1191. fi
  1192. AM_CONDITIONAL([USE_VALGRIND], [test "x$ENABLED_VALGRIND" = "xyes"])
  1193. # Test certs, use internal cert functions for extra testing
  1194. AC_ARG_ENABLE([testcert],
  1195. [ --enable-testcert Enable Test Cert (default: disabled)],
  1196. [ ENABLED_TESTCERT=$enableval ],
  1197. [ ENABLED_TESTCERT=no ]
  1198. )
  1199. if test "$ENABLED_TESTCERT" = "yes"
  1200. then
  1201. AM_CFLAGS="$AM_CFLAGS -DCYASSL_TEST_CERT"
  1202. fi
  1203. # I/O Pool, an example to show user how to override memory handler and use
  1204. # a pool for the input/output buffer requests
  1205. AC_ARG_ENABLE([iopool],
  1206. [ --enable-iopool Enable I/O Pool example (default: disabled)],
  1207. [ ENABLED_IOPOOL=$enableval ],
  1208. [ ENABLED_IOPOOL=no ]
  1209. )
  1210. if test "$ENABLED_IOPOOL" = "yes"
  1211. then
  1212. if test "$thread_ls_on" = "no"
  1213. then
  1214. AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
  1215. fi
  1216. AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
  1217. fi
  1218. # Certificate Service Support
  1219. AC_ARG_ENABLE([certservice],
  1220. [ --enable-certservice Enable cert service (default: disabled)],
  1221. [ ENABLED_CERT_SERVICE=$enableval ],
  1222. [ ENABLED_CERT_SERVICE=no ]
  1223. )
  1224. if test "$ENABLED_CERT_SERVICE" = "yes"
  1225. then
  1226. # Requires ecc,certgen, and opensslextra make sure on
  1227. if test "x$ENABLED_CERTGEN" = "xno"
  1228. then
  1229. ENABLED_CERTGEN="yes"
  1230. AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_GEN"
  1231. fi
  1232. if test "x$ENABLED_ECC" = "xno"
  1233. then
  1234. ENABLED_ECC="yes"
  1235. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
  1236. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  1237. fi
  1238. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1239. then
  1240. ENABLED_OPENSSLEXTRA="yes"
  1241. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  1242. fi
  1243. AM_CFLAGS="$AM_CFLAGS -DCYASSL_HAVE_CERT_SERVICE"
  1244. fi
  1245. # set fastmath default
  1246. FASTMATH_DEFAULT=no
  1247. if test "$host_cpu" = "x86_64"
  1248. then
  1249. FASTMATH_DEFAULT=yes
  1250. fi
  1251. # fastmath
  1252. AC_ARG_ENABLE([fastmath],
  1253. [ --enable-fastmath Enable fast math ops (default: enabled on x86_64)],
  1254. [ ENABLED_FASTMATH=$enableval ],
  1255. [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
  1256. )
  1257. if test "x$ENABLED_FASTMATH" = "xyes"
  1258. then
  1259. # turn off fastmth if leanpsk on or asn off
  1260. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  1261. then
  1262. ENABLED_FASTMATH=no
  1263. else
  1264. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1265. ENABLED_SLOWMATH="no"
  1266. fi
  1267. fi
  1268. # fast HUGE math
  1269. AC_ARG_ENABLE([fasthugemath],
  1270. [ --enable-fasthugemath Enable fast math + huge code (default: disabled)],
  1271. [ ENABLED_FASTHUGEMATH=$enableval ],
  1272. [ ENABLED_FASTHUGEMATH=no ]
  1273. )
  1274. if test "$ENABLED_BUMP" = "yes"
  1275. then
  1276. ENABLED_FASTHUGEMATH="yes"
  1277. fi
  1278. if test "$ENABLED_FASTHUGEMATH" = "yes"
  1279. then
  1280. ENABLED_FASTMATH="yes"
  1281. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1282. ENABLED_SLOWMATH="no"
  1283. fi
  1284. AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
  1285. AM_CONDITIONAL([BUILD_SLOWMATH], [test "x$ENABLED_SLOWMATH" = "xyes"])
  1286. # Enable Examples, used to disable examples
  1287. AC_ARG_ENABLE([examples],
  1288. [ --enable-examples Enable Examples (default: enabled)],
  1289. [ ENABLED_EXAMPLES=$enableval ],
  1290. [ ENABLED_EXAMPLES=yes ]
  1291. )
  1292. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  1293. AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
  1294. # certs still have sha signatures for now
  1295. AS_IF([test "x$ENABLED_SHA" = "xno"], [ENABLED_EXAMPLES="no"])
  1296. AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$ENABLED_EXAMPLES" = "xyes"])
  1297. # LIBZ
  1298. ENABLED_LIBZ="no"
  1299. trylibzdir=""
  1300. AC_ARG_WITH([libz],
  1301. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  1302. [
  1303. AC_MSG_CHECKING([for libz])
  1304. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  1305. LIBS="$LIBS -lz"
  1306. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  1307. if test "x$libz_linked" == "xno" ; then
  1308. if test "x$withval" != "xno" ; then
  1309. trylibzdir=$withval
  1310. fi
  1311. if test "x$withval" == "xyes" ; then
  1312. trylibzdir="/usr"
  1313. fi
  1314. AM_LDFLAGS="$AM_LDFLAGS -L$trylibzdir/lib"
  1315. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  1316. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  1317. if test "x$libz_linked" == "xno" ; then
  1318. AC_MSG_ERROR([libz isn't found.
  1319. If it's already installed, specify its path using --with-libz=/dir/])
  1320. fi
  1321. AC_MSG_RESULT([yes])
  1322. else
  1323. AC_MSG_RESULT([yes])
  1324. fi
  1325. ENABLED_LIBZ="yes"
  1326. ]
  1327. )
  1328. AM_CONDITIONAL([BUILD_LIBZ], [test "x$ENABLED_LIBZ" = "xyes"])
  1329. # cavium
  1330. trycaviumdir=""
  1331. AC_ARG_WITH([cavium],
  1332. [ --with-cavium=PATH PATH to cavium/software dir ],
  1333. [
  1334. AC_MSG_CHECKING([for cavium])
  1335. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
  1336. if test "x$withval" == "xyes" ; then
  1337. AC_MSG_ERROR([need a PATH for --with-cavium])
  1338. fi
  1339. if test "x$withval" != "xno" ; then
  1340. trycaviumdir=$withval
  1341. fi
  1342. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  1343. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  1344. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  1345. if test "x$cavium_linked" == "xno" ; then
  1346. AC_MSG_ERROR([cavium isn't found.
  1347. If it's already installed, specify its path using --with-cavium=/dir/])
  1348. fi
  1349. AC_MSG_RESULT([yes])
  1350. enable_shared=no
  1351. enable_static=yes
  1352. ]
  1353. )
  1354. # microchip api
  1355. AC_ARG_ENABLE([mcapi],
  1356. [ --enable-mcapi Enable Microchip API (default: disabled)],
  1357. [ ENABLED_MCAPI=$enableval ],
  1358. [ ENABLED_MCAPI=no ]
  1359. )
  1360. if test "$ENABLED_MCAPI" = "yes"
  1361. then
  1362. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI -DCYASSL_AES_COUNTER -DCYASSL_AES_DIRECT"
  1363. fi
  1364. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  1365. then
  1366. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  1367. fi
  1368. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  1369. then
  1370. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  1371. fi
  1372. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  1373. then
  1374. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  1375. fi
  1376. AM_CONDITIONAL([BUILD_MCAPI], [test "x$ENABLED_MCAPI" = "xyes"])
  1377. # OPTIMIZE FLAGS
  1378. if test "$GCC" = "yes"
  1379. then
  1380. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  1381. if test "$ax_enable_debug" = "no"
  1382. then
  1383. if test "$ENABLED_FASTMATH" = "yes"
  1384. then
  1385. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  1386. if test "$ENABLED_FASTHUGEMATH" = "yes"
  1387. then
  1388. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  1389. fi
  1390. else
  1391. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  1392. fi
  1393. fi
  1394. fi
  1395. # ICC command line warning for non supported warning flags
  1396. if test "$CC" = "icc"
  1397. then
  1398. AM_CFLAGS="$AM_CFLAGS -wd10006"
  1399. fi
  1400. LIB_SOCKET_NSL
  1401. AX_HARDEN_CC_COMPILER_FLAGS
  1402. # link to ws2_32 if on mingw
  1403. case $host_os in
  1404. *mingw32)
  1405. LDFLAGS="$LDFLAGS -lws2_32" ;;
  1406. esac
  1407. # add user C_EXTRA_FLAGS back
  1408. CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
  1409. OPTION_FLAGS="$USER_C_EXTRA_FLAGS $AM_CFLAGS"
  1410. CREATE_HEX_VERSION
  1411. AC_SUBST([AM_CPPFLAGS])
  1412. AC_SUBST([AM_CFLAGS])
  1413. AC_SUBST([AM_LDFLAGS])
  1414. # FINAL
  1415. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  1416. AC_CONFIG_FILES([Makefile])
  1417. AC_CONFIG_FILES([cyassl/version.h])
  1418. AC_CONFIG_FILES([cyassl/options.h])
  1419. AC_CONFIG_FILES([support/cyassl.pc])
  1420. AC_CONFIG_FILES([rpm/spec])
  1421. AX_CREATE_GENERIC_CONFIG
  1422. AX_AM_JOBSERVER([yes])
  1423. AC_OUTPUT
  1424. # force make clean
  1425. echo "---"
  1426. echo "Running make clean..."
  1427. make clean >/dev/null 2>&1
  1428. # Touch files that may not be in repository
  1429. echo "Touching File..."
  1430. touch ctaocrypt/src/fips.c
  1431. touch ctaocrypt/src/fips_test.c
  1432. echo
  1433. # generate user options header
  1434. echo "---"
  1435. echo "Generating user options header..."
  1436. OPTION_FILE="cyassl/options.h"
  1437. rm -f $OPTION_FILE
  1438. echo "/* cyassl options.h" > $OPTION_FILE
  1439. echo " * generated from configure options" >> $OPTION_FILE
  1440. echo " *" >> $OPTION_FILE
  1441. echo " * Copyright (C) 2006-2014 wolfSSL Inc." >> $OPTION_FILE
  1442. echo " *" >> $OPTION_FILE
  1443. echo " * This file is part of CyaSSL." >> $OPTION_FILE
  1444. echo " *" >> $OPTION_FILE
  1445. echo " */" >> $OPTION_FILE
  1446. echo "" >> $OPTION_FILE
  1447. echo "#pragma once" >> $OPTION_FILE
  1448. echo "" >> $OPTION_FILE
  1449. echo "#ifdef __cplusplus" >> $OPTION_FILE
  1450. echo "extern \"C\" {" >> $OPTION_FILE
  1451. echo "#endif" >> $OPTION_FILE
  1452. echo "" >> $OPTION_FILE
  1453. for option in $OPTION_FLAGS; do
  1454. defonly=`echo $option | sed 's/-D//'`
  1455. if test "$defonly" != "$option"
  1456. then
  1457. noequalsign=`echo $defonly | sed 's/=/ /'`
  1458. echo "#undef $noequalsign" >> $OPTION_FILE
  1459. echo "#define $noequalsign" >> $OPTION_FILE
  1460. echo "" >> $OPTION_FILE
  1461. else
  1462. echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
  1463. fi
  1464. done
  1465. echo "" >> $OPTION_FILE
  1466. echo "#ifdef __cplusplus" >> $OPTION_FILE
  1467. echo "}" >> $OPTION_FILE
  1468. echo "#endif" >> $OPTION_FILE
  1469. echo "" >> $OPTION_FILE
  1470. echo
  1471. # output config summary
  1472. echo "---"
  1473. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  1474. echo ""
  1475. echo " * Installation prefix: $prefix"
  1476. echo " * System type: $host_vendor-$host_os"
  1477. echo " * Host CPU: $host_cpu"
  1478. echo " * C Compiler: $CC"
  1479. echo " * C Flags: $CFLAGS"
  1480. echo " * C++ Compiler: $CXX"
  1481. echo " * C++ Flags: $CXXFLAGS"
  1482. echo " * CPP Flags: $CPPFLAGS"
  1483. echo " * LIB Flags: $LIB"
  1484. echo " * Debug enabled: $ax_enable_debug"
  1485. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  1486. echo " * make -j: $enable_jobserver"
  1487. echo " * VCS checkout: $ac_cv_vcs_checkout"
  1488. echo
  1489. echo " Features "
  1490. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  1491. echo " * Filesystem: $ENABLED_FILESYSTEM"
  1492. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  1493. echo " * fastmath: $ENABLED_FASTMATH"
  1494. echo " * sniffer: $ENABLED_SNIFFER"
  1495. echo " * snifftest: $ENABLED_SNIFFTEST"
  1496. echo " * ARC4: $ENABLED_ARC4"
  1497. echo " * AES: $ENABLED_AES"
  1498. echo " * AES-NI: $ENABLED_AESNI"
  1499. echo " * AES-GCM: $ENABLED_AESGCM"
  1500. echo " * AES-CCM: $ENABLED_AESCCM"
  1501. echo " * DES3: $ENABLED_DES3"
  1502. echo " * Camellia: $ENABLED_CAMELLIA"
  1503. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  1504. echo " * MD5: $ENABLED_MD5"
  1505. echo " * RIPEMD: $ENABLED_RIPEMD"
  1506. echo " * SHA: $ENABLED_SHA"
  1507. echo " * SHA-512: $ENABLED_SHA512"
  1508. echo " * BLAKE2: $ENABLED_BLAKE2"
  1509. echo " * keygen: $ENABLED_KEYGEN"
  1510. echo " * certgen: $ENABLED_CERTGEN"
  1511. echo " * certreq: $ENABLED_CERTREQ"
  1512. echo " * HC-128: $ENABLED_HC128"
  1513. echo " * RABBIT: $ENABLED_RABBIT"
  1514. echo " * CHACHA: $ENABLED_CHACHA"
  1515. echo " * Hash DRBG: $ENABLED_HASHDRBG"
  1516. echo " * PWDBASED: $ENABLED_PWDBASED"
  1517. echo " * HKDF: $ENABLED_HKDF"
  1518. echo " * MD4: $ENABLED_MD4"
  1519. echo " * PSK: $ENABLED_PSK"
  1520. echo " * Poly1305: $ENABLED_POLY1305"
  1521. echo " * LEANPSK: $ENABLED_LEANPSK"
  1522. echo " * RSA: $ENABLED_RSA"
  1523. echo " * DSA: $ENABLED_DSA"
  1524. echo " * DH: $ENABLED_DH"
  1525. echo " * ECC: $ENABLED_ECC"
  1526. echo " * FPECC: $ENABLED_FPECC"
  1527. echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
  1528. echo " * ASN: $ENABLED_ASN"
  1529. echo " * CODING: $ENABLED_CODING"
  1530. echo " * MEMORY: $ENABLED_MEMORY"
  1531. echo " * I/O POOL: $ENABLED_IOPOOL"
  1532. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  1533. echo " * DTLS: $ENABLED_DTLS"
  1534. echo " * Old TLS Versions: $ENABLED_OLD_TLS"
  1535. echo " * OCSP: $ENABLED_OCSP"
  1536. echo " * CRL: $ENABLED_CRL"
  1537. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  1538. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  1539. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  1540. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  1541. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  1542. echo " * NTRU: $ENABLED_NTRU"
  1543. echo " * SNI: $ENABLED_SNI"
  1544. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  1545. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  1546. echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
  1547. echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
  1548. echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
  1549. echo " * Session Ticket: $ENABLED_SESSION_TICKET"
  1550. echo " * All TLS Extensions: $ENABLED_TLSX"
  1551. echo " * PKCS#7 $ENABLED_PKCS7"
  1552. echo " * wolfSCEP $ENABLED_WOLFSCEP"
  1553. echo " * Small Stack: $ENABLED_SMALL_STACK"
  1554. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  1555. echo " * LIBZ: $ENABLED_LIBZ"
  1556. echo " * Examples: $ENABLED_EXAMPLES"
  1557. echo ""
  1558. echo "---"