configure.ac 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948
  1. # configure.ac
  2. #
  3. # Copyright (C) 2006-2015 wolfSSL Inc.
  4. #
  5. # This file is part of wolfSSL. (formerly known as CyaSSL)
  6. #
  7. #
  8. AC_INIT([wolfssl],[3.3.4],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[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. WOLFSSL_LIBRARY_VERSION=0:0:0
  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([WOLFSSL_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_WOLFSSL"
  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 wolfSSL 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 wolfSSL DTLS (default: disabled)],
  118. [ ENABLED_DTLS=$enableval ],
  119. [ ENABLED_DTLS=no ]
  120. )
  121. if test "$ENABLED_DTLS" = "yes"
  122. then
  123. AM_CFLAGS="-DWOLFSSL_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 -DWOLFSSL_ALWAYS_VERIFY_CB -DOPENSSL_EXTRA -DWOLFSSL_DES_ECB -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT -DWOLFSSL_DER_LOAD -DWOLFSSL_SHA512 -DWOLFSSL_SHA384 -DWOLFSSL_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 -DWOLFSSL_CERT_GEN -DWOLFSSL_KEY_GEN -DHUGE_SESSION_CACHE -DOPENSSL_EXTRA -DFP_MAX_BITS=8192 -DWOLFSSL_DER_LOAD -DWOLFSSL_ALT_NAMES -DWOLFSSL_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 -DWOLFSSL_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 -DWOLFSSL_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 wolfSSL sniffer support (default: disabled) ])],[
  257. ENABLED_SNIFFER=yes
  258. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_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 wolfSSL 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 wolfSSL 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 wolfSSL 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 -DWOLFSSL_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 wolfSSL 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 wolfSSL 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 wolfSSL 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 -DWOLFSSL_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 wolfSSL 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 wolfSSL 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 -DWOLFSSL_RIPEMD"
  380. fi
  381. AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
  382. # BLAKE2
  383. AC_ARG_ENABLE([blake2],
  384. [ --enable-blake2 Enable wolfSSL 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 wolfSSL 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 -DWOLFSSL_SHA512 -DWOLFSSL_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 -DWOLFSSL_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 -DWOLFSSL_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 -DWOLFSSL_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="-DWOLFSSL_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 -DWOLFSSL_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_WOLFSSL_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_WOLFSSL_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. # Anonymous
  645. AC_ARG_ENABLE([anon],
  646. [AS_HELP_STRING([--enable-anon],[Enable Anonymous (default: disabled)])],
  647. [ ENABLED_ANON=$enableval ],
  648. [ ENABLED_ANON=no ]
  649. )
  650. if test "x$ENABLED_ANON" = "xyes"
  651. then
  652. if test "x$ENABLED_DH" != "xyes"
  653. then
  654. AC_MSG_ERROR([Anonymous suite requires DH.])
  655. fi
  656. AM_CFLAGS="$AM_CFLAGS -DHAVE_ANON"
  657. fi
  658. # ASN
  659. # turn off asn, which means no certs, no rsa, no dh, no dsa, no ecc,
  660. # and no big int, use this to disable all public key stuff
  661. AC_ARG_ENABLE([asn],
  662. [ --enable-asn Enable ASN (default: enabled)],
  663. [ ENABLED_ASN=$enableval ],
  664. [ ENABLED_ASN=yes ]
  665. )
  666. if test "$ENABLED_ASN" = "no"
  667. then
  668. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  669. else
  670. # turn off ASN if leanpsk on
  671. if test "$ENABLED_LEANPSK" = "yes"
  672. then
  673. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  674. ENABLED_ASN=no
  675. fi
  676. fi
  677. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_ASN" = "no"
  678. then
  679. AC_MSG_ERROR([please disable rsa if disabling asn.])
  680. fi
  681. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  682. then
  683. AC_MSG_ERROR([please disable dsa if disabling asn.])
  684. fi
  685. if test "$ENABLED_DH" = "yes" && test "$ENABLED_ASN" = "no"
  686. then
  687. AC_MSG_ERROR([please disable dh if disabling asn.])
  688. fi
  689. if test "$ENABLED_ECC" = "yes" && test "$ENABLED_ASN" = "no"
  690. then
  691. AC_MSG_ERROR([please disable ecc if disabling asn.])
  692. fi
  693. if test "$ENABLED_PSK" = "no" && test "$ENABLED_ASN" = "no"
  694. then
  695. AC_MSG_ERROR([please enable psk if disabling asn.])
  696. fi
  697. if test "$ENABLED_ASN" = "no"
  698. then
  699. ENABLED_FASTMATH=no
  700. ENABLED_SLOWMATH=no
  701. fi
  702. AM_CONDITIONAL([BUILD_ASN], [test "x$ENABLED_ASN" = "xyes"])
  703. # AES
  704. AC_ARG_ENABLE([aes],
  705. [ --enable-aes Enable AES (default: enabled)],
  706. [ ENABLED_AES=$enableval ],
  707. [ ENABLED_AES=yes ]
  708. )
  709. if test "$ENABLED_AES" = "no"
  710. then
  711. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  712. else
  713. # turn off AES if leanpsk on
  714. if test "$ENABLED_LEANPSK" = "yes"
  715. then
  716. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  717. ENABLED_AES=no
  718. fi
  719. fi
  720. AM_CONDITIONAL([BUILD_AES], [test "x$ENABLED_AES" = "xyes"])
  721. # CODING
  722. AC_ARG_ENABLE([coding],
  723. [ --enable-coding Enable Coding base 16/64 (default: enabled)],
  724. [ ENABLED_CODING=$enableval ],
  725. [ ENABLED_CODING=yes ]
  726. )
  727. if test "$ENABLED_CODING" = "no"
  728. then
  729. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  730. else
  731. # turn off CODING if leanpsk on
  732. if test "$ENABLED_LEANPSK" = "yes"
  733. then
  734. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  735. ENABLED_CODING=no
  736. fi
  737. fi
  738. AM_CONDITIONAL([BUILD_CODING], [test "x$ENABLED_CODING" = "xyes"])
  739. # DES3
  740. AC_ARG_ENABLE([des3],
  741. [ --enable-des3 Enable DES3 (default: enabled)],
  742. [ ENABLED_DES3=$enableval ],
  743. [ ENABLED_DES3=yes ]
  744. )
  745. if test "$ENABLED_DES3" = "no"
  746. then
  747. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  748. else
  749. # turn off DES3 if leanpsk on
  750. if test "$ENABLED_LEANPSK" = "yes"
  751. then
  752. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  753. ENABLED_DES3=no
  754. fi
  755. fi
  756. AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"])
  757. # ARC4
  758. AC_ARG_ENABLE([arc4],
  759. [ --enable-arc4 Enable ARC4 (default: enabled)],
  760. [ ENABLED_ARC4=$enableval ],
  761. [ ENABLED_ARC4=yes ]
  762. )
  763. if test "$ENABLED_ARC4" = "no"
  764. then
  765. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  766. else
  767. # turn off ARC4 if leanpsk on
  768. if test "$ENABLED_LEANPSK" = "yes"
  769. then
  770. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  771. ENABLED_ARC4=no
  772. fi
  773. fi
  774. AM_CONDITIONAL([BUILD_RC4], [test "x$ENABLED_ARC4" = "xyes"])
  775. # MD5
  776. AC_ARG_ENABLE([md5],
  777. [ --enable-md5 Enable MD5 (default: enabled)],
  778. [ ENABLED_MD5=$enableval ],
  779. [ ENABLED_MD5=yes ]
  780. )
  781. if test "$ENABLED_MD5" = "no"
  782. then
  783. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  784. else
  785. # turn off MD5 if leanpsk on
  786. if test "$ENABLED_LEANPSK" = "yes"
  787. then
  788. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  789. ENABLED_MD5=no
  790. fi
  791. fi
  792. AM_CONDITIONAL([BUILD_MD5], [test "x$ENABLED_MD5" = "xyes"])
  793. # SHA
  794. AC_ARG_ENABLE([sha],
  795. [ --enable-sha Enable SHA (default: enabled)],
  796. [ ENABLED_SHA=$enableval ],
  797. [ ENABLED_SHA=yes ]
  798. )
  799. if test "$ENABLED_SHA" = "no"
  800. then
  801. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  802. else
  803. # turn off SHA if leanpsk on
  804. if test "$ENABLED_LEANPSK" = "yes"
  805. then
  806. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  807. ENABLED_SHA=no
  808. fi
  809. fi
  810. AM_CONDITIONAL([BUILD_SHA], [test "x$ENABLED_SHA" = "xyes"])
  811. # MD4
  812. AC_ARG_ENABLE([md4],
  813. [ --enable-md4 Enable MD4 (default: disabled)],
  814. [ ENABLED_MD4=$enableval ],
  815. [ ENABLED_MD4=no ]
  816. )
  817. if test "$ENABLED_MD4" = "no"
  818. then
  819. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  820. fi
  821. AM_CONDITIONAL([BUILD_MD4], [test "x$ENABLED_MD4" = "xyes"])
  822. # Web Server Build
  823. AC_ARG_ENABLE([webserver],
  824. [ --enable-webserver Enable Web Server (default: disabled)],
  825. [ ENABLED_WEBSERVER=$enableval ],
  826. [ ENABLED_WEBSERVER=no ]
  827. )
  828. if test "$ENABLED_WEBSERVER" = "yes"
  829. then
  830. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  831. fi
  832. # PWDBASED
  833. AC_ARG_ENABLE([pwdbased],
  834. [ --enable-pwdbased Enable PWDBASED (default: disabled)],
  835. [ ENABLED_PWDBASED=$enableval ],
  836. [ ENABLED_PWDBASED=no ]
  837. )
  838. if test "$ENABLED_PWDBASED" = "no"
  839. then
  840. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes"
  841. then
  842. # opensslextra and webserver needs pwdbased
  843. ENABLED_PWDBASED=yes
  844. else
  845. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  846. fi
  847. fi
  848. AM_CONDITIONAL([BUILD_PWDBASED], [test "x$ENABLED_PWDBASED" = "xyes"])
  849. # HC128
  850. AC_ARG_ENABLE([hc128],
  851. [ --enable-hc128 Enable HC-128 (default: disabled)],
  852. [ ENABLED_HC128=$enableval ],
  853. [ ENABLED_HC128=no ]
  854. )
  855. if test "$ENABLED_HC128" = "no"
  856. then
  857. AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
  858. else
  859. AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
  860. fi
  861. AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
  862. # RABBIT
  863. AC_ARG_ENABLE([rabbit],
  864. [ --enable-rabbit Enable RABBIT (default: disabled)],
  865. [ ENABLED_RABBIT=$enableval ],
  866. [ ENABLED_RABBIT=no ]
  867. )
  868. if test "$ENABLED_RABBIT" = "no"
  869. then
  870. AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
  871. else
  872. AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
  873. fi
  874. AM_CONDITIONAL([BUILD_RABBIT], [test "x$ENABLED_RABBIT" = "xyes"])
  875. # CHACHA
  876. AC_ARG_ENABLE([chacha],
  877. [ --enable-chacha Enable CHACHA (default: disabled)],
  878. [ ENABLED_CHACHA=$enableval ],
  879. [ ENABLED_CHACHA=no ]
  880. )
  881. if test "$ENABLED_CHACHA" = "yes"
  882. then
  883. AM_CFLAGS="$AM_CFLAGS -DHAVE_CHACHA"
  884. fi
  885. AM_CONDITIONAL([BUILD_CHACHA], [test "x$ENABLED_CHACHA" = "xyes"])
  886. # FIPS
  887. AC_ARG_ENABLE([fips],
  888. [ --enable-fips Enable FIPS 140-2 (default: disabled)],
  889. [ ENABLED_FIPS=$enableval ],
  890. [ ENABLED_FIPS=no ]
  891. )
  892. if test "x$ENABLED_FIPS" = "xyes"
  893. then
  894. # requires thread local storage
  895. if test "$thread_ls_on" = "no"
  896. then
  897. AC_MSG_ERROR([FIPS requires Thread Local Storage])
  898. fi
  899. # requires SHA512
  900. if test "x$ENABLED_SHA512" = "xno"
  901. then
  902. ENABLED_SHA512="yes"
  903. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"
  904. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  905. fi
  906. # requires AESGCM
  907. if test "x$ENABLED_AESGCM" != "xyes"
  908. then
  909. ENABLED_AESGCM="yes"
  910. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  911. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  912. fi
  913. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
  914. fi
  915. AM_CONDITIONAL([BUILD_FIPS], [test "x$ENABLED_FIPS" = "xyes"])
  916. # Hash DRBG
  917. AC_ARG_ENABLE([hashdrbg],
  918. [ --enable-hashdrbg Enable Hash DRBG support (default: enabled)],
  919. [ ENABLED_HASHDRBG=$enableval ],
  920. [ ENABLED_HASHDRBG=yes ]
  921. )
  922. if test "x$ENABLED_HASHDRBG" = "xyes"
  923. then
  924. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  925. else
  926. # turn on Hash DRBG if FIPS is on or ARC4 is off
  927. if test "x$ENABLED_FIPS" = "xyes" || test "x$ENABLED_ARC4" = "xno"
  928. then
  929. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  930. ENABLED_HASHDRBG=yes
  931. fi
  932. fi
  933. # Filesystem Build
  934. AC_ARG_ENABLE([filesystem],
  935. [ --enable-filesystem Enable Filesystem support (default: enabled)],
  936. [ ENABLED_FILESYSTEM=$enableval ],
  937. [ ENABLED_FILESYSTEM=yes ]
  938. )
  939. if test "$ENABLED_FILESYSTEM" = "no"
  940. then
  941. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  942. else
  943. # turn off filesystem if leanpsk on
  944. if test "$ENABLED_LEANPSK" = "yes"
  945. then
  946. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  947. ENABLED_FILESYSTEM=no
  948. fi
  949. fi
  950. # inline Build
  951. AC_ARG_ENABLE([inline],
  952. [ --enable-inline Enable inline functions (default: enabled)],
  953. [ ENABLED_INLINE=$enableval ],
  954. [ ENABLED_INLINE=yes ]
  955. )
  956. if test "$ENABLED_INLINE" = "no"
  957. then
  958. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  959. fi
  960. AM_CONDITIONAL([BUILD_INLINE], [test "x$ENABLED_INLINE" = "xyes"])
  961. # OCSP
  962. AC_ARG_ENABLE([ocsp],
  963. [ --enable-ocsp Enable OCSP (default: disabled)],
  964. [ ENABLED_OCSP=$enableval ],
  965. [ ENABLED_OCSP=no ],
  966. )
  967. if test "$ENABLED_OCSP" = "yes"
  968. then
  969. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  970. fi
  971. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  972. if test "$ENABLED_OCSP" = "yes"
  973. then
  974. # check openssl command tool for testing ocsp
  975. AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
  976. if test "$HAVE_OPENSSL_CMD" = "yes"
  977. then
  978. AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
  979. else
  980. AC_MSG_WARN([openssl command line tool not available for testing ocsp])
  981. fi
  982. fi
  983. # CRL
  984. AC_ARG_ENABLE([crl],
  985. [ --enable-crl Enable CRL (default: disabled)],
  986. [ ENABLED_CRL=$enableval ],
  987. [ ENABLED_CRL=no ],
  988. )
  989. if test "$ENABLED_CRL" = "yes"
  990. then
  991. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  992. fi
  993. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  994. # CRL Monitor
  995. AC_ARG_ENABLE([crl-monitor],
  996. [ --enable-crl-monitor Enable CRL Monitor (default: disabled)],
  997. [ ENABLED_CRL_MONITOR=$enableval ],
  998. [ ENABLED_CRL_MONITOR=no ],
  999. )
  1000. if test "$ENABLED_CRL_MONITOR" = "yes"
  1001. then
  1002. case $host_os in
  1003. *linux* | *darwin* | *freebsd*)
  1004. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
  1005. *)
  1006. AC_MSG_ERROR([crl monitor only allowed on linux, OS X, or freebsd]) ;;
  1007. esac
  1008. fi
  1009. AM_CONDITIONAL([BUILD_CRL_MONITOR], [test "x$ENABLED_CRL_MONITOR" = "xyes"])
  1010. # NTRU
  1011. ENABLED_NTRU="no"
  1012. tryntrudir=""
  1013. AC_ARG_WITH([ntru],
  1014. [ --with-ntru=PATH Path to NTRU install (default /usr/) ],
  1015. [
  1016. AC_MSG_CHECKING([for NTRU])
  1017. CPPFLAGS="$CPPFLAGS -DHAVE_NTRU"
  1018. LIBS="$LIBS -lNTRUEncrypt"
  1019. 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 ])
  1020. if test "x$ntru_linked" == "xno" ; then
  1021. if test "x$withval" != "xno" ; then
  1022. tryntrudir=$withval
  1023. fi
  1024. if test "x$withval" == "xyes" ; then
  1025. tryntrudir="/usr"
  1026. fi
  1027. LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  1028. CPPFLAGS="$CPPFLAGS -I$tryntrudir/include"
  1029. 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 ])
  1030. if test "x$ntru_linked" == "xno" ; then
  1031. AC_MSG_ERROR([NTRU isn't found.
  1032. If it's already installed, specify its path using --with-ntru=/dir/])
  1033. fi
  1034. AC_MSG_RESULT([yes])
  1035. AM_LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  1036. else
  1037. AC_MSG_RESULT([yes])
  1038. fi
  1039. AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU"
  1040. ENABLED_NTRU="yes"
  1041. ]
  1042. )
  1043. AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
  1044. if test "$ENABLED_NTRU" = "yes" && test "$ENABLED_SMALL" = "yes"
  1045. then
  1046. AC_MSG_ERROR([cannot enable ntru and small, ntru requires TLS which small turns off.])
  1047. fi
  1048. # SNI
  1049. AC_ARG_ENABLE([sni],
  1050. [ --enable-sni Enable SNI (default: disabled)],
  1051. [ ENABLED_SNI=$enableval ],
  1052. [ ENABLED_SNI=no ]
  1053. )
  1054. if test "x$ENABLED_SNI" = "xyes"
  1055. then
  1056. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  1057. fi
  1058. # Maximum Fragment Length
  1059. AC_ARG_ENABLE([maxfragment],
  1060. [ --enable-maxfragment Enable Maximum Fragment Length (default: disabled)],
  1061. [ ENABLED_MAX_FRAGMENT=$enableval ],
  1062. [ ENABLED_MAX_FRAGMENT=no ]
  1063. )
  1064. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  1065. then
  1066. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  1067. fi
  1068. # Truncated HMAC
  1069. AC_ARG_ENABLE([truncatedhmac],
  1070. [ --enable-truncatedhmac Enable Truncated HMAC (default: disabled)],
  1071. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  1072. [ ENABLED_TRUNCATED_HMAC=no ]
  1073. )
  1074. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  1075. then
  1076. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  1077. fi
  1078. # Renegotiation Indication - (FAKE Secure Renegotiation)
  1079. AC_ARG_ENABLE([renegotiation-indication],
  1080. [ --enable-renegotiation-indication Enable Renegotiation Indication (default: disabled)],
  1081. [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
  1082. [ ENABLED_RENEGOTIATION_INDICATION=no ]
  1083. )
  1084. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  1085. then
  1086. AM_CFLAGS="$AM_CFLAGS -DHAVE_RENEGOTIATION_INDICATION"
  1087. fi
  1088. # Secure Renegotiation
  1089. AC_ARG_ENABLE([secure-renegotiation],
  1090. [ --enable-secure-renegotiation Enable Secure Renegotiation (default: disabled)],
  1091. [ ENABLED_SECURE_RENEGOTIATION=$enableval ],
  1092. [ ENABLED_SECURE_RENEGOTIATION=no ]
  1093. )
  1094. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes"
  1095. then
  1096. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  1097. then
  1098. AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.])
  1099. fi
  1100. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION"
  1101. fi
  1102. # Supported Elliptic Curves Extensions
  1103. AC_ARG_ENABLE([supportedcurves],
  1104. [ --enable-supportedcurves Enable Supported Elliptic Curves (default: disabled)],
  1105. [ ENABLED_SUPPORTED_CURVES=$enableval ],
  1106. [ ENABLED_SUPPORTED_CURVES=no ]
  1107. )
  1108. if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
  1109. then
  1110. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"
  1111. fi
  1112. # Session Ticket Extension
  1113. AC_ARG_ENABLE([session-ticket],
  1114. [ --enable-session-ticket Enable Session Ticket (default: disabled)],
  1115. [ ENABLED_SESSION_TICKET=$enableval ],
  1116. [ ENABLED_SESSION_TICKET=no ]
  1117. )
  1118. if test "x$ENABLED_SESSION_TICKET" = "xyes"
  1119. then
  1120. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  1121. fi
  1122. # TLS Extensions
  1123. AC_ARG_ENABLE([tlsx],
  1124. [ --enable-tlsx Enable all TLS Extensions (default: disabled)],
  1125. [ ENABLED_TLSX=$enableval ],
  1126. [ ENABLED_TLSX=no ]
  1127. )
  1128. if test "x$ENABLED_TLSX" = "xyes"
  1129. then
  1130. ENABLED_SNI=yes
  1131. ENABLED_MAX_FRAGMENT=yes
  1132. ENABLED_TRUNCATED_HMAC=yes
  1133. ENABLED_SUPPORTED_CURVES=yes
  1134. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES"
  1135. fi
  1136. # PKCS7
  1137. AC_ARG_ENABLE([pkcs7],
  1138. [ --enable-pkcs7 Enable PKCS7 (default: disabled)],
  1139. [ ENABLED_PKCS7=$enableval ],
  1140. [ ENABLED_PKCS7=no ],
  1141. )
  1142. if test "$ENABLED_PKCS7" = "yes"
  1143. then
  1144. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  1145. fi
  1146. AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
  1147. # Simple Certificate Enrollment Protocol (SCEP)
  1148. AC_ARG_ENABLE([scep],
  1149. [ --enable-scep Enable wolfSCEP (default: disabled)],
  1150. [ ENABLED_WOLFSCEP=$enableval ],
  1151. [ ENABLED_WOLFSCEP=no ]
  1152. )
  1153. if test "$ENABLED_WOLFSCEP" = "yes"
  1154. then
  1155. # Enable prereqs if not already enabled
  1156. if test "x$ENABLED_KEYGEN" = "xno"
  1157. then
  1158. ENABLED_KEYGEN="yes"
  1159. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  1160. fi
  1161. if test "x$ENABLED_CERTGEN" = "xno"
  1162. then
  1163. ENABLED_CERTGEN="yes"
  1164. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1165. fi
  1166. if test "x$ENABLED_CERTREQ" = "xno"
  1167. then
  1168. ENABLED_CERTREQ="yes"
  1169. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  1170. fi
  1171. if test "x$ENABLED_PKCS7" = "xno"
  1172. then
  1173. ENABLED_PKCS7="yes"
  1174. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  1175. AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
  1176. fi
  1177. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_WOLFSCEP"
  1178. fi
  1179. # Small Stack
  1180. AC_ARG_ENABLE([smallstack],
  1181. [ --enable-smallstack Enable Small Stack Usage (default: disabled)],
  1182. [ ENABLED_SMALL_STACK=$enableval ],
  1183. [ ENABLED_SMALL_STACK=no ]
  1184. )
  1185. if test "x$ENABLED_SMALL_STACK" = "xyes"
  1186. then
  1187. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK"
  1188. fi
  1189. #valgrind
  1190. AC_ARG_ENABLE([valgrind],
  1191. [ --enable-valgrind Enable valgrind for unit tests (default: disabled)],
  1192. [ ENABLED_VALGRIND=$enableval ],
  1193. [ ENABLED_VALGRIND=no ]
  1194. )
  1195. if test "$ENABLED_VALGRIND" = "yes"
  1196. then
  1197. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  1198. if test "$HAVE_VALGRIND" = "no"
  1199. then
  1200. AC_MSG_ERROR([Valgrind not found.])
  1201. fi
  1202. enable_shared=no
  1203. enable_static=yes
  1204. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  1205. fi
  1206. AM_CONDITIONAL([USE_VALGRIND], [test "x$ENABLED_VALGRIND" = "xyes"])
  1207. # Test certs, use internal cert functions for extra testing
  1208. AC_ARG_ENABLE([testcert],
  1209. [ --enable-testcert Enable Test Cert (default: disabled)],
  1210. [ ENABLED_TESTCERT=$enableval ],
  1211. [ ENABLED_TESTCERT=no ]
  1212. )
  1213. if test "$ENABLED_TESTCERT" = "yes"
  1214. then
  1215. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TEST_CERT"
  1216. fi
  1217. # I/O Pool, an example to show user how to override memory handler and use
  1218. # a pool for the input/output buffer requests
  1219. AC_ARG_ENABLE([iopool],
  1220. [ --enable-iopool Enable I/O Pool example (default: disabled)],
  1221. [ ENABLED_IOPOOL=$enableval ],
  1222. [ ENABLED_IOPOOL=no ]
  1223. )
  1224. if test "$ENABLED_IOPOOL" = "yes"
  1225. then
  1226. if test "$thread_ls_on" = "no"
  1227. then
  1228. AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
  1229. fi
  1230. AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
  1231. fi
  1232. # Certificate Service Support
  1233. AC_ARG_ENABLE([certservice],
  1234. [ --enable-certservice Enable cert service (default: disabled)],
  1235. [ ENABLED_CERT_SERVICE=$enableval ],
  1236. [ ENABLED_CERT_SERVICE=no ]
  1237. )
  1238. if test "$ENABLED_CERT_SERVICE" = "yes"
  1239. then
  1240. # Requires ecc,certgen, and opensslextra make sure on
  1241. if test "x$ENABLED_CERTGEN" = "xno"
  1242. then
  1243. ENABLED_CERTGEN="yes"
  1244. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1245. fi
  1246. if test "x$ENABLED_ECC" = "xno"
  1247. then
  1248. ENABLED_ECC="yes"
  1249. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
  1250. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  1251. fi
  1252. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1253. then
  1254. ENABLED_OPENSSLEXTRA="yes"
  1255. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  1256. fi
  1257. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_CERT_SERVICE"
  1258. fi
  1259. # set fastmath default
  1260. FASTMATH_DEFAULT=no
  1261. if test "$host_cpu" = "x86_64"
  1262. then
  1263. FASTMATH_DEFAULT=yes
  1264. fi
  1265. # fastmath
  1266. AC_ARG_ENABLE([fastmath],
  1267. [ --enable-fastmath Enable fast math ops (default: enabled on x86_64)],
  1268. [ ENABLED_FASTMATH=$enableval ],
  1269. [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
  1270. )
  1271. if test "x$ENABLED_FASTMATH" = "xyes"
  1272. then
  1273. # turn off fastmth if leanpsk on or asn off
  1274. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  1275. then
  1276. ENABLED_FASTMATH=no
  1277. else
  1278. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1279. ENABLED_SLOWMATH="no"
  1280. fi
  1281. fi
  1282. # fast HUGE math
  1283. AC_ARG_ENABLE([fasthugemath],
  1284. [ --enable-fasthugemath Enable fast math + huge code (default: disabled)],
  1285. [ ENABLED_FASTHUGEMATH=$enableval ],
  1286. [ ENABLED_FASTHUGEMATH=no ]
  1287. )
  1288. if test "$ENABLED_BUMP" = "yes"
  1289. then
  1290. ENABLED_FASTHUGEMATH="yes"
  1291. fi
  1292. if test "$ENABLED_FASTHUGEMATH" = "yes"
  1293. then
  1294. ENABLED_FASTMATH="yes"
  1295. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1296. ENABLED_SLOWMATH="no"
  1297. fi
  1298. AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
  1299. AM_CONDITIONAL([BUILD_SLOWMATH], [test "x$ENABLED_SLOWMATH" = "xyes"])
  1300. # Enable Examples, used to disable examples
  1301. AC_ARG_ENABLE([examples],
  1302. [ --enable-examples Enable Examples (default: enabled)],
  1303. [ ENABLED_EXAMPLES=$enableval ],
  1304. [ ENABLED_EXAMPLES=yes ]
  1305. )
  1306. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  1307. AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
  1308. # certs still have sha signatures for now
  1309. AS_IF([test "x$ENABLED_SHA" = "xno"], [ENABLED_EXAMPLES="no"])
  1310. AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$ENABLED_EXAMPLES" = "xyes"])
  1311. # LIBZ
  1312. ENABLED_LIBZ="no"
  1313. trylibzdir=""
  1314. AC_ARG_WITH([libz],
  1315. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  1316. [
  1317. AC_MSG_CHECKING([for libz])
  1318. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  1319. LIBS="$LIBS -lz"
  1320. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  1321. if test "x$libz_linked" == "xno" ; then
  1322. if test "x$withval" != "xno" ; then
  1323. trylibzdir=$withval
  1324. fi
  1325. if test "x$withval" == "xyes" ; then
  1326. trylibzdir="/usr"
  1327. fi
  1328. AM_LDFLAGS="$AM_LDFLAGS -L$trylibzdir/lib"
  1329. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  1330. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  1331. if test "x$libz_linked" == "xno" ; then
  1332. AC_MSG_ERROR([libz isn't found.
  1333. If it's already installed, specify its path using --with-libz=/dir/])
  1334. fi
  1335. AC_MSG_RESULT([yes])
  1336. else
  1337. AC_MSG_RESULT([yes])
  1338. fi
  1339. ENABLED_LIBZ="yes"
  1340. ]
  1341. )
  1342. AM_CONDITIONAL([BUILD_LIBZ], [test "x$ENABLED_LIBZ" = "xyes"])
  1343. # cavium
  1344. trycaviumdir=""
  1345. AC_ARG_WITH([cavium],
  1346. [ --with-cavium=PATH PATH to cavium/software dir ],
  1347. [
  1348. AC_MSG_CHECKING([for cavium])
  1349. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
  1350. if test "x$withval" == "xyes" ; then
  1351. AC_MSG_ERROR([need a PATH for --with-cavium])
  1352. fi
  1353. if test "x$withval" != "xno" ; then
  1354. trycaviumdir=$withval
  1355. fi
  1356. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  1357. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  1358. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  1359. if test "x$cavium_linked" == "xno" ; then
  1360. AC_MSG_ERROR([cavium isn't found.
  1361. If it's already installed, specify its path using --with-cavium=/dir/])
  1362. fi
  1363. AC_MSG_RESULT([yes])
  1364. enable_shared=no
  1365. enable_static=yes
  1366. ]
  1367. )
  1368. # microchip api
  1369. AC_ARG_ENABLE([mcapi],
  1370. [ --enable-mcapi Enable Microchip API (default: disabled)],
  1371. [ ENABLED_MCAPI=$enableval ],
  1372. [ ENABLED_MCAPI=no ]
  1373. )
  1374. if test "$ENABLED_MCAPI" = "yes"
  1375. then
  1376. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  1377. fi
  1378. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  1379. then
  1380. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  1381. fi
  1382. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  1383. then
  1384. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  1385. fi
  1386. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  1387. then
  1388. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  1389. fi
  1390. AM_CONDITIONAL([BUILD_MCAPI], [test "x$ENABLED_MCAPI" = "xyes"])
  1391. # OPTIMIZE FLAGS
  1392. if test "$GCC" = "yes"
  1393. then
  1394. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  1395. if test "$ax_enable_debug" = "no"
  1396. then
  1397. if test "$ENABLED_FASTMATH" = "yes"
  1398. then
  1399. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  1400. if test "$ENABLED_FASTHUGEMATH" = "yes"
  1401. then
  1402. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  1403. fi
  1404. else
  1405. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  1406. fi
  1407. fi
  1408. fi
  1409. # ICC command line warning for non supported warning flags
  1410. if test "$CC" = "icc"
  1411. then
  1412. AM_CFLAGS="$AM_CFLAGS -wd10006"
  1413. fi
  1414. LIB_SOCKET_NSL
  1415. AX_HARDEN_CC_COMPILER_FLAGS
  1416. # link to ws2_32 if on mingw
  1417. case $host_os in
  1418. *mingw32)
  1419. LDFLAGS="$LDFLAGS -lws2_32" ;;
  1420. esac
  1421. # add user C_EXTRA_FLAGS back
  1422. CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
  1423. OPTION_FLAGS="$USER_C_EXTRA_FLAGS $AM_CFLAGS"
  1424. CREATE_HEX_VERSION
  1425. AC_SUBST([AM_CPPFLAGS])
  1426. AC_SUBST([AM_CFLAGS])
  1427. AC_SUBST([AM_LDFLAGS])
  1428. # FINAL
  1429. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  1430. AC_CONFIG_FILES([Makefile])
  1431. AC_CONFIG_FILES([wolfssl/version.h])
  1432. AC_CONFIG_FILES([wolfssl/options.h])
  1433. #have options.h and version.h for autoconf fips tag and build
  1434. #if test "x$ENABLED_FIPS" = "xyes"
  1435. #then
  1436. # AC_CONFIG_FILES([cyassl/version.h])
  1437. # AC_CONFIG_FILES([cyassl/options.h])
  1438. #fi
  1439. AC_CONFIG_FILES([support/wolfssl.pc])
  1440. AC_CONFIG_FILES([rpm/spec])
  1441. AX_CREATE_GENERIC_CONFIG
  1442. AX_AM_JOBSERVER([yes])
  1443. AC_OUTPUT
  1444. # force make clean
  1445. echo "---"
  1446. echo "Running make clean..."
  1447. make clean >/dev/null 2>&1
  1448. # Touch files that may not be in repository
  1449. echo "Touching File..."
  1450. touch ctaocrypt/src/fips.c
  1451. touch ctaocrypt/src/fips_test.c
  1452. echo
  1453. # generate user options header
  1454. echo "---"
  1455. echo "Generating user options header..."
  1456. OPTION_FILE="wolfssl/options.h"
  1457. #if
  1458. #OPTION_FILE+="cyassl/options.h"
  1459. #fi
  1460. rm -f $OPTION_FILE
  1461. echo "/* wolfssl options.h" > $OPTION_FILE
  1462. echo " * generated from configure options" >> $OPTION_FILE
  1463. echo " *" >> $OPTION_FILE
  1464. echo " * Copyright (C) 2006-2015 wolfSSL Inc." >> $OPTION_FILE
  1465. echo " *" >> $OPTION_FILE
  1466. echo " * This file is part of wolfSSL. (formerly known as CyaSSL)" >> $OPTION_FILE
  1467. echo " *" >> $OPTION_FILE
  1468. echo " */" >> $OPTION_FILE
  1469. echo "" >> $OPTION_FILE
  1470. echo "#pragma once" >> $OPTION_FILE
  1471. echo "" >> $OPTION_FILE
  1472. echo "#ifdef __cplusplus" >> $OPTION_FILE
  1473. echo "extern \"C\" {" >> $OPTION_FILE
  1474. echo "#endif" >> $OPTION_FILE
  1475. echo "" >> $OPTION_FILE
  1476. for option in $OPTION_FLAGS; do
  1477. defonly=`echo $option | sed 's/-D//'`
  1478. if test "$defonly" != "$option"
  1479. then
  1480. noequalsign=`echo $defonly | sed 's/=/ /'`
  1481. echo "#undef $noequalsign" >> $OPTION_FILE
  1482. echo "#define $noequalsign" >> $OPTION_FILE
  1483. echo "" >> $OPTION_FILE
  1484. else
  1485. echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
  1486. fi
  1487. done
  1488. echo "" >> $OPTION_FILE
  1489. echo "#ifdef __cplusplus" >> $OPTION_FILE
  1490. echo "}" >> $OPTION_FILE
  1491. echo "#endif" >> $OPTION_FILE
  1492. echo "" >> $OPTION_FILE
  1493. echo
  1494. #backwards compatability for those who have included options or version
  1495. touch cyassl/options.h
  1496. echo "/* cyassl options.h" > cyassl/options.h
  1497. echo " * generated from wolfssl/options.h" >> cyassl/options.h
  1498. echo " */\n" >> cyassl/options.h
  1499. while read -r line
  1500. do
  1501. echo "$line" >> cyassl/options.h
  1502. done < $OPTION_FILE
  1503. # output config summary
  1504. echo "---"
  1505. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  1506. echo ""
  1507. echo " * Installation prefix: $prefix"
  1508. echo " * System type: $host_vendor-$host_os"
  1509. echo " * Host CPU: $host_cpu"
  1510. echo " * C Compiler: $CC"
  1511. echo " * C Flags: $CFLAGS"
  1512. echo " * C++ Compiler: $CXX"
  1513. echo " * C++ Flags: $CXXFLAGS"
  1514. echo " * CPP Flags: $CPPFLAGS"
  1515. echo " * LIB Flags: $LIB"
  1516. echo " * Debug enabled: $ax_enable_debug"
  1517. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  1518. echo " * make -j: $enable_jobserver"
  1519. echo " * VCS checkout: $ac_cv_vcs_checkout"
  1520. echo
  1521. echo " Features "
  1522. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  1523. echo " * Filesystem: $ENABLED_FILESYSTEM"
  1524. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  1525. echo " * fastmath: $ENABLED_FASTMATH"
  1526. echo " * sniffer: $ENABLED_SNIFFER"
  1527. echo " * snifftest: $ENABLED_SNIFFTEST"
  1528. echo " * ARC4: $ENABLED_ARC4"
  1529. echo " * AES: $ENABLED_AES"
  1530. echo " * AES-NI: $ENABLED_AESNI"
  1531. echo " * AES-GCM: $ENABLED_AESGCM"
  1532. echo " * AES-CCM: $ENABLED_AESCCM"
  1533. echo " * DES3: $ENABLED_DES3"
  1534. echo " * Camellia: $ENABLED_CAMELLIA"
  1535. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  1536. echo " * MD5: $ENABLED_MD5"
  1537. echo " * RIPEMD: $ENABLED_RIPEMD"
  1538. echo " * SHA: $ENABLED_SHA"
  1539. echo " * SHA-512: $ENABLED_SHA512"
  1540. echo " * BLAKE2: $ENABLED_BLAKE2"
  1541. echo " * keygen: $ENABLED_KEYGEN"
  1542. echo " * certgen: $ENABLED_CERTGEN"
  1543. echo " * certreq: $ENABLED_CERTREQ"
  1544. echo " * HC-128: $ENABLED_HC128"
  1545. echo " * RABBIT: $ENABLED_RABBIT"
  1546. echo " * CHACHA: $ENABLED_CHACHA"
  1547. echo " * Hash DRBG: $ENABLED_HASHDRBG"
  1548. echo " * PWDBASED: $ENABLED_PWDBASED"
  1549. echo " * HKDF: $ENABLED_HKDF"
  1550. echo " * MD4: $ENABLED_MD4"
  1551. echo " * PSK: $ENABLED_PSK"
  1552. echo " * Poly1305: $ENABLED_POLY1305"
  1553. echo " * LEANPSK: $ENABLED_LEANPSK"
  1554. echo " * RSA: $ENABLED_RSA"
  1555. echo " * DSA: $ENABLED_DSA"
  1556. echo " * DH: $ENABLED_DH"
  1557. echo " * ECC: $ENABLED_ECC"
  1558. echo " * FPECC: $ENABLED_FPECC"
  1559. echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
  1560. echo " * ASN: $ENABLED_ASN"
  1561. echo " * Anonymous cipher: $ENABLED_ANON"
  1562. echo " * CODING: $ENABLED_CODING"
  1563. echo " * MEMORY: $ENABLED_MEMORY"
  1564. echo " * I/O POOL: $ENABLED_IOPOOL"
  1565. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  1566. echo " * DTLS: $ENABLED_DTLS"
  1567. echo " * Old TLS Versions: $ENABLED_OLD_TLS"
  1568. echo " * OCSP: $ENABLED_OCSP"
  1569. echo " * CRL: $ENABLED_CRL"
  1570. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  1571. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  1572. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  1573. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  1574. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  1575. echo " * NTRU: $ENABLED_NTRU"
  1576. echo " * SNI: $ENABLED_SNI"
  1577. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  1578. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  1579. echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
  1580. echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
  1581. echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
  1582. echo " * Session Ticket: $ENABLED_SESSION_TICKET"
  1583. echo " * All TLS Extensions: $ENABLED_TLSX"
  1584. echo " * PKCS#7 $ENABLED_PKCS7"
  1585. echo " * wolfSCEP $ENABLED_WOLFSCEP"
  1586. echo " * Small Stack: $ENABLED_SMALL_STACK"
  1587. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  1588. echo " * LIBZ: $ENABLED_LIBZ"
  1589. echo " * Examples: $ENABLED_EXAMPLES"
  1590. echo ""
  1591. echo "---"