configure.ac 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275
  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.9.8],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[http://www.wolfssl.com])
  9. AC_CONFIG_AUX_DIR([build-aux])
  10. # The following sets CFLAGS to empty if unset on command line. We do not want
  11. # the default "-g -O2" that AC_PROG_CC sets automatically.
  12. : ${CFLAGS=""}
  13. AC_CANONICAL_HOST
  14. AC_CANONICAL_BUILD
  15. AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
  16. AC_PREREQ([2.63])
  17. AC_ARG_PROGRAM
  18. AC_DEFUN([PROTECT_AC_USE_SYSTEM_EXTENSIONS],
  19. [AX_SAVE_FLAGS
  20. AC_LANG_PUSH([C])
  21. AC_USE_SYSTEM_EXTENSIONS
  22. AC_LANG_POP([C])
  23. AX_RESTORE_FLAGS
  24. ])
  25. #PROTECT_AC_USE_SYSTEM_EXTENSIONS
  26. AC_CONFIG_MACRO_DIR([m4])
  27. AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
  28. #shared library versioning
  29. WOLFSSL_LIBRARY_VERSION=7:0:4
  30. # | | |
  31. # +------+ | +---+
  32. # | | |
  33. # current:revision:age
  34. # | | |
  35. # | | +- increment if interfaces have been added
  36. # | | set to zero if interfaces have been removed
  37. # | | or changed
  38. # | +- increment if source code has changed
  39. # | set to zero if current is incremented
  40. # +- increment if interfaces have been added, removed or changed
  41. AC_SUBST([WOLFSSL_LIBRARY_VERSION])
  42. # capture user C_EXTRA_FLAGS from ./configure line, CFLAGS may hold -g -O2 even
  43. # if user doesn't override, no way to tell
  44. USER_C_EXTRA_FLAGS="$C_EXTRA_FLAGS"
  45. USER_CFLAGS="$CFLAGS"
  46. LT_PREREQ([2.2])
  47. LT_INIT([disable-static],[win32-dll])
  48. LT_LANG([C++])
  49. LT_LANG([C])
  50. gl_VISIBILITY
  51. AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
  52. AM_CPPFLAGS="$AM_CPPFLAGS $CFLAG_VISIBILITY"
  53. CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"
  54. ])
  55. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  56. AC_CHECK_FUNCS([gethostbyname])
  57. AC_CHECK_FUNCS([getaddrinfo])
  58. AC_CHECK_FUNCS([gettimeofday])
  59. AC_CHECK_FUNCS([gmtime_r])
  60. AC_CHECK_FUNCS([inet_ntoa])
  61. AC_CHECK_FUNCS([memset])
  62. AC_CHECK_FUNCS([socket])
  63. AC_CHECK_HEADERS([arpa/inet.h])
  64. AC_CHECK_HEADERS([fcntl.h])
  65. AC_CHECK_HEADERS([limits.h])
  66. AC_CHECK_HEADERS([netdb.h])
  67. AC_CHECK_HEADERS([netinet/in.h])
  68. AC_CHECK_HEADERS([stddef.h])
  69. AC_CHECK_HEADERS([sys/ioctl.h])
  70. AC_CHECK_HEADERS([sys/socket.h])
  71. AC_CHECK_HEADERS([sys/time.h])
  72. AC_CHECK_HEADERS([errno.h])
  73. AC_CHECK_LIB(network,socket)
  74. AC_CHECK_SIZEOF(long long, 8)
  75. AC_CHECK_SIZEOF(long, 4)
  76. AC_CHECK_TYPES(__uint128_t)
  77. AC_C_BIGENDIAN
  78. # mktime check takes forever on some systems, if time supported it would be
  79. # highly unusual for mktime to be missing
  80. #AC_FUNC_MKTIME
  81. AC_PROG_CC
  82. AC_PROG_CC_C_O
  83. AC_PROG_CXX
  84. AC_PROG_INSTALL
  85. AC_TYPE_SIZE_T
  86. AC_TYPE_UINT8_T
  87. AM_PROG_AS
  88. AM_PROG_CC_C_O
  89. LT_LIB_M
  90. OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
  91. OPTIMIZE_FAST_CFLAGS="-O2 -fomit-frame-pointer"
  92. OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
  93. DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL"
  94. LIB_ADD=
  95. LIB_STATIC_ADD=
  96. thread_ls_on=no
  97. # Thread local storage
  98. AX_TLS([
  99. [AM_CFLAGS="$AM_CFLAGS -DHAVE_THREAD_LS"]
  100. [thread_ls_on=yes]
  101. ] , [:])
  102. # DEBUG
  103. AX_DEBUG
  104. AS_IF([test "$ax_enable_debug" = "yes"],
  105. [AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"],
  106. [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
  107. # Distro build feature subset (Debian, Ubuntu, etc.)
  108. AC_ARG_ENABLE([distro],
  109. [ --enable-distro Enable wolfSSL distro build (default: disabled)],
  110. [ ENABLED_DISTRO=$enableval ],
  111. [ ENABLED_DISTRO=no ]
  112. )
  113. if test "$ENABLED_DISTRO" = "yes"
  114. then
  115. enable_shared=yes
  116. enable_static=yes
  117. enable_dtls=yes
  118. enable_openssh=yes
  119. enable_opensslextra=yes
  120. enable_savesession=yes
  121. enable_savecert=yes
  122. enable_atomicuser=yes
  123. enable_pkcallbacks=yes
  124. enable_aesgcm=yes
  125. enable_aesccm=yes
  126. enable_camellia=yes
  127. enable_ripemd=yes
  128. enable_sha512=yes
  129. enable_sessioncerts=yes
  130. enable_keygen=yes
  131. enable_certgen=yes
  132. enable_certreq=yes
  133. enable_certext=yes
  134. enable_sep=yes
  135. enable_hkdf=yes
  136. enable_dsa=yes
  137. enable_ecccustcurves=yes
  138. enable_compkey=yes
  139. enable_curve25519=yes
  140. enable_ed25519=yes
  141. enable_fpecc=yes
  142. enable_eccencrypt=yes
  143. enable_psk=yes
  144. enable_idea=yes
  145. enable_cmac=yes
  146. enable_webserver=yes
  147. enable_hc128=yes
  148. enable_rabbit=yes
  149. enable_ocsp=yes
  150. enable_ocspstapling=yes
  151. enable_ocspstapling2=yes
  152. enable_crl=yes
  153. enable_crl_monitor=yes
  154. enable_sni=yes
  155. enable_maxfragment=yes
  156. enable_alpn=yes
  157. enable_truncatedhmac=yes
  158. enable_supportedcurves=yes
  159. enable_session_ticket=yes
  160. enable_tlsx=yes
  161. enable_pkcs7=yes
  162. enable_scep=yes
  163. enable_srp=yes
  164. enable_certservice=yes
  165. enable_jni=yes
  166. enable_lighty=yes
  167. enable_stunnel=yes
  168. enable_pwdbased=yes
  169. fi
  170. # SINGLE THREADED
  171. AC_ARG_ENABLE([singlethreaded],
  172. [ --enable-singlethreaded Enable wolfSSL single threaded (default: disabled)],
  173. [ ENABLED_SINGLETHREADED=$enableval ],
  174. [ ENABLED_SINGLETHREADED=no ])
  175. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
  176. AX_PTHREAD([
  177. AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
  178. AM_CFLAGS="-D_POSIX_THREADS $AM_CFLAGS $PTHREAD_CFLAGS"
  179. LIBS="$LIBS $PTHREAD_LIBS"
  180. ],[
  181. ENABLED_SINGLETHREADED=yes
  182. ])
  183. ])
  184. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="-DSINGLE_THREADED $AM_CFLAGS" ])
  185. # DTLS
  186. AC_ARG_ENABLE([dtls],
  187. [ --enable-dtls Enable wolfSSL DTLS (default: disabled)],
  188. [ ENABLED_DTLS=$enableval ],
  189. [ ENABLED_DTLS=no ]
  190. )
  191. if test "$ENABLED_DTLS" = "yes"
  192. then
  193. AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  194. fi
  195. # DTLS-SCTP
  196. AC_ARG_ENABLE([sctp],
  197. [AS_HELP_STRING([--enable-sctp],[Enable wolfSSL DTLS-SCTP support (default: disabled)])],
  198. [ENABLED_SCTP=$enableval],
  199. [ENABLED_SCTP=no])
  200. AM_CONDITIONAL([BUILD_SCTP], [test "x$ENABLED_SCTP" = "xyes"])
  201. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  202. [AC_MSG_CHECKING([for SCTP])
  203. AC_RUN_IFELSE(
  204. [AC_LANG_PROGRAM(
  205. [[
  206. #include <sys/socket.h>
  207. #include <arpa/inet.h>
  208. ]],
  209. [[int s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); if (s == -1) return 1;]])],
  210. [AC_MSG_RESULT(yes)],
  211. [AC_MSG_RESULT(no)
  212. AC_MSG_ERROR([SCTP not available, remove enable-sctp from configure])])
  213. ])
  214. # OpenSSH compatibility Build
  215. AC_ARG_ENABLE([openssh],
  216. [AS_HELP_STRING([--enable-openssh],[Enable OpenSSH compatibility build (default: disabled)])],
  217. [ENABLED_OPENSSH=$enableval],
  218. [ENABLED_OPENSSH=no])
  219. # OPENSSL Extra Compatibility
  220. AC_ARG_ENABLE([opensslextra],
  221. [ --enable-opensslextra Enable extra OpenSSL API, size+ (default: disabled)],
  222. [ ENABLED_OPENSSLEXTRA=$enableval ],
  223. [ ENABLED_OPENSSLEXTRA=no ]
  224. )
  225. if test "$ENABLED_OPENSSH" = "yes"
  226. then
  227. ENABLED_OPENSSLEXTRA="yes"
  228. fi
  229. if test "$ENABLED_OPENSSLEXTRA" = "yes"
  230. then
  231. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  232. fi
  233. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
  234. then
  235. AC_MSG_ERROR([cannot enable small and opensslextra, only one or the other.])
  236. fi
  237. # High Strength Build
  238. AC_ARG_ENABLE([maxstrength],
  239. [AS_HELP_STRING([--enable-maxstrength],[Enable Max Strengh build, allows TLSv1.2-AEAD-PFS ciphers only (default: disabled)])],
  240. [ENABLED_MAXSTRENGTH=$enableval],
  241. [ENABLED_MAXSTRENGTH=no])
  242. # Harden, enable Timing Resistance and Blinding by default
  243. AC_ARG_ENABLE([harden],
  244. [AS_HELP_STRING([--enable-harden],[Enable Hardened build, Enables Timing Resistance and Blinding (default: enabled)])],
  245. [ENABLED_HARDEN=$enableval],
  246. [ENABLED_HARDEN=yes])
  247. if test "$ENABLED_HARDEN" = "yes"
  248. then
  249. AM_CFLAGS="$AM_CFLAGS -DTFM_TIMING_RESISTANT -DECC_TIMING_RESISTANT -DWC_RSA_BLINDING"
  250. fi
  251. # IPv6 Test Apps
  252. AC_ARG_ENABLE([ipv6],
  253. [ --enable-ipv6 Enable testing of IPV6 (default: disabled)],
  254. [ ENABLED_IPV6=$enableval ],
  255. [ ENABLED_IPV6=no ]
  256. )
  257. if test "$ENABLED_IPV6" = "yes"
  258. then
  259. AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6"
  260. fi
  261. AM_CONDITIONAL([BUILD_IPV6], [test "x$ENABLED_IPV6" = "xyes"])
  262. # Fortress build
  263. AC_ARG_ENABLE([fortress],
  264. [ --enable-fortress Enable SSL fortress build (default: disabled)],
  265. [ ENABLED_FORTRESS=$enableval ],
  266. [ ENABLED_FORTRESS=no ]
  267. )
  268. if test "$ENABLED_OPENSSH" = "yes"
  269. then
  270. ENABLED_FORTRESS="yes"
  271. fi
  272. if test "$ENABLED_FORTRESS" = "yes"
  273. then
  274. 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"
  275. fi
  276. # ssl bump build
  277. AC_ARG_ENABLE([bump],
  278. [ --enable-bump Enable SSL Bump build (default: disabled)],
  279. [ ENABLED_BUMP=$enableval ],
  280. [ ENABLED_BUMP=no ]
  281. )
  282. if test "$ENABLED_BUMP" = "yes"
  283. then
  284. 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"
  285. fi
  286. ENABLED_SLOWMATH="yes"
  287. # lean psk build
  288. AC_ARG_ENABLE([leanpsk],
  289. [ --enable-leanpsk Enable Lean PSK build (default: disabled)],
  290. [ ENABLED_LEANPSK=$enableval ],
  291. [ ENABLED_LEANPSK=no ]
  292. )
  293. if test "$ENABLED_LEANPSK" = "yes"
  294. then
  295. 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_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"
  296. ENABLED_SLOWMATH="no"
  297. ENABLED_SINGLETHREADED="yes"
  298. fi
  299. AM_CONDITIONAL([BUILD_LEANPSK], [test "x$ENABLED_LEANPSK" = "xyes"])
  300. # lean TLS build (TLS 1.2 client only (no client auth), ECC256, AES128 and SHA256 w/o Shamir)
  301. AC_ARG_ENABLE([leantls],
  302. [ --enable-leantls Enable Lean TLS build (default: disabled)],
  303. [ ENABLED_LEANTLS=$enableval ],
  304. [ ENABLED_LEANTLS=no ]
  305. )
  306. if test "$ENABLED_LEANTLS" = "yes"
  307. then
  308. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANTLS -DNO_WRITEV -DHAVE_ECC -DTFM_ECC256 -DECC_USER_CURVES -DNO_WOLFSSL_SERVER -DNO_RABBIT -DNO_RSA -DNO_DSA -DNO_DH -DNO_PWDBASED -DNO_MD5 -DNO_ERROR_STRINGS -DNO_OLD_TLS -DNO_RC4 -DNO_SESSION_CACHE -DNO_SHA -DUSE_SLOW_SHA -DUSE_SLOW_SHA2 -DNO_PSK -DNO_WOLFSSL_MEMORY"
  309. fi
  310. AM_CONDITIONAL([BUILD_LEANTLS], [test "x$ENABLED_LEANTLS" = "xyes"])
  311. # big cache
  312. AC_ARG_ENABLE([bigcache],
  313. [ --enable-bigcache Enable big session cache (default: disabled)],
  314. [ ENABLED_BIGCACHE=$enableval ],
  315. [ ENABLED_BIGCACHE=no ]
  316. )
  317. if test "$ENABLED_BIGCACHE" = "yes"
  318. then
  319. AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
  320. fi
  321. # HUGE cache
  322. AC_ARG_ENABLE([hugecache],
  323. [ --enable-hugecache Enable huge session cache (default: disabled)],
  324. [ ENABLED_HUGECACHE=$enableval ],
  325. [ ENABLED_HUGECACHE=no ]
  326. )
  327. if test "$ENABLED_HUGECACHE" = "yes"
  328. then
  329. AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
  330. fi
  331. # SMALL cache
  332. AC_ARG_ENABLE([smallcache],
  333. [ --enable-smallcache Enable small session cache (default: disabled)],
  334. [ ENABLED_SMALLCACHE=$enableval ],
  335. [ ENABLED_SMALLCACHE=no ]
  336. )
  337. if test "$ENABLED_SMALLCACHE" = "yes"
  338. then
  339. AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
  340. fi
  341. # Persistent session cache
  342. AC_ARG_ENABLE([savesession],
  343. [ --enable-savesession Enable persistent session cache (default: disabled)],
  344. [ ENABLED_SAVESESSION=$enableval ],
  345. [ ENABLED_SAVESESSION=no ]
  346. )
  347. if test "$ENABLED_SAVESESSION" = "yes"
  348. then
  349. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  350. fi
  351. # Persistent cert cache
  352. AC_ARG_ENABLE([savecert],
  353. [ --enable-savecert Enable persistent cert cache (default: disabled)],
  354. [ ENABLED_SAVECERT=$enableval ],
  355. [ ENABLED_SAVECERT=no ]
  356. )
  357. if test "$ENABLED_SAVECERT" = "yes"
  358. then
  359. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  360. fi
  361. # Atomic User Record Layer
  362. AC_ARG_ENABLE([atomicuser],
  363. [ --enable-atomicuser Enable Atomic User Record Layer (default: disabled)],
  364. [ ENABLED_ATOMICUSER=$enableval ],
  365. [ ENABLED_ATOMICUSER=no ]
  366. )
  367. if test "$ENABLED_ATOMICUSER" = "yes"
  368. then
  369. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  370. fi
  371. # Public Key Callbacks
  372. AC_ARG_ENABLE([pkcallbacks],
  373. [ --enable-pkcallbacks Enable Public Key Callbacks (default: disabled)],
  374. [ ENABLED_PKCALLBACKS=$enableval ],
  375. [ ENABLED_PKCALLBACKS=no ]
  376. )
  377. if test "$ENABLED_PKCALLBACKS" = "yes"
  378. then
  379. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  380. fi
  381. # SNIFFER
  382. AC_ARG_ENABLE([sniffer],
  383. [AS_HELP_STRING([--enable-sniffer],[Enable wolfSSL sniffer support (default: disabled)])],
  384. [ ENABLED_SNIFFER=$enableval ],
  385. [ ENABLED_SNIFFER=no ]
  386. )
  387. # sniffer doesn't work in maxstrength mode
  388. if test "$ENABLED_SNIFFER" = "yes" && test "$ENABLED_MAXSTRENGTH" = "yes"
  389. then
  390. AC_MSG_ERROR([cannot enable maxstrength in sniffer mode.])
  391. fi
  392. ENABLED_SNIFFTEST=no
  393. AS_IF([ test "x$ENABLED_SNIFFER" = "xyes" ],
  394. [
  395. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SNIFFER -DOPENSSL_EXTRA"
  396. AC_CHECK_HEADERS([pcap/pcap.h],
  397. [ ENABLED_SNIFFTEST=yes ],
  398. [ AC_MSG_WARN([cannot enable sniffer test without having libpcap available.]) ]
  399. )
  400. ])
  401. AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" ])
  402. AM_CONDITIONAL([BUILD_SNIFFTEST], [ test "x$ENABLED_SNIFFTEST" = "xyes" ])
  403. # AES-GCM
  404. AC_ARG_ENABLE([aesgcm],
  405. [AS_HELP_STRING([--enable-aesgcm],[Enable wolfSSL AES-GCM support (default: enabled)])],
  406. [ ENABLED_AESGCM=$enableval ],
  407. [ ENABLED_AESGCM=yes ]
  408. )
  409. # leanpsk and leantls don't need gcm
  410. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  411. then
  412. ENABLED_AESGCM=no
  413. fi
  414. if test "$ENABLED_AESGCM" = "word32"
  415. then
  416. AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
  417. ENABLED_AESGCM=yes
  418. fi
  419. if test "$ENABLED_AESGCM" = "small"
  420. then
  421. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
  422. ENABLED_AESGCM=yes
  423. fi
  424. if test "$ENABLED_AESGCM" = "table"
  425. then
  426. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
  427. ENABLED_AESGCM=yes
  428. fi
  429. if test "$ENABLED_AESGCM" = "yes"
  430. then
  431. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  432. fi
  433. AM_CONDITIONAL([BUILD_AESGCM], [test "x$ENABLED_AESGCM" = "xyes"])
  434. # AES-CCM
  435. AC_ARG_ENABLE([aesccm],
  436. [ --enable-aesccm Enable wolfSSL AES-CCM support (default: disabled)],
  437. [ ENABLED_AESCCM=$enableval ],
  438. [ ENABLED_AESCCM=no ]
  439. )
  440. if test "$ENABLED_AESCCM" = "yes"
  441. then
  442. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
  443. fi
  444. AM_CONDITIONAL([BUILD_AESCCM], [test "x$ENABLED_AESCCM" = "xyes"])
  445. # AES-ARM
  446. AC_ARG_ENABLE([armasm],
  447. [AS_HELP_STRING([--enable-armasm],[Enable wolfSSL ARM ASM support (default: disabled)])],
  448. [ ENABLED_ARMASM=$enableval ],
  449. [ ENABLED_ARMASM=no ]
  450. )
  451. if test "$ENABLED_ARMASM" = "yes"
  452. then
  453. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ARMASM"
  454. if test "$GCC" = "yes"
  455. then
  456. # GCC needs this flag
  457. AM_CFLAGS="$AM_CFLAGS -mcpu=generic+crypto"
  458. fi
  459. fi
  460. AM_CONDITIONAL([BUILD_ARMASM], [test "x$ENABLED_ARMASM" = "xyes"])
  461. # AES-NI
  462. AC_ARG_ENABLE([aesni],
  463. [AS_HELP_STRING([--enable-aesni],[Enable wolfSSL AES-NI support (default: disabled)])],
  464. [ ENABLED_AESNI=$enableval ],
  465. [ ENABLED_AESNI=no ]
  466. )
  467. # INTEL ASM
  468. AC_ARG_ENABLE([intelasm],
  469. [AS_HELP_STRING([--enable-intelasm],[Enable All Intel ASM speedups (default: disabled)])],
  470. [ ENABLED_INTELASM=$enableval ],
  471. [ ENABLED_INTELASM=no ]
  472. )
  473. if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
  474. then
  475. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
  476. if test "$GCC" = "yes"
  477. then
  478. # GCC needs these flags, icc doesn't
  479. # opt levels greater than 2 may cause problems on systems w/o aesni
  480. if test "$CC" != "icc"
  481. then
  482. AM_CFLAGS="$AM_CFLAGS -maes -msse4"
  483. fi
  484. fi
  485. AS_IF([test "x$ENABLED_AESGCM" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
  486. fi
  487. if test "$ENABLED_INTELASM" = "yes"
  488. then
  489. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDGEN -DUSE_INTEL_SPEEDUP"
  490. ENABLED_AESNI=yes
  491. fi
  492. AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
  493. # Camellia
  494. AC_ARG_ENABLE([camellia],
  495. [ --enable-camellia Enable wolfSSL Camellia support (default: disabled)],
  496. [ ENABLED_CAMELLIA=$enableval ],
  497. [ ENABLED_CAMELLIA=no ]
  498. )
  499. if test "$ENABLED_CAMELLIA" = "yes"
  500. then
  501. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
  502. fi
  503. AM_CONDITIONAL([BUILD_CAMELLIA], [test "x$ENABLED_CAMELLIA" = "xyes"])
  504. # MD2
  505. AC_ARG_ENABLE([md2],
  506. [ --enable-md2 Enable wolfSSL MD2 support (default: disabled)],
  507. [ ENABLED_MD2=$enableval ],
  508. [ ENABLED_MD2=no ]
  509. )
  510. if test "$ENABLED_BUMP" = "yes"
  511. then
  512. ENABLED_MD2="yes"
  513. fi
  514. if test "$ENABLED_MD2" = "yes"
  515. then
  516. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MD2"
  517. fi
  518. AM_CONDITIONAL([BUILD_MD2], [test "x$ENABLED_MD2" = "xyes"])
  519. # NULL CIPHER
  520. AC_ARG_ENABLE([nullcipher],
  521. [ --enable-nullcipher Enable wolfSSL NULL cipher support (default: disabled)],
  522. [ ENABLED_NULL_CIPHER=$enableval ],
  523. [ ENABLED_NULL_CIPHER=no ]
  524. )
  525. if test "$ENABLED_OPENSSH" = "yes"
  526. then
  527. ENABLED_NULL_CIPHER="yes"
  528. fi
  529. if test "$ENABLED_NULL_CIPHER" = "yes"
  530. then
  531. AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  532. fi
  533. # RIPEMD
  534. AC_ARG_ENABLE([ripemd],
  535. [ --enable-ripemd Enable wolfSSL RIPEMD-160 support (default: disabled)],
  536. [ ENABLED_RIPEMD=$enableval ],
  537. [ ENABLED_RIPEMD=no ]
  538. )
  539. if test "$ENABLED_OPENSSH" = "yes"
  540. then
  541. ENABLED_RIPEMD="yes"
  542. fi
  543. if test "$ENABLED_RIPEMD" = "yes"
  544. then
  545. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RIPEMD"
  546. fi
  547. AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
  548. # BLAKE2
  549. AC_ARG_ENABLE([blake2],
  550. [ --enable-blake2 Enable wolfSSL BLAKE2 support (default: disabled)],
  551. [ ENABLED_BLAKE2=$enableval ],
  552. [ ENABLED_BLAKE2=no ]
  553. )
  554. if test "$ENABLED_BLAKE2" = "yes"
  555. then
  556. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2"
  557. fi
  558. AM_CONDITIONAL([BUILD_BLAKE2], [test "x$ENABLED_BLAKE2" = "xyes"])
  559. # set sha512 default
  560. SHA512_DEFAULT=no
  561. if test "$host_cpu" = "x86_64"
  562. then
  563. SHA512_DEFAULT=yes
  564. fi
  565. # SHA512
  566. AC_ARG_ENABLE([sha512],
  567. [AS_HELP_STRING([--enable-sha512],[Enable wolfSSL SHA-512 support (default: enabled on x86_64)])],
  568. [ ENABLED_SHA512=$enableval ],
  569. [ ENABLED_SHA512=$SHA512_DEFAULT ]
  570. )
  571. # leanpsk and leantls don't need sha512
  572. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  573. then
  574. ENABLED_SHA512=no
  575. fi
  576. if test "$ENABLED_OPENSSH" = "yes"
  577. then
  578. ENABLED_SHA512="yes"
  579. fi
  580. if test "$ENABLED_SHA512" = "yes"
  581. then
  582. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"
  583. fi
  584. if test "$ENABLED_FORTRESS" = "yes"
  585. then
  586. ENABLED_SHA512="yes"
  587. fi
  588. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  589. # SESSION CERTS
  590. AC_ARG_ENABLE([sessioncerts],
  591. [ --enable-sessioncerts Enable session cert storing (default: disabled)],
  592. [ ENABLED_SESSIONCERTS=$enableval ],
  593. [ ENABLED_SESSIONCERTS=no ]
  594. )
  595. if test "$ENABLED_SESSIONCERTS" = "yes"
  596. then
  597. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  598. fi
  599. # KEY GENERATION
  600. AC_ARG_ENABLE([keygen],
  601. [ --enable-keygen Enable key generation (default: disabled)],
  602. [ ENABLED_KEYGEN=$enableval ],
  603. [ ENABLED_KEYGEN=no ]
  604. )
  605. if test "$ENABLED_KEYGEN" = "yes"
  606. then
  607. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  608. fi
  609. # CERT GENERATION
  610. AC_ARG_ENABLE([certgen],
  611. [ --enable-certgen Enable cert generation (default: disabled)],
  612. [ ENABLED_CERTGEN=$enableval ],
  613. [ ENABLED_CERTGEN=no ]
  614. )
  615. if test "$ENABLED_CERTGEN" = "yes"
  616. then
  617. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  618. fi
  619. # CERT REQUEST GENERATION
  620. AC_ARG_ENABLE([certreq],
  621. [ --enable-certreq Enable cert request generation (default: disabled)],
  622. [ ENABLED_CERTREQ=$enableval ],
  623. [ ENABLED_CERTREQ=no ]
  624. )
  625. if test "$ENABLED_CERTREQ" = "yes"
  626. then
  627. if test "$ENABLED_CERTGEN" = "no"
  628. then
  629. AC_MSG_ERROR([cannot enable certreq without enabling certgen.])
  630. fi
  631. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  632. fi
  633. # CERT REQUEST EXTENSION
  634. AC_ARG_ENABLE([certext],
  635. [ --enable-certext Enable cert request extensions (default: disabled)],
  636. [ ENABLED_CERTEXT=$enableval ],
  637. [ ENABLED_CERTEXT=no ]
  638. )
  639. if test "$ENABLED_CERTEXT" = "yes"
  640. then
  641. if test "$ENABLED_CERTGEN" = "no"
  642. then
  643. AC_MSG_ERROR([cannot enable certext without enabling certgen.])
  644. fi
  645. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  646. fi
  647. # SEP
  648. AC_ARG_ENABLE([sep],
  649. [ --enable-sep Enable sep extensions (default: disabled)],
  650. [ ENABLED_SEP=$enableval ],
  651. [ ENABLED_SEP=no ]
  652. )
  653. if test "$ENABLED_SEP" = "yes"
  654. then
  655. AM_CFLAGS="-DWOLFSSL_SEP -DKEEP_PEER_CERT $AM_CFLAGS"
  656. fi
  657. # HKDF
  658. AC_ARG_ENABLE([hkdf],
  659. [ --enable-hkdf Enable HKDF (HMAC-KDF) support (default: disabled)],
  660. [ ENABLED_HKDF=$enableval ],
  661. [ ENABLED_HKDF=no ]
  662. )
  663. if test "$ENABLED_HKDF" = "yes"
  664. then
  665. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
  666. fi
  667. # DSA
  668. AC_ARG_ENABLE([dsa],
  669. [ --enable-dsa Enable DSA (default: disabled)],
  670. [ ENABLED_DSA=$enableval ],
  671. [ ENABLED_DSA=no ]
  672. )
  673. if test "$ENABLED_OPENSSH" = "yes"
  674. then
  675. ENABLED_DSA="yes"
  676. fi
  677. if test "$ENABLED_DSA" = "no"
  678. then
  679. AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
  680. fi
  681. AM_CONDITIONAL([BUILD_DSA], [test "x$ENABLED_DSA" = "xyes"])
  682. # set ecc default
  683. ECC_DEFAULT=no
  684. if test "$host_cpu" = "x86_64"
  685. then
  686. ECC_DEFAULT=yes
  687. fi
  688. # ECC Shamir
  689. AC_ARG_ENABLE([eccshamir],
  690. [AS_HELP_STRING([--enable-eccshamir],[Enable ECC Shamir (default: enabled on x86_64)])],
  691. [ ENABLED_ECC_SHAMIR=$enableval ],
  692. [ ENABLED_ECC_SHAMIR=$ECC_DEFAULT ]
  693. )
  694. # ECC
  695. AC_ARG_ENABLE([ecc],
  696. [AS_HELP_STRING([--enable-ecc],[Enable ECC (default: enabled on x86_64)])],
  697. [ ENABLED_ECC=$enableval ],
  698. [ ENABLED_ECC=$ECC_DEFAULT ]
  699. )
  700. # lean psk doesn't need ecc
  701. if test "$ENABLED_LEANPSK" = "yes"
  702. then
  703. ENABLED_ECC=no
  704. fi
  705. if test "$ENABLED_OPENSSH" = "yes"
  706. then
  707. ENABLED_ECC="yes"
  708. fi
  709. if test "$ENABLED_ECC" = "yes"
  710. then
  711. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  712. if test "$ENABLED_ECC_SHAMIR" = "yes"
  713. then
  714. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  715. fi
  716. fi
  717. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  718. # ECC Custom Curves
  719. AC_ARG_ENABLE([ecccustcurves],
  720. [AS_HELP_STRING([--enable-ecccustcurves],[Enable ECC custom curves (default: disabled)])],
  721. [ ENABLED_ECCCUSTCURVES=$enableval ],
  722. [ ENABLED_ECCCUSTCURVES=no ]
  723. )
  724. if test "$ENABLED_ECCCUSTCURVES" = "yes"
  725. then
  726. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES"
  727. fi
  728. # Compressed Key
  729. AC_ARG_ENABLE([compkey],
  730. [AS_HELP_STRING([--enable-compkey],[Enable compressed keys support (default: disabled)])],
  731. [ ENABLED_COMPKEY=$enableval ],
  732. [ ENABLED_COMPKEY=no ]
  733. )
  734. if test "$ENABLED_COMPKEY" = "yes"
  735. then
  736. AM_CFLAGS="$AM_CFLAGS -DHAVE_COMP_KEY"
  737. fi
  738. # for using memory optimization setting on both curve25519 and ed25519
  739. ENABLED_CURVED25519_SMALL=no
  740. # CURVE25519
  741. AC_ARG_ENABLE([curve25519],
  742. [AS_HELP_STRING([--enable-curve25519],[Enable Curve25519 (default: disabled)])],
  743. [ ENABLED_CURVE25519=$enableval ],
  744. [ ENABLED_CURVE25519=no ]
  745. )
  746. if test "$ENABLED_OPENSSH" = "yes"
  747. then
  748. ENABLED_CURVE25519="yes"
  749. fi
  750. if test "$ENABLED_CURVE25519" = "small"
  751. then
  752. AM_CFLAGS="$AM_CFLAGS -DCURVED25519_SMALL"
  753. ENABLED_CURVED25519_SMALL=yes
  754. ENABLED_CURVE25519=yes
  755. fi
  756. if test "$ENABLED_CURVE25519" = "yes"
  757. then
  758. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE25519"
  759. ENABLED_FEMATH=yes
  760. fi
  761. AM_CONDITIONAL([BUILD_CURVE25519], [test "x$ENABLED_CURVE25519" = "xyes"])
  762. # ED25519
  763. AC_ARG_ENABLE([ed25519],
  764. [AS_HELP_STRING([--enable-ed25519],[Enable ED25519 (default: disabled)])],
  765. [ ENABLED_ED25519=$enableval ],
  766. [ ENABLED_ED25519=no ]
  767. )
  768. if test "$ENABLED_OPENSSH" = "yes"
  769. then
  770. ENABLED_ED25519="yes"
  771. fi
  772. if test "$ENABLED_ED25519" = "small"
  773. then
  774. AM_CFLAGS="$AM_CFLAGS -DCURVED25519_SMALL"
  775. ENABLED_CURVED25519_SMALL=yes
  776. ENABLED_ED25519=yes
  777. fi
  778. if test "$ENABLED_ED25519" = "yes"
  779. then
  780. if test "$ENABLED_SHA512" = "no"
  781. then
  782. AC_MSG_ERROR([cannot enable ed25519 without enabling sha512.])
  783. fi
  784. ENABLED_FEMATH=yes
  785. ENABLED_GEMATH=yes
  786. AM_CFLAGS="$AM_CFLAGS -DHAVE_ED25519"
  787. fi
  788. AM_CONDITIONAL([BUILD_ED25519], [test "x$ENABLED_ED25519" = "xyes"])
  789. AM_CONDITIONAL([BUILD_CURVED25519_SMALL], [test "x$ENABLED_CURVED25519_SMALL" = "xyes"])
  790. AM_CONDITIONAL([BUILD_FEMATH], [test "x$ENABLED_FEMATH" = "xyes"])
  791. AM_CONDITIONAL([BUILD_GEMATH], [test "x$ENABLED_GEMATH" = "xyes"])
  792. # FP ECC, Fixed Point cache ECC
  793. AC_ARG_ENABLE([fpecc],
  794. [ --enable-fpecc Enable Fixed Point cache ECC (default: disabled)],
  795. [ ENABLED_FPECC=$enableval ],
  796. [ ENABLED_FPECC=no ]
  797. )
  798. if test "$ENABLED_FPECC" = "yes"
  799. then
  800. if test "$ENABLED_ECC" = "no"
  801. then
  802. AC_MSG_ERROR([cannot enable fpecc without enabling ecc.])
  803. fi
  804. AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
  805. fi
  806. # ECC encrypt
  807. AC_ARG_ENABLE([eccencrypt],
  808. [ --enable-eccencrypt Enable ECC encrypt (default: disabled)],
  809. [ ENABLED_ECC_ENCRYPT=$enableval ],
  810. [ ENABLED_ECC_ENCRYPT=no ]
  811. )
  812. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  813. then
  814. if test "$ENABLED_ECC" = "no"
  815. then
  816. AC_MSG_ERROR([cannot enable eccencrypt without enabling ecc.])
  817. fi
  818. if test "$ENABLED_HKDF" = "no"
  819. then
  820. AC_MSG_ERROR([cannot enable eccencrypt without enabling hkdf.])
  821. fi
  822. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_ENCRYPT"
  823. fi
  824. # PSK
  825. AC_ARG_ENABLE([psk],
  826. [ --enable-psk Enable PSK (default: disabled)],
  827. [ ENABLED_PSK=$enableval ],
  828. [ ENABLED_PSK=no ]
  829. )
  830. # ERROR STRINGS
  831. AC_ARG_ENABLE([errorstrings],
  832. [ --enable-errorstrings Enable error strings table (default: enabled)],
  833. [ ENABLED_ERROR_STRINGS=$enableval ],
  834. [ ENABLED_ERROR_STRINGS=yes ]
  835. )
  836. if test "$ENABLED_ERROR_STRINGS" = "no"
  837. then
  838. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  839. else
  840. # turn off error strings if leanpsk or leantls on
  841. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  842. then
  843. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  844. ENABLED_ERROR_STRINGS=no
  845. fi
  846. fi
  847. # OLD TLS
  848. AC_ARG_ENABLE([oldtls],
  849. [ --enable-oldtls Enable old TLS versions < 1.2 (default: enabled)],
  850. [ ENABLED_OLD_TLS=$enableval ],
  851. [ ENABLED_OLD_TLS=yes ]
  852. )
  853. if test "$ENABLED_OLD_TLS" = "no"
  854. then
  855. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  856. else
  857. # turn off old if leanpsk or leantls on
  858. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  859. then
  860. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  861. ENABLED_OLD_TLS=no
  862. fi
  863. fi
  864. # SSLv3
  865. AC_ARG_ENABLE([sslv3],
  866. [AS_HELP_STRING([--enable-sslv3],[Enable SSL version 3.0 (default: disabled)])],
  867. [ ENABLED_SSLV3=$enableval ],
  868. [ ENABLED_SSLV3=no]
  869. )
  870. if test "$ENABLED_SSLV3" = "yes"
  871. then
  872. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3"
  873. fi
  874. # STACK SIZE info for examples
  875. AC_ARG_ENABLE([stacksize],
  876. [ --enable-stacksize Enable stack size info on examples (default: disabled)],
  877. [ ENABLED_STACKSIZE=$enableval ],
  878. [ ENABLED_STACKSIZE=no ]
  879. )
  880. if test "$ENABLED_STACKSIZE" = "yes"
  881. then
  882. AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  883. AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
  884. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE -DWOLFSSL_LOW_MEMORY"
  885. fi
  886. # MEMORY
  887. AC_ARG_ENABLE([memory],
  888. [ --enable-memory Enable memory callbacks (default: enabled)],
  889. [ ENABLED_MEMORY=$enableval ],
  890. [ ENABLED_MEMORY=yes ]
  891. )
  892. if test "$ENABLED_MEMORY" = "no"
  893. then
  894. AM_CFLAGS="$AM_CFLAGS -DNO_WOLFSSL_MEMORY"
  895. else
  896. # turn off memory cb if leanpsk or leantls on
  897. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  898. then
  899. # but don't turn on NO_WOLFSSL_MEMORY because using own
  900. ENABLED_MEMORY=no
  901. fi
  902. fi
  903. AM_CONDITIONAL([BUILD_MEMORY], [test "x$ENABLED_MEMORY" = "xyes"])
  904. # RSA
  905. AC_ARG_ENABLE([rsa],
  906. [ --enable-rsa Enable RSA (default: enabled)],
  907. [ ENABLED_RSA=$enableval ],
  908. [ ENABLED_RSA=yes ]
  909. )
  910. if test "$ENABLED_RSA" = "no"
  911. then
  912. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  913. else
  914. # turn off RSA if leanpsk or leantls on
  915. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  916. then
  917. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  918. ENABLED_RSA=no
  919. fi
  920. fi
  921. AM_CONDITIONAL([BUILD_RSA], [test "x$ENABLED_RSA" = "xyes"])
  922. # DH
  923. AC_ARG_ENABLE([dh],
  924. [AS_HELP_STRING([--enable-dh],[Enable DH (default: enabled)])],
  925. [ ENABLED_DH=$enableval ],
  926. [ ENABLED_DH=yes ]
  927. )
  928. if test "$ENABLED_OPENSSH" = "yes"
  929. then
  930. ENABLED_DH="yes"
  931. fi
  932. if test "$ENABLED_DH" = "no"
  933. then
  934. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  935. else
  936. # turn off DH if leanpsk or leantls on
  937. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  938. then
  939. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  940. ENABLED_DH=no
  941. fi
  942. fi
  943. AM_CONDITIONAL([BUILD_DH], [test "x$ENABLED_DH" = "xyes"])
  944. # Anonymous
  945. AC_ARG_ENABLE([anon],
  946. [AS_HELP_STRING([--enable-anon],[Enable Anonymous (default: disabled)])],
  947. [ ENABLED_ANON=$enableval ],
  948. [ ENABLED_ANON=no ]
  949. )
  950. if test "x$ENABLED_ANON" = "xyes"
  951. then
  952. if test "x$ENABLED_DH" != "xyes"
  953. then
  954. AC_MSG_ERROR([Anonymous suite requires DH.])
  955. fi
  956. AM_CFLAGS="$AM_CFLAGS -DHAVE_ANON"
  957. fi
  958. # ASN
  959. # turn off asn, which means no certs, no rsa, no dsa, no ecc,
  960. # and no big int (unless dh is on)
  961. AC_ARG_ENABLE([asn],
  962. [ --enable-asn Enable ASN (default: enabled)],
  963. [ ENABLED_ASN=$enableval ],
  964. [ ENABLED_ASN=yes ]
  965. )
  966. if test "$ENABLED_ASN" = "no"
  967. then
  968. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS"
  969. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" == "no"
  970. then
  971. # DH and ECC need bigint
  972. AM_CFLAGS="$AM_CFLAGS -DNO_BIG_INT"
  973. fi
  974. else
  975. # turn off ASN if leanpsk on
  976. if test "$ENABLED_LEANPSK" = "yes"
  977. then
  978. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  979. ENABLED_ASN=no
  980. fi
  981. fi
  982. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_ASN" = "no"
  983. then
  984. AC_MSG_ERROR([please disable rsa if disabling asn.])
  985. fi
  986. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  987. then
  988. AC_MSG_ERROR([please disable dsa if disabling asn.])
  989. fi
  990. # DH and ECC need bigint
  991. if test "$ENABLED_ASN" = "no" && test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no"
  992. then
  993. ENABLED_FASTMATH=no
  994. ENABLED_SLOWMATH=no
  995. fi
  996. AM_CONDITIONAL([BUILD_ASN], [test "x$ENABLED_ASN" = "xyes"])
  997. # AES
  998. AC_ARG_ENABLE([aes],
  999. [ --enable-aes Enable AES (default: enabled)],
  1000. [ ENABLED_AES=$enableval ],
  1001. [ ENABLED_AES=yes ]
  1002. )
  1003. if test "$ENABLED_AES" = "no"
  1004. then
  1005. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  1006. if test "$ENABLED_FORTRESS" = "yes"
  1007. then
  1008. AC_MSG_ERROR([fortress requires aes])
  1009. fi
  1010. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  1011. then
  1012. AC_MSG_ERROR([cannot enable eccencrypt and hkdf without aes.])
  1013. fi
  1014. if test "$ENABLED_AESGCM" = "yes"
  1015. then
  1016. AC_MSG_ERROR([AESGCM requires AES.])
  1017. fi
  1018. if test "$ENABLED_AESCCM" = "yes"
  1019. then
  1020. AC_MSG_ERROR([AESCCM requires AES.])
  1021. fi
  1022. else
  1023. # turn off AES if leanpsk on
  1024. if test "$ENABLED_LEANPSK" = "yes"
  1025. then
  1026. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  1027. ENABLED_AES=no
  1028. fi
  1029. fi
  1030. AM_CONDITIONAL([BUILD_AES], [test "x$ENABLED_AES" = "xyes"])
  1031. # CODING
  1032. AC_ARG_ENABLE([coding],
  1033. [ --enable-coding Enable Coding base 16/64 (default: enabled)],
  1034. [ ENABLED_CODING=$enableval ],
  1035. [ ENABLED_CODING=yes ]
  1036. )
  1037. if test "$ENABLED_CODING" = "no"
  1038. then
  1039. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  1040. else
  1041. # turn off CODING if leanpsk on
  1042. if test "$ENABLED_LEANPSK" = "yes"
  1043. then
  1044. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  1045. ENABLED_CODING=no
  1046. fi
  1047. fi
  1048. AM_CONDITIONAL([BUILD_CODING], [test "x$ENABLED_CODING" = "xyes"])
  1049. # Base64 Encode
  1050. BASE64ENCODE_DEFAULT=no
  1051. if test "$host_cpu" = "x86_64"
  1052. then
  1053. BASE64ENCODE_DEFAULT=yes
  1054. fi
  1055. AC_ARG_ENABLE([base64encode],
  1056. [ --enable-base64encode Enable Base64 encoding (default: enabled on x86_64)],
  1057. [ ENABLED_BASE64ENCODE=$enableval ],
  1058. [ ENABLED_BASE64ENCODE=$BASE64ENCODE_DEFAULT ]
  1059. )
  1060. if test "$ENABLED_BASE64ENCODE" = "yes"
  1061. then
  1062. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE64_ENCODE"
  1063. fi
  1064. # DES3
  1065. AC_ARG_ENABLE([des3],
  1066. [AS_HELP_STRING([--enable-des3],[Enable DES3 (default: disabled)])],
  1067. [ ENABLED_DES3=$enableval ],
  1068. [ ENABLED_DES3=no ]
  1069. )
  1070. # IDEA
  1071. AC_ARG_ENABLE([idea],
  1072. [AS_HELP_STRING([--enable-idea],[Enable IDEA Cipher (default: disabled)])],
  1073. [ ENABLED_IDEA=$enableval ],
  1074. [ ENABLED_IDEA=no ]
  1075. )
  1076. if test "x$ENABLED_IDEA" = "xyes"
  1077. then
  1078. AM_CFLAGS="$AM_CFLAGS -DHAVE_IDEA"
  1079. fi
  1080. AM_CONDITIONAL([BUILD_IDEA], [test "x$ENABLED_IDEA" = "xyes"])
  1081. # ARC4
  1082. AC_ARG_ENABLE([arc4],
  1083. [ --enable-arc4 Enable ARC4 (default: disabled)],
  1084. [ ENABLED_ARC4=$enableval ],
  1085. [ ENABLED_ARC4=no ]
  1086. )
  1087. if test "$ENABLED_OPENSSH" = "yes"
  1088. then
  1089. ENABLED_ARC4="yes"
  1090. fi
  1091. if test "$ENABLED_ARC4" = "no"
  1092. then
  1093. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  1094. else
  1095. # turn off ARC4 if leanpsk or leantls on
  1096. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1097. then
  1098. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  1099. ENABLED_ARC4=no
  1100. fi
  1101. fi
  1102. AM_CONDITIONAL([BUILD_RC4], [test "x$ENABLED_ARC4" = "xyes"])
  1103. # MD5
  1104. AC_ARG_ENABLE([md5],
  1105. [ --enable-md5 Enable MD5 (default: enabled)],
  1106. [ ENABLED_MD5=$enableval ],
  1107. [ ENABLED_MD5=yes ]
  1108. )
  1109. if test "$ENABLED_MD5" = "no"
  1110. then
  1111. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  1112. else
  1113. # turn off MD5 if leanpsk or leantls on
  1114. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1115. then
  1116. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  1117. ENABLED_MD5=no
  1118. fi
  1119. fi
  1120. AM_CONDITIONAL([BUILD_MD5], [test "x$ENABLED_MD5" = "xyes"])
  1121. # SHA
  1122. AC_ARG_ENABLE([sha],
  1123. [ --enable-sha Enable SHA (default: enabled)],
  1124. [ ENABLED_SHA=$enableval ],
  1125. [ ENABLED_SHA=yes ]
  1126. )
  1127. if test "$ENABLED_SHA" = "no"
  1128. then
  1129. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  1130. else
  1131. # turn off SHA if leanpsk or leantls on
  1132. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1133. then
  1134. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  1135. ENABLED_SHA=no
  1136. fi
  1137. fi
  1138. AM_CONDITIONAL([BUILD_SHA], [test "x$ENABLED_SHA" = "xyes"])
  1139. # CMAC
  1140. AC_ARG_ENABLE([cmac],
  1141. [AS_HELP_STRING([--enable-cmac],[Enable CMAC (default: disabled)])],
  1142. [ ENABLED_CMAC=$enableval ],
  1143. [ ENABLED_CMAC=no ]
  1144. )
  1145. AS_IF([test "x$ENABLED_CMAC" = "xyes"],
  1146. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
  1147. AM_CONDITIONAL([BUILD_CMAC], [test "x$ENABLED_CMAC" = "xyes"])
  1148. # Web Server Build
  1149. AC_ARG_ENABLE([webserver],
  1150. [ --enable-webserver Enable Web Server (default: disabled)],
  1151. [ ENABLED_WEBSERVER=$enableval ],
  1152. [ ENABLED_WEBSERVER=no ]
  1153. )
  1154. if test "$ENABLED_WEBSERVER" = "yes"
  1155. then
  1156. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  1157. fi
  1158. # HC128
  1159. AC_ARG_ENABLE([hc128],
  1160. [ --enable-hc128 Enable HC-128 (default: disabled)],
  1161. [ ENABLED_HC128=$enableval ],
  1162. [ ENABLED_HC128=no ]
  1163. )
  1164. if test "$ENABLED_HC128" = "no"
  1165. then
  1166. AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
  1167. else
  1168. AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
  1169. fi
  1170. AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
  1171. # RABBIT
  1172. AC_ARG_ENABLE([rabbit],
  1173. [ --enable-rabbit Enable RABBIT (default: disabled)],
  1174. [ ENABLED_RABBIT=$enableval ],
  1175. [ ENABLED_RABBIT=no ]
  1176. )
  1177. if test "$ENABLED_RABBIT" = "no"
  1178. then
  1179. AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
  1180. else
  1181. AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
  1182. fi
  1183. AM_CONDITIONAL([BUILD_RABBIT], [test "x$ENABLED_RABBIT" = "xyes"])
  1184. # FIPS
  1185. AC_ARG_ENABLE([fips],
  1186. [AS_HELP_STRING([--enable-fips],[Enable FIPS 140-2, Will NOT work w/o FIPS license (default: disabled)])],
  1187. [ ENABLED_FIPS=$enableval ],
  1188. [ ENABLED_FIPS=no ]
  1189. )
  1190. if test "x$ENABLED_FIPS" = "xyes"
  1191. then
  1192. # requires thread local storage
  1193. if test "$thread_ls_on" = "no"
  1194. then
  1195. AC_MSG_ERROR([FIPS requires Thread Local Storage])
  1196. fi
  1197. # requires SHA512
  1198. if test "x$ENABLED_SHA512" = "xno"
  1199. then
  1200. ENABLED_SHA512="yes"
  1201. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"
  1202. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  1203. fi
  1204. # requires AESGCM
  1205. if test "x$ENABLED_AESGCM" != "xyes"
  1206. then
  1207. ENABLED_AESGCM="yes"
  1208. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  1209. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  1210. fi
  1211. # requires DES3
  1212. if test "x$ENABLED_DES3" = "xno"
  1213. then
  1214. ENABLED_DES3="yes"
  1215. fi
  1216. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
  1217. fi
  1218. AM_CONDITIONAL([BUILD_FIPS], [test "x$ENABLED_FIPS" = "xyes"])
  1219. # set POLY1305 default
  1220. POLY1305_DEFAULT=yes
  1221. if test "x$ENABLED_FIPS" = "xyes"
  1222. then
  1223. POLY1305_DEFAULT=no
  1224. fi
  1225. # POLY1305
  1226. AC_ARG_ENABLE([poly1305],
  1227. [AS_HELP_STRING([--enable-poly1305],[Enable wolfSSL POLY1305 support (default: enabled)])],
  1228. [ ENABLED_POLY1305=$enableval ],
  1229. [ ENABLED_POLY1305=$POLY1305_DEFAULT]
  1230. )
  1231. # leanpsk and leantls don't need poly1305
  1232. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1233. then
  1234. ENABLED_POLY1305=no
  1235. fi
  1236. if test "$ENABLED_POLY1305" = "yes"
  1237. then
  1238. AM_CFLAGS="$AM_CFLAGS -DHAVE_POLY1305 -DHAVE_ONE_TIME_AUTH"
  1239. fi
  1240. AM_CONDITIONAL([BUILD_POLY1305], [test "x$ENABLED_POLY1305" = "xyes"])
  1241. # set CHACHA default
  1242. CHACHA_DEFAULT=yes
  1243. if test "x$ENABLED_FIPS" = "xyes"
  1244. then
  1245. CHACHA_DEFAULT=no
  1246. fi
  1247. # CHACHA
  1248. AC_ARG_ENABLE([chacha],
  1249. [ --enable-chacha Enable CHACHA (default: enabled)],
  1250. [ ENABLED_CHACHA=$enableval ],
  1251. [ ENABLED_CHACHA=$CHACHA_DEFAULT]
  1252. )
  1253. # leanpsk and leantls don't need chacha
  1254. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  1255. then
  1256. ENABLED_CHACHA=no
  1257. fi
  1258. if test "$ENABLED_CHACHA" = "yes"
  1259. then
  1260. AM_CFLAGS="$AM_CFLAGS -DHAVE_CHACHA"
  1261. fi
  1262. AM_CONDITIONAL([BUILD_CHACHA], [test "x$ENABLED_CHACHA" = "xyes"])
  1263. # Hash DRBG
  1264. AC_ARG_ENABLE([hashdrbg],
  1265. [ --enable-hashdrbg Enable Hash DRBG support (default: enabled)],
  1266. [ ENABLED_HASHDRBG=$enableval ],
  1267. [ ENABLED_HASHDRBG=yes ]
  1268. )
  1269. if test "x$ENABLED_HASHDRBG" = "xyes"
  1270. then
  1271. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  1272. else
  1273. # turn on Hash DRBG if FIPS is on or ARC4 is off
  1274. if test "x$ENABLED_FIPS" = "xyes" || test "x$ENABLED_ARC4" = "xno"
  1275. then
  1276. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  1277. ENABLED_HASHDRBG=yes
  1278. fi
  1279. fi
  1280. # Filesystem Build
  1281. AC_ARG_ENABLE([filesystem],
  1282. [ --enable-filesystem Enable Filesystem support (default: enabled)],
  1283. [ ENABLED_FILESYSTEM=$enableval ],
  1284. [ ENABLED_FILESYSTEM=yes ]
  1285. )
  1286. if test "$ENABLED_FILESYSTEM" = "no"
  1287. then
  1288. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  1289. else
  1290. # turn off filesystem if leanpsk on
  1291. if test "$ENABLED_LEANPSK" = "yes"
  1292. then
  1293. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  1294. ENABLED_FILESYSTEM=no
  1295. fi
  1296. fi
  1297. # inline Build
  1298. AC_ARG_ENABLE([inline],
  1299. [ --enable-inline Enable inline functions (default: enabled)],
  1300. [ ENABLED_INLINE=$enableval ],
  1301. [ ENABLED_INLINE=yes ]
  1302. )
  1303. if test "$ENABLED_INLINE" = "no"
  1304. then
  1305. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  1306. fi
  1307. AM_CONDITIONAL([BUILD_INLINE], [test "x$ENABLED_INLINE" = "xyes"])
  1308. # OCSP
  1309. AC_ARG_ENABLE([ocsp],
  1310. [ --enable-ocsp Enable OCSP (default: disabled)],
  1311. [ ENABLED_OCSP=$enableval ],
  1312. [ ENABLED_OCSP=no ],
  1313. )
  1314. if test "$ENABLED_OCSP" = "yes"
  1315. then
  1316. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1317. fi
  1318. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1319. if test "$ENABLED_OCSP" = "yes"
  1320. then
  1321. # check openssl command tool for testing ocsp
  1322. AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
  1323. if test "$HAVE_OPENSSL_CMD" = "yes"
  1324. then
  1325. AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
  1326. else
  1327. AC_MSG_WARN([openssl command line tool not available for testing ocsp])
  1328. fi
  1329. fi
  1330. # Certificate Status Request : a.k.a. OCSP Stapling
  1331. AC_ARG_ENABLE([ocspstapling],
  1332. [AS_HELP_STRING([--enable-ocspstapling],[Enable OCSP Stapling (default: disabled)])],
  1333. [ ENABLED_CERTIFICATE_STATUS_REQUEST=$enableval ],
  1334. [ ENABLED_CERTIFICATE_STATUS_REQUEST=no ]
  1335. )
  1336. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"
  1337. then
  1338. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST"
  1339. # Requires OCSP make sure on
  1340. if test "x$ENABLED_OCSP" = "xno"
  1341. then
  1342. ENABLED_OCSP="yes"
  1343. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1344. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1345. fi
  1346. fi
  1347. AM_CONDITIONAL([BUILD_OCSP_STAPLING], [test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"])
  1348. # Certificate Status Request v2 : a.k.a. OCSP stapling v2
  1349. AC_ARG_ENABLE([ocspstapling2],
  1350. [AS_HELP_STRING([--enable-ocspstapling2],[Enable OCSP Stapling v2 (default: disabled)])],
  1351. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=$enableval ],
  1352. [ ENABLED_CERTIFICATE_STATUS_REQUEST_V2=no ]
  1353. )
  1354. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"
  1355. then
  1356. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST_V2"
  1357. # Requires OCSP make sure on
  1358. if test "x$ENABLED_OCSP" = "xno"
  1359. then
  1360. ENABLED_OCSP="yes"
  1361. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1362. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1363. fi
  1364. fi
  1365. AM_CONDITIONAL([BUILD_OCSP_STAPLING_V2], [test "x$ENABLED_CERTIFICATE_STATUS_REQUEST_V2" = "xyes"])
  1366. # CRL
  1367. AC_ARG_ENABLE([crl],
  1368. [ --enable-crl Enable CRL (default: disabled)],
  1369. [ ENABLED_CRL=$enableval ],
  1370. [ ENABLED_CRL=no ],
  1371. )
  1372. if test "$ENABLED_CRL" = "yes"
  1373. then
  1374. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  1375. fi
  1376. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  1377. # CRL Monitor
  1378. AC_ARG_ENABLE([crl-monitor],
  1379. [ --enable-crl-monitor Enable CRL Monitor (default: disabled)],
  1380. [ ENABLED_CRL_MONITOR=$enableval ],
  1381. [ ENABLED_CRL_MONITOR=no ],
  1382. )
  1383. if test "$ENABLED_CRL_MONITOR" = "yes"
  1384. then
  1385. case $host_os in
  1386. *linux* | *darwin* | *freebsd*)
  1387. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
  1388. *)
  1389. AC_MSG_ERROR([crl monitor only allowed on linux, OS X, or freebsd]) ;;
  1390. esac
  1391. fi
  1392. AM_CONDITIONAL([BUILD_CRL_MONITOR], [test "x$ENABLED_CRL_MONITOR" = "xyes"])
  1393. # USER CRYPTO
  1394. ENABLED_USER_CRYPTO="no"
  1395. ENABLED_USER_RSA="no"
  1396. AC_DEFINE([BUILD_USER_RSA], [], [User RSA is being defined])
  1397. trycryptodir=""
  1398. AC_ARG_WITH([user-crypto],
  1399. [AS_HELP_STRING([--with-user-crypto=PATH],[Path to USER_CRYPTO install (default /usr/local)])],
  1400. [
  1401. CPPFLAGS="$CPPFLAGS -DHAVE_USER_CRYPTO"
  1402. LIBS="$LIBS -lusercrypto"
  1403. if test "x$withval" != "xno" ; then
  1404. trycryptodir=$withval
  1405. fi
  1406. if test "x$withval" == "xyes" ; then
  1407. trycryptodir="/usr/local"
  1408. fi
  1409. LDFLAGS="$LDFLAGS -L$trycryptodir/lib"
  1410. CPPFLAGS="$CPPFLAGS -I$trycryptodir/include"
  1411. #Look for RSA Init function in usercrypto lib
  1412. AC_CHECK_LIB([usercrypto], [wc_InitRsaKey], [user_rsa_linked=yes], [user_rsa_linked=no])
  1413. if test "x$user_rsa_linked" == "xyes" ; then
  1414. AC_MSG_NOTICE([User user_rsa.h being used])
  1415. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_RSA"
  1416. ENABLED_USER_RSA=yes
  1417. ENABLED_USER_CRYPTO=yes
  1418. fi
  1419. #Display check and find result of link attempts
  1420. AC_MSG_CHECKING([for USER_CRYPTO])
  1421. if test "x$ENABLED_USER_CRYPTO" == "xno" ; then
  1422. AC_MSG_RESULT([no])
  1423. AC_MSG_ERROR([USER_CRYPTO not found. Either move to /usr/include and /usr/lib or
  1424. Specify its path using --with-user-crypto=/dir/])
  1425. else
  1426. AC_MSG_RESULT([yes])
  1427. # Check if .la is available if not then rely on exported path
  1428. AC_CHECK_FILE($trycryptodir/lib/libusercrypto.la, [LIB_ADD="$trycryptodir/lib/libusercrypto.la $LIB_ADD"], [LIB_ADD="-lusercrypto $LIB_ADD"])
  1429. AM_LDFLAGS="$AM_LDFLAGS -L$trycryptodir/lib"
  1430. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_CRYPTO"
  1431. fi
  1432. ]
  1433. )
  1434. AM_CONDITIONAL([BUILD_USER_RSA], [test "x$ENABLED_USER_RSA" == "xyes"] )
  1435. AM_CONDITIONAL([BUILD_USER_CRYPTO], [test "x$ENABLED_USER_CRYPTO" = "xyes"])
  1436. if test "$ENABLED_USER_CRYPTO" = "yes" && test "$ENABLED_FIPS" = "yes"
  1437. then
  1438. AC_MSG_ERROR([cannot enable user crypto and fips, user crypto posibility of using code in fips boundary.])
  1439. fi
  1440. # NTRU
  1441. ENABLED_NTRU="no"
  1442. tryntrudir=""
  1443. AC_ARG_WITH([ntru],
  1444. [AS_HELP_STRING([--with-ntru=PATH],[Path to NTRU install (default /usr/)])],
  1445. [
  1446. AC_MSG_CHECKING([for NTRU])
  1447. CPPFLAGS="$CPPFLAGS -DHAVE_NTRU -DHAVE_QSH -DHAVE_TLS_EXTENSIONS"
  1448. LIBS="$LIBS -lntruencrypt"
  1449. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libntruencrypt/ntru_crypto_drbg.h>]], [[ ntru_crypto_drbg_instantiate(0, 0, 0, 0, 0); ]])], [ ntru_linked=yes ],[ ntru_linked=no ])
  1450. if test "x$ntru_linked" == "xno" ; then
  1451. if test "x$withval" != "xno" ; then
  1452. tryntrudir=$withval
  1453. fi
  1454. if test "x$withval" == "xyes" ; then
  1455. tryntrudir="/usr"
  1456. fi
  1457. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$tryntrudir/lib"
  1458. CPPFLAGS="$CPPFLAGS -I$tryntrudir/include"
  1459. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libntruencrypt/ntru_crypto_drbg.h>]], [[ ntru_crypto_drbg_instantiate(0, 0, 0, 0, 0); ]])], [ ntru_linked=yes ],[ ntru_linked=no ])
  1460. if test "x$ntru_linked" == "xno" ; then
  1461. AC_MSG_ERROR([NTRU isn't found.
  1462. If it's already installed, specify its path using --with-ntru=/dir/])
  1463. fi
  1464. AC_MSG_RESULT([yes])
  1465. AM_LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  1466. else
  1467. AC_MSG_RESULT([yes])
  1468. fi
  1469. AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU -DHAVE_QSH -DHAVE_TLS_EXTENSIONS"
  1470. ENABLED_NTRU="yes"
  1471. ]
  1472. )
  1473. AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
  1474. # Whitewood netRandom client library
  1475. ENABLED_WNR="no"
  1476. trywnrdir=""
  1477. AC_ARG_WITH([wnr],
  1478. [AS_HELP_STRING([--with-wnr=PATH],[Path to Whitewood netRandom install (default /usr/local)])],
  1479. [
  1480. AC_MSG_CHECKING([for Whitewood netRandom])
  1481. CPPFLAGS="$CPPFLAGS -DHAVE_WNR"
  1482. LIBS="$LIBS -lwnr"
  1483. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  1484. if test "x$wnr_linked" == "xno" ; then
  1485. if test "x$withval" != "xno" ; then
  1486. trywnrdir=$withval
  1487. fi
  1488. if test "x$withval" == "xyes" ; then
  1489. trywnrdir="/usr/local"
  1490. fi
  1491. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$trywnrdir/lib"
  1492. CPPFLAGS="$CPPFLAGS -I$trywnrdir/include"
  1493. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wnr.h>]], [[ wnr_setup(0, 0); ]])], [ wnr_linked=yes ],[ wnr_linked=no ])
  1494. if test "x$wnr_linked" == "xno" ; then
  1495. AC_MSG_ERROR([Whitewood netRandom isn't found.
  1496. If it's already installed, specify its path using --with-wnr=/dir/])
  1497. fi
  1498. AC_MSG_RESULT([yes])
  1499. AM_LDFLAGS="$AM_LDFLAGS -L$trywnrdir/lib"
  1500. else
  1501. AC_MSG_RESULT([yes])
  1502. fi
  1503. AM_CFLAGS="$AM_CFLAGS -DHAVE_WNR"
  1504. ENABLED_WNR="yes"
  1505. ]
  1506. )
  1507. AM_CONDITIONAL([BUILD_WNR], [test "x$ENABLED_WNR" = "xyes"])
  1508. # SNI
  1509. AC_ARG_ENABLE([sni],
  1510. [ --enable-sni Enable SNI (default: disabled)],
  1511. [ ENABLED_SNI=$enableval ],
  1512. [ ENABLED_SNI=no ]
  1513. )
  1514. if test "x$ENABLED_SNI" = "xyes"
  1515. then
  1516. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  1517. fi
  1518. # Maximum Fragment Length
  1519. AC_ARG_ENABLE([maxfragment],
  1520. [ --enable-maxfragment Enable Maximum Fragment Length (default: disabled)],
  1521. [ ENABLED_MAX_FRAGMENT=$enableval ],
  1522. [ ENABLED_MAX_FRAGMENT=no ]
  1523. )
  1524. # ALPN
  1525. AC_ARG_ENABLE([alpn],
  1526. [ --enable-alpn Enable ALPN (default: disabled)],
  1527. [ ENABLED_ALPN=$enableval ],
  1528. [ ENABLED_ALPN=no ]
  1529. )
  1530. if test "x$ENABLED_ALPN" = "xyes"
  1531. then
  1532. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  1533. fi
  1534. # Maximum Fragment Length
  1535. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  1536. then
  1537. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  1538. fi
  1539. # Truncated HMAC
  1540. AC_ARG_ENABLE([truncatedhmac],
  1541. [ --enable-truncatedhmac Enable Truncated HMAC (default: disabled)],
  1542. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  1543. [ ENABLED_TRUNCATED_HMAC=no ]
  1544. )
  1545. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  1546. then
  1547. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  1548. fi
  1549. # Renegotiation Indication - (FAKE Secure Renegotiation)
  1550. AC_ARG_ENABLE([renegotiation-indication],
  1551. [AS_HELP_STRING([--enable-renegotiation-indication],[Enable Renegotiation Indication (default: disabled)])],
  1552. [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
  1553. [ ENABLED_RENEGOTIATION_INDICATION=no ]
  1554. )
  1555. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  1556. then
  1557. AM_CFLAGS="$AM_CFLAGS -DHAVE_RENEGOTIATION_INDICATION"
  1558. fi
  1559. # Secure Renegotiation
  1560. AC_ARG_ENABLE([secure-renegotiation],
  1561. [AS_HELP_STRING([--enable-secure-renegotiation],[Enable Secure Renegotiation (default: disabled)])],
  1562. [ ENABLED_SECURE_RENEGOTIATION=$enableval ],
  1563. [ ENABLED_SECURE_RENEGOTIATION=no ]
  1564. )
  1565. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes"
  1566. then
  1567. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  1568. then
  1569. AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.])
  1570. fi
  1571. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION"
  1572. fi
  1573. # Supported Elliptic Curves Extensions
  1574. AC_ARG_ENABLE([supportedcurves],
  1575. [AS_HELP_STRING([--enable-supportedcurves],[Enable Supported Elliptic Curves (default: enabled)])],
  1576. [ ENABLED_SUPPORTED_CURVES=$enableval ],
  1577. [ ENABLED_SUPPORTED_CURVES=yes ]
  1578. )
  1579. if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
  1580. then
  1581. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"
  1582. fi
  1583. # Session Ticket Extension
  1584. AC_ARG_ENABLE([session-ticket],
  1585. [AS_HELP_STRING([--enable-session-ticket],[Enable Session Ticket (default: disabled)])],
  1586. [ ENABLED_SESSION_TICKET=$enableval ],
  1587. [ ENABLED_SESSION_TICKET=no ]
  1588. )
  1589. if test "x$ENABLED_SESSION_TICKET" = "xyes"
  1590. then
  1591. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  1592. fi
  1593. # TLS Extensions
  1594. AC_ARG_ENABLE([tlsx],
  1595. [ --enable-tlsx Enable all TLS Extensions (default: disabled)],
  1596. [ ENABLED_TLSX=$enableval ],
  1597. [ ENABLED_TLSX=no ]
  1598. )
  1599. if test "x$ENABLED_TLSX" = "xyes"
  1600. then
  1601. ENABLED_SNI=yes
  1602. ENABLED_MAX_FRAGMENT=yes
  1603. ENABLED_TRUNCATED_HMAC=yes
  1604. ENABLED_SUPPORTED_CURVES=yes
  1605. ENABLED_ALPN=yes
  1606. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES -DHAVE_ALPN"
  1607. fi
  1608. # PKCS7
  1609. AC_ARG_ENABLE([pkcs7],
  1610. [AS_HELP_STRING([--enable-pkcs7],[Enable PKCS7 (default: disabled)])],
  1611. [ ENABLED_PKCS7=$enableval ],
  1612. [ ENABLED_PKCS7=no ],
  1613. )
  1614. # Simple Certificate Enrollment Protocol (SCEP)
  1615. AC_ARG_ENABLE([scep],
  1616. [ --enable-scep Enable wolfSCEP (default: disabled)],
  1617. [ ENABLED_WOLFSCEP=$enableval ],
  1618. [ ENABLED_WOLFSCEP=no ]
  1619. )
  1620. # Secure Remote Password
  1621. AC_ARG_ENABLE([srp],
  1622. [ --enable-srp Enable Secure Remote Password (default: disabled)],
  1623. [ ENABLED_SRP=$enableval ],
  1624. [ ENABLED_SRP=no ]
  1625. )
  1626. if test "x$ENABLED_SRP" = "xyes"
  1627. then
  1628. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SRP"
  1629. fi
  1630. AM_CONDITIONAL([BUILD_SRP], [test "x$ENABLED_SRP" = "xyes"])
  1631. # Small Stack
  1632. AC_ARG_ENABLE([smallstack],
  1633. [ --enable-smallstack Enable Small Stack Usage (default: disabled)],
  1634. [ ENABLED_SMALL_STACK=$enableval ],
  1635. [ ENABLED_SMALL_STACK=no ]
  1636. )
  1637. if test "x$ENABLED_SMALL_STACK" = "xyes"
  1638. then
  1639. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK"
  1640. fi
  1641. #valgrind
  1642. AC_ARG_ENABLE([valgrind],
  1643. [ --enable-valgrind Enable valgrind for unit tests (default: disabled)],
  1644. [ ENABLED_VALGRIND=$enableval ],
  1645. [ ENABLED_VALGRIND=no ]
  1646. )
  1647. if test "$ENABLED_VALGRIND" = "yes"
  1648. then
  1649. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  1650. if test "$HAVE_VALGRIND" = "no"
  1651. then
  1652. AC_MSG_ERROR([Valgrind not found.])
  1653. fi
  1654. enable_shared=no
  1655. enable_static=yes
  1656. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  1657. fi
  1658. AM_CONDITIONAL([USE_VALGRIND], [test "x$ENABLED_VALGRIND" = "xyes"])
  1659. # Test certs, use internal cert functions for extra testing
  1660. AC_ARG_ENABLE([testcert],
  1661. [ --enable-testcert Enable Test Cert (default: disabled)],
  1662. [ ENABLED_TESTCERT=$enableval ],
  1663. [ ENABLED_TESTCERT=no ]
  1664. )
  1665. if test "$ENABLED_TESTCERT" = "yes"
  1666. then
  1667. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TEST_CERT"
  1668. fi
  1669. # I/O Pool, an example to show user how to override memory handler and use
  1670. # a pool for the input/output buffer requests
  1671. AC_ARG_ENABLE([iopool],
  1672. [ --enable-iopool Enable I/O Pool example (default: disabled)],
  1673. [ ENABLED_IOPOOL=$enableval ],
  1674. [ ENABLED_IOPOOL=no ]
  1675. )
  1676. if test "$ENABLED_IOPOOL" = "yes"
  1677. then
  1678. if test "$thread_ls_on" = "no"
  1679. then
  1680. AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
  1681. fi
  1682. AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
  1683. fi
  1684. # Certificate Service Support
  1685. AC_ARG_ENABLE([certservice],
  1686. [ --enable-certservice Enable cert service (default: disabled)],
  1687. [ ENABLED_CERT_SERVICE=$enableval ],
  1688. [ ENABLED_CERT_SERVICE=no ]
  1689. )
  1690. if test "$ENABLED_CERT_SERVICE" = "yes"
  1691. then
  1692. # Requires ecc,certgen, and opensslextra make sure on
  1693. if test "x$ENABLED_CERTGEN" = "xno"
  1694. then
  1695. ENABLED_CERTGEN="yes"
  1696. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1697. fi
  1698. if test "x$ENABLED_ECC" = "xno"
  1699. then
  1700. ENABLED_ECC="yes"
  1701. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  1702. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  1703. if test "$ENABLED_ECC_SHAMIR" = "yes"
  1704. then
  1705. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  1706. fi
  1707. fi
  1708. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1709. then
  1710. ENABLED_OPENSSLEXTRA="yes"
  1711. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  1712. fi
  1713. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_CERT_SERVICE"
  1714. fi
  1715. # wolfSSL JNI
  1716. AC_ARG_ENABLE([jni],
  1717. [ --enable-jni Enable wolfSSL JNI (default: disabled)],
  1718. [ ENABLED_JNI=$enableval ],
  1719. [ ENABLED_JNI=no ]
  1720. )
  1721. if test "$ENABLED_JNI" = "yes"
  1722. then
  1723. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_JNI"
  1724. # Enable prereqs if not already enabled
  1725. if test "x$ENABLED_DTLS" = "xno"
  1726. then
  1727. ENABLED_DTLS="yes"
  1728. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  1729. fi
  1730. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1731. then
  1732. ENABLED_OPENSSLEXTRA="yes"
  1733. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  1734. fi
  1735. if test "x$ENABLED_CRL" = "xno"
  1736. then
  1737. ENABLED_CRL="yes"
  1738. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  1739. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  1740. fi
  1741. if test "x$ENABLED_OCSP" = "xno"
  1742. then
  1743. ENABLED_OCSP="yes"
  1744. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1745. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1746. fi
  1747. if test "x$ENABLED_CRL_MONITOR" = "xno"
  1748. then
  1749. ENABLED_CRL_MONITOR="yes"
  1750. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR"
  1751. fi
  1752. if test "x$ENABLED_SAVESESSION" = "xno"
  1753. then
  1754. ENABLED_SAVESESSION="yes"
  1755. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  1756. fi
  1757. if test "x$ENABLED_SAVECERT" = "xno"
  1758. then
  1759. ENABLED_SAVECERT="yes"
  1760. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  1761. fi
  1762. if test "x$ENABLED_ATOMICUSER" = "xno"
  1763. then
  1764. ENABLED_ATOMICUSER="yes"
  1765. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  1766. fi
  1767. if test "x$ENABLED_ECC" = "xno"
  1768. then
  1769. ENABLED_ECC="yes"
  1770. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  1771. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  1772. if test "$ENABLED_ECC_SHAMIR" = "yes"
  1773. then
  1774. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  1775. fi
  1776. fi
  1777. if test "x$ENABLED_PKCALLBACKS" = "xno"
  1778. then
  1779. ENABLED_PKCALLBACKS="yes"
  1780. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  1781. fi
  1782. if test "x$ENABLED_DH" = "xno"
  1783. then
  1784. ENABLED_DH="yes"
  1785. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH"
  1786. fi
  1787. if test "x$ENABLED_PSK" = "xno"
  1788. then
  1789. ENABLED_PSK="yes"
  1790. fi
  1791. fi
  1792. # lighty Support
  1793. AC_ARG_ENABLE([lighty],
  1794. [ --enable-lighty Enable lighttpd/lighty (default: disabled)],
  1795. [ ENABLED_LIGHTY=$enableval ],
  1796. [ ENABLED_LIGHTY=no ]
  1797. )
  1798. if test "$ENABLED_LIGHTY" = "yes"
  1799. then
  1800. # Requires opensslextra make sure on
  1801. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1802. then
  1803. ENABLED_OPENSSLEXTRA="yes"
  1804. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  1805. fi
  1806. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIGHTY -DHAVE_WOLFSSL_SSL_H=1"
  1807. fi
  1808. # stunnel Support
  1809. AC_ARG_ENABLE([stunnel],
  1810. [ --enable-stunnel Enable stunnel (default: disabled)],
  1811. [ ENABLED_STUNNEL=$enableval ],
  1812. [ ENABLED_STUNNEL=no ]
  1813. )
  1814. if test "$ENABLED_STUNNEL" = "yes"
  1815. then
  1816. # Requires opensslextra make sure on
  1817. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1818. then
  1819. ENABLED_OPENSSLEXTRA="yes"
  1820. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  1821. fi
  1822. # Requires OCSP make sure on
  1823. if test "x$ENABLED_OCSP" = "xno"
  1824. then
  1825. ENABLED_OCSP="yes"
  1826. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1827. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1828. fi
  1829. # Requires coding make sure on
  1830. if test "x$ENABLED_CODING" = "xno"
  1831. then
  1832. ENABLED_CODING="yes"
  1833. fi
  1834. # Requires sessioncerts make sure on
  1835. if test "x$ENABLED_SESSIONCERTS" = "xno"
  1836. then
  1837. ENABLED_SESSIONCERTS="yes"
  1838. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  1839. fi
  1840. # Requires crls, make sure on
  1841. if test "x$ENABLED_CRL" = "xno"
  1842. then
  1843. ENABLED_CRL="yes"
  1844. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  1845. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  1846. fi
  1847. # Requires tlsx, make sure on
  1848. if test "x$ENABLED_TLSX" = "xno"
  1849. then
  1850. ENABLED_TLSX="yes"
  1851. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES"
  1852. fi
  1853. # Requires ecc make sure on
  1854. if test "x$ENABLED_ECC" = "xno"
  1855. then
  1856. ENABLED_OPENSSLEXTRA="yes"
  1857. ENABLED_ECC="yes"
  1858. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256"
  1859. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  1860. if test "$ENABLED_ECC_SHAMIR" = "yes"
  1861. then
  1862. AM_CFLAGS="$AM_CFLAGS -DECC_SHAMIR"
  1863. fi
  1864. fi
  1865. AM_CFLAGS="$AM_CFLAGS -DHAVE_STUNNEL -DWOLFSSL_ALWAYS_VERIFY_CB"
  1866. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  1867. fi
  1868. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no" \
  1869. && test "x$ENABLED_STUNNEL" = "xno"
  1870. then
  1871. AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
  1872. fi
  1873. if test "$ENABLED_PSK" = "no" && \
  1874. (test "$ENABLED_LEANPSK" = "yes" || test "x$ENABLED_STUNNEL" = "xyes")
  1875. then
  1876. ENABLED_PSK=yes
  1877. fi
  1878. # MD4
  1879. AC_ARG_ENABLE([md4],
  1880. [ --enable-md4 Enable MD4 (default: disabled)],
  1881. [ ENABLED_MD4=$enableval ],
  1882. [ ENABLED_MD4=no ]
  1883. )
  1884. if test "$ENABLED_MD4" = "no"
  1885. then
  1886. #turn on MD4 if using stunnel
  1887. if test "x$ENABLED_STUNNEL" = "xyes"
  1888. then
  1889. ENABLED_MD4="yes"
  1890. else
  1891. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  1892. fi
  1893. fi
  1894. AM_CONDITIONAL([BUILD_MD4], [test "x$ENABLED_MD4" = "xyes"])
  1895. # PWDBASED has to come after certservice since we want it on w/o explicit on
  1896. # PWDBASED
  1897. AC_ARG_ENABLE([pwdbased],
  1898. [ --enable-pwdbased Enable PWDBASED (default: disabled)],
  1899. [ ENABLED_PWDBASED=$enableval ],
  1900. [ ENABLED_PWDBASED=no ]
  1901. )
  1902. if test "$ENABLED_PWDBASED" = "no"
  1903. then
  1904. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes"
  1905. then
  1906. # opensslextra and webserver needs pwdbased
  1907. ENABLED_PWDBASED=yes
  1908. else
  1909. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  1910. fi
  1911. fi
  1912. AM_CONDITIONAL([BUILD_PWDBASED], [test "x$ENABLED_PWDBASED" = "xyes"])
  1913. # wolfCrypt Only Build
  1914. AC_ARG_ENABLE([cryptonly],
  1915. [AS_HELP_STRING([--enable-cryptonly],[Enable wolfCrypt Only build (default: disabled)])],
  1916. [ENABLED_CRYPTONLY=$enableval],
  1917. [ENABLED_CRYPTONLY=no])
  1918. if test "$ENABLED_CRYPTONLY" = "yes"
  1919. then
  1920. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_ONLY"
  1921. fi
  1922. AM_CONDITIONAL([BUILD_CRYPTONLY], [test "x$ENABLED_CRYPTONLY" = "xyes"])
  1923. if test "x$ENABLED_CRYPTONLY" = "xno"
  1924. then
  1925. if test "x$ENABLED_PSK" = "xno" && test "x$ENABLED_ASN" = "xno"
  1926. then
  1927. AC_MSG_ERROR([please enable psk if disabling asn.])
  1928. fi
  1929. if test "x$ENABLED_ECC" = "xyes" && test "x$ENABLED_ASN" = "xno"
  1930. then
  1931. AC_MSG_ERROR([please disable ecc if disabling asn.])
  1932. fi
  1933. fi
  1934. # set fastmath default
  1935. FASTMATH_DEFAULT=no
  1936. if test "$host_cpu" = "x86_64"
  1937. then
  1938. FASTMATH_DEFAULT=yes
  1939. fi
  1940. # fastmath
  1941. AC_ARG_ENABLE([fastmath],
  1942. [ --enable-fastmath Enable fast math ops (default: enabled on x86_64)],
  1943. [ ENABLED_FASTMATH=$enableval ],
  1944. [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
  1945. )
  1946. if test "x$ENABLED_FASTMATH" = "xyes"
  1947. then
  1948. # turn off fastmth if leanpsk on or asn off (w/o DH and ECC)
  1949. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  1950. then
  1951. if test "$ENABLED_DH" = "no" && test "$ENABLED_ECC" = "no"
  1952. then
  1953. ENABLED_FASTMATH=no
  1954. else
  1955. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1956. ENABLED_SLOWMATH="no"
  1957. fi
  1958. else
  1959. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1960. ENABLED_SLOWMATH="no"
  1961. fi
  1962. if test "$host_cpu" = "x86_64"
  1963. then
  1964. # Have settings.h set FP_MAX_BITS higher if user didn't set directly
  1965. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD"
  1966. fi
  1967. fi
  1968. # fast HUGE math
  1969. AC_ARG_ENABLE([fasthugemath],
  1970. [ --enable-fasthugemath Enable fast math + huge code (default: disabled)],
  1971. [ ENABLED_FASTHUGEMATH=$enableval ],
  1972. [ ENABLED_FASTHUGEMATH=no ]
  1973. )
  1974. if test "$ENABLED_BUMP" = "yes"
  1975. then
  1976. ENABLED_FASTHUGEMATH="yes"
  1977. fi
  1978. if test "$ENABLED_FASTHUGEMATH" = "yes"
  1979. then
  1980. ENABLED_FASTMATH="yes"
  1981. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1982. ENABLED_SLOWMATH="no"
  1983. fi
  1984. AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
  1985. AM_CONDITIONAL([BUILD_SLOWMATH], [test "x$ENABLED_SLOWMATH" = "xyes"])
  1986. # Enable Examples, used to disable examples
  1987. AC_ARG_ENABLE([examples],
  1988. [ --enable-examples Enable Examples (default: enabled)],
  1989. [ ENABLED_EXAMPLES=$enableval ],
  1990. [ ENABLED_EXAMPLES=yes ]
  1991. )
  1992. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  1993. AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
  1994. AS_IF([test "x$ENABLED_CRYPTONLY" = "xyes"], [ENABLED_EXAMPLES="no"])
  1995. AM_CONDITIONAL([BUILD_EXAMPLE_SERVERS], [test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  1996. AM_CONDITIONAL([BUILD_EXAMPLE_CLIENTS], [test "x$ENABLED_EXAMPLES" = "xyes"])
  1997. AM_CONDITIONAL([BUILD_TESTS], [test "x$ENABLED_EXAMPLES" = "xyes" && test "x$ENABLED_LEANTLS" = "xno"])
  1998. # Enable wolfCrypt test and benchmark
  1999. AC_ARG_ENABLE([crypttests],
  2000. [ --enable-crypttests Enable Crypt Bench/Test (default: enabled)],
  2001. [ ENABLED_CRYPT_TESTS=$enableval ],
  2002. [ ENABLED_CRYPT_TESTS=yes ]
  2003. )
  2004. AM_CONDITIONAL([BUILD_WOLFCRYPT_TESTS], [test "x$ENABLED_CRYPT_TESTS" = "xyes"])
  2005. # LIBZ
  2006. ENABLED_LIBZ="no"
  2007. trylibzdir=""
  2008. AC_ARG_WITH([libz],
  2009. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  2010. [
  2011. AC_MSG_CHECKING([for libz])
  2012. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  2013. LIBS="$LIBS -lz"
  2014. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  2015. if test "x$libz_linked" == "xno" ; then
  2016. if test "x$withval" != "xno" ; then
  2017. trylibzdir=$withval
  2018. fi
  2019. if test "x$withval" == "xyes" ; then
  2020. trylibzdir="/usr"
  2021. fi
  2022. AM_LDFLAGS="$AM_LDFLAGS -L$trylibzdir/lib"
  2023. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  2024. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  2025. if test "x$libz_linked" == "xno" ; then
  2026. AC_MSG_ERROR([libz isn't found.
  2027. If it's already installed, specify its path using --with-libz=/dir/])
  2028. fi
  2029. AC_MSG_RESULT([yes])
  2030. else
  2031. AC_MSG_RESULT([yes])
  2032. fi
  2033. ENABLED_LIBZ="yes"
  2034. ]
  2035. )
  2036. AM_CONDITIONAL([BUILD_LIBZ], [test "x$ENABLED_LIBZ" = "xyes"])
  2037. # cavium
  2038. trycaviumdir=""
  2039. AC_ARG_WITH([cavium],
  2040. [ --with-cavium=PATH PATH to cavium/software dir ],
  2041. [
  2042. AC_MSG_CHECKING([for cavium])
  2043. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
  2044. if test "x$withval" == "xyes" ; then
  2045. AC_MSG_ERROR([need a PATH for --with-cavium])
  2046. fi
  2047. if test "x$withval" != "xno" ; then
  2048. trycaviumdir=$withval
  2049. fi
  2050. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  2051. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  2052. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  2053. if test "x$cavium_linked" == "xno" ; then
  2054. AC_MSG_ERROR([cavium isn't found.
  2055. If it's already installed, specify its path using --with-cavium=/dir/])
  2056. fi
  2057. AC_MSG_RESULT([yes])
  2058. enable_shared=no
  2059. enable_static=yes
  2060. ENABLED_CAVIUM=yes
  2061. ],
  2062. [ ENABLED_CAVIUM=no ]
  2063. )
  2064. # cavium V
  2065. trycaviumdir=""
  2066. AC_ARG_WITH([cavium-v],
  2067. [ --with-cavium-v=PATH PATH to Cavium V/software dir ],
  2068. [
  2069. AC_MSG_CHECKING([for cavium])
  2070. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM -DHAVE_CAVIUM_V"
  2071. if test "x$withval" == "xyes" ; then
  2072. AC_MSG_ERROR([need a PATH for --with-cavium])
  2073. fi
  2074. if test "x$withval" != "xno" ; then
  2075. trycaviumdir=$withval
  2076. fi
  2077. LDFLAGS="$AM_LDFLAGS $trycaviumdir/utils/sample_tests/cavium_common.o $trycaviumdir/utils/sample_tests/cavium_sym_crypto.o $trycaviumdir/utils/sample_tests/cavium_asym_crypto.o"
  2078. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  2079. #AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(0); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  2080. if test "x$cavium_linked" == "xno" ; then
  2081. AC_MSG_ERROR([cavium isn't found.
  2082. If it's already installed, specify its path using --with-cavium-v=/dir/])
  2083. fi
  2084. AC_MSG_RESULT([yes])
  2085. enable_shared=no
  2086. enable_static=yes
  2087. ENABLED_CAVIUM=yes
  2088. ENABLED_CAVIUM_V=yes
  2089. ],
  2090. [
  2091. ENABLED_CAVIUM_=no
  2092. ENABLED_CAVIUM_V=no
  2093. ]
  2094. )
  2095. AM_CONDITIONAL([BUILD_CAVIUM], [test "x$ENABLED_CAVIUM" = "xyes"])
  2096. # Fast RSA using Intel IPP
  2097. ippdir="${srcdir}/IPP"
  2098. ipplib="lib" # if autoconf guesses 32bit system changes lib directory
  2099. fastRSA_found=no
  2100. abs_path=`pwd`
  2101. # set up variables used
  2102. IPPLIBS=
  2103. IPPHEADERS=
  2104. IPPLINK=
  2105. AC_ARG_ENABLE([fast-rsa],
  2106. [AS_HELP_STRING([--enable-fast-rsa],[Enable RSA using Intel IPP (default: disabled)])],
  2107. [ ENABLED_FAST_RSA=$enableval ],
  2108. [ ENABLED_FAST_RSA=no ],
  2109. )
  2110. if test "$ENABLED_USER_RSA" = "no" && test "$ENABLED_FIPS" = "no"; then
  2111. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  2112. ipplib="lib_32" # 32 bit OS detected
  2113. fi
  2114. # Use static IPP Libraries
  2115. if test "$enable_shared" = "no" && test "$ENABLED_FAST_RSA" = "yes"; then
  2116. case $host_os in
  2117. *darwin*)
  2118. ipplib="$ipplib/mac_static"
  2119. AC_MSG_ERROR([Issue with static linking to libippcp.a on Mac.
  2120. Dynamic IPP libraries supported on Mac])
  2121. break;;
  2122. *linux*)
  2123. ipplib="$ipplib/linux_static"
  2124. break;;
  2125. *)
  2126. ENABLED_FAST_RSA=no
  2127. esac
  2128. AC_CHECK_FILES([$srcdir/IPP/$ipplib/libippcore.a $srcdir/IPP/$ipplib/libippcp.a], [], [ENABLED_FAST_RSA=no])
  2129. AC_CHECK_FILES([$srcdir/IPP/include/ipp.h $srcdir/IPP/include/ippcp.h], [AM_CPPFLAGS="-I$srcdir/IPP/include $AM_CPPFLAGS"], [ENABLED_FAST_RSA=no])
  2130. LIB_STATIC_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_STATIC_ADD"
  2131. if test "$ENABLED_FAST_RSA" = "no"; then
  2132. AC_MSG_ERROR([Could not find fast rsa libraries])
  2133. fi
  2134. else
  2135. # Check for and use bundled IPP libraries
  2136. if test "$ENABLED_FAST_RSA" = "yes"; then
  2137. AC_MSG_NOTICE([Using local IPP crypto library])
  2138. AC_CHECK_FILES([$abs_path/IPP/include/ippcp.h],
  2139. [
  2140. # build and default locations on linux and mac
  2141. STORE_LDFLAGS=${LDFLAGS}
  2142. STORE_CPPFLAGS=${CPPFLAGS}
  2143. # using LDFLAGS instead of AM_ temporarily to test link to library
  2144. LDFLAGS="-L$ippdir/$ipplib -lippcp -lippcore"
  2145. CPPFLAGS="-I$ippdir/include"
  2146. AC_CHECK_HEADERS([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15], [fastRSA_found=yes], [fastRSA_found=no])], [fastRSA_found=no])
  2147. name="$ippdir/$ipplib/libippcp"
  2148. case $host_os in
  2149. *darwin*)
  2150. # check file existence and conditionally set variables
  2151. AC_CHECK_FILES([$abs_path/IPP/$ipplib/libippcp.dylib], [
  2152. IPPLIBS="${name}.dylib ${name}-9.0.dylib ${name}e9-9.0.dylib ${name}g9-9.0.dylib ${name}h9-9.0.dylib ${name}k0-9.0.dylib ${name}l9-9.0.dylib ${name}n8-9.0.dylib ${name}p8-9.0.dylib ${name}s8-9.0.dylib ${name}y8-9.0.dylib IPP/lib/libippcore.dylib IPP/lib/libippcore-9.0.dylib"
  2153. IPPLINK="mkdir -p src/.libs && ln -f ${name}.dylib src/.libs/libippcp.dylib && ln -f ${srcdir}/${name}-9.0.dylib src/.libs/libippcp-9.0.dylib && ln -f ${srcdir}/${name}e9-9.0.dylib src/.libs/libippcpe9-9.0.dylib && ln -f ${srcdir}/${name}g9-9.0.dylib src/.libs/libippcpg9-9.0.dylib && ln -f ${srcdir}/${name}h9-9.0.dylib src/.libs/libippcph9-9.0.dylib && ln -f ${srcdir}/${name}k0-9.0.dylib src/.libs/libippcpk0-9.0.dylib && ln -f ${srcdir}/${name}l9-9.0.dylib src/.libs/libippcpl9-9.0.dylib && ln -f ${srcdir}/${name}n8-9.0.dylib src/.libs/libippcpn8-9.0.dylib && ln -f ${srcdir}/${name}p8-9.0.dylib src/.libs/libippcpp8-9.0.dylib && ln -f ${srcdir}/${name}s8-9.0.dylib src/.libs/libippcps8-9.0.dylib && ln -f ${srcdir}/${name}y8-9.0.dylib src/.libs/libippcpy8-9.0.dylib && ln -f ${srcdir}/IPP/lib/libippcore.dylib src/.libs/libippcore.dylib && ln -f ${srcdir}/IPP/lib/libippcore-9.0.dylib src/.libs/libippcore-9.0.dylib"
  2154. ], [fastRSA_found=no])
  2155. break;;
  2156. *linux*)
  2157. # check file existence and conditionally set variables
  2158. AC_CHECK_FILES([$abs_path/IPP/$ipplib/libippcp.so.9.0], [
  2159. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  2160. IPPLIBS="${name}.so.9.0 ${name}g9.so.9.0 ${name}h9.so.9.0 ${name}p8.so.9.0 ${name}px.so.9.0 ${name}s8.so.9.0 ${name}.so ${name}w7.so.9.0 IPP/$ipplib/libippcore.so IPP/$ipplib/libippcore.so.9.0"
  2161. IPPLINK="mkdir -p src/.libs && ln -f ${name}.so.9.0 src/.libs/libippcp.so.9.0 && ln -f ${name}g9.so.9.0 src/.libs/libippcpg9.so.9.0 && ln -f ${name}h9.so.9.0 src/.libs/libippcph9.so.9.0 && ln -f ${name}p8.so.9.0 src/.libs/libippcpp8.so.9.0 && ln -f ${name}px.so.9.0 src/.libs/libippcppx.so.9.0 && ln -f ${name}s8.so.9.0 src/.libs/libippcps8.so.9.0 && ln -f ${name}.so src/.libs/libippcp.so && ln -f ${name}w7.so.9.0 src/.libs/libippcpw7.so.9.0 && ln -f IPP/$ipplib/libippcore.so src/.libs/libippcore.so && ln -f IPP/$ipplib/libippcore.so.9.0 src/.libs/libippcore.so.9.0"
  2162. else
  2163. IPPLIBS="${name}.so.9.0 ${name}e9.so.9.0 ${name}k0.so.9.0 ${name}l9.so.9.0 ${name}m7.so.9.0 ${name}mx.so.9.0 ${name}.so ${name}n8.so.9.0 ${name}y8.so.9.0 IPP/lib/libippcore.so IPP/lib/libippcore.so.9.0"
  2164. IPPLINK="mkdir -p src/.libs && ln -f ${name}.so.9.0 src/.libs/libippcp.so.9.0 && ln -f ${name}e9.so.9.0 src/.libs/libippcpe9.so.9.0 && ln -f ${name}k0.so.9.0 src/.libs/libippcpk0.so.9.0 && ln -f ${name}l9.so.9.0 src/.libs/libippcpl9.so.9.0 && ln -f ${name}m7.so.9.0 src/.libs/libippcpm7.so.9.0 && ln -f ${name}mx.so.9.0 src/.libs/libippcpmx.so.9.0 && ln -f ${name}.so src/.libs/libippcp.so && ln -f ${name}n8.so.9.0 src/.libs/libippcpn8.so.9.0 && ln -f ${name}y8.so.9.0 src/.libs/libippcpy8.so.9.0 && ln -f IPP/lib/libippcore.so src/.libs/libippcore.so && ln -f IPP/lib/libippcore.so.9.0 src/.libs/libippcore.so.9.0"
  2165. fi
  2166. ], [fastRSA_found=no])
  2167. break;;
  2168. *)
  2169. fastRSA_found=no
  2170. esac
  2171. if test "$fastRSA_found" = "yes"; then
  2172. # was succesfull so add tested LDFLAGS to AM_ flags
  2173. AM_LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
  2174. AM_CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
  2175. IPPHEADERS="${srcdir}/IPP/include/*.h"
  2176. fi
  2177. # restore LDFLAGS to user set
  2178. LDFLAGS=${STORE_LDFLAGS}
  2179. CPPFLAGS=${STORE_CPPFLAGS}
  2180. ], [fastRSA_found=no])
  2181. fi
  2182. # Don't cache the result so it can be checked
  2183. AS_UNSET([ac_cv_header_ippcp_h])
  2184. AS_UNSET([ac_cv_header_ipp_h])
  2185. AS_UNSET([ac_cv_lib_ippcp_ippsRSAEncrypt_PKCSv15]);
  2186. # Check link and see if user has pre-existing IPP Libraries if not using local
  2187. if test "$ENABLED_FAST_RSA" = "yes" && test "$fastRSA_found" = "no"; then
  2188. AC_MSG_NOTICE([Checking if IPP crypto library installed])
  2189. AC_CHECK_HEADER([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15],
  2190. [
  2191. fastRSA_found=yes
  2192. AM_LDFLAGS="${AM_LDFLAGS} -lippcore -lippcp"
  2193. ], [ fastRSA_found=no])
  2194. ], [fastRSA_found=no])
  2195. # Error out on not finding libraries
  2196. if test "$fastRSA_found" = "no"; then
  2197. AC_MSG_ERROR([Could not find fast rsa libraries])
  2198. fi
  2199. fi
  2200. fi # end of if for shared library
  2201. else # if user rsa is set than do not use fast rsa option
  2202. if test "$ENABLED_FAST_RSA" = "yes"; then
  2203. AC_MSG_ERROR([Could not use fast rsa libraries with user crypto or fips])
  2204. fi
  2205. fi # end of if for user rsa crypto or fips
  2206. # End result of checking for IPP Libraries
  2207. AC_MSG_CHECKING([for fast RSA])
  2208. if test "$ENABLED_FAST_RSA" = "yes"; then
  2209. AM_CFLAGS="$AM_CFLAGS -DHAVE_FAST_RSA -DHAVE_USER_RSA"
  2210. # add in user crypto header that uses Intel IPP
  2211. AM_CPPFLAGS="$AM_CPPFLAGS -I$srcdir/wolfcrypt/user-crypto/include"
  2212. if test "$enable_shared" = "yes"; then
  2213. LIBS="$LIBS -lippcore -lippcp"
  2214. LIB_ADD="-lippcp -lippcore $LIB_ADD"
  2215. else
  2216. LIB_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_ADD"
  2217. fi
  2218. AC_MSG_RESULT([yes])
  2219. else
  2220. AC_MSG_RESULT([no])
  2221. fi
  2222. AC_SUBST([IPPLIBS])
  2223. AC_SUBST([IPPHEADERS])
  2224. AC_SUBST([IPPLINK])
  2225. AM_CONDITIONAL([BUILD_FAST_RSA], [test "x$ENABLED_FAST_RSA" = "xyes"])
  2226. # static memory use
  2227. AC_ARG_ENABLE([staticmemory],
  2228. [AS_HELP_STRING([--enable-staticmemory],[Enable static memory use (default: disabled)])],
  2229. [ ENABLED_STATICMEMORY=$enableval ],
  2230. [ ENABLED_STATICMEMORY=no ]
  2231. )
  2232. if test "x$ENABLED_STATICMEMORY" = "xyes"
  2233. then
  2234. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY"
  2235. if test "x$ENABLED_FASTMATH" = "xno"
  2236. then
  2237. AC_MSG_ERROR([please use --enable-fastmath if enabling staticmemory.])
  2238. fi
  2239. fi
  2240. # microchip api
  2241. AC_ARG_ENABLE([mcapi],
  2242. [ --enable-mcapi Enable Microchip API (default: disabled)],
  2243. [ ENABLED_MCAPI=$enableval ],
  2244. [ ENABLED_MCAPI=no ]
  2245. )
  2246. if test "$ENABLED_MCAPI" = "yes"
  2247. then
  2248. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  2249. fi
  2250. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  2251. then
  2252. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  2253. fi
  2254. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  2255. then
  2256. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  2257. fi
  2258. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  2259. then
  2260. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  2261. fi
  2262. AM_CONDITIONAL([BUILD_MCAPI], [test "x$ENABLED_MCAPI" = "xyes"])
  2263. # Asynchronous Crypto
  2264. AC_ARG_ENABLE([asynccrypt],
  2265. [ --enable-asynccrypt Enable Asynchronous Crypto (default: disabled)],
  2266. [ ENABLED_ASYNCCRYPT=$enableval ],
  2267. [ ENABLED_ASYNCCRYPT=no ]
  2268. )
  2269. if test "$ENABLED_ASYNCCRYPT" = "yes"
  2270. then
  2271. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT -DHAVE_WOLF_EVENT"
  2272. # if Cavium not enabled the use async simulator for testing
  2273. if test "x$ENABLED_CAVIUM" = "xno"
  2274. then
  2275. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ASYNC_CRYPT_TEST"
  2276. fi
  2277. fi
  2278. AM_CONDITIONAL([BUILD_ASYNCCRYPT], [test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  2279. AM_CONDITIONAL([BUILD_WOLFEVENT], [test "x$ENABLED_ASYNCCRYPT" = "xyes"])
  2280. # Session Export
  2281. AC_ARG_ENABLE([sessionexport],
  2282. [AS_HELP_STRING([--enable-sessionexport],[Enable export and import of sessions (default: disabled)])],
  2283. [ ENABLED_SESSIONEXPORT=$enableval ],
  2284. [ ENABLED_SESSIONEXPORT=no ]
  2285. )
  2286. if test "$ENABLED_SESSIONEXPORT" = "yes"
  2287. then
  2288. if test "$ENABLED_DTLS" = "no"
  2289. then
  2290. AC_MSG_ERROR([Only DTLS supported with session export])
  2291. fi
  2292. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SESSION_EXPORT"
  2293. fi
  2294. # check if PSK was enabled for conditionally running psk.test script
  2295. AM_CONDITIONAL([BUILD_PSK], [test "x$ENABLED_PSK" = "xyes"])
  2296. # check if should run the trusted peer certs test
  2297. # (for now checking both C_FLAGS and C_EXTRA_FLAGS)
  2298. case $C_EXTRA_FLAGS in
  2299. *WOLFSSL_TRUST_PEER_CERT*)
  2300. have_tp=yes
  2301. break;;
  2302. *)
  2303. have_tp=no ;;
  2304. esac
  2305. if test "$have_tp" = "no"; then
  2306. case $C_FLAGS in
  2307. *WOLFSSL_TRUST_PEER_CERT*)
  2308. have_tp=yes
  2309. break;;
  2310. *)
  2311. have_tp=no ;;
  2312. esac
  2313. fi
  2314. AM_CONDITIONAL([BUILD_TRUST_PEER_CERT], [test "x$have_tp" = "xyes"])
  2315. ################################################################################
  2316. # Check for build-type conflicts #
  2317. ################################################################################
  2318. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  2319. test "x$ENABLED_LEANPSK" = "xyes"],
  2320. [AC_MSG_ERROR([Cannot use Max Strength and Lean PSK at the same time.])])
  2321. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  2322. test "x$ENABLED_ASN" = "xno"],
  2323. [AC_MSG_ERROR([please enable asn if enabling ocsp.])])
  2324. AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
  2325. test "x$ENABLED_RSA" = "xno" && \
  2326. test "x$ENABLED_ECC" = "xno"],
  2327. [AC_MSG_ERROR([please enable rsa or ecc if enabling ocsp.])])
  2328. # checks for pkcs7 needed enables
  2329. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  2330. test "x$ENABLED_RSA" = "xno"],
  2331. [AC_MSG_ERROR([please enable rsa if enabling pkcs7.])])
  2332. AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
  2333. test "x$ENABLED_SHA" = "xno"],
  2334. [AC_MSG_ERROR([please enable sha if enabling pkcs7.])])
  2335. AS_IF([test "x$ENABLED_LEANTLS" = "xyes" && \
  2336. test "x$ENABLED_ECC" = "xno"],
  2337. [AC_MSG_ERROR([please enable ecc if enabling leantls.])])
  2338. AS_IF([test "x$ENABLED_SNIFFER" = "xyes" && \
  2339. test "x$ENABLED_RSA" = "xno"],
  2340. [AC_MSG_ERROR([please enable rsa if enabling sniffer.])])
  2341. # Lean TLS forces off prereqs of SCEP.
  2342. AS_IF([test "x$ENABLED_SCEP" = "xyes" && \
  2343. test "x$ENABLED_LEANTLS" = "xyes"],
  2344. [AC_MSG_ERROR([Cannot use SCEP and Lean TLS at the same time.])])
  2345. # CMAC currently requires AES.
  2346. AS_IF([test "x$ENABLED_CMAC" = "xyes" && \
  2347. test "x$ENABLED_AES" = "xno"],
  2348. [AC_MSG_ERROR([cannot use CMAC without AES.])])
  2349. ################################################################################
  2350. # Update CFLAGS based on options #
  2351. ################################################################################
  2352. if test "$ENABLED_WOLFSCEP" = "yes"
  2353. then
  2354. # Enable prereqs if not already enabled
  2355. if test "x$ENABLED_KEYGEN" = "xno"
  2356. then
  2357. ENABLED_KEYGEN="yes"
  2358. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  2359. fi
  2360. if test "x$ENABLED_CERTGEN" = "xno"
  2361. then
  2362. ENABLED_CERTGEN="yes"
  2363. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  2364. fi
  2365. if test "x$ENABLED_CERTREQ" = "xno"
  2366. then
  2367. ENABLED_CERTREQ="yes"
  2368. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  2369. fi
  2370. if test "x$ENABLED_CERTEXT" = "xno"
  2371. then
  2372. ENABLED_CERTEXT="yes"
  2373. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  2374. fi
  2375. if test "x$ENABLED_PKCS7" = "xno"
  2376. then
  2377. ENABLED_PKCS7="yes"
  2378. fi
  2379. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_WOLFSCEP"
  2380. fi
  2381. if test "x$ENABLED_PKCS7" = "xyes"
  2382. then
  2383. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  2384. # Enable prereqs if not already enabled
  2385. AS_IF([test "x$ENABLED_DES3" = "xno"],
  2386. [ENABLED_DES3=yes])
  2387. fi
  2388. if test "x$ENABLED_DES3" = "xno"
  2389. then
  2390. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  2391. else
  2392. # turn off DES3 if leanpsk or leantls on
  2393. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_LEANTLS" = "yes"
  2394. then
  2395. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  2396. ENABLED_DES3=no
  2397. fi
  2398. fi
  2399. AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"])
  2400. AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
  2401. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes"],
  2402. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MAX_STRENGTH"])
  2403. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  2404. test "x$ENABLED_OLD_TLS" = "xyes"],
  2405. [AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  2406. ENABLED_OLD_TLS=no])
  2407. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  2408. test "x$ENABLED_SSLV3" = "xyes"],
  2409. [AC_MSG_ERROR([Cannot use Max Strength and SSLv3 at the same time.])])
  2410. AS_IF([test "x$ENABLED_SCTP" = "xyes"],
  2411. [AM_CFLAGS="-DWOLFSSL_SCTP $AM_CFLAGS"])
  2412. # SCTP requires DTLS
  2413. AS_IF([test "x$ENABLED_DTLS" = "xno" && \
  2414. test "x$ENABLED_SCTP" = "xyes"],
  2415. [AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  2416. ENABLED_DTLS=yes])
  2417. ################################################################################
  2418. # OPTIMIZE FLAGS
  2419. if test "$GCC" = "yes"
  2420. then
  2421. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  2422. if test "$ax_enable_debug" = "no"
  2423. then
  2424. if test "$ENABLED_FASTMATH" = "yes"
  2425. then
  2426. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  2427. if test "$ENABLED_FASTHUGEMATH" = "yes"
  2428. then
  2429. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  2430. fi
  2431. else
  2432. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  2433. fi
  2434. fi
  2435. fi
  2436. # ICC command line warning for non supported warning flags
  2437. if test "$CC" = "icc"
  2438. then
  2439. AM_CFLAGS="$AM_CFLAGS -wd10006"
  2440. fi
  2441. # Expose HAVE___UINT128_T to options flags"
  2442. if test "$ac_cv_type___uint128_t" = "yes"
  2443. then
  2444. AM_CFLAGS="$AM_CFLAGS -DHAVE___UINT128_T"
  2445. fi
  2446. LIB_SOCKET_NSL
  2447. AX_HARDEN_CC_COMPILER_FLAGS
  2448. # if mingw then link to ws2_32 for sockets
  2449. case $host_os in
  2450. mingw*)
  2451. LDFLAGS="$LDFLAGS -lws2_32"
  2452. if test "$enable_shared" = "yes"
  2453. then
  2454. AC_DEFINE([WOLFSSL_DLL], [1], [Use __declspec(dllexport) when building library])
  2455. if test "$enable_static" = "yes"
  2456. then
  2457. MINGW_LIB_WARNING="yes"
  2458. fi
  2459. fi ;;
  2460. esac
  2461. # add user C_EXTRA_FLAGS back
  2462. CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
  2463. OPTION_FLAGS="$USER_CFLAGS $USER_C_EXTRA_FLAGS $AM_CFLAGS"
  2464. CREATE_HEX_VERSION
  2465. AC_SUBST([AM_CPPFLAGS])
  2466. AC_SUBST([AM_CFLAGS])
  2467. AC_SUBST([AM_LDFLAGS])
  2468. AC_SUBST([AM_CCASFLAGS])
  2469. AC_SUBST([LIB_ADD])
  2470. AC_SUBST([LIB_STATIC_ADD])
  2471. # FINAL
  2472. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  2473. AC_CONFIG_FILES([Makefile])
  2474. AC_CONFIG_FILES([wolfssl/version.h])
  2475. AC_CONFIG_FILES([wolfssl/options.h])
  2476. #have options.h and version.h for autoconf fips tag and build
  2477. #if test "x$ENABLED_FIPS" = "xyes"
  2478. #then
  2479. # AC_CONFIG_FILES([cyassl/version.h])
  2480. # AC_CONFIG_FILES([cyassl/options.h])
  2481. #fi
  2482. AC_CONFIG_FILES([support/wolfssl.pc])
  2483. AC_CONFIG_FILES([rpm/spec])
  2484. AX_CREATE_GENERIC_CONFIG
  2485. AX_AM_JOBSERVER([yes])
  2486. AC_OUTPUT
  2487. # force make clean
  2488. echo "---"
  2489. echo "Running make clean..."
  2490. make clean >/dev/null 2>&1
  2491. # generate user options header
  2492. echo "---"
  2493. echo "Generating user options header..."
  2494. OPTION_FILE="wolfssl/options.h"
  2495. #if
  2496. #OPTION_FILE+="cyassl/options.h"
  2497. #fi
  2498. rm -f $OPTION_FILE
  2499. echo "/* wolfssl options.h" > $OPTION_FILE
  2500. echo " * generated from configure options" >> $OPTION_FILE
  2501. echo " *" >> $OPTION_FILE
  2502. echo " * Copyright (C) 2006-2015 wolfSSL Inc." >> $OPTION_FILE
  2503. echo " *" >> $OPTION_FILE
  2504. echo " * This file is part of wolfSSL. (formerly known as CyaSSL)" >> $OPTION_FILE
  2505. echo " *" >> $OPTION_FILE
  2506. echo " */" >> $OPTION_FILE
  2507. echo "" >> $OPTION_FILE
  2508. echo "#ifndef WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  2509. echo "#define WOLFSSL_OPTIONS_H" >> $OPTION_FILE
  2510. echo "" >> $OPTION_FILE
  2511. echo "" >> $OPTION_FILE
  2512. echo "#ifdef __cplusplus" >> $OPTION_FILE
  2513. echo "extern \"C\" {" >> $OPTION_FILE
  2514. echo "#endif" >> $OPTION_FILE
  2515. echo "" >> $OPTION_FILE
  2516. for option in $OPTION_FLAGS; do
  2517. defonly=`echo $option | sed 's/-D//'`
  2518. if test "$defonly" != "$option"
  2519. then
  2520. noequalsign=`echo $defonly | sed 's/=/ /'`
  2521. if test "$noequalsign" = "NDEBUG" || test "$noequalsign" = "DEBUG"
  2522. then
  2523. echo "not outputting (N)DEBUG to $OPTION_FILE"
  2524. continue
  2525. fi
  2526. # allow user to igonore system options
  2527. ignoresys=no
  2528. if [[[ $noequalsign == _* ]]] ;
  2529. then
  2530. ignoresys=yes
  2531. echo "#ifndef WOLFSSL_OPTIONS_IGNORE_SYS" >> $OPTION_FILE
  2532. fi
  2533. noarg=`echo $defonly | sed 's/=.*//'`
  2534. echo "#undef $noarg" >> $OPTION_FILE
  2535. echo "#define $noequalsign" >> $OPTION_FILE
  2536. if test "$ignoresys" = "yes"
  2537. then
  2538. echo "#endif" >> $OPTION_FILE
  2539. fi
  2540. echo "" >> $OPTION_FILE
  2541. else
  2542. echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
  2543. fi
  2544. done
  2545. echo "" >> $OPTION_FILE
  2546. echo "#ifdef __cplusplus" >> $OPTION_FILE
  2547. echo "}" >> $OPTION_FILE
  2548. echo "#endif" >> $OPTION_FILE
  2549. echo "" >> $OPTION_FILE
  2550. echo "" >> $OPTION_FILE
  2551. echo "#endif /* WOLFSSL_OPTIONS_H */" >> $OPTION_FILE
  2552. echo "" >> $OPTION_FILE
  2553. echo
  2554. #backwards compatability for those who have included options or version
  2555. touch cyassl/options.h
  2556. echo "/* cyassl options.h" > cyassl/options.h
  2557. echo " * generated from wolfssl/options.h" >> cyassl/options.h
  2558. echo " */" >> cyassl/options.h
  2559. echo ""
  2560. while read -r line
  2561. do
  2562. echo "$line" >> cyassl/options.h
  2563. done < $OPTION_FILE
  2564. # switch ifdef protection in cyassl/option.h to CYASSL_OPTONS_H, remove bak
  2565. sed -i.bak 's/WOLFSSL_OPTIONS_H/CYASSL_OPTIONS_H/g' cyassl/options.h
  2566. # workaround for mingw sed that may get "Permission denied" trying to preserver permissions
  2567. case $host_os in
  2568. mingw*)
  2569. chmod u+w cyassl/options.h ;;
  2570. esac
  2571. rm cyassl/options.h.bak
  2572. # output config summary
  2573. echo "---"
  2574. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  2575. echo ""
  2576. echo " * Installation prefix: $prefix"
  2577. echo " * System type: $host_vendor-$host_os"
  2578. echo " * Host CPU: $host_cpu"
  2579. echo " * C Compiler: $CC"
  2580. echo " * C Flags: $CFLAGS"
  2581. echo " * C++ Compiler: $CXX"
  2582. echo " * C++ Flags: $CXXFLAGS"
  2583. echo " * CPP Flags: $CPPFLAGS"
  2584. echo " * CCAS Flags: $CCASFLAGS"
  2585. echo " * LIB Flags: $LIB"
  2586. echo " * Debug enabled: $ax_enable_debug"
  2587. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  2588. echo " * make -j: $enable_jobserver"
  2589. echo " * VCS checkout: $ac_cv_vcs_checkout"
  2590. echo
  2591. echo " Features "
  2592. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  2593. echo " * Filesystem: $ENABLED_FILESYSTEM"
  2594. echo " * OpenSSH Build: $ENABLED_OPENSSH"
  2595. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  2596. echo " * Max Strength Build: $ENABLED_MAXSTRENGTH"
  2597. echo " * Distro Build: $ENABLED_DISTRO"
  2598. echo " * fastmath: $ENABLED_FASTMATH"
  2599. echo " * sniffer: $ENABLED_SNIFFER"
  2600. echo " * snifftest: $ENABLED_SNIFFTEST"
  2601. echo " * ARC4: $ENABLED_ARC4"
  2602. echo " * AES: $ENABLED_AES"
  2603. echo " * AES-NI: $ENABLED_AESNI"
  2604. echo " * AES-GCM: $ENABLED_AESGCM"
  2605. echo " * AES-CCM: $ENABLED_AESCCM"
  2606. echo " * DES3: $ENABLED_DES3"
  2607. echo " * IDEA: $ENABLED_IDEA"
  2608. echo " * Camellia: $ENABLED_CAMELLIA"
  2609. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  2610. echo " * MD5: $ENABLED_MD5"
  2611. echo " * RIPEMD: $ENABLED_RIPEMD"
  2612. echo " * SHA: $ENABLED_SHA"
  2613. echo " * SHA-512: $ENABLED_SHA512"
  2614. echo " * BLAKE2: $ENABLED_BLAKE2"
  2615. echo " * CMAC: $ENABLED_CMAC"
  2616. echo " * keygen: $ENABLED_KEYGEN"
  2617. echo " * certgen: $ENABLED_CERTGEN"
  2618. echo " * certreq: $ENABLED_CERTREQ"
  2619. echo " * certext: $ENABLED_CERTEXT"
  2620. echo " * HC-128: $ENABLED_HC128"
  2621. echo " * RABBIT: $ENABLED_RABBIT"
  2622. echo " * CHACHA: $ENABLED_CHACHA"
  2623. echo " * Hash DRBG: $ENABLED_HASHDRBG"
  2624. echo " * PWDBASED: $ENABLED_PWDBASED"
  2625. echo " * wolfCrypt Only: $ENABLED_CRYPTONLY"
  2626. echo " * HKDF: $ENABLED_HKDF"
  2627. echo " * MD4: $ENABLED_MD4"
  2628. echo " * PSK: $ENABLED_PSK"
  2629. echo " * Poly1305: $ENABLED_POLY1305"
  2630. echo " * LEANPSK: $ENABLED_LEANPSK"
  2631. echo " * LEANTLS: $ENABLED_LEANTLS"
  2632. echo " * RSA: $ENABLED_RSA"
  2633. echo " * DSA: $ENABLED_DSA"
  2634. echo " * DH: $ENABLED_DH"
  2635. echo " * ECC: $ENABLED_ECC"
  2636. echo " * CURVE25519: $ENABLED_CURVE25519"
  2637. echo " * ED25519: $ENABLED_ED25519"
  2638. echo " * FPECC: $ENABLED_FPECC"
  2639. echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
  2640. echo " * ASN: $ENABLED_ASN"
  2641. echo " * Anonymous cipher: $ENABLED_ANON"
  2642. echo " * CODING: $ENABLED_CODING"
  2643. echo " * MEMORY: $ENABLED_MEMORY"
  2644. echo " * I/O POOL: $ENABLED_IOPOOL"
  2645. echo " * LIGHTY: $ENABLED_LIGHTY"
  2646. echo " * STUNNEL: $ENABLED_STUNNEL"
  2647. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  2648. echo " * DTLS: $ENABLED_DTLS"
  2649. echo " * SCTP: $ENABLED_SCTP"
  2650. echo " * Old TLS Versions: $ENABLED_OLD_TLS"
  2651. echo " * SSL version 3.0: $ENABLED_SSLV3"
  2652. echo " * OCSP: $ENABLED_OCSP"
  2653. echo " * OCSP Stapling: $ENABLED_CERTIFICATE_STATUS_REQUEST"
  2654. echo " * OCSP Stapling v2: $ENABLED_CERTIFICATE_STATUS_REQUEST_V2"
  2655. echo " * CRL: $ENABLED_CRL"
  2656. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  2657. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  2658. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  2659. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  2660. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  2661. echo " * NTRU: $ENABLED_NTRU"
  2662. echo " * Whitewood netRandom: $ENABLED_WNR"
  2663. echo " * Server Name Indication: $ENABLED_SNI"
  2664. echo " * ALPN: $ENABLED_ALPN"
  2665. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  2666. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  2667. echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
  2668. echo " * Session Ticket: $ENABLED_SESSION_TICKET"
  2669. echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
  2670. echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
  2671. echo " * All TLS Extensions: $ENABLED_TLSX"
  2672. echo " * PKCS#7 $ENABLED_PKCS7"
  2673. echo " * wolfSCEP $ENABLED_WOLFSCEP"
  2674. echo " * Secure Remote Password $ENABLED_SRP"
  2675. echo " * Small Stack: $ENABLED_SMALL_STACK"
  2676. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  2677. echo " * LIBZ: $ENABLED_LIBZ"
  2678. echo " * Examples: $ENABLED_EXAMPLES"
  2679. echo " * User Crypto: $ENABLED_USER_CRYPTO"
  2680. echo " * Fast RSA: $ENABLED_FAST_RSA"
  2681. echo " * Async Crypto: $ENABLED_ASYNCCRYPT"
  2682. echo " * Cavium: $ENABLED_CAVIUM"
  2683. echo " * ARM ASM: $ENABLED_ARMASM"
  2684. echo ""
  2685. echo "---"
  2686. ################################################################################
  2687. # Show warnings at bottom so they are noticed
  2688. ################################################################################
  2689. if test "$ENABLED_ASYNCCRYPT" = "yes"
  2690. then
  2691. AC_MSG_WARN([Make sure real async files are loaded. Contact wolfSSL for details on using the asynccrypt option.])
  2692. fi
  2693. # MinGW static vs shared library
  2694. # Reference URL from libtool for MinGW is located at
  2695. # http://www.gnu.org/software/libtool/manual/libtool.html#Cygwin-to-MinGW-Cross
  2696. # this allows for not even having dllimport/dllexport on functions
  2697. # with recent libtools, only requiring it with global variables.
  2698. #
  2699. # The following warning is displayed here because if not using "contemporary GNU
  2700. # tools" there is the possibility of export/import issues.
  2701. # wolfSSL uses __declspec(dllexport) and "contemporary GNU tools" handle the
  2702. # case where both static and shared libraries are built.
  2703. #
  2704. # More can be found about the MinGW linker at
  2705. # https://sourceware.org/binutils/docs/ld/WIN32.html
  2706. if test "$MINGW_LIB_WARNING" = "yes"
  2707. then
  2708. AC_MSG_WARN([Building with shared and static library at the same time on this system may cause export/import problems when using non contemporary GNU tools.])
  2709. fi