configure.ac 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539
  1. # configure.ac
  2. #
  3. # Copyright (C) 2006-2013 wolfSSL Inc.
  4. #
  5. # This file is part of CyaSSL.
  6. #
  7. #
  8. AC_INIT([cyassl],[2.8.1],[http://www.yassl.com])
  9. AC_CONFIG_AUX_DIR([build-aux])
  10. AC_CONFIG_MACRO_DIR([m4])
  11. AC_CANONICAL_TARGET
  12. AC_USE_SYSTEM_EXTENSIONS
  13. AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects])
  14. AC_CANONICAL_HOST
  15. AC_CANONICAL_BUILD
  16. AC_PREREQ([2.63])
  17. AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
  18. #shared library versioning
  19. CYASSL_LIBRARY_VERSION=5:2:0
  20. # | | |
  21. # +------+ | +---+
  22. # | | |
  23. # current:revision:age
  24. # | | |
  25. # | | +- increment if interfaces have been added
  26. # | | set to zero if interfaces have been removed
  27. # | or changed
  28. # | +- increment if source code has changed
  29. # | set to zero if current is incremented
  30. # +- increment if interfaces have been added, removed or changed
  31. AC_SUBST([CYASSL_LIBRARY_VERSION])
  32. # capture user C_EXTRA_FLAGS from ./configure line, CFLAGS may hold -g -O2 even
  33. # if user doesn't override, no way to tell
  34. USER_C_EXTRA_FLAGS="$C_EXTRA_FLAGS"
  35. LT_PREREQ([2.2])
  36. LT_INIT([disable-static],[win32-dll])
  37. LT_LANG([C++])
  38. LT_LANG([C])
  39. gl_VISIBILITY
  40. AS_IF([ test -n "$CFLAG_VISIBILITY" ], [
  41. AM_CPPFLAGS="$AM_CPPFLAGS $CFLAG_VISIBILITY"
  42. CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"
  43. ])
  44. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
  45. AX_CXX_COMPILER_VERSION
  46. AC_CHECK_FUNCS([gethostbyname])
  47. AC_CHECK_FUNCS([getaddrinfo])
  48. AC_CHECK_FUNCS([gettimeofday])
  49. AC_CHECK_FUNCS([inet_ntoa])
  50. AC_CHECK_FUNCS([memset])
  51. AC_CHECK_FUNCS([socket])
  52. AC_CHECK_HEADERS([arpa/inet.h])
  53. AC_CHECK_HEADERS([fcntl.h])
  54. AC_CHECK_HEADERS([limits.h])
  55. AC_CHECK_HEADERS([netdb.h])
  56. AC_CHECK_HEADERS([netinet/in.h])
  57. AC_CHECK_HEADERS([stddef.h])
  58. AC_CHECK_HEADERS([sys/ioctl.h])
  59. AC_CHECK_HEADERS([sys/socket.h])
  60. AC_CHECK_HEADERS([sys/time.h])
  61. AC_CHECK_HEADERS([errno.h])
  62. AC_CHECK_LIB(network,socket)
  63. AC_CHECK_SIZEOF(long long, 8)
  64. AC_CHECK_SIZEOF(long, 4)
  65. AC_C_BIGENDIAN
  66. # mktime check takes forever on some systems, if time supported it would be
  67. # highly unusual for mktime to be missing
  68. #AC_FUNC_MKTIME
  69. AC_PROG_CC
  70. AC_PROG_CC_C_O
  71. AC_PROG_CXX
  72. AC_PROG_INSTALL
  73. AC_TYPE_SIZE_T
  74. AC_TYPE_UINT8_T
  75. AM_PROG_AS
  76. AM_PROG_CC_C_O
  77. LT_LIB_M
  78. OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
  79. OPTIMIZE_FAST_CFLAGS="-O2 -fomit-frame-pointer"
  80. OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
  81. DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_CYASSL"
  82. # DEBUG
  83. AX_DEBUG
  84. AS_IF([test "$ax_enable_debug" = "yes"],
  85. [AM_CFLAGS="$DEBUG_CFLAGS $AM_CFLAGS"],
  86. [AM_CFLAGS="$AM_CFLAGS -DNDEBUG"])
  87. # SINGLE THREADED
  88. AC_ARG_ENABLE([singlethreaded],
  89. [ --enable-singlethreaded Enable CyaSSL single threaded (default: disabled)],
  90. [ ENABLED_SINGLETHREADED=$enableval ],
  91. [ ENABLED_SINGLETHREADED=no ])
  92. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xno" ],[
  93. AX_PTHREAD([
  94. AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
  95. AM_CFLAGS="-D_POSIX_THREADS $AM_CFLAGS $PTHREAD_CFLAGS"
  96. LIBS="$LIBS $PTHREAD_LIBS"
  97. ],[
  98. ENABLED_SINGLETHREADED=yes
  99. ])
  100. ])
  101. AS_IF([ test "x$ENABLED_SINGLETHREADED" = "xyes" ],[ AM_CFLAGS="-DSINGLE_THREADED $AM_CFLAGS" ])
  102. # DTLS
  103. AC_ARG_ENABLE([dtls],
  104. [ --enable-dtls Enable CyaSSL DTLS (default: disabled)],
  105. [ ENABLED_DTLS=$enableval ],
  106. [ ENABLED_DTLS=no ]
  107. )
  108. if test "$ENABLED_DTLS" = "yes"
  109. then
  110. AM_CFLAGS="-DCYASSL_DTLS $AM_CFLAGS"
  111. fi
  112. # OPENSSL Extra Compatibility
  113. AC_ARG_ENABLE([opensslextra],
  114. [ --enable-opensslextra Enable extra OpenSSL API, size+ (default: disabled)],
  115. [ ENABLED_OPENSSLEXTRA=$enableval ],
  116. [ ENABLED_OPENSSLEXTRA=no ]
  117. )
  118. if test "$ENABLED_OPENSSLEXTRA" = "yes"
  119. then
  120. AM_CFLAGS="-DOPENSSL_EXTRA $AM_CFLAGS"
  121. fi
  122. if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "$ENABLED_SMALL" = "yes"
  123. then
  124. AC_MSG_ERROR([cannot enable small and opensslextra, only one or the other.])
  125. fi
  126. # IPv6 Test Apps
  127. AC_ARG_ENABLE([ipv6],
  128. [ --enable-ipv6 Enable testing of IPV6 (default: disabled)],
  129. [ ENABLED_IPV6=$enableval ],
  130. [ ENABLED_IPV6=no ]
  131. )
  132. if test "$ENABLED_IPV6" = "yes"
  133. then
  134. AM_CFLAGS="$AM_CFLAGS -DTEST_IPV6"
  135. fi
  136. # Fortress build
  137. AC_ARG_ENABLE([fortress],
  138. [ --enable-fortress Enable SSL fortress build (default: disabled)],
  139. [ ENABLED_FORTRESS=$enableval ],
  140. [ ENABLED_FORTRESS=no ]
  141. )
  142. if test "$ENABLED_FORTRESS" = "yes"
  143. then
  144. AM_CFLAGS="$AM_CFLAGS -DFORTRESS -DOPENSSL_EXTRA -DCYASSL_DES_ECB -DCYASSL_AES_COUNTER -DCYASSL_AES_DIRECT -DCYASSL_DER_LOAD -DCYASSL_SHA512 -DCYASSL_SHA384 -DCYASSL_KEY_GEN"
  145. fi
  146. # ssl bump build
  147. AC_ARG_ENABLE([bump],
  148. [ --enable-bump Enable SSL Bump build (default: disabled)],
  149. [ ENABLED_BUMP=$enableval ],
  150. [ ENABLED_BUMP=no ]
  151. )
  152. if test "$ENABLED_BUMP" = "yes"
  153. then
  154. AM_CFLAGS="$AM_CFLAGS -DLARGE_STATIC_BUFFERS -DCYASSL_CERT_GEN -DCYASSL_KEY_GEN -DHUGE_SESSION_CACHE -DOPENSSL_EXTRA -DFP_MAX_BITS=8192 -DCYASSL_DER_LOAD -DCYASSL_ALT_NAMES -DCYASSL_TEST_CERT"
  155. fi
  156. ENABLED_SLOWMATH="yes"
  157. # lean psk build
  158. AC_ARG_ENABLE([leanpsk],
  159. [ --enable-leanpsk Enable Lean PSK build (default: disabled)],
  160. [ ENABLED_LEANPSK=$enableval ],
  161. [ ENABLED_LEANPSK=no ]
  162. )
  163. if test "$ENABLED_LEANPSK" = "yes"
  164. then
  165. AM_CFLAGS="$AM_CFLAGS -DCYASSL_LEANPSK -DHAVE_NULL_CIPHER -DSINGLE_THREADED -DNO_AES -DNO_FILESYSTEM -DNO_RABBIT -DNO_RSA -DNO_DSA -DNO_DH -DNO_CERTS -DNO_PWDBASED -DNO_DES3 -DNO_MD4 -DNO_MD5 -DNO_ERROR_STRINGS -DNO_OLD_TLS -DNO_RC4 -DNO_WRITEV -DNO_SESSION_CACHE -DNO_DEV_RANDOM -DCYASSL_USER_IO -DNO_SHA -DUSE_SLOW_SHA"
  166. ENABLED_SLOWMATH="no"
  167. ENABLED_SINGLETHREADED="yes"
  168. fi
  169. AM_CONDITIONAL([BUILD_LEANPSK], [test "x$ENABLED_LEANPSK" = "xyes"])
  170. # big cache
  171. AC_ARG_ENABLE([bigcache],
  172. [ --enable-bigcache Enable big session cache (default: disabled)],
  173. [ ENABLED_BIGCACHE=$enableval ],
  174. [ ENABLED_BIGCACHE=no ]
  175. )
  176. if test "$ENABLED_BIGCACHE" = "yes"
  177. then
  178. AM_CFLAGS="$AM_CFLAGS -DBIG_SESSION_CACHE"
  179. fi
  180. # HUGE cache
  181. AC_ARG_ENABLE([hugecache],
  182. [ --enable-hugecache Enable huge session cache (default: disabled)],
  183. [ ENABLED_HUGECACHE=$enableval ],
  184. [ ENABLED_HUGECACHE=no ]
  185. )
  186. if test "$ENABLED_HUGECACHE" = "yes"
  187. then
  188. AM_CFLAGS="$AM_CFLAGS -DHUGE_SESSION_CACHE"
  189. fi
  190. # SMALL cache
  191. AC_ARG_ENABLE([smallcache],
  192. [ --enable-smallcache Enable small session cache (default: disabled)],
  193. [ ENABLED_SMALLCACHE=$enableval ],
  194. [ ENABLED_SMALLCACHE=no ]
  195. )
  196. if test "$ENABLED_SMALLCACHE" = "yes"
  197. then
  198. AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
  199. fi
  200. # Persistent session cache
  201. AC_ARG_ENABLE([savesession],
  202. [ --enable-savesession Enable persistent session cache (default: disabled)],
  203. [ ENABLED_SAVESESSION=$enableval ],
  204. [ ENABLED_SAVESESSION=no ]
  205. )
  206. if test "$ENABLED_SAVESESSION" = "yes"
  207. then
  208. AM_CFLAGS="$AM_CFLAGS -DPERSIST_SESSION_CACHE"
  209. fi
  210. # Persistent cert cache
  211. AC_ARG_ENABLE([savecert],
  212. [ --enable-savecert Enable persistent cert cache (default: disabled)],
  213. [ ENABLED_SAVECERT=$enableval ],
  214. [ ENABLED_SAVECERT=no ]
  215. )
  216. if test "$ENABLED_SAVECERT" = "yes"
  217. then
  218. AM_CFLAGS="$AM_CFLAGS -DPERSIST_CERT_CACHE"
  219. fi
  220. # Atomic User Record Layer
  221. AC_ARG_ENABLE([atomicuser],
  222. [ --enable-atomicuser Enable Atomic User Record Layer (default: disabled)],
  223. [ ENABLED_ATOMICUSER=$enableval ],
  224. [ ENABLED_ATOMICUSER=no ]
  225. )
  226. if test "$ENABLED_ATOMICUSER" = "yes"
  227. then
  228. AM_CFLAGS="$AM_CFLAGS -DATOMIC_USER"
  229. fi
  230. # Public Key Callbacks
  231. AC_ARG_ENABLE([pkcallbacks],
  232. [ --enable-pkcallbacks Enable Public Key Callbacks (default: disabled)],
  233. [ ENABLED_PKCALLBACKS=$enableval ],
  234. [ ENABLED_PKCALLBACKS=no ]
  235. )
  236. if test "$ENABLED_PKCALLBACKS" = "yes"
  237. then
  238. AM_CFLAGS="$AM_CFLAGS -DHAVE_PK_CALLBACKS"
  239. fi
  240. # SNIFFER
  241. AC_ARG_ENABLE([sniffer],
  242. [AS_HELP_STRING([--enable-sniffer],[ Enable CyaSSL sniffer support (default: disabled) ])],[
  243. AS_IF([ test "x$enableval" = "xyes" ],[ AC_CHECK_HEADERS([pcap/pcap.h],[
  244. ENABLED_SNIFFER=yes
  245. AM_CFLAGS="$AM_CFLAGS -DCYASSL_SNIFFER -DOPENSSL_EXTRA"
  246. ],[ ENABLED_SNIFFER=no ]) ])
  247. ],[
  248. ENABLED_SNIFFER=no
  249. ])
  250. AM_CONDITIONAL([BUILD_SNIFFER], [ test "x$ENABLED_SNIFFER" = "xyes" ])
  251. # AES-GCM
  252. AC_ARG_ENABLE([aesgcm],
  253. [ --enable-aesgcm Enable CyaSSL AES-GCM support (default: disabled)],
  254. [ ENABLED_AESGCM=$enableval ],
  255. [ ENABLED_AESGCM=no ]
  256. )
  257. if test "$ENABLED_AESGCM" = "word32"
  258. then
  259. AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
  260. ENABLED_AESGCM=yes
  261. fi
  262. if test "$ENABLED_AESGCM" = "small"
  263. then
  264. AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
  265. ENABLED_AESGCM=yes
  266. fi
  267. if test "$ENABLED_AESGCM" = "table"
  268. then
  269. AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
  270. ENABLED_AESGCM=yes
  271. fi
  272. if test "$ENABLED_AESGCM" = "yes"
  273. then
  274. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
  275. fi
  276. AM_CONDITIONAL([BUILD_AESGCM], [test "x$ENABLED_AESGCM" = "xyes"])
  277. # AES-CCM
  278. AC_ARG_ENABLE([aesccm],
  279. [ --enable-aesccm Enable CyaSSL AES-CCM support (default: disabled)],
  280. [ ENABLED_AESCCM=$enableval ],
  281. [ ENABLED_AESCCM=no ]
  282. )
  283. if test "$ENABLED_AESCCM" = "yes"
  284. then
  285. AM_CFLAGS="$AM_CFLAGS -DHAVE_AESCCM"
  286. fi
  287. AM_CONDITIONAL([BUILD_AESCCM], [test "x$ENABLED_AESCCM" = "xyes"])
  288. # AES-NI
  289. AC_ARG_ENABLE([aesni],
  290. [ --enable-aesni Enable CyaSSL AES-NI support (default: disabled)],
  291. [ ENABLED_AESNI=$enableval ],
  292. [ ENABLED_AESNI=no ]
  293. )
  294. if test "$ENABLED_AESNI" = "yes"
  295. then
  296. AM_CFLAGS="$AM_CFLAGS -DCYASSL_AESNI"
  297. if test "$GCC" = "yes"
  298. then
  299. # GCC needs these flags, icc doesn't
  300. # opt levels greater than 2 may cause problems on systems w/o aesni
  301. AM_CFLAGS="$AM_CFLAGS -maes -msse4"
  302. fi
  303. fi
  304. AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
  305. # Camellia
  306. AC_ARG_ENABLE([camellia],
  307. [ --enable-camellia Enable CyaSSL Camellia support (default: disabled)],
  308. [ ENABLED_CAMELLIA=$enableval ],
  309. [ ENABLED_CAMELLIA=no ]
  310. )
  311. if test "$ENABLED_CAMELLIA" = "yes"
  312. then
  313. AM_CFLAGS="$AM_CFLAGS -DHAVE_CAMELLIA"
  314. fi
  315. AM_CONDITIONAL([BUILD_CAMELLIA], [test "x$ENABLED_CAMELLIA" = "xyes"])
  316. # MD2
  317. AC_ARG_ENABLE([md2],
  318. [ --enable-md2 Enable CyaSSL MD2 support (default: disabled)],
  319. [ ENABLED_MD2=$enableval ],
  320. [ ENABLED_MD2=no ]
  321. )
  322. if test "$ENABLED_BUMP" = "yes"
  323. then
  324. ENABLED_MD2="yes"
  325. fi
  326. if test "$ENABLED_MD2" = "yes"
  327. then
  328. AM_CFLAGS="$AM_CFLAGS -DCYASSL_MD2"
  329. fi
  330. AM_CONDITIONAL([BUILD_MD2], [test "x$ENABLED_MD2" = "xyes"])
  331. # NULL CIPHER
  332. AC_ARG_ENABLE([nullcipher],
  333. [ --enable-nullcipher Enable CyaSSL NULL cipher support (default: disabled)],
  334. [ ENABLED_NULL_CIPHER=$enableval ],
  335. [ ENABLED_NULL_CIPHER=no ]
  336. )
  337. if test "$ENABLED_NULL_CIPHER" = "yes"
  338. then
  339. AM_CFLAGS="$AM_CFLAGS -DHAVE_NULL_CIPHER"
  340. fi
  341. # RIPEMD
  342. AC_ARG_ENABLE([ripemd],
  343. [ --enable-ripemd Enable CyaSSL RIPEMD-160 support (default: disabled)],
  344. [ ENABLED_RIPEMD=$enableval ],
  345. [ ENABLED_RIPEMD=no ]
  346. )
  347. if test "$ENABLED_RIPEMD" = "yes"
  348. then
  349. AM_CFLAGS="$AM_CFLAGS -DCYASSL_RIPEMD"
  350. fi
  351. AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
  352. # BLAKE2
  353. AC_ARG_ENABLE([blake2],
  354. [ --enable-blake2 Enable CyaSSL BLAKE2 support (default: disabled)],
  355. [ ENABLED_BLAKE2=$enableval ],
  356. [ ENABLED_BLAKE2=no ]
  357. )
  358. if test "$ENABLED_BLAKE2" = "yes"
  359. then
  360. AM_CFLAGS="$AM_CFLAGS -DHAVE_BLAKE2"
  361. fi
  362. AM_CONDITIONAL([BUILD_BLAKE2], [test "x$ENABLED_BLAKE2" = "xyes"])
  363. # SHA512
  364. AC_ARG_ENABLE([sha512],
  365. [ --enable-sha512 Enable CyaSSL SHA-512 support (default: disabled)],
  366. [ ENABLED_SHA512=$enableval ],
  367. [ ENABLED_SHA512=no ]
  368. )
  369. if test "$ENABLED_SHA512" = "yes"
  370. then
  371. AM_CFLAGS="$AM_CFLAGS -DCYASSL_SHA512 -DCYASSL_SHA384"
  372. fi
  373. if test "$ENABLED_FORTRESS" = "yes"
  374. then
  375. ENABLED_SHA512="yes"
  376. fi
  377. AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
  378. # SESSION CERTS
  379. AC_ARG_ENABLE([sessioncerts],
  380. [ --enable-sessioncerts Enable session cert storing (default: disabled)],
  381. [ ENABLED_SESSIONCERTS=$enableval ],
  382. [ ENABLED_SESSIONCERTS=no ]
  383. )
  384. if test "$ENABLED_SESSIONCERTS" = "yes"
  385. then
  386. AM_CFLAGS="$AM_CFLAGS -DSESSION_CERTS"
  387. fi
  388. # KEY GENERATION
  389. AC_ARG_ENABLE([keygen],
  390. [ --enable-keygen Enable key generation (default: disabled)],
  391. [ ENABLED_KEYGEN=$enableval ],
  392. [ ENABLED_KEYGEN=no ]
  393. )
  394. if test "$ENABLED_KEYGEN" = "yes"
  395. then
  396. AM_CFLAGS="$AM_CFLAGS -DCYASSL_KEY_GEN"
  397. fi
  398. # CERT GENERATION
  399. AC_ARG_ENABLE([certgen],
  400. [ --enable-certgen Enable cert generation (default: disabled)],
  401. [ ENABLED_CERTGEN=$enableval ],
  402. [ ENABLED_CERTGEN=no ]
  403. )
  404. if test "$ENABLED_CERTGEN" = "yes"
  405. then
  406. AM_CFLAGS="$AM_CFLAGS -DCYASSL_CERT_GEN"
  407. fi
  408. # SEP
  409. AC_ARG_ENABLE([sep],
  410. [ --enable-sep Enable sep extensions (default: disabled)],
  411. [ ENABLED_SEP=$enableval ],
  412. [ ENABLED_SEP=no ]
  413. )
  414. if test "$ENABLED_SEP" = "yes"
  415. then
  416. AM_CFLAGS="-DCYASSL_SEP -DKEEP_PEER_CERT $AM_CFLAGS"
  417. fi
  418. # DSA
  419. AC_ARG_ENABLE([dsa],
  420. [ --enable-dsa Enable DSA (default: disabled)],
  421. [ ENABLED_DSA=$enableval ],
  422. [ ENABLED_DSA=no ]
  423. )
  424. if test "$ENABLED_DSA" = "no"
  425. then
  426. AM_CFLAGS="$AM_CFLAGS -DNO_DSA"
  427. fi
  428. AM_CONDITIONAL([BUILD_DSA], [test "x$ENABLED_DSA" = "xyes"])
  429. # ECC
  430. AC_ARG_ENABLE([ecc],
  431. [ --enable-ecc Enable ECC (default: disabled)],
  432. [ ENABLED_ECC=$enableval ],
  433. [ ENABLED_ECC=no ]
  434. )
  435. if test "$ENABLED_ECC" = "yes"
  436. then
  437. AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
  438. fi
  439. AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
  440. if test "$ENABLED_ECC" = "yes" && test "$ENABLED_SMALL" = "yes"
  441. then
  442. AC_MSG_ERROR([cannot enable ecc and small, ecc requires TLS which small turns off.])
  443. fi
  444. # FP ECC, Fixed Point cache ECC
  445. AC_ARG_ENABLE([fpecc],
  446. [ --enable-fpecc Enable Fixed Point cache ECC (default: disabled)],
  447. [ ENABLED_FPECC=$enableval ],
  448. [ ENABLED_FPECC=no ]
  449. )
  450. if test "$ENABLED_FPECC" = "yes"
  451. then
  452. AM_CFLAGS="$AM_CFLAGS -DFP_ECC"
  453. fi
  454. # PSK
  455. AC_ARG_ENABLE([psk],
  456. [ --enable-psk Enable PSK (default: disabled)],
  457. [ ENABLED_PSK=$enableval ],
  458. [ ENABLED_PSK=no ]
  459. )
  460. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no"
  461. then
  462. AM_CFLAGS="$AM_CFLAGS -DNO_PSK"
  463. fi
  464. if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "yes"
  465. then
  466. ENABLED_PSK=yes
  467. fi
  468. # ERROR STRINGS
  469. AC_ARG_ENABLE([errorstrings],
  470. [ --enable-errorstrings Enable error strings table (default: enabled)],
  471. [ ENABLED_ERROR_STRINGS=$enableval ],
  472. [ ENABLED_ERROR_STRINGS=yes ]
  473. )
  474. if test "$ENABLED_ERROR_STRINGS" = "no"
  475. then
  476. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  477. else
  478. # turn off error strings if leanpsk on
  479. if test "$ENABLED_LEANPSK" = "yes"
  480. then
  481. AM_CFLAGS="$AM_CFLAGS -DNO_ERROR_STRINGS"
  482. ENABLED_ERROR_STRINGS=no
  483. fi
  484. fi
  485. # OLD TLS
  486. AC_ARG_ENABLE([oldtls],
  487. [ --enable-oldtls Enable old TLS versions < 1.2 (default: enabled)],
  488. [ ENABLED_OLD_TLS=$enableval ],
  489. [ ENABLED_OLD_TLS=yes ]
  490. )
  491. if test "$ENABLED_OLD_TLS" = "no"
  492. then
  493. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  494. else
  495. # turn off old if leanpsk on
  496. if test "$ENABLED_LEANPSK" = "yes"
  497. then
  498. AM_CFLAGS="$AM_CFLAGS -DNO_OLD_TLS"
  499. ENABLED_OLD_TLS=no
  500. fi
  501. fi
  502. # STACK SIZE info for examples
  503. AC_ARG_ENABLE([stacksize],
  504. [ --enable-stacksize Enable stack size info on examples (default: disabled)],
  505. [ ENABLED_STACKSIZE=$enableval ],
  506. [ ENABLED_STACKSIZE=no ]
  507. )
  508. if test "$ENABLED_STACKSIZE" = "yes"
  509. then
  510. AC_CHECK_FUNC([posix_memalign], [], [AC_MSG_ERROR(stacksize needs posix_memalign)])
  511. AC_CHECK_FUNC([pthread_attr_setstack], [], AC_CHECK_LIB([pthread],[pthread_attr_setstack]))
  512. AM_CFLAGS="$AM_CFLAGS -DHAVE_STACK_SIZE -DCYASSL_LOW_MEMORY"
  513. fi
  514. # MEMORY
  515. AC_ARG_ENABLE([memory],
  516. [ --enable-memory Enable memory callbacks (default: enabled)],
  517. [ ENABLED_MEMORY=$enableval ],
  518. [ ENABLED_MEMORY=yes ]
  519. )
  520. if test "$ENABLED_MEMORY" = "no"
  521. then
  522. AM_CFLAGS="$AM_CFLAGS -DNO_CYASSL_MEMORY"
  523. else
  524. # turn off memory cb if leanpsk on
  525. if test "$ENABLED_LEANPSK" = "yes"
  526. then
  527. # but don't turn on NO_CYASSL_MEMORY because using own
  528. ENABLED_MEMORY=no
  529. fi
  530. fi
  531. AM_CONDITIONAL([BUILD_MEMORY], [test "x$ENABLED_MEMORY" = "xyes"])
  532. # RSA
  533. AC_ARG_ENABLE([rsa],
  534. [ --enable-rsa Enable RSA (default: enabled)],
  535. [ ENABLED_RSA=$enableval ],
  536. [ ENABLED_RSA=yes ]
  537. )
  538. if test "$ENABLED_RSA" = "no"
  539. then
  540. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  541. else
  542. # turn off RSA if leanpsk on
  543. if test "$ENABLED_LEANPSK" = "yes"
  544. then
  545. AM_CFLAGS="$AM_CFLAGS -DNO_RSA"
  546. ENABLED_RSA=no
  547. fi
  548. fi
  549. AM_CONDITIONAL([BUILD_RSA], [test "x$ENABLED_RSA" = "xyes"])
  550. # DH
  551. AC_ARG_ENABLE([dh],
  552. [ --enable-dh Enable DH (default: enabled)],
  553. [ ENABLED_DH=$enableval ],
  554. [ ENABLED_DH=yes ]
  555. )
  556. if test "$ENABLED_DH" = "no"
  557. then
  558. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  559. else
  560. # turn off DH if leanpsk on
  561. if test "$ENABLED_LEANPSK" = "yes"
  562. then
  563. AM_CFLAGS="$AM_CFLAGS -DNO_DH"
  564. ENABLED_DH=no
  565. fi
  566. fi
  567. AM_CONDITIONAL([BUILD_DH], [test "x$ENABLED_DH" = "xyes"])
  568. # ASN
  569. # turn off asn, which means no certs, no rsa, no dh, no dsa, no ecc,
  570. # and no big int, use this to disable all public key stuff
  571. AC_ARG_ENABLE([asn],
  572. [ --enable-asn Enable ASN (default: enabled)],
  573. [ ENABLED_ASN=$enableval ],
  574. [ ENABLED_ASN=yes ]
  575. )
  576. if test "$ENABLED_ASN" = "no"
  577. then
  578. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  579. else
  580. # turn off ASN if leanpsk on
  581. if test "$ENABLED_LEANPSK" = "yes"
  582. then
  583. AM_CFLAGS="$AM_CFLAGS -DNO_ASN -DNO_CERTS -DNO_BIG_INT"
  584. ENABLED_ASN=no
  585. fi
  586. fi
  587. if test "$ENABLED_RSA" = "yes" && test "$ENABLED_ASN" = "no"
  588. then
  589. AC_MSG_ERROR([please disable rsa if disabling asn.])
  590. fi
  591. if test "$ENABLED_DSA" = "yes" && test "$ENABLED_ASN" = "no"
  592. then
  593. AC_MSG_ERROR([please disable dsa if disabling asn.])
  594. fi
  595. if test "$ENABLED_DH" = "yes" && test "$ENABLED_ASN" = "no"
  596. then
  597. AC_MSG_ERROR([please disable dh if disabling asn.])
  598. fi
  599. if test "$ENABLED_ECC" = "yes" && test "$ENABLED_ASN" = "no"
  600. then
  601. AC_MSG_ERROR([please disable ecc if disabling asn.])
  602. fi
  603. if test "$ENABLED_PSK" = "no" && test "$ENABLED_ASN" = "no"
  604. then
  605. AC_MSG_ERROR([please enable psk if disabling asn.])
  606. fi
  607. if test "$ENABLED_ASN" = "no"
  608. then
  609. ENABLED_FASTMATH=no
  610. ENABLED_SLOWMATH=no
  611. fi
  612. AM_CONDITIONAL([BUILD_ASN], [test "x$ENABLED_ASN" = "xyes"])
  613. # AES
  614. AC_ARG_ENABLE([aes],
  615. [ --enable-aes Enable AES (default: enabled)],
  616. [ ENABLED_AES=$enableval ],
  617. [ ENABLED_AES=yes ]
  618. )
  619. if test "$ENABLED_AES" = "no"
  620. then
  621. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  622. else
  623. # turn off AES if leanpsk on
  624. if test "$ENABLED_LEANPSK" = "yes"
  625. then
  626. AM_CFLAGS="$AM_CFLAGS -DNO_AES"
  627. ENABLED_AES=no
  628. fi
  629. fi
  630. AM_CONDITIONAL([BUILD_AES], [test "x$ENABLED_AES" = "xyes"])
  631. # CODING
  632. AC_ARG_ENABLE([coding],
  633. [ --enable-coding Enable Coding base 16/64 (default: enabled)],
  634. [ ENABLED_CODING=$enableval ],
  635. [ ENABLED_CODING=yes ]
  636. )
  637. if test "$ENABLED_CODING" = "no"
  638. then
  639. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  640. else
  641. # turn off CODING if leanpsk on
  642. if test "$ENABLED_LEANPSK" = "yes"
  643. then
  644. AM_CFLAGS="$AM_CFLAGS -DNO_CODING"
  645. ENABLED_CODING=no
  646. fi
  647. fi
  648. AM_CONDITIONAL([BUILD_CODING], [test "x$ENABLED_CODING" = "xyes"])
  649. # DES3
  650. AC_ARG_ENABLE([des3],
  651. [ --enable-des3 Enable DES3 (default: enabled)],
  652. [ ENABLED_DES3=$enableval ],
  653. [ ENABLED_DES3=yes ]
  654. )
  655. if test "$ENABLED_DES3" = "no"
  656. then
  657. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  658. else
  659. # turn off DES3 if leanpsk on
  660. if test "$ENABLED_LEANPSK" = "yes"
  661. then
  662. AM_CFLAGS="$AM_CFLAGS -DNO_DES3"
  663. ENABLED_DES3=no
  664. fi
  665. fi
  666. AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"])
  667. # ARC4
  668. AC_ARG_ENABLE([arc4],
  669. [ --enable-arc4 Enable ARC4 (default: enabled)],
  670. [ ENABLED_ARC4=$enableval ],
  671. [ ENABLED_ARC4=yes ]
  672. )
  673. if test "$ENABLED_ARC4" = "no"
  674. then
  675. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  676. else
  677. # turn off ARC4 if leanpsk on
  678. if test "$ENABLED_LEANPSK" = "yes"
  679. then
  680. AM_CFLAGS="$AM_CFLAGS -DNO_RC4"
  681. ENABLED_ARC4=no
  682. fi
  683. fi
  684. AM_CONDITIONAL([BUILD_RC4], [test "x$ENABLED_ARC4" = "xyes"])
  685. # MD5
  686. AC_ARG_ENABLE([md5],
  687. [ --enable-md5 Enable MD5 (default: enabled)],
  688. [ ENABLED_MD5=$enableval ],
  689. [ ENABLED_MD5=yes ]
  690. )
  691. if test "$ENABLED_MD5" = "no"
  692. then
  693. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  694. else
  695. # turn off MD5 if leanpsk on
  696. if test "$ENABLED_LEANPSK" = "yes"
  697. then
  698. AM_CFLAGS="$AM_CFLAGS -DNO_MD5 -DNO_OLD_TLS"
  699. ENABLED_MD5=no
  700. fi
  701. fi
  702. AM_CONDITIONAL([BUILD_MD5], [test "x$ENABLED_MD5" = "xyes"])
  703. # SHA
  704. AC_ARG_ENABLE([sha],
  705. [ --enable-sha Enable SHA (default: enabled)],
  706. [ ENABLED_SHA=$enableval ],
  707. [ ENABLED_SHA=yes ]
  708. )
  709. if test "$ENABLED_SHA" = "no"
  710. then
  711. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  712. else
  713. # turn off SHA if leanpsk on
  714. if test "$ENABLED_LEANPSK" = "yes"
  715. then
  716. AM_CFLAGS="$AM_CFLAGS -DNO_SHA -DNO_OLD_TLS"
  717. ENABLED_SHA=no
  718. fi
  719. fi
  720. AM_CONDITIONAL([BUILD_SHA], [test "x$ENABLED_SHA" = "xyes"])
  721. # MD4
  722. AC_ARG_ENABLE([md4],
  723. [ --enable-md4 Enable MD4 (default: disabled)],
  724. [ ENABLED_MD4=$enableval ],
  725. [ ENABLED_MD4=no ]
  726. )
  727. if test "$ENABLED_MD4" = "no"
  728. then
  729. AM_CFLAGS="$AM_CFLAGS -DNO_MD4"
  730. fi
  731. AM_CONDITIONAL([BUILD_MD4], [test "x$ENABLED_MD4" = "xyes"])
  732. # PWDBASED
  733. AC_ARG_ENABLE([pwdbased],
  734. [ --enable-pwdbased Enable PWDBASED (default: disabled)],
  735. [ ENABLED_PWDBASED=$enableval ],
  736. [ ENABLED_PWDBASED=no ]
  737. )
  738. if test "$ENABLED_PWDBASED" = "no"
  739. then
  740. if test "$ENABLED_OPENSSLEXTRA" = "yes"
  741. then
  742. # opensslextra needs pwdbased
  743. ENABLED_PWDBASED=yes
  744. else
  745. AM_CFLAGS="$AM_CFLAGS -DNO_PWDBASED"
  746. fi
  747. fi
  748. AM_CONDITIONAL([BUILD_PWDBASED], [test "x$ENABLED_PWDBASED" = "xyes"])
  749. # HC128
  750. AC_ARG_ENABLE([hc128],
  751. [ --enable-hc128 Enable HC-128 (default: disabled)],
  752. [ ENABLED_HC128=$enableval ],
  753. [ ENABLED_HC128=no ]
  754. )
  755. if test "$ENABLED_HC128" = "no"
  756. then
  757. AM_CFLAGS="$AM_CFLAGS -DNO_HC128"
  758. else
  759. AM_CFLAGS="$AM_CFLAGS -DHAVE_HC128"
  760. fi
  761. AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
  762. # RABBIT
  763. AC_ARG_ENABLE([rabbit],
  764. [ --enable-rabbit Enable RABBIT (default: disabled)],
  765. [ ENABLED_RABBIT=$enableval ],
  766. [ ENABLED_RABBIT=no ]
  767. )
  768. if test "$ENABLED_RABBIT" = "no"
  769. then
  770. AM_CFLAGS="$AM_CFLAGS -DNO_RABBIT"
  771. else
  772. AM_CFLAGS="$AM_CFLAGS -DHAVE_RABBIT"
  773. fi
  774. AM_CONDITIONAL([BUILD_RABBIT], [test "x$ENABLED_RABBIT" = "xyes"])
  775. # Web Server Build
  776. AC_ARG_ENABLE([webserver],
  777. [ --enable-webserver Enable Web Server (default: disabled)],
  778. [ ENABLED_WEBSERVER=$enableval ],
  779. [ ENABLED_WEBSERVER=no ]
  780. )
  781. if test "$ENABLED_WEBSERVER" = "yes"
  782. then
  783. AM_CFLAGS="$AM_CFLAGS -DHAVE_WEBSERVER"
  784. fi
  785. # Filesystem Build
  786. AC_ARG_ENABLE([filesystem],
  787. [ --enable-filesystem Enable Filesystem support (default: enabled)],
  788. [ ENABLED_FILESYSTEM=$enableval ],
  789. [ ENABLED_FILESYSTEM=yes ]
  790. )
  791. if test "$ENABLED_FILESYSTEM" = "no"
  792. then
  793. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  794. else
  795. # turn off filesystem if leanpsk on
  796. if test "$ENABLED_LEANPSK" = "yes"
  797. then
  798. AM_CFLAGS="$AM_CFLAGS -DNO_FILESYSTEM"
  799. ENABLED_FILESYSTEM=no
  800. fi
  801. fi
  802. # inline Build
  803. AC_ARG_ENABLE([inline],
  804. [ --enable-inline Enable inline functions (default: enabled)],
  805. [ ENABLED_INLINE=$enableval ],
  806. [ ENABLED_INLINE=yes ]
  807. )
  808. if test "$ENABLED_INLINE" = "no"
  809. then
  810. AM_CFLAGS="$AM_CFLAGS -DNO_INLINE"
  811. fi
  812. AM_CONDITIONAL([BUILD_INLINE], [test "x$ENABLED_INLINE" = "xyes"])
  813. # OCSP
  814. AC_ARG_ENABLE([ocsp],
  815. [ --enable-ocsp Enable OCSP (default: disabled)],
  816. [ ENABLED_OCSP=$enableval ],
  817. [ ENABLED_OCSP=no ],
  818. )
  819. if test "$ENABLED_OCSP" = "yes"
  820. then
  821. AM_CFLAGS="$AM_CFLAGS -DHAVE_OCSP"
  822. fi
  823. AM_CONDITIONAL([BUILD_OCSP], [test "x$ENABLED_OCSP" = "xyes"])
  824. # CRL
  825. AC_ARG_ENABLE([crl],
  826. [ --enable-crl Enable CRL (default: disabled)],
  827. [ ENABLED_CRL=$enableval ],
  828. [ ENABLED_CRL=no ],
  829. )
  830. if test "$ENABLED_CRL" = "yes"
  831. then
  832. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL"
  833. fi
  834. AM_CONDITIONAL([BUILD_CRL], [test "x$ENABLED_CRL" = "xyes"])
  835. # CRL Monitor
  836. AC_ARG_ENABLE([crl-monitor],
  837. [ --enable-crl-monitor Enable CRL Monitor (default: disabled)],
  838. [ ENABLED_CRL_MONITOR=$enableval ],
  839. [ ENABLED_CRL_MONITOR=no ],
  840. )
  841. if test "$ENABLED_CRL_MONITOR" = "yes"
  842. then
  843. case $host_os in
  844. *linux* | *darwin* | *freebsd*)
  845. AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_MONITOR" ;;
  846. *)
  847. AC_MSG_ERROR([crl monitor only allowed on linux, OS X, or freebsd]) ;;
  848. esac
  849. fi
  850. AM_CONDITIONAL([BUILD_CRL_MONITOR], [test "x$ENABLED_CRL_MONITOR" = "xyes"])
  851. # NTRU
  852. ntruHome=`pwd`/NTRU_algorithm
  853. ntruInclude=$ntruHome/cryptolib
  854. ntruLib=$ntruHome
  855. AC_ARG_ENABLE([ntru],
  856. [ --enable-ntru Enable NTRU (default: disabled)],
  857. [ ENABLED_NTRU=$enableval ],
  858. [ ENABLED_NTRU=no ]
  859. )
  860. if test "$ENABLED_NTRU" = "yes"
  861. then
  862. AM_CFLAGS="$AM_CFLAGS -DHAVE_NTRU -I$ntruInclude"
  863. AM_LDFLAGS="$AM_LDFLAGS -L$ntruLib"
  864. LIBS="$LIBS -lntru_encrypt"
  865. fi
  866. AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
  867. if test "$ENABLED_NTRU" = "yes" && test "$ENABLED_SMALL" = "yes"
  868. then
  869. AC_MSG_ERROR([cannot enable ntru and small, ntru requires TLS which small turns off.])
  870. fi
  871. # SNI
  872. AC_ARG_ENABLE([sni],
  873. [ --enable-sni Enable SNI (default: disabled)],
  874. [ ENABLED_SNI=$enableval ],
  875. [ ENABLED_SNI=no ]
  876. )
  877. if test "x$ENABLED_SNI" = "xyes"
  878. then
  879. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"
  880. fi
  881. # Maximum Fragment Length
  882. AC_ARG_ENABLE([maxfragment],
  883. [ --enable-maxfragment Enable Maximum Fragment Length (default: disabled)],
  884. [ ENABLED_MAX_FRAGMENT=$enableval ],
  885. [ ENABLED_MAX_FRAGMENT=no ]
  886. )
  887. if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
  888. then
  889. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
  890. fi
  891. # Truncated HMAC
  892. AC_ARG_ENABLE([truncatedhmac],
  893. [ --enable-truncatedhmac Enable Truncated HMAC (default: disabled)],
  894. [ ENABLED_TRUNCATED_HMAC=$enableval ],
  895. [ ENABLED_TRUNCATED_HMAC=no ]
  896. )
  897. if test "x$ENABLED_TRUNCATED_HMAC" = "xyes"
  898. then
  899. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_TRUNCATED_HMAC"
  900. fi
  901. # TLS Extensions
  902. AC_ARG_ENABLE([tlsx],
  903. [ --enable-tlsx Enable all TLS Extensions (default: disabled)],
  904. [ ENABLED_TLSX=$enableval ],
  905. [ ENABLED_TLSX=no ]
  906. )
  907. if test "x$ENABLED_TLSX" = "xyes"
  908. then
  909. ENABLED_SNI=yes
  910. ENABLED_MAX_FRAGMENT=yes
  911. AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT"
  912. fi
  913. #valgrind
  914. AC_ARG_ENABLE([valgrind],
  915. [ --enable-valgrind Enable valgrind for unit tests (default: disabled)],
  916. [ ENABLED_VALGRIND=$enableval ],
  917. [ ENABLED_VALGRIND=no ]
  918. )
  919. if test "$ENABLED_VALGRIND" = "yes"
  920. then
  921. AC_CHECK_PROG([HAVE_VALGRIND],[valgrind],[yes],[no])
  922. if test "$HAVE_VALGRIND" = "no"
  923. then
  924. AC_MSG_ERROR([Valgrind not found.])
  925. fi
  926. enable_shared=no
  927. enable_static=yes
  928. AM_CFLAGS="$AM_CFLAGS -DHAVE_VALGRIND"
  929. fi
  930. AM_CONDITIONAL([USE_VALGRIND], [test "x$ENABLED_VALGRIND" = "xyes"])
  931. # Test certs, use internal cert functions for extra testing
  932. AC_ARG_ENABLE([testcert],
  933. [ --enable-testcert Enable Test Cert (default: disabled)],
  934. [ ENABLED_TESTCERT=$enableval ],
  935. [ ENABLED_TESTCERT=no ]
  936. )
  937. if test "$ENABLED_TESTCERT" = "yes"
  938. then
  939. AM_CFLAGS="$AM_CFLAGS -DCYASSL_TEST_CERT"
  940. fi
  941. # set fastmath default
  942. FASTMATH_DEFAULT=no
  943. if test "$target_cpu" = "x86_64"
  944. then
  945. FASTMATH_DEFAULT=yes
  946. fi
  947. # fastmath
  948. AC_ARG_ENABLE([fastmath],
  949. [ --enable-fastmath Enable fast math ops (default: enabled on x86_64)],
  950. [ ENABLED_FASTMATH=$enableval ],
  951. [ ENABLED_FASTMATH=$FASTMATH_DEFAULT]
  952. )
  953. if test "x$ENABLED_FASTMATH" = "xyes"
  954. then
  955. # turn off fastmth if leanpsk on or asn off
  956. if test "$ENABLED_LEANPSK" = "yes" || test "$ENABLED_ASN" = "no"
  957. then
  958. ENABLED_FASTMATH=no
  959. else
  960. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  961. ENABLED_SLOWMATH="no"
  962. fi
  963. fi
  964. # fast HUGE math
  965. AC_ARG_ENABLE([fasthugemath],
  966. [ --enable-fasthugemath Enable fast math + huge code (default: disabled)],
  967. [ ENABLED_FASTHUGEMATH=$enableval ],
  968. [ ENABLED_FASTHUGEMATH=no ]
  969. )
  970. if test "$ENABLED_BUMP" = "yes"
  971. then
  972. ENABLED_FASTHUGEMATH="yes"
  973. fi
  974. if test "$ENABLED_FASTHUGEMATH" = "yes"
  975. then
  976. ENABLED_FASTMATH="yes"
  977. AM_CFLAGS="$AM_CFLAGS -DUSE_FAST_MATH"
  978. ENABLED_SLOWMATH="no"
  979. fi
  980. AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
  981. AM_CONDITIONAL([BUILD_SLOWMATH], [test "x$ENABLED_SLOWMATH" = "xyes"])
  982. # Enable Examples, used to disable examples
  983. AC_ARG_ENABLE([examples],
  984. [ --enable-examples Enable Examples (default: enabled)],
  985. [ ENABLED_EXAMPLES=$enableval ],
  986. [ ENABLED_EXAMPLES=yes ]
  987. )
  988. AS_IF([test "x$ENABLED_SINGLETHREADED" = "xyes"], [ENABLED_EXAMPLES="no"])
  989. AS_IF([test "x$ENABLED_FILESYSTEM" = "xno"], [ENABLED_EXAMPLES="no"])
  990. AS_IF([test "x$ENABLED_INLINE" = "xno"], [ENABLED_EXAMPLES="no"])
  991. # certs still have sha signatures for now
  992. AS_IF([test "x$ENABLED_SHA" = "xno"], [ENABLED_EXAMPLES="no"])
  993. AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$ENABLED_EXAMPLES" = "xyes"])
  994. # LIBZ
  995. ENABLED_LIBZ="no"
  996. trylibzdir=""
  997. AC_ARG_WITH([libz],
  998. [ --with-libz=PATH PATH to libz install (default /usr/) ],
  999. [
  1000. AC_MSG_CHECKING([for libz])
  1001. CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
  1002. LIBS="$LIBS -lz"
  1003. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  1004. if test "x$libz_linked" == "xno" ; then
  1005. if test "x$withval" != "xno" ; then
  1006. trylibzdir=$withval
  1007. fi
  1008. if test "x$withval" == "xyes" ; then
  1009. trylibzdir="/usr"
  1010. fi
  1011. AM_LDFLAGS="$AM_LDFLAGS -L$trylibzdir/lib"
  1012. CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
  1013. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <zlib.h>]], [[ deflateInit(0, 8); ]])],[ libz_linked=yes ],[ libz_linked=no ])
  1014. if test "x$libz_linked" == "xno" ; then
  1015. AC_MSG_ERROR([libz isn't found.
  1016. If it's already installed, specify its path using --with-libz=/dir/])
  1017. fi
  1018. AC_MSG_RESULT([yes])
  1019. else
  1020. AC_MSG_RESULT([yes])
  1021. fi
  1022. ENABLED_LIBZ="yes"
  1023. ]
  1024. )
  1025. AM_CONDITIONAL([BUILD_LIBZ], [test "x$ENABLED_LIBZ" = "xyes"])
  1026. # cavium
  1027. trycaviumdir=""
  1028. AC_ARG_WITH([cavium],
  1029. [ --with-cavium=PATH PATH to cavium/software dir ],
  1030. [
  1031. AC_MSG_CHECKING([for cavium])
  1032. CPPFLAGS="$CPPFLAGS -DHAVE_CAVIUM"
  1033. if test "x$withval" == "xyes" ; then
  1034. AC_MSG_ERROR([need a PATH for --with-cavium])
  1035. fi
  1036. if test "x$withval" != "xno" ; then
  1037. trycaviumdir=$withval
  1038. fi
  1039. LDFLAGS="$AM_LDFLAGS $trycaviumdir/api/cavium_common.o"
  1040. CPPFLAGS="$CPPFLAGS -I$trycaviumdir/include"
  1041. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cavium_common.h"]], [[ CspShutdown(CAVIUM_DEV_ID); ]])],[ cavium_linked=yes ],[ cavium_linked=no ])
  1042. if test "x$cavium_linked" == "xno" ; then
  1043. AC_MSG_ERROR([cavium isn't found.
  1044. If it's already installed, specify its path using --with-cavium=/dir/])
  1045. fi
  1046. AC_MSG_RESULT([yes])
  1047. enable_shared=no
  1048. enable_static=yes
  1049. ]
  1050. )
  1051. # microchip api
  1052. AC_ARG_ENABLE([mcapi],
  1053. [ --enable-mcapi Enable Microchip API (default: disabled)],
  1054. [ ENABLED_MCAPI=$enableval ],
  1055. [ ENABLED_MCAPI=no ]
  1056. )
  1057. if test "$ENABLED_MCAPI" = "yes"
  1058. then
  1059. AM_CFLAGS="$AM_CFLAGS -DHAVE_MCAPI -DCYASSL_AES_COUNTER -DCYASSL_AES_DIRECT"
  1060. fi
  1061. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_SHA512" = "no"
  1062. then
  1063. AC_MSG_ERROR([please enable sha512 if enabling mcapi.])
  1064. fi
  1065. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_ECC" = "no"
  1066. then
  1067. AC_MSG_ERROR([please enable ecc if enabling mcapi.])
  1068. fi
  1069. if test "$ENABLED_MCAPI" = "yes" && test "$ENABLED_LIBZ" = "no"
  1070. then
  1071. AC_MSG_ERROR([please use --with-libz if enabling mcapi.])
  1072. fi
  1073. AM_CONDITIONAL([BUILD_MCAPI], [test "x$ENABLED_MCAPI" = "xyes"])
  1074. # OPTIMIZE FLAGS
  1075. if test "$GCC" = "yes"
  1076. then
  1077. AM_CFLAGS="$AM_CFLAGS -Wall -Wno-unused"
  1078. if test "$ax_enable_debug" = "no"
  1079. then
  1080. if test "$ENABLED_FASTMATH" = "yes"
  1081. then
  1082. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_FAST_CFLAGS"
  1083. if test "$ENABLED_FASTHUGEMATH" = "yes"
  1084. then
  1085. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_HUGE_CFLAGS"
  1086. fi
  1087. else
  1088. AM_CFLAGS="$AM_CFLAGS $OPTIMIZE_CFLAGS"
  1089. fi
  1090. fi
  1091. fi
  1092. LIB_SOCKET_NSL
  1093. AC_ARG_ENABLE([gcc-hardening],
  1094. AS_HELP_STRING(--enable-gcc-hardening, Enable compiler security checks (default: disabled)),
  1095. [if test x$enableval = xyes; then
  1096. AM_CFLAGS="$AM_CFLAGS -D_FORTIFY_SOURCE=2 -fstack-protector-all"
  1097. AM_CFLAGS="$AM_CFLAGS -fwrapv -fPIE -Wstack-protector"
  1098. AM_CFLAGS="$AM_CFLAGS --param ssp-buffer-size=1"
  1099. LDFLAGS="$LDFLAGS -pie"
  1100. fi])
  1101. AX_HARDEN_CC_COMPILER_FLAGS
  1102. # link to ws2_32 if on mingw
  1103. case $host_os in
  1104. *mingw32)
  1105. LDFLAGS="$LDFLAGS -lws2_32" ;;
  1106. esac
  1107. # add user C_EXTRA_FLAGS back
  1108. CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
  1109. OPTION_FLAGS="$USER_C_EXTRA_FLAGS $AM_CFLAGS"
  1110. CREATE_HEX_VERSION
  1111. AC_SUBST([AM_CPPFLAGS])
  1112. AC_SUBST([AM_CFLAGS])
  1113. AC_SUBST([AM_LDFLAGS])
  1114. # FINAL
  1115. AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
  1116. AC_CONFIG_FILES([Makefile])
  1117. AC_CONFIG_FILES([cyassl/version.h])
  1118. AC_CONFIG_FILES([cyassl/options.h])
  1119. AC_CONFIG_FILES([support/cyassl.pc])
  1120. AC_CONFIG_FILES([rpm/spec])
  1121. AX_CREATE_GENERIC_CONFIG
  1122. AX_AM_JOBSERVER([yes])
  1123. AC_OUTPUT
  1124. # force make clean
  1125. echo "---"
  1126. echo "Running make clean..."
  1127. make clean >/dev/null 2>&1
  1128. echo
  1129. # generate user options header
  1130. echo "---"
  1131. echo "Generating user options header..."
  1132. OPTION_FILE="cyassl/options.h"
  1133. rm -f $OPTION_FILE
  1134. echo "/* cyassl options.h" >> $OPTION_FILE
  1135. echo " * generated from configure options" >> $OPTION_FILE
  1136. echo " *" >> $OPTION_FILE
  1137. echo " * Copyright (C) 2006-2013 wolfSSL Inc." >> $OPTION_FILE
  1138. echo " *" >> $OPTION_FILE
  1139. echo " * This file is part of CyaSSL." >> $OPTION_FILE
  1140. echo " *" >> $OPTION_FILE
  1141. echo " */" >> $OPTION_FILE
  1142. echo "" >> $OPTION_FILE
  1143. echo "#pragma once" >> $OPTION_FILE
  1144. echo "" >> $OPTION_FILE
  1145. echo "#ifdef __cplusplus" >> $OPTION_FILE
  1146. echo "extern \"C\" {" >> $OPTION_FILE
  1147. echo "#endif" >> $OPTION_FILE
  1148. echo "" >> $OPTION_FILE
  1149. for option in $OPTION_FLAGS; do
  1150. defonly=`echo $option | sed 's/-D//'`
  1151. if test "$defonly" != "$option"
  1152. then
  1153. noequalsign=`echo $defonly | sed 's/=/ /'`
  1154. echo "#undef $noequalsign" >> $OPTION_FILE
  1155. echo "#define $noequalsign" >> $OPTION_FILE
  1156. echo "" >> $OPTION_FILE
  1157. else
  1158. echo "option w/o begin -D is $option, not saving to $OPTION_FILE"
  1159. fi
  1160. done
  1161. echo "" >> $OPTION_FILE
  1162. echo "#ifdef __cplusplus" >> $OPTION_FILE
  1163. echo "}" >> $OPTION_FILE
  1164. echo "#endif" >> $OPTION_FILE
  1165. echo "" >> $OPTION_FILE
  1166. echo
  1167. # output config summary
  1168. echo "---"
  1169. echo "Configuration summary for $PACKAGE_NAME version $VERSION"
  1170. echo ""
  1171. echo " * Installation prefix: $prefix"
  1172. echo " * System type: $host_vendor-$host_os"
  1173. echo " * Host CPU: $host_cpu"
  1174. echo " * C Compiler: $CC_VERSION"
  1175. echo " * C Flags: $CFLAGS"
  1176. echo " * C++ Compiler: $CXX_VERSION"
  1177. echo " * C++ Flags: $CXXFLAGS"
  1178. echo " * CPP Flags: $CPPFLAGS"
  1179. echo " * LIB Flags: $LIB"
  1180. echo " * Debug enabled: $ax_enable_debug"
  1181. echo " * Warnings as failure: $ac_cv_warnings_as_errors"
  1182. echo " * make -j: $enable_jobserver"
  1183. echo " * VCS checkout: $ac_cv_vcs_checkout"
  1184. echo
  1185. echo " Features "
  1186. echo " * Single threaded: $ENABLED_SINGLETHREADED"
  1187. echo " * Filesystem: $ENABLED_FILESYSTEM"
  1188. echo " * OpenSSL Extra API: $ENABLED_OPENSSLEXTRA"
  1189. echo " * fastmath: $ENABLED_FASTMATH"
  1190. echo " * sniffer: $ENABLED_SNIFFER"
  1191. echo " * ARC4: $ENABLED_ARC4"
  1192. echo " * AES: $ENABLED_AES"
  1193. echo " * AES-NI: $ENABLED_AESNI"
  1194. echo " * AES-GCM: $ENABLED_AESGCM"
  1195. echo " * AES-CCM: $ENABLED_AESCCM"
  1196. echo " * DES3: $ENABLED_DES3"
  1197. echo " * Camellia: $ENABLED_CAMELLIA"
  1198. echo " * NULL Cipher: $ENABLED_NULL_CIPHER"
  1199. echo " * MD5: $ENABLED_MD5"
  1200. echo " * RIPEMD: $ENABLED_RIPEMD"
  1201. echo " * SHA: $ENABLED_SHA"
  1202. echo " * SHA-512: $ENABLED_SHA512"
  1203. echo " * BLAKE2: $ENABLED_BLAKE2"
  1204. echo " * keygen: $ENABLED_KEYGEN"
  1205. echo " * certgen: $ENABLED_CERTGEN"
  1206. echo " * HC-128: $ENABLED_HC128"
  1207. echo " * RABBIT: $ENABLED_RABBIT"
  1208. echo " * PWDBASED: $ENABLED_PWDBASED"
  1209. echo " * MD4: $ENABLED_MD4"
  1210. echo " * PSK: $ENABLED_PSK"
  1211. echo " * LEANPSK: $ENABLED_LEANPSK"
  1212. echo " * RSA: $ENABLED_RSA"
  1213. echo " * DSA: $ENABLED_DSA"
  1214. echo " * DH: $ENABLED_DH"
  1215. echo " * ECC: $ENABLED_ECC"
  1216. echo " * FPECC: $ENABLED_FPECC"
  1217. echo " * ASN: $ENABLED_ASN"
  1218. echo " * CODING: $ENABLED_CODING"
  1219. echo " * MEMORY: $ENABLED_MEMORY"
  1220. echo " * ERROR_STRINGS: $ENABLED_ERROR_STRINGS"
  1221. echo " * DTLS: $ENABLED_DTLS"
  1222. echo " * Old TLS Versions: $ENABLED_OLD_TLS"
  1223. echo " * OCSP: $ENABLED_OCSP"
  1224. echo " * CRL: $ENABLED_CRL"
  1225. echo " * CRL-MONITOR: $ENABLED_CRL_MONITOR"
  1226. echo " * Persistent session cache: $ENABLED_SAVESESSION"
  1227. echo " * Persistent cert cache: $ENABLED_SAVECERT"
  1228. echo " * Atomic User Record Layer: $ENABLED_ATOMICUSER"
  1229. echo " * Public Key Callbacks: $ENABLED_PKCALLBACKS"
  1230. echo " * NTRU: $ENABLED_NTRU"
  1231. echo " * SNI: $ENABLED_SNI"
  1232. echo " * Maximum Fragment Length: $ENABLED_MAX_FRAGMENT"
  1233. echo " * Truncated HMAC: $ENABLED_TRUNCATED_HMAC"
  1234. echo " * All TLS Extensions: $ENABLED_TLSX"
  1235. echo " * valgrind unit tests: $ENABLED_VALGRIND"
  1236. echo " * LIBZ: $ENABLED_LIBZ"
  1237. echo " * Examples: $ENABLED_EXAMPLES"
  1238. echo ""
  1239. echo "---"