configure.ac 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736
  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.7.0],[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=2:0:1
  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([inet_ntoa])
  60. AC_CHECK_FUNCS([memset])
  61. AC_CHECK_FUNCS([socket])
  62. AC_CHECK_HEADERS([arpa/inet.h])
  63. AC_CHECK_HEADERS([fcntl.h])
  64. AC_CHECK_HEADERS([limits.h])
  65. AC_CHECK_HEADERS([netdb.h])
  66. AC_CHECK_HEADERS([netinet/in.h])
  67. AC_CHECK_HEADERS([stddef.h])
  68. AC_CHECK_HEADERS([sys/ioctl.h])
  69. AC_CHECK_HEADERS([sys/socket.h])
  70. AC_CHECK_HEADERS([sys/time.h])
  71. AC_CHECK_HEADERS([errno.h])
  72. AC_CHECK_LIB(network,socket)
  73. AC_CHECK_SIZEOF(long long, 8)
  74. AC_CHECK_SIZEOF(long, 4)
  75. AC_CHECK_TYPES(__uint128_t)
  76. AC_C_BIGENDIAN
  77. # mktime check takes forever on some systems, if time supported it would be
  78. # highly unusual for mktime to be missing
  79. #AC_FUNC_MKTIME
  80. AC_PROG_CC
  81. AC_PROG_CC_C_O
  82. AC_PROG_CXX
  83. AC_PROG_INSTALL
  84. AC_TYPE_SIZE_T
  85. AC_TYPE_UINT8_T
  86. AM_PROG_AS
  87. AM_PROG_CC_C_O
  88. LT_LIB_M
  89. OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
  90. OPTIMIZE_FAST_CFLAGS="-O2 -fomit-frame-pointer"
  91. OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
  92. DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL"
  93. LIB_ADD=
  94. LIB_STATIC_ADD=
  95. thread_ls_on=no
  96. # Thread local storage
  97. AX_TLS([
  98. [AM_CFLAGS="$AM_CFLAGS -DHAVE_THREAD_LS"]
  99. [thread_ls_on=yes]
  100. ] , [:])
  101. # DEBUG
  102. AX_DEBUG
  103. AS_IF([test "$ax_enable_debug" = "yes"],
  104. [AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"],
  105. [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
  106. # SINGLE THREADED
  107. AC_ARG_ENABLE([singlethreaded],
  108. [ --enable-singlethreaded Enable wolfSSL single threaded (default: disabled)],
  109. [ ENABLED_SINGLETHREADED=$enableval ],
  110. [ ENABLED_SINGLETHREADED=no ])
  111. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
  112. AX_PTHREAD([
  113. AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
  114. AM_CFLAGS="-D_POSIX_THREADS $AM_CFLAGS $PTHREAD_CFLAGS"
  115. LIBS="$LIBS $PTHREAD_LIBS"
  116. ],[
  117. ENABLED_SINGLETHREADED=yes
  118. ])
  119. ])
  120. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="-DSINGLE_THREADED $AM_CFLAGS" ])
  121. # DTLS
  122. AC_ARG_ENABLE([dtls],
  123. [ --enable-dtls Enable wolfSSL DTLS (default: disabled)],
  124. [ ENABLED_DTLS=$enableval ],
  125. [ ENABLED_DTLS=no ]
  126. )
  127. if test "$ENABLED_DTLS" = "yes"
  128. then
  129. AM_CFLAGS="-DWOLFSSL_DTLS $AM_CFLAGS"
  130. fi
  131. # OpenSSH compatibility Build
  132. AC_ARG_ENABLE([openssh],
  133. [AS_HELP_STRING([--enable-openssh],[Enable OpenSSH compatibility build (default: disabled)])],
  134. [ENABLED_OPENSSH=$enableval],
  135. [ENABLED_OPENSSH=no])
  136. # OPENSSL Extra Compatibility
  137. AC_ARG_ENABLE([opensslextra],
  138. [ --enable-opensslextra Enable extra OpenSSL API, size+ (default: disabled)],
  139. [ ENABLED_OPENSSLEXTRA=$enableval ],
  140. [ ENABLED_OPENSSLEXTRA=no ]
  141. )
  142. if test "$ENABLED_OPENSSH" = "yes"
  143. then
  144. ENABLED_OPENSSLEXTRA="yes"
  145. fi
  146. if test "$ENABLED_OPENSSLEXTRA" = "yes"
  147. then
  148. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  149. fi
  150. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
  151. then
  152. AC_MSG_ERROR([cannot enable small and opensslextra, only one or the other.])
  153. fi
  154. # High Strength Build
  155. AC_ARG_ENABLE([maxstrength],
  156. [AS_HELP_STRING([--enable-maxstrength],[Enable Max Strengh build, allows TLSv1.2-AEAD-PFS ciphers only (default: disabled)])],
  157. [ENABLED_MAXSTRENGTH=$enableval],
  158. [ENABLED_MAXSTRENGTH=no])
  159. # IPv6 Test Apps
  160. AC_ARG_ENABLE([ipv6],
  161. [ --enable-ipv6 Enable testing of IPV6 (default: disabled)],
  162. [ ENABLED_IPV6=$enableval ],
  163. [ ENABLED_IPV6=no ]
  164. )
  165. if test "$ENABLED_IPV6" = "yes"
  166. then
  167. AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6"
  168. fi
  169. AM_CONDITIONAL([BUILD_IPV6], [test "x$ENABLED_IPV6" = "xyes"])
  170. # Fortress build
  171. AC_ARG_ENABLE([fortress],
  172. [ --enable-fortress Enable SSL fortress build (default: disabled)],
  173. [ ENABLED_FORTRESS=$enableval ],
  174. [ ENABLED_FORTRESS=no ]
  175. )
  176. if test "$ENABLED_OPENSSH" = "yes"
  177. then
  178. ENABLED_FORTRESS="yes"
  179. fi
  180. if test "$ENABLED_FORTRESS" = "yes"
  181. then
  182. 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"
  183. fi
  184. # ssl bump build
  185. AC_ARG_ENABLE([bump],
  186. [ --enable-bump Enable SSL Bump build (default: disabled)],
  187. [ ENABLED_BUMP=$enableval ],
  188. [ ENABLED_BUMP=no ]
  189. )
  190. if test "$ENABLED_BUMP" = "yes"
  191. then
  192. 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"
  193. fi
  194. ENABLED_SLOWMATH="yes"
  195. # lean psk build
  196. AC_ARG_ENABLE([leanpsk],
  197. [ --enable-leanpsk Enable Lean PSK build (default: disabled)],
  198. [ ENABLED_LEANPSK=$enableval ],
  199. [ ENABLED_LEANPSK=no ]
  200. )
  201. if test "$ENABLED_LEANPSK" = "yes"
  202. then
  203. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LEANPSK -DHAVE_NULL_CIPHER -DSINGLE_THREADED -DNO_AES -DNO_FILESYSTEM -DNO_RABBIT -DNO_RSA -DNO_DSA -DNO_DH -DNO_CERTS -DNO_PWDBASED -DNO_DES3 -DNO_MD4 -DNO_MD5 -DNO_ERROR_STRINGS -DNO_OLD_TLS -DNO_RC4 -DNO_WRITEV -DNO_SESSION_CACHE -DNO_DEV_RANDOM -DWOLFSSL_USER_IO -DNO_SHA -DUSE_SLOW_SHA"
  204. ENABLED_SLOWMATH="no"
  205. ENABLED_SINGLETHREADED="yes"
  206. fi
  207. AM_CONDITIONAL([BUILD_LEANPSK], [test "x$ENABLED_LEANPSK" = "xyes"])
  208. # big cache
  209. AC_ARG_ENABLE([bigcache],
  210. [ --enable-bigcache Enable big session cache (default: disabled)],
  211. [ ENABLED_BIGCACHE=$enableval ],
  212. [ ENABLED_BIGCACHE=no ]
  213. )
  214. if test "$ENABLED_BIGCACHE" = "yes"
  215. then
  216. AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
  217. fi
  218. # HUGE cache
  219. AC_ARG_ENABLE([hugecache],
  220. [ --enable-hugecache Enable huge session cache (default: disabled)],
  221. [ ENABLED_HUGECACHE=$enableval ],
  222. [ ENABLED_HUGECACHE=no ]
  223. )
  224. if test "$ENABLED_HUGECACHE" = "yes"
  225. then
  226. AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
  227. fi
  228. # SMALL cache
  229. AC_ARG_ENABLE([smallcache],
  230. [ --enable-smallcache Enable small session cache (default: disabled)],
  231. [ ENABLED_SMALLCACHE=$enableval ],
  232. [ ENABLED_SMALLCACHE=no ]
  233. )
  234. if test "$ENABLED_SMALLCACHE" = "yes"
  235. then
  236. AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
  237. fi
  238. # Persistent session cache
  239. AC_ARG_ENABLE([savesession],
  240. [ --enable-savesession Enable persistent session cache (default: disabled)],
  241. [ ENABLED_SAVESESSION=$enableval ],
  242. [ ENABLED_SAVESESSION=no ]
  243. )
  244. if test "$ENABLED_SAVESESSION" = "yes"
  245. then
  246. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  247. fi
  248. # Persistent cert cache
  249. AC_ARG_ENABLE([savecert],
  250. [ --enable-savecert Enable persistent cert cache (default: disabled)],
  251. [ ENABLED_SAVECERT=$enableval ],
  252. [ ENABLED_SAVECERT=no ]
  253. )
  254. if test "$ENABLED_SAVECERT" = "yes"
  255. then
  256. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  257. fi
  258. # Atomic User Record Layer
  259. AC_ARG_ENABLE([atomicuser],
  260. [ --enable-atomicuser Enable Atomic User Record Layer (default: disabled)],
  261. [ ENABLED_ATOMICUSER=$enableval ],
  262. [ ENABLED_ATOMICUSER=no ]
  263. )
  264. if test "$ENABLED_ATOMICUSER" = "yes"
  265. then
  266. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  267. fi
  268. # Public Key Callbacks
  269. AC_ARG_ENABLE([pkcallbacks],
  270. [ --enable-pkcallbacks Enable Public Key Callbacks (default: disabled)],
  271. [ ENABLED_PKCALLBACKS=$enableval ],
  272. [ ENABLED_PKCALLBACKS=no ]
  273. )
  274. if test "$ENABLED_PKCALLBACKS" = "yes"
  275. then
  276. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  277. fi
  278. # SNIFFER
  279. AC_ARG_ENABLE([sniffer],
  280. [AS_HELP_STRING([--enable-sniffer],[Enable wolfSSL sniffer support (default: disabled)])],
  281. [ ENABLED_SNIFFER=$enableval ],
  282. [ ENABLED_SNIFFER=no ]
  283. )
  284. # sniffer does't work in maxstrength mode
  285. if test "$ENABLED_SNIFFER" = "yes" && test "$ENABLED_MAXSTRENGTH" = "yes"
  286. then
  287. AC_MSG_ERROR([cannot enable maxstrength in sniffer mode.])
  288. fi
  289. ENABLED_SNIFFTEST=no
  290. AS_IF([ test "x$ENABLED_SNIFFER" = "xyes" ],
  291. [
  292. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SNIFFER -DOPENSSL_EXTRA"
  293. AC_CHECK_HEADERS([pcap/pcap.h],
  294. [ ENABLED_SNIFFTEST=yes ],
  295. [ AC_MSG_WARN([cannot enable sniffer test without having libpcap available.]) ]
  296. )
  297. ])
  298. AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" ])
  299. AM_CONDITIONAL([BUILD_SNIFFTEST], [ test "x$ENABLED_SNIFFTEST" = "xyes" ])
  300. # AES-GCM
  301. AC_ARG_ENABLE([aesgcm],
  302. [AS_HELP_STRING([--enable-aesgcm],[Enable wolfSSL AES-GCM support (default: enabled)])],
  303. [ ENABLED_AESGCM=$enableval ],
  304. [ ENABLED_AESGCM=yes ]
  305. )
  306. # lean psk does't need gcm
  307. if test "$ENABLED_LEANPSK" = "yes"
  308. then
  309. ENABLED_AESGCM=no
  310. fi
  311. if test "$ENABLED_AESGCM" = "word32"
  312. then
  313. AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
  314. ENABLED_AESGCM=yes
  315. fi
  316. if test "$ENABLED_AESGCM" = "small"
  317. then
  318. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
  319. ENABLED_AESGCM=yes
  320. fi
  321. if test "$ENABLED_AESGCM" = "table"
  322. then
  323. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
  324. ENABLED_AESGCM=yes
  325. fi
  326. if test "$ENABLED_AESGCM" = "yes"
  327. then
  328. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  329. fi
  330. AM_CONDITIONAL([BUILD_AESGCM], [test "x$ENABLED_AESGCM" = "xyes"])
  331. # AES-CCM
  332. AC_ARG_ENABLE([aesccm],
  333. [ --enable-aesccm Enable wolfSSL AES-CCM support (default: disabled)],
  334. [ ENABLED_AESCCM=$enableval ],
  335. [ ENABLED_AESCCM=no ]
  336. )
  337. if test "$ENABLED_AESCCM" = "yes"
  338. then
  339. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
  340. fi
  341. AM_CONDITIONAL([BUILD_AESCCM], [test "x$ENABLED_AESCCM" = "xyes"])
  342. # AES-NI
  343. AC_ARG_ENABLE([aesni],
  344. [AS_HELP_STRING([--enable-aesni],[Enable wolfSSL AES-NI support (default: disabled)])],
  345. [ ENABLED_AESNI=$enableval ],
  346. [ ENABLED_AESNI=no ]
  347. )
  348. # INTEL ASM
  349. AC_ARG_ENABLE([intelasm],
  350. [AS_HELP_STRING([--enable-intelasm],[Enable All Intel ASM speedups (default: disabled)])],
  351. [ ENABLED_INTELASM=$enableval ],
  352. [ ENABLED_INTELASM=no ]
  353. )
  354. if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
  355. then
  356. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
  357. if test "$GCC" = "yes"
  358. then
  359. # GCC needs these flags, icc doesn't
  360. # opt levels greater than 2 may cause problems on systems w/o aesni
  361. if test "$CC" != "icc"
  362. then
  363. AM_CFLAGS="$AM_CFLAGS -maes -msse4"
  364. fi
  365. fi
  366. AS_IF([test "x$ENABLED_AESGCM" != "xno"],[AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"])
  367. fi
  368. if test "$ENABLED_INTELASM" = "yes"
  369. then
  370. AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_RDGEN -DUSE_INTEL_SPEEDUP"
  371. ENABLED_AESNI=yes
  372. fi
  373. AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
  374. # Camellia
  375. AC_ARG_ENABLE([camellia],
  376. [ --enable-camellia Enable wolfSSL Camellia support (default: disabled)],
  377. [ ENABLED_CAMELLIA=$enableval ],
  378. [ ENABLED_CAMELLIA=no ]
  379. )
  380. if test "$ENABLED_CAMELLIA" = "yes"
  381. then
  382. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
  383. fi
  384. AM_CONDITIONAL([BUILD_CAMELLIA], [test "x$ENABLED_CAMELLIA" = "xyes"])
  385. # MD2
  386. AC_ARG_ENABLE([md2],
  387. [ --enable-md2 Enable wolfSSL MD2 support (default: disabled)],
  388. [ ENABLED_MD2=$enableval ],
  389. [ ENABLED_MD2=no ]
  390. )
  391. if test "$ENABLED_BUMP" = "yes"
  392. then
  393. ENABLED_MD2="yes"
  394. fi
  395. if test "$ENABLED_MD2" = "yes"
  396. then
  397. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MD2"
  398. fi
  399. AM_CONDITIONAL([BUILD_MD2], [test "x$ENABLED_MD2" = "xyes"])
  400. # NULL CIPHER
  401. AC_ARG_ENABLE([nullcipher],
  402. [ --enable-nullcipher Enable wolfSSL NULL cipher support (default: disabled)],
  403. [ ENABLED_NULL_CIPHER=$enableval ],
  404. [ ENABLED_NULL_CIPHER=no ]
  405. )
  406. if test "$ENABLED_OPENSSH" = "yes"
  407. then
  408. ENABLED_NULL_CIPHER="yes"
  409. fi
  410. if test "$ENABLED_NULL_CIPHER" = "yes"
  411. then
  412. AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  413. fi
  414. # RIPEMD
  415. AC_ARG_ENABLE([ripemd],
  416. [ --enable-ripemd Enable wolfSSL RIPEMD-160 support (default: disabled)],
  417. [ ENABLED_RIPEMD=$enableval ],
  418. [ ENABLED_RIPEMD=no ]
  419. )
  420. if test "$ENABLED_OPENSSH" = "yes"
  421. then
  422. ENABLED_RIPEMD="yes"
  423. fi
  424. if test "$ENABLED_RIPEMD" = "yes"
  425. then
  426. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_RIPEMD"
  427. fi
  428. AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
  429. # BLAKE2
  430. AC_ARG_ENABLE([blake2],
  431. [ --enable-blake2 Enable wolfSSL BLAKE2 support (default: disabled)],
  432. [ ENABLED_BLAKE2=$enableval ],
  433. [ ENABLED_BLAKE2=no ]
  434. )
  435. if test "$ENABLED_BLAKE2" = "yes"
  436. then
  437. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2"
  438. fi
  439. AM_CONDITIONAL([BUILD_BLAKE2], [test "x$ENABLED_BLAKE2" = "xyes"])
  440. # set sha512 default
  441. SHA512_DEFAULT=no
  442. if test "$host_cpu" = "x86_64"
  443. then
  444. SHA512_DEFAULT=yes
  445. fi
  446. # SHA512
  447. AC_ARG_ENABLE([sha512],
  448. [AS_HELP_STRING([--enable-sha512],[Enable wolfSSL SHA-512 support (default: enabled on x86_64)])],
  449. [ ENABLED_SHA512=$enableval ],
  450. [ ENABLED_SHA512=$SHA512_DEFAULT ]
  451. )
  452. # lean psk does't need sha512
  453. if test "$ENABLED_LEANPSK" = "yes"
  454. then
  455. ENABLED_SHA512=no
  456. fi
  457. if test "$ENABLED_OPENSSH" = "yes"
  458. then
  459. ENABLED_SHA512="yes"
  460. fi
  461. if test "$ENABLED_SHA512" = "yes"
  462. then
  463. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"
  464. fi
  465. if test "$ENABLED_FORTRESS" = "yes"
  466. then
  467. ENABLED_SHA512="yes"
  468. fi
  469. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  470. # SESSION CERTS
  471. AC_ARG_ENABLE([sessioncerts],
  472. [ --enable-sessioncerts Enable session cert storing (default: disabled)],
  473. [ ENABLED_SESSIONCERTS=$enableval ],
  474. [ ENABLED_SESSIONCERTS=no ]
  475. )
  476. if test "$ENABLED_SESSIONCERTS" = "yes"
  477. then
  478. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  479. fi
  480. # KEY GENERATION
  481. AC_ARG_ENABLE([keygen],
  482. [ --enable-keygen Enable key generation (default: disabled)],
  483. [ ENABLED_KEYGEN=$enableval ],
  484. [ ENABLED_KEYGEN=no ]
  485. )
  486. if test "$ENABLED_KEYGEN" = "yes"
  487. then
  488. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  489. fi
  490. # CERT GENERATION
  491. AC_ARG_ENABLE([certgen],
  492. [ --enable-certgen Enable cert generation (default: disabled)],
  493. [ ENABLED_CERTGEN=$enableval ],
  494. [ ENABLED_CERTGEN=no ]
  495. )
  496. if test "$ENABLED_CERTGEN" = "yes"
  497. then
  498. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  499. fi
  500. # CERT REQUEST GENERATION
  501. AC_ARG_ENABLE([certreq],
  502. [ --enable-certreq Enable cert request generation (default: disabled)],
  503. [ ENABLED_CERTREQ=$enableval ],
  504. [ ENABLED_CERTREQ=no ]
  505. )
  506. if test "$ENABLED_CERTREQ" = "yes"
  507. then
  508. if test "$ENABLED_CERTGEN" = "no"
  509. then
  510. AC_MSG_ERROR([cannot enable certreq without enabling certgen.])
  511. fi
  512. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  513. fi
  514. # CERT REQUEST EXTENSION
  515. AC_ARG_ENABLE([certext],
  516. [ --enable-certext Enable cert request extensions (default: disabled)],
  517. [ ENABLED_CERTEXT=$enableval ],
  518. [ ENABLED_CERTEXT=no ]
  519. )
  520. if test "$ENABLED_CERTEXT" = "yes"
  521. then
  522. if test "$ENABLED_CERTGEN" = "no"
  523. then
  524. AC_MSG_ERROR([cannot enable certext without enabling certgen.])
  525. fi
  526. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  527. fi
  528. # SEP
  529. AC_ARG_ENABLE([sep],
  530. [ --enable-sep Enable sep extensions (default: disabled)],
  531. [ ENABLED_SEP=$enableval ],
  532. [ ENABLED_SEP=no ]
  533. )
  534. if test "$ENABLED_SEP" = "yes"
  535. then
  536. AM_CFLAGS="-DWOLFSSL_SEP -DKEEP_PEER_CERT $AM_CFLAGS"
  537. fi
  538. # HKDF
  539. AC_ARG_ENABLE([hkdf],
  540. [ --enable-hkdf Enable HKDF (HMAC-KDF) support (default: disabled)],
  541. [ ENABLED_HKDF=$enableval ],
  542. [ ENABLED_HKDF=no ]
  543. )
  544. if test "$ENABLED_HKDF" = "yes"
  545. then
  546. AM_CFLAGS="$AM_CFLAGS -DHAVE_HKDF"
  547. fi
  548. # DSA
  549. AC_ARG_ENABLE([dsa],
  550. [ --enable-dsa Enable DSA (default: disabled)],
  551. [ ENABLED_DSA=$enableval ],
  552. [ ENABLED_DSA=no ]
  553. )
  554. if test "$ENABLED_OPENSSH" = "yes"
  555. then
  556. ENABLED_DSA="yes"
  557. fi
  558. if test "$ENABLED_DSA" = "no"
  559. then
  560. AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
  561. fi
  562. AM_CONDITIONAL([BUILD_DSA], [test "x$ENABLED_DSA" = "xyes"])
  563. # set ecc default
  564. ECC_DEFAULT=no
  565. if test "$host_cpu" = "x86_64"
  566. then
  567. ECC_DEFAULT=yes
  568. fi
  569. # ECC
  570. AC_ARG_ENABLE([ecc],
  571. [AS_HELP_STRING([--enable-ecc],[Enable ECC (default: enabled on x86_64)])],
  572. [ ENABLED_ECC=$enableval ],
  573. [ ENABLED_ECC=$ECC_DEFAULT ]
  574. )
  575. # lean psk does't need ecc
  576. if test "$ENABLED_LEANPSK" = "yes"
  577. then
  578. ENABLED_ECC=no
  579. fi
  580. if test "$ENABLED_OPENSSH" = "yes"
  581. then
  582. ENABLED_ECC="yes"
  583. fi
  584. if test "$ENABLED_ECC" = "yes"
  585. then
  586. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
  587. fi
  588. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  589. if test "$ENABLED_ECC" = "yes" && test "$ENABLED_SMALL" = "yes"
  590. then
  591. AC_MSG_ERROR([cannot enable ecc and small, ecc requires TLS which small turns off.])
  592. fi
  593. # for using memory optimization setting on both curve25519 and ed25519
  594. ENABLED_CURVED25519_SMALL=no
  595. # CURVE25519
  596. AC_ARG_ENABLE([curve25519],
  597. [AS_HELP_STRING([--enable-curve25519],[Enable Curve25519 (default: disabled)])],
  598. [ ENABLED_CURVE25519=$enableval ],
  599. [ ENABLED_CURVE25519=no ]
  600. )
  601. if test "$ENABLED_OPENSSH" = "yes"
  602. then
  603. ENABLED_CURVE25519="yes"
  604. fi
  605. if test "$ENABLED_CURVE25519" = "small"
  606. then
  607. AM_CFLAGS="$AM_CFLAGS -DCURVED25519_SMALL"
  608. ENABLED_CURVED25519_SMALL=yes
  609. ENABLED_CURVE25519=yes
  610. fi
  611. if test "$ENABLED_CURVE25519" = "yes"
  612. then
  613. AM_CFLAGS="$AM_CFLAGS -DHAVE_CURVE25519"
  614. ENABLED_FEMATH=yes
  615. fi
  616. AM_CONDITIONAL([BUILD_CURVE25519], [test "x$ENABLED_CURVE25519" = "xyes"])
  617. # ED25519
  618. AC_ARG_ENABLE([ed25519],
  619. [AS_HELP_STRING([--enable-ed25519],[Enable ED25519 (default: disabled)])],
  620. [ ENABLED_ED25519=$enableval ],
  621. [ ENABLED_ED25519=no ]
  622. )
  623. if test "$ENABLED_OPENSSH" = "yes"
  624. then
  625. ENABLED_ED25519="yes"
  626. fi
  627. if test "$ENABLED_ED25519" = "small"
  628. then
  629. AM_CFLAGS="$AM_CFLAGS -DCURVED25519_SMALL"
  630. ENABLED_CURVED25519_SMALL=yes
  631. ENABLED_ED25519=yes
  632. fi
  633. if test "$ENABLED_ED25519" = "yes"
  634. then
  635. if test "$ENABLED_SHA512" = "no"
  636. then
  637. AC_MSG_ERROR([cannot enable ed25519 without enabling sha512.])
  638. fi
  639. ENABLED_FEMATH=yes
  640. ENABLED_GEMATH=yes
  641. AM_CFLAGS="$AM_CFLAGS -DHAVE_ED25519"
  642. fi
  643. AM_CONDITIONAL([BUILD_ED25519], [test "x$ENABLED_ED25519" = "xyes"])
  644. AM_CONDITIONAL([BUILD_CURVED25519_SMALL], [test "x$ENABLED_CURVED25519_SMALL" = "xyes"])
  645. AM_CONDITIONAL([BUILD_FEMATH], [test "x$ENABLED_FEMATH" = "xyes"])
  646. AM_CONDITIONAL([BUILD_GEMATH], [test "x$ENABLED_GEMATH" = "xyes"])
  647. # FP ECC, Fixed Point cache ECC
  648. AC_ARG_ENABLE([fpecc],
  649. [ --enable-fpecc Enable Fixed Point cache ECC (default: disabled)],
  650. [ ENABLED_FPECC=$enableval ],
  651. [ ENABLED_FPECC=no ]
  652. )
  653. if test "$ENABLED_FPECC" = "yes"
  654. then
  655. if test "$ENABLED_ECC" = "no"
  656. then
  657. AC_MSG_ERROR([cannot enable fpecc without enabling ecc.])
  658. fi
  659. AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
  660. fi
  661. # ECC encrypt
  662. AC_ARG_ENABLE([eccencrypt],
  663. [ --enable-eccencrypt Enable ECC encrypt (default: disabled)],
  664. [ ENABLED_ECC_ENCRYPT=$enableval ],
  665. [ ENABLED_ECC_ENCRYPT=no ]
  666. )
  667. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  668. then
  669. if test "$ENABLED_ECC" = "no"
  670. then
  671. AC_MSG_ERROR([cannot enable eccencrypt without enabling ecc.])
  672. fi
  673. if test "$ENABLED_HKDF" = "no"
  674. then
  675. AC_MSG_ERROR([cannot enable eccencrypt without enabling hkdf.])
  676. fi
  677. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC_ENCRYPT"
  678. fi
  679. # PSK
  680. AC_ARG_ENABLE([psk],
  681. [ --enable-psk Enable PSK (default: disabled)],
  682. [ ENABLED_PSK=$enableval ],
  683. [ ENABLED_PSK=no ]
  684. )
  685. # ERROR STRINGS
  686. AC_ARG_ENABLE([errorstrings],
  687. [ --enable-errorstrings Enable error strings table (default: enabled)],
  688. [ ENABLED_ERROR_STRINGS=$enableval ],
  689. [ ENABLED_ERROR_STRINGS=yes ]
  690. )
  691. if test "$ENABLED_ERROR_STRINGS" = "no"
  692. then
  693. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  694. else
  695. # turn off error strings if leanpsk on
  696. if test "$ENABLED_LEANPSK" = "yes"
  697. then
  698. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  699. ENABLED_ERROR_STRINGS=no
  700. fi
  701. fi
  702. # OLD TLS
  703. AC_ARG_ENABLE([oldtls],
  704. [ --enable-oldtls Enable old TLS versions < 1.2 (default: enabled)],
  705. [ ENABLED_OLD_TLS=$enableval ],
  706. [ ENABLED_OLD_TLS=yes ]
  707. )
  708. if test "$ENABLED_OLD_TLS" = "no"
  709. then
  710. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  711. else
  712. # turn off old if leanpsk on
  713. if test "$ENABLED_LEANPSK" = "yes"
  714. then
  715. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  716. ENABLED_OLD_TLS=no
  717. fi
  718. fi
  719. # SSLv3
  720. AC_ARG_ENABLE([sslv3],
  721. [AS_HELP_STRING([--enable-sslv3],[Enable SSL version 3.0 (default: disabled)])],
  722. [ ENABLED_SSLV3=$enableval ],
  723. [ ENABLED_SSLV3=no]
  724. )
  725. if test "$ENABLED_SSLV3" = "yes"
  726. then
  727. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALLOW_SSLV3"
  728. fi
  729. # STACK SIZE info for examples
  730. AC_ARG_ENABLE([stacksize],
  731. [ --enable-stacksize Enable stack size info on examples (default: disabled)],
  732. [ ENABLED_STACKSIZE=$enableval ],
  733. [ ENABLED_STACKSIZE=no ]
  734. )
  735. if test "$ENABLED_STACKSIZE" = "yes"
  736. then
  737. AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  738. AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
  739. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE -DWOLFSSL_LOW_MEMORY"
  740. fi
  741. # MEMORY
  742. AC_ARG_ENABLE([memory],
  743. [ --enable-memory Enable memory callbacks (default: enabled)],
  744. [ ENABLED_MEMORY=$enableval ],
  745. [ ENABLED_MEMORY=yes ]
  746. )
  747. if test "$ENABLED_MEMORY" = "no"
  748. then
  749. AM_CFLAGS="$AM_CFLAGS -DNO_WOLFSSL_MEMORY"
  750. else
  751. # turn off memory cb if leanpsk on
  752. if test "$ENABLED_LEANPSK" = "yes"
  753. then
  754. # but don't turn on NO_WOLFSSL_MEMORY because using own
  755. ENABLED_MEMORY=no
  756. fi
  757. fi
  758. AM_CONDITIONAL([BUILD_MEMORY], [test "x$ENABLED_MEMORY" = "xyes"])
  759. # RSA
  760. AC_ARG_ENABLE([rsa],
  761. [ --enable-rsa Enable RSA (default: enabled)],
  762. [ ENABLED_RSA=$enableval ],
  763. [ ENABLED_RSA=yes ]
  764. )
  765. if test "$ENABLED_RSA" = "no"
  766. then
  767. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  768. else
  769. # turn off RSA if leanpsk on
  770. if test "$ENABLED_LEANPSK" = "yes"
  771. then
  772. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  773. ENABLED_RSA=no
  774. fi
  775. fi
  776. AM_CONDITIONAL([BUILD_RSA], [test "x$ENABLED_RSA" = "xyes"])
  777. # DH
  778. AC_ARG_ENABLE([dh],
  779. [AS_HELP_STRING([--enable-dh],[Enable DH (default: enabled)])],
  780. [ ENABLED_DH=$enableval ],
  781. [ ENABLED_DH=yes ]
  782. )
  783. if test "$ENABLED_OPENSSH" = "yes"
  784. then
  785. ENABLED_DH="yes"
  786. fi
  787. if test "$ENABLED_DH" = "no"
  788. then
  789. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  790. else
  791. # turn off DH if leanpsk on
  792. if test "$ENABLED_LEANPSK" = "yes"
  793. then
  794. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  795. ENABLED_DH=no
  796. fi
  797. fi
  798. AM_CONDITIONAL([BUILD_DH], [test "x$ENABLED_DH" = "xyes"])
  799. # Anonymous
  800. AC_ARG_ENABLE([anon],
  801. [AS_HELP_STRING([--enable-anon],[Enable Anonymous (default: disabled)])],
  802. [ ENABLED_ANON=$enableval ],
  803. [ ENABLED_ANON=no ]
  804. )
  805. if test "x$ENABLED_ANON" = "xyes"
  806. then
  807. if test "x$ENABLED_DH" != "xyes"
  808. then
  809. AC_MSG_ERROR([Anonymous suite requires DH.])
  810. fi
  811. AM_CFLAGS="$AM_CFLAGS -DHAVE_ANON"
  812. fi
  813. # ASN
  814. # turn off asn, which means no certs, no rsa, no dsa, no ecc,
  815. # and no big int (unless dh is on)
  816. AC_ARG_ENABLE([asn],
  817. [ --enable-asn Enable ASN (default: enabled)],
  818. [ ENABLED_ASN=$enableval ],
  819. [ ENABLED_ASN=yes ]
  820. )
  821. if test "$ENABLED_ASN" = "no"
  822. then
  823. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS"
  824. if test "$ENABLED_DH" = "no"
  825. then
  826. # DH needs bigint
  827. AM_CFLAGS="$AM_CFLAGS -DNO_BIG_INT"
  828. fi
  829. else
  830. # turn off ASN if leanpsk on
  831. if test "$ENABLED_LEANPSK" = "yes"
  832. then
  833. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  834. ENABLED_ASN=no
  835. fi
  836. fi
  837. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_ASN" = "no"
  838. then
  839. AC_MSG_ERROR([please disable rsa if disabling asn.])
  840. fi
  841. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  842. then
  843. AC_MSG_ERROR([please disable dsa if disabling asn.])
  844. fi
  845. if test "$ENABLED_ECC" = "yes" && test "$ENABLED_ASN" = "no"
  846. then
  847. AC_MSG_ERROR([please disable ecc if disabling asn.])
  848. fi
  849. if test "$ENABLED_PSK" = "no" && test "$ENABLED_ASN" = "no"
  850. then
  851. AC_MSG_ERROR([please enable psk if disabling asn.])
  852. fi
  853. # DH needs bigint
  854. if test "$ENABLED_ASN" = "no" && test "$ENABLED_DH" = "no"
  855. then
  856. ENABLED_FASTMATH=no
  857. ENABLED_SLOWMATH=no
  858. fi
  859. AM_CONDITIONAL([BUILD_ASN], [test "x$ENABLED_ASN" = "xyes"])
  860. # AES
  861. AC_ARG_ENABLE([aes],
  862. [ --enable-aes Enable AES (default: enabled)],
  863. [ ENABLED_AES=$enableval ],
  864. [ ENABLED_AES=yes ]
  865. )
  866. if test "$ENABLED_AES" = "no"
  867. then
  868. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  869. if test "$ENABLED_FORTRESS" = "yes"
  870. then
  871. AC_MSG_ERROR([fortress requires aes])
  872. fi
  873. if test "$ENABLED_ECC_ENCRYPT" = "yes"
  874. then
  875. AC_MSG_ERROR([cannot enable eccencrypt and hkdf without aes.])
  876. fi
  877. if test "$ENABLED_AESGCM" = "yes"
  878. then
  879. AC_MSG_ERROR([AESGCM requires AES.])
  880. fi
  881. if test "$ENABLED_AESCCM" = "yes"
  882. then
  883. AC_MSG_ERROR([AESCCM requires AES.])
  884. fi
  885. else
  886. # turn off AES if leanpsk on
  887. if test "$ENABLED_LEANPSK" = "yes"
  888. then
  889. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  890. ENABLED_AES=no
  891. fi
  892. fi
  893. AM_CONDITIONAL([BUILD_AES], [test "x$ENABLED_AES" = "xyes"])
  894. # CODING
  895. AC_ARG_ENABLE([coding],
  896. [ --enable-coding Enable Coding base 16/64 (default: enabled)],
  897. [ ENABLED_CODING=$enableval ],
  898. [ ENABLED_CODING=yes ]
  899. )
  900. if test "$ENABLED_CODING" = "no"
  901. then
  902. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  903. else
  904. # turn off CODING if leanpsk on
  905. if test "$ENABLED_LEANPSK" = "yes"
  906. then
  907. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  908. ENABLED_CODING=no
  909. fi
  910. fi
  911. AM_CONDITIONAL([BUILD_CODING], [test "x$ENABLED_CODING" = "xyes"])
  912. # DES3
  913. AC_ARG_ENABLE([des3],
  914. [ --enable-des3 Enable DES3 (default: enabled)],
  915. [ ENABLED_DES3=$enableval ],
  916. [ ENABLED_DES3=yes ]
  917. )
  918. if test "$ENABLED_DES3" = "no"
  919. then
  920. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  921. else
  922. # turn off DES3 if leanpsk on
  923. if test "$ENABLED_LEANPSK" = "yes"
  924. then
  925. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  926. ENABLED_DES3=no
  927. fi
  928. fi
  929. AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"])
  930. # IDEA
  931. AC_ARG_ENABLE([idea],
  932. [AS_HELP_STRING([--enable-idea],[Enable IDEA Cipher (default: disabled)])],
  933. [ ENABLED_IDEA=$enableval ],
  934. [ ENABLED_IDEA=no ]
  935. )
  936. if test "x$ENABLED_IDEA" = "xyes"
  937. then
  938. AM_CFLAGS="$AM_CFLAGS -DHAVE_IDEA"
  939. fi
  940. AM_CONDITIONAL([BUILD_IDEA], [test "x$ENABLED_IDEA" = "xyes"])
  941. # ARC4
  942. AC_ARG_ENABLE([arc4],
  943. [ --enable-arc4 Enable ARC4 (default: disabled)],
  944. [ ENABLED_ARC4=$enableval ],
  945. [ ENABLED_ARC4=no ]
  946. )
  947. if test "$ENABLED_OPENSSH" = "yes"
  948. then
  949. ENABLED_ARC4="yes"
  950. fi
  951. if test "$ENABLED_ARC4" = "no"
  952. then
  953. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  954. else
  955. # turn off ARC4 if leanpsk on
  956. if test "$ENABLED_LEANPSK" = "yes"
  957. then
  958. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  959. ENABLED_ARC4=no
  960. fi
  961. fi
  962. AM_CONDITIONAL([BUILD_RC4], [test "x$ENABLED_ARC4" = "xyes"])
  963. # MD5
  964. AC_ARG_ENABLE([md5],
  965. [ --enable-md5 Enable MD5 (default: enabled)],
  966. [ ENABLED_MD5=$enableval ],
  967. [ ENABLED_MD5=yes ]
  968. )
  969. if test "$ENABLED_MD5" = "no"
  970. then
  971. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  972. else
  973. # turn off MD5 if leanpsk on
  974. if test "$ENABLED_LEANPSK" = "yes"
  975. then
  976. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  977. ENABLED_MD5=no
  978. fi
  979. fi
  980. AM_CONDITIONAL([BUILD_MD5], [test "x$ENABLED_MD5" = "xyes"])
  981. # SHA
  982. AC_ARG_ENABLE([sha],
  983. [ --enable-sha Enable SHA (default: enabled)],
  984. [ ENABLED_SHA=$enableval ],
  985. [ ENABLED_SHA=yes ]
  986. )
  987. if test "$ENABLED_SHA" = "no"
  988. then
  989. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  990. else
  991. # turn off SHA if leanpsk on
  992. if test "$ENABLED_LEANPSK" = "yes"
  993. then
  994. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  995. ENABLED_SHA=no
  996. fi
  997. fi
  998. AM_CONDITIONAL([BUILD_SHA], [test "x$ENABLED_SHA" = "xyes"])
  999. # Web Server Build
  1000. AC_ARG_ENABLE([webserver],
  1001. [ --enable-webserver Enable Web Server (default: disabled)],
  1002. [ ENABLED_WEBSERVER=$enableval ],
  1003. [ ENABLED_WEBSERVER=no ]
  1004. )
  1005. if test "$ENABLED_WEBSERVER" = "yes"
  1006. then
  1007. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  1008. fi
  1009. # HC128
  1010. AC_ARG_ENABLE([hc128],
  1011. [ --enable-hc128 Enable HC-128 (default: disabled)],
  1012. [ ENABLED_HC128=$enableval ],
  1013. [ ENABLED_HC128=no ]
  1014. )
  1015. if test "$ENABLED_HC128" = "no"
  1016. then
  1017. AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
  1018. else
  1019. AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
  1020. fi
  1021. AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
  1022. # RABBIT
  1023. AC_ARG_ENABLE([rabbit],
  1024. [ --enable-rabbit Enable RABBIT (default: disabled)],
  1025. [ ENABLED_RABBIT=$enableval ],
  1026. [ ENABLED_RABBIT=no ]
  1027. )
  1028. if test "$ENABLED_RABBIT" = "no"
  1029. then
  1030. AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
  1031. else
  1032. AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
  1033. fi
  1034. AM_CONDITIONAL([BUILD_RABBIT], [test "x$ENABLED_RABBIT" = "xyes"])
  1035. # FIPS
  1036. AC_ARG_ENABLE([fips],
  1037. [AS_HELP_STRING([--enable-fips],[Enable FIPS 140-2, Will NOT work w/o FIPS license (default: disabled)])],
  1038. [ ENABLED_FIPS=$enableval ],
  1039. [ ENABLED_FIPS=no ]
  1040. )
  1041. if test "x$ENABLED_FIPS" = "xyes"
  1042. then
  1043. # requires thread local storage
  1044. if test "$thread_ls_on" = "no"
  1045. then
  1046. AC_MSG_ERROR([FIPS requires Thread Local Storage])
  1047. fi
  1048. # requires SHA512
  1049. if test "x$ENABLED_SHA512" = "xno"
  1050. then
  1051. ENABLED_SHA512="yes"
  1052. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512 -DWOLFSSL_SHA384"
  1053. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  1054. fi
  1055. # requires AESGCM
  1056. if test "x$ENABLED_AESGCM" != "xyes"
  1057. then
  1058. ENABLED_AESGCM="yes"
  1059. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  1060. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  1061. fi
  1062. AM_CFLAGS="$AM_CFLAGS -DHAVE_FIPS"
  1063. fi
  1064. AM_CONDITIONAL([BUILD_FIPS], [test "x$ENABLED_FIPS" = "xyes"])
  1065. # set POLY1305 default
  1066. POLY1305_DEFAULT=yes
  1067. if test "x$ENABLED_FIPS" = "xyes"
  1068. then
  1069. POLY1305_DEFAULT=no
  1070. fi
  1071. # POLY1305
  1072. AC_ARG_ENABLE([poly1305],
  1073. [AS_HELP_STRING([--enable-poly1305],[Enable wolfSSL POLY1305 support (default: enabled)])],
  1074. [ ENABLED_POLY1305=$enableval ],
  1075. [ ENABLED_POLY1305=$POLY1305_DEFAULT]
  1076. )
  1077. # lean psk does't need poly1305
  1078. if test "$ENABLED_LEANPSK" = "yes"
  1079. then
  1080. ENABLED_POLY1305=no
  1081. fi
  1082. if test "$ENABLED_POLY1305" = "yes"
  1083. then
  1084. AM_CFLAGS="$AM_CFLAGS -DHAVE_POLY1305 -DHAVE_ONE_TIME_AUTH"
  1085. fi
  1086. AM_CONDITIONAL([BUILD_POLY1305], [test "x$ENABLED_POLY1305" = "xyes"])
  1087. # set CHACHA default
  1088. CHACHA_DEFAULT=yes
  1089. if test "x$ENABLED_FIPS" = "xyes"
  1090. then
  1091. CHACHA_DEFAULT=no
  1092. fi
  1093. # CHACHA
  1094. AC_ARG_ENABLE([chacha],
  1095. [ --enable-chacha Enable CHACHA (default: enabled)],
  1096. [ ENABLED_CHACHA=$enableval ],
  1097. [ ENABLED_CHACHA=$CHACHA_DEFAULT]
  1098. )
  1099. # lean psk does't need chacha
  1100. if test "$ENABLED_LEANPSK" = "yes"
  1101. then
  1102. ENABLED_CHACHA=no
  1103. fi
  1104. if test "$ENABLED_CHACHA" = "yes"
  1105. then
  1106. AM_CFLAGS="$AM_CFLAGS -DHAVE_CHACHA"
  1107. fi
  1108. AM_CONDITIONAL([BUILD_CHACHA], [test "x$ENABLED_CHACHA" = "xyes"])
  1109. # Hash DRBG
  1110. AC_ARG_ENABLE([hashdrbg],
  1111. [ --enable-hashdrbg Enable Hash DRBG support (default: enabled)],
  1112. [ ENABLED_HASHDRBG=$enableval ],
  1113. [ ENABLED_HASHDRBG=yes ]
  1114. )
  1115. if test "x$ENABLED_HASHDRBG" = "xyes"
  1116. then
  1117. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  1118. else
  1119. # turn on Hash DRBG if FIPS is on or ARC4 is off
  1120. if test "x$ENABLED_FIPS" = "xyes" || test "x$ENABLED_ARC4" = "xno"
  1121. then
  1122. AM_CFLAGS="$AM_CFLAGS -DHAVE_HASHDRBG"
  1123. ENABLED_HASHDRBG=yes
  1124. fi
  1125. fi
  1126. # Filesystem Build
  1127. AC_ARG_ENABLE([filesystem],
  1128. [ --enable-filesystem Enable Filesystem support (default: enabled)],
  1129. [ ENABLED_FILESYSTEM=$enableval ],
  1130. [ ENABLED_FILESYSTEM=yes ]
  1131. )
  1132. if test "$ENABLED_FILESYSTEM" = "no"
  1133. then
  1134. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  1135. else
  1136. # turn off filesystem if leanpsk on
  1137. if test "$ENABLED_LEANPSK" = "yes"
  1138. then
  1139. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  1140. ENABLED_FILESYSTEM=no
  1141. fi
  1142. fi
  1143. # inline Build
  1144. AC_ARG_ENABLE([inline],
  1145. [ --enable-inline Enable inline functions (default: enabled)],
  1146. [ ENABLED_INLINE=$enableval ],
  1147. [ ENABLED_INLINE=yes ]
  1148. )
  1149. if test "$ENABLED_INLINE" = "no"
  1150. then
  1151. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  1152. fi
  1153. AM_CONDITIONAL([BUILD_INLINE], [test "x$ENABLED_INLINE" = "xyes"])
  1154. # OCSP
  1155. AC_ARG_ENABLE([ocsp],
  1156. [ --enable-ocsp Enable OCSP (default: disabled)],
  1157. [ ENABLED_OCSP=$enableval ],
  1158. [ ENABLED_OCSP=no ],
  1159. )
  1160. if test "$ENABLED_OCSP" = "yes"
  1161. then
  1162. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1163. fi
  1164. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1165. if test "$ENABLED_OCSP" = "yes"
  1166. then
  1167. # check openssl command tool for testing ocsp
  1168. AC_CHECK_PROG([HAVE_OPENSSL_CMD],[openssl],[yes],[no])
  1169. if test "$HAVE_OPENSSL_CMD" = "yes"
  1170. then
  1171. AM_CFLAGS="$AM_CFLAGS -DHAVE_OPENSSL_CMD"
  1172. else
  1173. AC_MSG_WARN([openssl command line tool not available for testing ocsp])
  1174. fi
  1175. fi
  1176. # CRL
  1177. AC_ARG_ENABLE([crl],
  1178. [ --enable-crl Enable CRL (default: disabled)],
  1179. [ ENABLED_CRL=$enableval ],
  1180. [ ENABLED_CRL=no ],
  1181. )
  1182. if test "$ENABLED_CRL" = "yes"
  1183. then
  1184. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  1185. fi
  1186. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  1187. # CRL Monitor
  1188. AC_ARG_ENABLE([crl-monitor],
  1189. [ --enable-crl-monitor Enable CRL Monitor (default: disabled)],
  1190. [ ENABLED_CRL_MONITOR=$enableval ],
  1191. [ ENABLED_CRL_MONITOR=no ],
  1192. )
  1193. if test "$ENABLED_CRL_MONITOR" = "yes"
  1194. then
  1195. case $host_os in
  1196. *linux* | *darwin* | *freebsd*)
  1197. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
  1198. *)
  1199. AC_MSG_ERROR([crl monitor only allowed on linux, OS X, or freebsd]) ;;
  1200. esac
  1201. fi
  1202. AM_CONDITIONAL([BUILD_CRL_MONITOR], [test "x$ENABLED_CRL_MONITOR" = "xyes"])
  1203. # USER CRYPTO
  1204. ENABLED_USER_CRYPTO="no"
  1205. ENABLED_USER_RSA="no"
  1206. AC_DEFINE([BUILD_USER_RSA], [], [User RSA is being defined])
  1207. trycryptodir=""
  1208. AC_ARG_WITH([user-crypto],
  1209. [AS_HELP_STRING([--with-user-crypto=PATH],[Path to USER_CRYPTO install (default /usr/local)])],
  1210. [
  1211. CPPFLAGS="$CPPFLAGS -DHAVE_USER_CRYPTO"
  1212. LIBS="$LIBS -lusercrypto"
  1213. if test "x$withval" != "xno" ; then
  1214. trycryptodir=$withval
  1215. fi
  1216. if test "x$withval" == "xyes" ; then
  1217. trycryptodir="/usr/local"
  1218. fi
  1219. LDFLAGS="$LDFLAGS -L$trycryptodir/lib"
  1220. CPPFLAGS="$CPPFLAGS -I$trycryptodir/include"
  1221. #Look for RSA Init function in usercrypto lib
  1222. AC_CHECK_LIB([usercrypto], [wc_InitRsaKey], [user_rsa_linked=yes], [user_rsa_linked=no])
  1223. if test "x$user_rsa_linked" == "xyes" ; then
  1224. AC_MSG_NOTICE([User user_rsa.h being used])
  1225. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_RSA"
  1226. ENABLED_USER_RSA=yes
  1227. ENABLED_USER_CRYPTO=yes
  1228. fi
  1229. #Display check and find result of link attempts
  1230. AC_MSG_CHECKING([for USER_CRYPTO])
  1231. if test "x$ENABLED_USER_CRYPTO" == "xno" ; then
  1232. AC_MSG_RESULT([no])
  1233. AC_MSG_ERROR([USER_CRYPTO not found. Either move to /usr/include and /usr/lib or
  1234. Specify its path using --with-user-crypto=/dir/])
  1235. else
  1236. AC_MSG_RESULT([yes])
  1237. # Check if .la is available if not then rely on exported path
  1238. AC_CHECK_FILE($trycryptodir/lib/libusercrypto.la, [LIB_ADD="$trycryptodir/lib/libusercrypto.la $LIB_ADD"], [LIB_ADD="-lusercrypto $LIB_ADD"])
  1239. AM_LDFLAGS="$AM_LDFLAGS -L$trycryptodir/lib"
  1240. AM_CFLAGS="$AM_CFLAGS -DHAVE_USER_CRYPTO"
  1241. fi
  1242. ]
  1243. )
  1244. AM_CONDITIONAL([BUILD_USER_RSA], [test "x$ENABLED_USER_RSA" == "xyes"] )
  1245. AM_CONDITIONAL([BUILD_USER_CRYPTO], [test "x$ENABLED_USER_CRYPTO" = "xyes"])
  1246. if test "$ENABLED_USER_CRYPTO" = "yes" && test "$ENABLED_FIPS" = "yes"
  1247. then
  1248. AC_MSG_ERROR([cannot enable user crypto and fips, user crypto posibility of using code in fips boundary.])
  1249. fi
  1250. # NTRU
  1251. ENABLED_NTRU="no"
  1252. tryntrudir=""
  1253. AC_ARG_WITH([ntru],
  1254. [AS_HELP_STRING([--with-ntru=PATH],[Path to NTRU install (default /usr/)])],
  1255. [
  1256. AC_MSG_CHECKING([for NTRU])
  1257. CPPFLAGS="$CPPFLAGS -DHAVE_NTRU -DHAVE_QSH -DHAVE_TLS_EXTENSIONS"
  1258. LIBS="$LIBS -lntruencrypt"
  1259. 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 ])
  1260. if test "x$ntru_linked" == "xno" ; then
  1261. if test "x$withval" != "xno" ; then
  1262. tryntrudir=$withval
  1263. fi
  1264. if test "x$withval" == "xyes" ; then
  1265. tryntrudir="/usr"
  1266. fi
  1267. LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$tryntrudir/lib"
  1268. CPPFLAGS="$CPPFLAGS -I$tryntrudir/include"
  1269. 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 ])
  1270. if test "x$ntru_linked" == "xno" ; then
  1271. AC_MSG_ERROR([NTRU isn't found.
  1272. If it's already installed, specify its path using --with-ntru=/dir/])
  1273. fi
  1274. AC_MSG_RESULT([yes])
  1275. AM_LDFLAGS="$AM_LDFLAGS -L$tryntrudir/lib"
  1276. else
  1277. AC_MSG_RESULT([yes])
  1278. fi
  1279. AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU -DHAVE_QSH -DHAVE_TLS_EXTENSIONS"
  1280. ENABLED_NTRU="yes"
  1281. ]
  1282. )
  1283. AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
  1284. if test "$ENABLED_NTRU" = "yes" && test "$ENABLED_SMALL" = "yes"
  1285. then
  1286. AC_MSG_ERROR([cannot enable ntru and small, ntru requires TLS which small turns off.])
  1287. fi
  1288. # SNI
  1289. AC_ARG_ENABLE([sni],
  1290. [ --enable-sni Enable SNI (default: disabled)],
  1291. [ ENABLED_SNI=$enableval ],
  1292. [ ENABLED_SNI=no ]
  1293. )
  1294. if test "x$ENABLED_SNI" = "xyes"
  1295. then
  1296. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  1297. fi
  1298. # Maximum Fragment Length
  1299. AC_ARG_ENABLE([maxfragment],
  1300. [ --enable-maxfragment Enable Maximum Fragment Length (default: disabled)],
  1301. [ ENABLED_MAX_FRAGMENT=$enableval ],
  1302. [ ENABLED_MAX_FRAGMENT=no ]
  1303. )
  1304. # ALPN
  1305. AC_ARG_ENABLE([alpn],
  1306. [ --enable-alpn Enable ALPN (default: disabled)],
  1307. [ ENABLED_ALPN=$enableval ],
  1308. [ ENABLED_ALPN=no ]
  1309. )
  1310. if test "x$ENABLED_ALPN" = "xyes"
  1311. then
  1312. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
  1313. fi
  1314. # Maximum Fragment Length
  1315. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  1316. then
  1317. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  1318. fi
  1319. # Truncated HMAC
  1320. AC_ARG_ENABLE([truncatedhmac],
  1321. [ --enable-truncatedhmac Enable Truncated HMAC (default: disabled)],
  1322. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  1323. [ ENABLED_TRUNCATED_HMAC=no ]
  1324. )
  1325. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  1326. then
  1327. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  1328. fi
  1329. # Certificate Status Request : a.k.a. OCSP Stapling
  1330. AC_ARG_ENABLE([ocspstapling],
  1331. [AS_HELP_STRING([--enable-ocspstapling],[Enable Certificate Status Request - a.k.a. OCSP Stapling (default: disabled)])],
  1332. [ ENABLED_CERTIFICATE_STATUS_REQUEST=$enableval ],
  1333. [ ENABLED_CERTIFICATE_STATUS_REQUEST=no ]
  1334. )
  1335. if test "x$ENABLED_CERTIFICATE_STATUS_REQUEST" = "xyes"
  1336. then
  1337. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_CERTIFICATE_STATUS_REQUEST"
  1338. # Requires OCSP make sure on
  1339. if test "x$ENABLED_OCSP" = "xno"
  1340. then
  1341. ENABLED_OCSP="yes"
  1342. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1343. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1344. fi
  1345. fi
  1346. # Renegotiation Indication - (FAKE Secure Renegotiation)
  1347. AC_ARG_ENABLE([renegotiation-indication],
  1348. [AS_HELP_STRING([--enable-renegotiation-indication],[Enable Renegotiation Indication (default: disabled)])],
  1349. [ ENABLED_RENEGOTIATION_INDICATION=$enableval ],
  1350. [ ENABLED_RENEGOTIATION_INDICATION=no ]
  1351. )
  1352. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  1353. then
  1354. AM_CFLAGS="$AM_CFLAGS -DHAVE_RENEGOTIATION_INDICATION"
  1355. fi
  1356. # Secure Renegotiation
  1357. AC_ARG_ENABLE([secure-renegotiation],
  1358. [AS_HELP_STRING([--enable-secure-renegotiation],[Enable Secure Renegotiation (default: disabled)])],
  1359. [ ENABLED_SECURE_RENEGOTIATION=$enableval ],
  1360. [ ENABLED_SECURE_RENEGOTIATION=no ]
  1361. )
  1362. if test "x$ENABLED_SECURE_RENEGOTIATION" = "xyes"
  1363. then
  1364. if test "x$ENABLED_RENEGOTIATION_INDICATION" = "xyes"
  1365. then
  1366. AC_MSG_ERROR([cannot enable renegotiation-indication and secure-renegotiation.])
  1367. fi
  1368. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SECURE_RENEGOTIATION"
  1369. fi
  1370. # Supported Elliptic Curves Extensions
  1371. AC_ARG_ENABLE([supportedcurves],
  1372. [AS_HELP_STRING([--enable-supportedcurves],[Enable Supported Elliptic Curves (default: disabled)])],
  1373. [ ENABLED_SUPPORTED_CURVES=$enableval ],
  1374. [ ENABLED_SUPPORTED_CURVES=no ]
  1375. )
  1376. if test "x$ENABLED_SUPPORTED_CURVES" = "xyes"
  1377. then
  1378. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES"
  1379. fi
  1380. # Session Ticket Extension
  1381. AC_ARG_ENABLE([session-ticket],
  1382. [AS_HELP_STRING([--enable-session-ticket],[Enable Session Ticket (default: disabled)])],
  1383. [ ENABLED_SESSION_TICKET=$enableval ],
  1384. [ ENABLED_SESSION_TICKET=no ]
  1385. )
  1386. if test "x$ENABLED_SESSION_TICKET" = "xyes"
  1387. then
  1388. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SESSION_TICKET"
  1389. fi
  1390. # TLS Extensions
  1391. AC_ARG_ENABLE([tlsx],
  1392. [ --enable-tlsx Enable all TLS Extensions (default: disabled)],
  1393. [ ENABLED_TLSX=$enableval ],
  1394. [ ENABLED_TLSX=no ]
  1395. )
  1396. if test "x$ENABLED_TLSX" = "xyes"
  1397. then
  1398. ENABLED_SNI=yes
  1399. ENABLED_MAX_FRAGMENT=yes
  1400. ENABLED_TRUNCATED_HMAC=yes
  1401. ENABLED_SUPPORTED_CURVES=yes
  1402. ENABLED_ALPN=yes
  1403. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES -DHAVE_ALPN"
  1404. fi
  1405. # PKCS7
  1406. AC_ARG_ENABLE([pkcs7],
  1407. [ --enable-pkcs7 Enable PKCS7 (default: disabled)],
  1408. [ ENABLED_PKCS7=$enableval ],
  1409. [ ENABLED_PKCS7=no ],
  1410. )
  1411. if test "$ENABLED_PKCS7" = "yes"
  1412. then
  1413. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  1414. fi
  1415. AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
  1416. # Simple Certificate Enrollment Protocol (SCEP)
  1417. AC_ARG_ENABLE([scep],
  1418. [ --enable-scep Enable wolfSCEP (default: disabled)],
  1419. [ ENABLED_WOLFSCEP=$enableval ],
  1420. [ ENABLED_WOLFSCEP=no ]
  1421. )
  1422. if test "$ENABLED_WOLFSCEP" = "yes"
  1423. then
  1424. # Enable prereqs if not already enabled
  1425. if test "x$ENABLED_KEYGEN" = "xno"
  1426. then
  1427. ENABLED_KEYGEN="yes"
  1428. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_KEY_GEN"
  1429. fi
  1430. if test "x$ENABLED_CERTGEN" = "xno"
  1431. then
  1432. ENABLED_CERTGEN="yes"
  1433. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1434. fi
  1435. if test "x$ENABLED_CERTREQ" = "xno"
  1436. then
  1437. ENABLED_CERTREQ="yes"
  1438. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_REQ"
  1439. fi
  1440. if test "x$ENABLED_CERTEXT" = "xno"
  1441. then
  1442. ENABLED_CERTEXT="yes"
  1443. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_EXT"
  1444. fi
  1445. if test "x$ENABLED_PKCS7" = "xno"
  1446. then
  1447. ENABLED_PKCS7="yes"
  1448. AM_CFLAGS="$AM_CFLAGS -DHAVE_PKCS7"
  1449. AM_CONDITIONAL([BUILD_PKCS7], [test "x$ENABLED_PKCS7" = "xyes"])
  1450. fi
  1451. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_WOLFSCEP"
  1452. fi
  1453. # Secure Remote Password
  1454. AC_ARG_ENABLE([srp],
  1455. [ --enable-srp Enable Secure Remote Password (default: disabled)],
  1456. [ ENABLED_SRP=$enableval ],
  1457. [ ENABLED_SRP=no ]
  1458. )
  1459. if test "x$ENABLED_SRP" = "xyes"
  1460. then
  1461. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_SRP"
  1462. fi
  1463. AM_CONDITIONAL([BUILD_SRP], [test "x$ENABLED_SRP" = "xyes"])
  1464. # Small Stack
  1465. AC_ARG_ENABLE([smallstack],
  1466. [ --enable-smallstack Enable Small Stack Usage (default: disabled)],
  1467. [ ENABLED_SMALL_STACK=$enableval ],
  1468. [ ENABLED_SMALL_STACK=no ]
  1469. )
  1470. if test "x$ENABLED_SMALL_STACK" = "xyes"
  1471. then
  1472. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SMALL_STACK"
  1473. fi
  1474. #valgrind
  1475. AC_ARG_ENABLE([valgrind],
  1476. [ --enable-valgrind Enable valgrind for unit tests (default: disabled)],
  1477. [ ENABLED_VALGRIND=$enableval ],
  1478. [ ENABLED_VALGRIND=no ]
  1479. )
  1480. if test "$ENABLED_VALGRIND" = "yes"
  1481. then
  1482. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  1483. if test "$HAVE_VALGRIND" = "no"
  1484. then
  1485. AC_MSG_ERROR([Valgrind not found.])
  1486. fi
  1487. enable_shared=no
  1488. enable_static=yes
  1489. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  1490. fi
  1491. AM_CONDITIONAL([USE_VALGRIND], [test "x$ENABLED_VALGRIND" = "xyes"])
  1492. # Test certs, use internal cert functions for extra testing
  1493. AC_ARG_ENABLE([testcert],
  1494. [ --enable-testcert Enable Test Cert (default: disabled)],
  1495. [ ENABLED_TESTCERT=$enableval ],
  1496. [ ENABLED_TESTCERT=no ]
  1497. )
  1498. if test "$ENABLED_TESTCERT" = "yes"
  1499. then
  1500. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_TEST_CERT"
  1501. fi
  1502. # I/O Pool, an example to show user how to override memory handler and use
  1503. # a pool for the input/output buffer requests
  1504. AC_ARG_ENABLE([iopool],
  1505. [ --enable-iopool Enable I/O Pool example (default: disabled)],
  1506. [ ENABLED_IOPOOL=$enableval ],
  1507. [ ENABLED_IOPOOL=no ]
  1508. )
  1509. if test "$ENABLED_IOPOOL" = "yes"
  1510. then
  1511. if test "$thread_ls_on" = "no"
  1512. then
  1513. AC_MSG_ERROR([I/O Pool example requires Thread Local Storage])
  1514. fi
  1515. AM_CFLAGS="$AM_CFLAGS -DHAVE_IO_POOL -DXMALLOC_USER"
  1516. fi
  1517. # Certificate Service Support
  1518. AC_ARG_ENABLE([certservice],
  1519. [ --enable-certservice Enable cert service (default: disabled)],
  1520. [ ENABLED_CERT_SERVICE=$enableval ],
  1521. [ ENABLED_CERT_SERVICE=no ]
  1522. )
  1523. if test "$ENABLED_CERT_SERVICE" = "yes"
  1524. then
  1525. # Requires ecc,certgen, and opensslextra make sure on
  1526. if test "x$ENABLED_CERTGEN" = "xno"
  1527. then
  1528. ENABLED_CERTGEN="yes"
  1529. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CERT_GEN"
  1530. fi
  1531. if test "x$ENABLED_ECC" = "xno"
  1532. then
  1533. ENABLED_ECC="yes"
  1534. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
  1535. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  1536. fi
  1537. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1538. then
  1539. ENABLED_OPENSSLEXTRA="yes"
  1540. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  1541. fi
  1542. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_CERT_SERVICE"
  1543. fi
  1544. # wolfSSL JNI
  1545. AC_ARG_ENABLE([jni],
  1546. [ --enable-jni Enable wolfSSL JNI (default: disabled)],
  1547. [ ENABLED_JNI=$enableval ],
  1548. [ ENABLED_JNI=no ]
  1549. )
  1550. if test "$ENABLED_JNI" = "yes"
  1551. then
  1552. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_JNI"
  1553. # Enable prereqs if not already enabled
  1554. if test "x$ENABLED_DTLS" = "xno"
  1555. then
  1556. ENABLED_DTLS="yes"
  1557. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
  1558. fi
  1559. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1560. then
  1561. ENABLED_OPENSSLEXTRA="yes"
  1562. AM_CFLAGS="$AM_CFLAGS -DOPENSSL_EXTRA"
  1563. fi
  1564. if test "x$ENABLED_CRL" = "xno"
  1565. then
  1566. ENABLED_CRL="yes"
  1567. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  1568. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  1569. fi
  1570. if test "x$ENABLED_OCSP" = "xno"
  1571. then
  1572. ENABLED_OCSP="yes"
  1573. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1574. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1575. fi
  1576. if test "x$ENABLED_CRL_MONITOR" = "xno"
  1577. then
  1578. ENABLED_CRL_MONITOR="yes"
  1579. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR"
  1580. fi
  1581. if test "x$ENABLED_SAVESESSION" = "xno"
  1582. then
  1583. ENABLED_SAVESESSION="yes"
  1584. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  1585. fi
  1586. if test "x$ENABLED_SAVECERT" = "xno"
  1587. then
  1588. ENABLED_SAVECERT="yes"
  1589. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  1590. fi
  1591. if test "x$ENABLED_ATOMICUSER" = "xno"
  1592. then
  1593. ENABLED_ATOMICUSER="yes"
  1594. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  1595. fi
  1596. if test "x$ENABLED_ECC" = "xno"
  1597. then
  1598. ENABLED_ECC="yes"
  1599. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC"
  1600. fi
  1601. if test "x$ENABLED_PKCALLBACKS" = "xno"
  1602. then
  1603. ENABLED_PKCALLBACKS="yes"
  1604. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  1605. fi
  1606. if test "x$ENABLED_DH" = "xno"
  1607. then
  1608. ENABLED_DH="yes"
  1609. AM_CFLAGS="$AM_CFLAGS -DHAVE_DH"
  1610. fi
  1611. if test "x$ENABLED_PSK" = "xno"
  1612. then
  1613. ENABLED_PSK="yes"
  1614. fi
  1615. fi
  1616. # lighty Support
  1617. AC_ARG_ENABLE([lighty],
  1618. [ --enable-lighty Enable lighttpd/lighty (default: disabled)],
  1619. [ ENABLED_LIGHTY=$enableval ],
  1620. [ ENABLED_LIGHTY=no ]
  1621. )
  1622. if test "$ENABLED_LIGHTY" = "yes"
  1623. then
  1624. # Requires opensslextra make sure on
  1625. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1626. then
  1627. ENABLED_OPENSSLEXTRA="yes"
  1628. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  1629. fi
  1630. AM_CFLAGS="$AM_CFLAGS -DHAVE_LIGHTY -DHAVE_WOLFSSL_SSL_H=1"
  1631. fi
  1632. # stunnel Support
  1633. AC_ARG_ENABLE([stunnel],
  1634. [ --enable-stunnel Enable stunnel (default: disabled)],
  1635. [ ENABLED_STUNNEL=$enableval ],
  1636. [ ENABLED_STUNNEL=no ]
  1637. )
  1638. if test "$ENABLED_STUNNEL" = "yes"
  1639. then
  1640. # Requires opensslextra make sure on
  1641. if test "x$ENABLED_OPENSSLEXTRA" = "xno"
  1642. then
  1643. ENABLED_OPENSSLEXTRA="yes"
  1644. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  1645. fi
  1646. # Requires OCSP make sure on
  1647. if test "x$ENABLED_OCSP" = "xno"
  1648. then
  1649. ENABLED_OCSP="yes"
  1650. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  1651. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  1652. fi
  1653. # Requires coding make sure on
  1654. if test "x$ENABLED_CODING" = "xno"
  1655. then
  1656. ENABLED_CODING="yes"
  1657. fi
  1658. # Requires sessioncerts make sure on
  1659. if test "x$ENABLED_SESSIONCERTS" = "xno"
  1660. then
  1661. ENABLED_SESSIONCERTS="yes"
  1662. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  1663. fi
  1664. # Requires crls, make sure on
  1665. if test "x$ENABLED_CRL" = "xno"
  1666. then
  1667. ENABLED_CRL="yes"
  1668. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  1669. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  1670. fi
  1671. # Requires tlsx, make sure on
  1672. if test "x$ENABLED_TLSX" = "xno"
  1673. then
  1674. ENABLED_TLSX="yes"
  1675. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES"
  1676. fi
  1677. # Requires ecc make sure on
  1678. if test "x$ENABLED_ECC" = "xno"
  1679. then
  1680. ENABLED_OPENSSLEXTRA="yes"
  1681. ENABLED_ECC="yes"
  1682. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
  1683. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  1684. fi
  1685. AM_CFLAGS="$AM_CFLAGS -DHAVE_STUNNEL -DWOLFSSL_ALWAYS_VERIFY_CB"
  1686. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_ALWAYS_KEEP_SNI"
  1687. fi
  1688. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no" \
  1689. && test "x$ENABLED_STUNNEL" = "xno"
  1690. then
  1691. AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
  1692. fi
  1693. if test "$ENABLED_PSK" = "no" && \
  1694. (test "$ENABLED_LEANPSK" = "yes" || test "x$ENABLED_STUNNEL" = "xyes")
  1695. then
  1696. ENABLED_PSK=yes
  1697. fi
  1698. # MD4
  1699. AC_ARG_ENABLE([md4],
  1700. [ --enable-md4 Enable MD4 (default: disabled)],
  1701. [ ENABLED_MD4=$enableval ],
  1702. [ ENABLED_MD4=no ]
  1703. )
  1704. if test "$ENABLED_MD4" = "no"
  1705. then
  1706. #turn on MD4 if using stunnel
  1707. if test "x$ENABLED_STUNNEL" = "xyes"
  1708. then
  1709. ENABLED_MD4="yes"
  1710. else
  1711. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  1712. fi
  1713. fi
  1714. AM_CONDITIONAL([BUILD_MD4], [test "x$ENABLED_MD4" = "xyes"])
  1715. # PWDBASED has to come after certservice since we want it on w/o explicit on
  1716. # PWDBASED
  1717. AC_ARG_ENABLE([pwdbased],
  1718. [ --enable-pwdbased Enable PWDBASED (default: disabled)],
  1719. [ ENABLED_PWDBASED=$enableval ],
  1720. [ ENABLED_PWDBASED=no ]
  1721. )
  1722. if test "$ENABLED_PWDBASED" = "no"
  1723. then
  1724. if test "$ENABLED_OPENSSLEXTRA" = "yes" || test "$ENABLED_WEBSERVER" = "yes"
  1725. then
  1726. # opensslextra and webserver needs pwdbased
  1727. ENABLED_PWDBASED=yes
  1728. else
  1729. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  1730. fi
  1731. fi
  1732. AM_CONDITIONAL([BUILD_PWDBASED], [test "x$ENABLED_PWDBASED" = "xyes"])
  1733. # wolfCrypt Only Build
  1734. AC_ARG_ENABLE([cryptonly],
  1735. [AS_HELP_STRING([--enable-cryptonly],[Enable wolfCrypt Only build (default: disabled)])],
  1736. [ENABLED_CRYPTONLY=$enableval],
  1737. [ENABLED_CRYPTONLY=no])
  1738. if test "$ENABLED_CRYPTONLY" = "yes"
  1739. then
  1740. AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_ONLY"
  1741. fi
  1742. AM_CONDITIONAL([BUILD_CRYPTONLY], [test "x$ENABLED_CRYPTONLY" = "xyes"])
  1743. # set fastmath default
  1744. FASTMATH_DEFAULT=no
  1745. if test "$host_cpu" = "x86_64"
  1746. then
  1747. FASTMATH_DEFAULT=yes
  1748. fi
  1749. # fastmath
  1750. AC_ARG_ENABLE([fastmath],
  1751. [ --enable-fastmath Enable fast math ops (default: enabled on x86_64)],
  1752. [ ENABLED_FASTMATH=$enableval ],
  1753. [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
  1754. )
  1755. if test "x$ENABLED_FASTMATH" = "xyes"
  1756. then
  1757. # turn off fastmth if leanpsk on or asn off (w/o dh)
  1758. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  1759. then
  1760. if test "$ENABLED_DH" = "no"
  1761. then
  1762. ENABLED_FASTMATH=no
  1763. else
  1764. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1765. ENABLED_SLOWMATH="no"
  1766. fi
  1767. else
  1768. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1769. ENABLED_SLOWMATH="no"
  1770. fi
  1771. if test "$host_cpu" = "x86_64"
  1772. then
  1773. # Have settings.h set FP_MAX_BITS higher if user didn't set directly
  1774. AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_X86_64_BUILD"
  1775. fi
  1776. fi
  1777. # fast HUGE math
  1778. AC_ARG_ENABLE([fasthugemath],
  1779. [ --enable-fasthugemath Enable fast math + huge code (default: disabled)],
  1780. [ ENABLED_FASTHUGEMATH=$enableval ],
  1781. [ ENABLED_FASTHUGEMATH=no ]
  1782. )
  1783. if test "$ENABLED_BUMP" = "yes"
  1784. then
  1785. ENABLED_FASTHUGEMATH="yes"
  1786. fi
  1787. if test "$ENABLED_FASTHUGEMATH" = "yes"
  1788. then
  1789. ENABLED_FASTMATH="yes"
  1790. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  1791. ENABLED_SLOWMATH="no"
  1792. fi
  1793. AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
  1794. AM_CONDITIONAL([BUILD_SLOWMATH], [test "x$ENABLED_SLOWMATH" = "xyes"])
  1795. # Enable Examples, used to disable examples
  1796. AC_ARG_ENABLE([examples],
  1797. [ --enable-examples Enable Examples (default: enabled)],
  1798. [ ENABLED_EXAMPLES=$enableval ],
  1799. [ ENABLED_EXAMPLES=yes ]
  1800. )
  1801. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  1802. AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
  1803. AS_IF([test "x$ENABLED_CRYPTONLY" = "xyes"], [ENABLED_EXAMPLES="no"])
  1804. AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$ENABLED_EXAMPLES" = "xyes"])
  1805. # LIBZ
  1806. ENABLED_LIBZ="no"
  1807. trylibzdir=""
  1808. AC_ARG_WITH([libz],
  1809. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  1810. [
  1811. AC_MSG_CHECKING([for libz])
  1812. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  1813. LIBS="$LIBS -lz"
  1814. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  1815. if test "x$libz_linked" == "xno" ; then
  1816. if test "x$withval" != "xno" ; then
  1817. trylibzdir=$withval
  1818. fi
  1819. if test "x$withval" == "xyes" ; then
  1820. trylibzdir="/usr"
  1821. fi
  1822. AM_LDFLAGS="$AM_LDFLAGS -L$trylibzdir/lib"
  1823. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  1824. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  1825. if test "x$libz_linked" == "xno" ; then
  1826. AC_MSG_ERROR([libz isn't found.
  1827. If it's already installed, specify its path using --with-libz=/dir/])
  1828. fi
  1829. AC_MSG_RESULT([yes])
  1830. else
  1831. AC_MSG_RESULT([yes])
  1832. fi
  1833. ENABLED_LIBZ="yes"
  1834. ]
  1835. )
  1836. AM_CONDITIONAL([BUILD_LIBZ], [test "x$ENABLED_LIBZ" = "xyes"])
  1837. # cavium
  1838. trycaviumdir=""
  1839. AC_ARG_WITH([cavium],
  1840. [ --with-cavium=PATH PATH to cavium/software dir ],
  1841. [
  1842. AC_MSG_CHECKING([for cavium])
  1843. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
  1844. if test "x$withval" == "xyes" ; then
  1845. AC_MSG_ERROR([need a PATH for --with-cavium])
  1846. fi
  1847. if test "x$withval" != "xno" ; then
  1848. trycaviumdir=$withval
  1849. fi
  1850. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  1851. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  1852. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  1853. if test "x$cavium_linked" == "xno" ; then
  1854. AC_MSG_ERROR([cavium isn't found.
  1855. If it's already installed, specify its path using --with-cavium=/dir/])
  1856. fi
  1857. AC_MSG_RESULT([yes])
  1858. enable_shared=no
  1859. enable_static=yes
  1860. ]
  1861. )
  1862. # Fast RSA using Intel IPP
  1863. ippdir="${srcdir}/IPP"
  1864. ipplib="lib" # if autoconf guesses 32 changes lib directory
  1865. fastRSA_headers=no
  1866. # set up variables used
  1867. IPPLIBS=
  1868. IPPHEADERS=
  1869. IPPLINK=
  1870. AC_ARG_ENABLE([fast-rsa],
  1871. [AS_HELP_STRING([--enable-fast-rsa],[Enable RSA using Intel IPP (default: disabled)])],
  1872. [ ENABLED_FAST_RSA=$enableval ],
  1873. [ ENABLED_FAST_RSA=no ],
  1874. )
  1875. if test "$ENABLED_USER_RSA" = "no" && test "$ENABLED_FIPS" = "no"; then
  1876. if test "$enable_shared" = "no" && test "$ENABLED_FAST_RSA" = "yes"; then
  1877. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  1878. ipplib="lib_32" # 32 bit OS detected
  1879. fi
  1880. case $host_os in
  1881. *darwin*)
  1882. ipplib="$ipplib/mac_static"
  1883. AC_MSG_ERROR([Issue with static linking to libippcp.a on Mac.
  1884. Dynamic IPP libraries supported on Mac])
  1885. break;;
  1886. *linux*)
  1887. ipplib="$ipplib/linux_static"
  1888. break;;
  1889. *)
  1890. ENABLED_FAST_RSA=no
  1891. esac
  1892. AC_CHECK_FILES([$srcdir/IPP/$ipplib/libippcore.a $srcdir/IPP/$ipplib/libippcp.a], [], [ENABLED_FAST_RSA=no])
  1893. 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])
  1894. LIB_STATIC_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a"
  1895. if test "$ENABLED_FAST_RSA" = "no"; then
  1896. AC_MSG_ERROR([Could not find fast rsa libraries])
  1897. fi
  1898. else
  1899. # just check link and see if user has already exported paths
  1900. if test "$ENABLED_FAST_RSA" = "yes"
  1901. then
  1902. AC_MSG_NOTICE([Checking if IPP crypto library installed])
  1903. AC_CHECK_HEADER([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15], [LIBS="$LIBS -lippcore"; fastRSA_headers=yes], [AS_UNSET([ac_cv_lib_ippcp_ippsRSAEncrypt_PKCSv15]); fastRSA_headers=no])], [fastRSA_headers=no])
  1904. if test "$fastRSA_headers" = "yes"; then
  1905. AM_LDFLAGS="${AM_LDFLAGS} -lippcore -lippcp"
  1906. fi
  1907. fi
  1908. # Don't cache the result so it can be checked again
  1909. AS_UNSET([ac_cv_header_ippcp_h])
  1910. AS_UNSET([ac_cv_header_ipp_h])
  1911. if test "$fastRSA_headers" = "no"; then
  1912. dnl set default paths
  1913. if test "$ENABLED_FAST_RSA" = "yes"; then
  1914. AC_MSG_NOTICE([Using local IPP crypto library])
  1915. # build and default locations on linux and mac
  1916. STORE_LDFLAGS=${LDFLAGS}
  1917. STORE_CPPFLAGS=${CPPFLAGS}
  1918. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  1919. ipplib="lib_32" # 32 bit OS detected
  1920. fi
  1921. # using LDFLAGS instead of AM_ temporarily to test link to library
  1922. LDFLAGS="-L$ippdir/$ipplib -lippcp -lippcore"
  1923. CPPFLAGS="-I$ippdir/include"
  1924. AC_CHECK_HEADERS([ippcp.h], [AC_CHECK_LIB([ippcp], [ippsRSAEncrypt_PKCSv15], [], [ENABLED_FAST_RSA=no])], [ENABLED_FAST_RSA=no])
  1925. if test "$ENABLED_FAST_RSA" = "yes"; then
  1926. # was succesfull so add tested LDFLAGS to AM_ flags
  1927. AM_LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
  1928. AM_CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
  1929. case $host_os in
  1930. *darwin*)
  1931. name="$ippdir/$ipplib/libippcp"
  1932. 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"
  1933. 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"
  1934. break;;
  1935. *linux*)
  1936. if test "$ac_cv_sizeof_long" = "4" && test "$ac_cv_sizeof_long_long" = "8"; then
  1937. name="$ippdir/$ipplib/libippcp"
  1938. 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"
  1939. 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"
  1940. else
  1941. name="$ippdir/$ipplib/libippcp"
  1942. 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"
  1943. 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"
  1944. fi
  1945. break;;
  1946. *)
  1947. ENABLED_FAST_RSA=no
  1948. esac
  1949. fi
  1950. # restore LDFLAGS to user set
  1951. LDFLAGS=${STORE_LDFLAGS}
  1952. CPPFLAGS=${STORE_CPPFLAGS}
  1953. IPPHEADERS="${srcdir}/IPP/include/*.h"
  1954. # Error out on not finding libraries
  1955. if test "$ENABLED_FAST_RSA" = "no"; then
  1956. AC_MSG_ERROR([Could not find fast rsa libraries])
  1957. fi
  1958. fi
  1959. fi # end of if found exported paths
  1960. fi # end of if for shared library
  1961. else # if user rsa is set than do not use fast rsa option
  1962. if test "$ENABLED_FAST_RSA" = "yes"; then
  1963. AC_MSG_ERROR([Could not use fast rsa libraries with user crypto or fips])
  1964. fi
  1965. fi # end of if for user rsa crypto
  1966. AC_MSG_CHECKING([for fast RSA])
  1967. if test "$ENABLED_FAST_RSA" = "yes"; then
  1968. AM_CFLAGS="$AM_CFLAGS -DHAVE_FAST_RSA -DHAVE_USER_RSA"
  1969. # add in user crypto header that uses Intel IPP
  1970. AM_CPPFLAGS="$AM_CPPFLAGS -I$srcdir/wolfcrypt/user-crypto/include"
  1971. if test "$enable_shared" = "yes"; then
  1972. LIBS="$LIBS -lippcore"
  1973. LIB_ADD="-lippcp -lippcore $LIB_ADD"
  1974. else
  1975. LIB_ADD="$srcdir/IPP/$ipplib/libippcp.a $srcdir/IPP/$ipplib/libippcore.a $LIB_ADD"
  1976. fi
  1977. AC_MSG_RESULT([yes])
  1978. else
  1979. AC_MSG_RESULT([no])
  1980. fi
  1981. AC_SUBST([IPPLIBS])
  1982. AC_SUBST([IPPHEADERS])
  1983. AC_SUBST([IPPLINK])
  1984. # Found IPP library now build in user crypto to use it
  1985. AM_CONDITIONAL([BUILD_FAST_RSA], [test "x$ENABLED_FAST_RSA" = "xyes"])
  1986. # microchip api
  1987. AC_ARG_ENABLE([mcapi],
  1988. [ --enable-mcapi Enable Microchip API (default: disabled)],
  1989. [ ENABLED_MCAPI=$enableval ],
  1990. [ ENABLED_MCAPI=no ]
  1991. )
  1992. if test "$ENABLED_MCAPI" = "yes"
  1993. then
  1994. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI -DWOLFSSL_AES_COUNTER -DWOLFSSL_AES_DIRECT"
  1995. fi
  1996. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  1997. then
  1998. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  1999. fi
  2000. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  2001. then
  2002. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  2003. fi
  2004. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  2005. then
  2006. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  2007. fi
  2008. AM_CONDITIONAL([BUILD_MCAPI], [test "x$ENABLED_MCAPI" = "xyes"])
  2009. # Check for build-type conflicts
  2010. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  2011. test "x$ENABLED_LEANPSK" = "xyes"],
  2012. [AC_MSG_ERROR([Cannot use Max Strength and Lean PSK at the same time.])])
  2013. # Update CFLAGS based on options
  2014. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes"],
  2015. [AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_MAX_STRENGTH"])
  2016. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  2017. test "x$ENABLED_OLD_TLS" = "xyes"],
  2018. [AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  2019. ENABLED_OLD_TLS=no])
  2020. AS_IF([test "x$ENABLED_MAXSTRENGTH" = "xyes" && \
  2021. test "x$ENABLED_SSLV3" = "xyes"],
  2022. [AC_MSG_ERROR([Cannot use Max Strength and SSLv3 at the same time.])])
  2023. # OPTIMIZE FLAGS
  2024. if test "$GCC" = "yes"
  2025. then
  2026. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  2027. if test "$ax_enable_debug" = "no"
  2028. then
  2029. if test "$ENABLED_FASTMATH" = "yes"
  2030. then
  2031. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  2032. if test "$ENABLED_FASTHUGEMATH" = "yes"
  2033. then
  2034. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  2035. fi
  2036. else
  2037. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  2038. fi
  2039. fi
  2040. fi
  2041. # ICC command line warning for non supported warning flags
  2042. if test "$CC" = "icc"
  2043. then
  2044. AM_CFLAGS="$AM_CFLAGS -wd10006"
  2045. fi
  2046. # Expose HAVE___UINT128_T to options flags"
  2047. if test "$ac_cv_type___uint128_t" = "yes"
  2048. then
  2049. AM_CFLAGS="$AM_CFLAGS -DHAVE___UINT128_T"
  2050. fi
  2051. LIB_SOCKET_NSL
  2052. AX_HARDEN_CC_COMPILER_FLAGS
  2053. # link to ws2_32 if on mingw
  2054. case $host_os in
  2055. *mingw32)
  2056. LDFLAGS="$LDFLAGS -lws2_32" ;;
  2057. esac
  2058. # add user C_EXTRA_FLAGS back
  2059. CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
  2060. OPTION_FLAGS="$USER_CFLAGS $USER_C_EXTRA_FLAGS $AM_CFLAGS"
  2061. CREATE_HEX_VERSION
  2062. AC_SUBST([AM_CPPFLAGS])
  2063. AC_SUBST([AM_CFLAGS])
  2064. AC_SUBST([AM_LDFLAGS])
  2065. AC_SUBST([AM_CCASFLAGS])
  2066. AC_SUBST([LIB_ADD])
  2067. AC_SUBST([LIB_STATIC_ADD])
  2068. # FINAL
  2069. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  2070. AC_CONFIG_FILES([Makefile])
  2071. AC_CONFIG_FILES([wolfssl/version.h])
  2072. AC_CONFIG_FILES([wolfssl/options.h])
  2073. #have options.h and version.h for autoconf fips tag and build
  2074. #if test "x$ENABLED_FIPS" = "xyes"
  2075. #then
  2076. # AC_CONFIG_FILES([cyassl/version.h])
  2077. # AC_CONFIG_FILES([cyassl/options.h])
  2078. #fi
  2079. AC_CONFIG_FILES([support/wolfssl.pc])
  2080. AC_CONFIG_FILES([rpm/spec])
  2081. AX_CREATE_GENERIC_CONFIG
  2082. AX_AM_JOBSERVER([yes])
  2083. AC_OUTPUT
  2084. # force make clean
  2085. echo "---"
  2086. echo "Running make clean..."
  2087. make clean >/dev/null 2>&1
  2088. # generate user options header
  2089. echo "---"
  2090. echo "Generating user options header..."
  2091. OPTION_FILE="wolfssl/options.h"
  2092. #if
  2093. #OPTION_FILE+="cyassl/options.h"
  2094. #fi
  2095. rm -f $OPTION_FILE
  2096. echo "/* wolfssl options.h" > $OPTION_FILE
  2097. echo " * generated from configure options" >> $OPTION_FILE
  2098. echo " *" >> $OPTION_FILE
  2099. echo " * Copyright (C) 2006-2015 wolfSSL Inc." >> $OPTION_FILE
  2100. echo " *" >> $OPTION_FILE
  2101. echo " * This file is part of wolfSSL. (formerly known as CyaSSL)" >> $OPTION_FILE
  2102. echo " *" >> $OPTION_FILE
  2103. echo " */" >> $OPTION_FILE
  2104. echo "" >> $OPTION_FILE
  2105. echo "#pragma once" >> $OPTION_FILE
  2106. echo "" >> $OPTION_FILE
  2107. echo "#ifdef __cplusplus" >> $OPTION_FILE
  2108. echo "extern \"C\" {" >> $OPTION_FILE
  2109. echo "#endif" >> $OPTION_FILE
  2110. echo "" >> $OPTION_FILE
  2111. for option in $OPTION_FLAGS; do
  2112. defonly=`echo $option | sed 's/-D//'`
  2113. if test "$defonly" != "$option"
  2114. then
  2115. noequalsign=`echo $defonly | sed 's/=/ /'`
  2116. if test "$noequalsign" = "NDEBUG" || test "$noequalsign" = "DEBUG"
  2117. then
  2118. echo "not outputing (N)DEBUG to $OPTION_FILE"
  2119. continue
  2120. fi
  2121. # allow user to igonore system options
  2122. ignoresys=no
  2123. if [[[ $noequalsign == _* ]]] ;
  2124. then
  2125. ignoresys=yes
  2126. echo "#ifndef WOLFSSL_OPTIONS_IGNORE_SYS" >> $OPTION_FILE
  2127. fi
  2128. noarg=`echo $defonly | sed 's/=.*//'`
  2129. echo "#undef $noarg" >> $OPTION_FILE
  2130. echo "#define $noequalsign" >> $OPTION_FILE
  2131. if test "$ignoresys" = "yes"
  2132. then
  2133. echo "#endif" >> $OPTION_FILE
  2134. fi
  2135. echo "" >> $OPTION_FILE
  2136. else
  2137. echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
  2138. fi
  2139. done
  2140. echo "" >> $OPTION_FILE
  2141. echo "#ifdef __cplusplus" >> $OPTION_FILE
  2142. echo "}" >> $OPTION_FILE
  2143. echo "#endif" >> $OPTION_FILE
  2144. echo "" >> $OPTION_FILE
  2145. echo
  2146. #backwards compatability for those who have included options or version
  2147. touch cyassl/options.h
  2148. echo "/* cyassl options.h" > cyassl/options.h
  2149. echo " * generated from wolfssl/options.h" >> cyassl/options.h
  2150. echo " */" >> cyassl/options.h
  2151. echo ""
  2152. while read -r line
  2153. do
  2154. echo "$line" >> cyassl/options.h
  2155. done < $OPTION_FILE
  2156. # output config summary
  2157. echo "---"
  2158. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  2159. echo ""
  2160. echo " * Installation prefix: $prefix"
  2161. echo " * System type: $host_vendor-$host_os"
  2162. echo " * Host CPU: $host_cpu"
  2163. echo " * C Compiler: $CC"
  2164. echo " * C Flags: $CFLAGS"
  2165. echo " * C++ Compiler: $CXX"
  2166. echo " * C++ Flags: $CXXFLAGS"
  2167. echo " * CPP Flags: $CPPFLAGS"
  2168. echo " * CCAS Flags: $CCASFLAGS"
  2169. echo " * LIB Flags: $LIB"
  2170. echo " * Debug enabled: $ax_enable_debug"
  2171. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  2172. echo " * make -j: $enable_jobserver"
  2173. echo " * VCS checkout: $ac_cv_vcs_checkout"
  2174. echo
  2175. echo " Features "
  2176. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  2177. echo " * Filesystem: $ENABLED_FILESYSTEM"
  2178. echo " * OpenSSH Build: $ENABLED_OPENSSH"
  2179. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  2180. echo " * Max Strength Build: $ENABLED_MAXSTRENGTH"
  2181. echo " * fastmath: $ENABLED_FASTMATH"
  2182. echo " * sniffer: $ENABLED_SNIFFER"
  2183. echo " * snifftest: $ENABLED_SNIFFTEST"
  2184. echo " * ARC4: $ENABLED_ARC4"
  2185. echo " * AES: $ENABLED_AES"
  2186. echo " * AES-NI: $ENABLED_AESNI"
  2187. echo " * AES-GCM: $ENABLED_AESGCM"
  2188. echo " * AES-CCM: $ENABLED_AESCCM"
  2189. echo " * DES3: $ENABLED_DES3"
  2190. echo " * IDEA: $ENABLED_IDEA"
  2191. echo " * Camellia: $ENABLED_CAMELLIA"
  2192. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  2193. echo " * MD5: $ENABLED_MD5"
  2194. echo " * RIPEMD: $ENABLED_RIPEMD"
  2195. echo " * SHA: $ENABLED_SHA"
  2196. echo " * SHA-512: $ENABLED_SHA512"
  2197. echo " * BLAKE2: $ENABLED_BLAKE2"
  2198. echo " * keygen: $ENABLED_KEYGEN"
  2199. echo " * certgen: $ENABLED_CERTGEN"
  2200. echo " * certreq: $ENABLED_CERTREQ"
  2201. echo " * certext: $ENABLED_CERTEXT"
  2202. echo " * HC-128: $ENABLED_HC128"
  2203. echo " * RABBIT: $ENABLED_RABBIT"
  2204. echo " * CHACHA: $ENABLED_CHACHA"
  2205. echo " * Hash DRBG: $ENABLED_HASHDRBG"
  2206. echo " * PWDBASED: $ENABLED_PWDBASED"
  2207. echo " * wolfCrypt Only: $ENABLED_CRYPTONLY"
  2208. echo " * HKDF: $ENABLED_HKDF"
  2209. echo " * MD4: $ENABLED_MD4"
  2210. echo " * PSK: $ENABLED_PSK"
  2211. echo " * Poly1305: $ENABLED_POLY1305"
  2212. echo " * LEANPSK: $ENABLED_LEANPSK"
  2213. echo " * RSA: $ENABLED_RSA"
  2214. echo " * DSA: $ENABLED_DSA"
  2215. echo " * DH: $ENABLED_DH"
  2216. echo " * ECC: $ENABLED_ECC"
  2217. echo " * CURVE25519: $ENABLED_CURVE25519"
  2218. echo " * ED25519: $ENABLED_ED25519"
  2219. echo " * FPECC: $ENABLED_FPECC"
  2220. echo " * ECC_ENCRYPT: $ENABLED_ECC_ENCRYPT"
  2221. echo " * ASN: $ENABLED_ASN"
  2222. echo " * Anonymous cipher: $ENABLED_ANON"
  2223. echo " * CODING: $ENABLED_CODING"
  2224. echo " * MEMORY: $ENABLED_MEMORY"
  2225. echo " * I/O POOL: $ENABLED_IOPOOL"
  2226. echo " * LIGHTY: $ENABLED_LIGHTY"
  2227. echo " * STUNNEL: $ENABLED_STUNNEL"
  2228. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  2229. echo " * DTLS: $ENABLED_DTLS"
  2230. echo " * Old TLS Versions: $ENABLED_OLD_TLS"
  2231. echo " * SSL version 3.0: $ENABLED_SSLV3"
  2232. echo " * OCSP: $ENABLED_OCSP"
  2233. echo " * CRL: $ENABLED_CRL"
  2234. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  2235. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  2236. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  2237. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  2238. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  2239. echo " * NTRU: $ENABLED_NTRU"
  2240. echo " * Server Name Indication: $ENABLED_SNI"
  2241. echo " * ALPN: $ENABLED_ALPN"
  2242. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  2243. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  2244. echo " * Certificate Status Request: $ENABLED_CERTIFICATE_STATUS_REQUEST"
  2245. echo " * Supported Elliptic Curves: $ENABLED_SUPPORTED_CURVES"
  2246. echo " * Session Ticket: $ENABLED_SESSION_TICKET"
  2247. echo " * Renegotiation Indication: $ENABLED_RENEGOTIATION_INDICATION"
  2248. echo " * Secure Renegotiation: $ENABLED_SECURE_RENEGOTIATION"
  2249. echo " * All TLS Extensions: $ENABLED_TLSX"
  2250. echo " * PKCS#7 $ENABLED_PKCS7"
  2251. echo " * wolfSCEP $ENABLED_WOLFSCEP"
  2252. echo " * Secure Remote Password $ENABLED_SRP"
  2253. echo " * Small Stack: $ENABLED_SMALL_STACK"
  2254. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  2255. echo " * LIBZ: $ENABLED_LIBZ"
  2256. echo " * Examples: $ENABLED_EXAMPLES"
  2257. echo " * User Crypto: $ENABLED_USER_CRYPTO"
  2258. echo " * Fast RSA: $ENABLED_FAST_RSA"
  2259. echo ""
  2260. echo "---"