]> Git Repo - secp256k1.git/blame - configure.ac
Append instead of Prepend user-CFLAGS to default CFLAGS allowing the user to override...
[secp256k1.git] / configure.ac
CommitLineData
78cd96b1
CF
1AC_PREREQ([2.60])
2AC_INIT([libsecp256k1],[0.1])
6fac238f 3AC_CONFIG_AUX_DIR([build-aux])
4AC_CONFIG_MACRO_DIR([build-aux/m4])
78cd96b1
CF
5AC_CANONICAL_HOST
6AH_TOP([#ifndef LIBSECP256K1_CONFIG_H])
7AH_TOP([#define LIBSECP256K1_CONFIG_H])
f735446c 8AH_BOTTOM([#endif /*LIBSECP256K1_CONFIG_H*/])
5190079e 9AM_INIT_AUTOMAKE([foreign subdir-objects])
78cd96b1
CF
10LT_INIT
11
53628757
CF
12dnl make the compilation flags quiet unless V=1 is used
13m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
14
78cd96b1
CF
15PKG_PROG_PKG_CONFIG
16
3ab1178d
CF
17AC_PATH_TOOL(AR, ar)
18AC_PATH_TOOL(RANLIB, ranlib)
19AC_PATH_TOOL(STRIP, strip)
fbecc38a 20AX_PROG_CC_FOR_BUILD
3ab1178d 21
ed5334a7 22AM_PROG_CC_C_O
23
f735446c
GM
24AC_PROG_CC_C89
25if test x"$ac_cv_prog_cc_c89" = x"no"; then
26 AC_MSG_ERROR([c89 compiler support required])
78cd96b1 27fi
001f1763 28AM_PROG_AS
78cd96b1 29
a86f241d 30case $host_os in
e2274c58
CF
31 *darwin*)
32 if test x$cross_compiling != xyes; then
33 AC_PATH_PROG([BREW],brew,)
34 if test x$BREW != x; then
35 dnl These Homebrew packages may be keg-only, meaning that they won't be found
36 dnl in expected paths because they may conflict with system files. Ask
37 dnl Homebrew where each one is located, then adjust paths accordingly.
38
39 openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
40 gmp_prefix=`$BREW --prefix gmp 2>/dev/null`
41 if test x$openssl_prefix != x; then
42 PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
43 export PKG_CONFIG_PATH
44 fi
45 if test x$gmp_prefix != x; then
46 GMP_CPPFLAGS="-I$gmp_prefix/include"
47 GMP_LIBS="-L$gmp_prefix/lib"
48 fi
49 else
50 AC_PATH_PROG([PORT],port,)
51 dnl if homebrew isn't installed and macports is, add the macports default paths
52 dnl as a last resort.
53 if test x$PORT != x; then
54 CPPFLAGS="$CPPFLAGS -isystem /opt/local/include"
55 LDFLAGS="$LDFLAGS -L/opt/local/lib"
56 fi
57 fi
58 fi
59 ;;
a86f241d
PD
60esac
61
ecba8138 62CFLAGS="-W $CFLAGS"
a099073a 63
7c3771dd 64warn_CFLAGS="-std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings"
a099073a 65saved_CFLAGS="$CFLAGS"
ecba8138 66CFLAGS="$warn_CFLAGS $CFLAGS"
a099073a
GM
67AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}])
68AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
69 [ AC_MSG_RESULT([yes]) ],
70 [ AC_MSG_RESULT([no])
71 CFLAGS="$saved_CFLAGS"
72 ])
73
118cd821 74saved_CFLAGS="$CFLAGS"
ecba8138 75CFLAGS="-fvisibility=hidden $CFLAGS"
118cd821
GM
76AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
77AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
78 [ AC_MSG_RESULT([yes]) ],
79 [ AC_MSG_RESULT([no])
80 CFLAGS="$saved_CFLAGS"
81 ])
a099073a 82
78cd96b1 83AC_ARG_ENABLE(benchmark,
a61a93ff 84 AS_HELP_STRING([--enable-benchmark],[compile benchmark [default=yes]]),
78cd96b1 85 [use_benchmark=$enableval],
4afec9f1 86 [use_benchmark=yes])
78cd96b1 87
a724d729 88AC_ARG_ENABLE(coverage,
a61a93ff 89 AS_HELP_STRING([--enable-coverage],[enable compiler flags to support kcov coverage analysis [default=no]]),
a724d729
AP
90 [enable_coverage=$enableval],
91 [enable_coverage=no])
92
78cd96b1 93AC_ARG_ENABLE(tests,
a61a93ff 94 AS_HELP_STRING([--enable-tests],[compile tests [default=yes]]),
78cd96b1
CF
95 [use_tests=$enableval],
96 [use_tests=yes])
97
a9b2a5d8 98AC_ARG_ENABLE(openssl_tests,
a61a93ff 99 AS_HELP_STRING([--enable-openssl-tests],[enable OpenSSL tests [default=auto]]),
a9b2a5d8
AP
100 [enable_openssl_tests=$enableval],
101 [enable_openssl_tests=auto])
102
83221ecb 103AC_ARG_ENABLE(experimental,
a61a93ff 104 AS_HELP_STRING([--enable-experimental],[allow experimental configure options [default=no]]),
83221ecb
PW
105 [use_experimental=$enableval],
106 [use_experimental=no])
107
20b8877b 108AC_ARG_ENABLE(exhaustive_tests,
a61a93ff 109 AS_HELP_STRING([--enable-exhaustive-tests],[compile exhaustive tests [default=yes]]),
20b8877b
AP
110 [use_exhaustive_tests=$enableval],
111 [use_exhaustive_tests=yes])
112
78cd96b1 113AC_ARG_ENABLE(endomorphism,
a61a93ff 114 AS_HELP_STRING([--enable-endomorphism],[enable endomorphism [default=no]]),
78cd96b1 115 [use_endomorphism=$enableval],
0e9baf6f 116 [use_endomorphism=no])
83221ecb 117
fbecc38a 118AC_ARG_ENABLE(ecmult_static_precomputation,
a61a93ff 119 AS_HELP_STRING([--enable-ecmult-static-precomputation],[enable precomputed ecmult table for signing [default=auto]]),
fbecc38a 120 [use_ecmult_static_precomputation=$enableval],
aa0b1fd1 121 [use_ecmult_static_precomputation=auto])
78cd96b1 122
0739bbb6 123AC_ARG_ENABLE(module_ecdh,
83221ecb 124 AS_HELP_STRING([--enable-module-ecdh],[enable ECDH shared secret computation (experimental)]),
0739bbb6
AP
125 [enable_module_ecdh=$enableval],
126 [enable_module_ecdh=no])
127
9f443be0 128AC_ARG_ENABLE(module_recovery,
a61a93ff 129 AS_HELP_STRING([--enable-module-recovery],[enable ECDSA pubkey recovery module [default=no]]),
9f443be0
PW
130 [enable_module_recovery=$enableval],
131 [enable_module_recovery=no])
132
5db782e6 133AC_ARG_ENABLE(external_default_callbacks,
a467047e 134 AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]),
5db782e6
TR
135 [use_external_default_callbacks=$enableval],
136 [use_external_default_callbacks=no])
137
3093576a 138AC_ARG_ENABLE(jni,
a61a93ff 139 AS_HELP_STRING([--enable-jni],[enable libsecp256k1_jni [default=no]]),
3093576a 140 [use_jni=$enableval],
57752d28 141 [use_jni=no])
3093576a 142
7277fd76 143AC_ARG_WITH([field], [AS_HELP_STRING([--with-field=64bit|32bit|auto],
a61a93ff 144[finite field implementation to use [default=auto]])],[req_field=$withval], [req_field=auto])
78cd96b1 145
1ba4a60a 146AC_ARG_WITH([bignum], [AS_HELP_STRING([--with-bignum=gmp|no|auto],
a61a93ff 147[bignum implementation to use [default=auto]])],[req_bignum=$withval], [req_bignum=auto])
78cd96b1 148
1d52a8b1 149AC_ARG_WITH([scalar], [AS_HELP_STRING([--with-scalar=64bit|32bit|auto],
a61a93ff 150[scalar implementation to use [default=auto]])],[req_scalar=$withval], [req_scalar=auto])
1d52a8b1 151
a61a93ff
TR
152AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto],
153[assembly optimizations to useĀ (experimental: arm) [default=auto]])],[req_asm=$withval], [req_asm=auto])
1ba4a60a 154
2842dc52
TR
155AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto],
156[window size for ecmult precomputation for verification, specified as integer in range [2..24].]
157[Larger values result in possibly better performance at the cost of an exponentially larger precomputed table.]
158[The table will store 2^(SIZE-2) * 64 bytes of data but can be larger in memory due to platform-specific padding and alignment.]
159[If the endomorphism optimization is enabled, two tables of this size are used instead of only one.]
160["auto" is a reasonable setting for desktop machines (currently 15). [default=auto]]
161)],
162[req_ecmult_window=$withval], [req_ecmult_window=auto])
163
dcb2e3b3 164AC_ARG_WITH([ecmult-gen-precision], [AS_HELP_STRING([--with-ecmult-gen-precision=2|4|8|auto],
165[Precision bits to tune the precomputed table size for signing.]
166[The size of the table is 32kB for 2 bits, 64kB for 4 bits, 512kB for 8 bits of precision.]
167[A larger table size usually results in possible faster signing.]
168["auto" is a reasonable setting for desktop machines (currently 4). [default=auto]]
169)],
170[req_ecmult_gen_precision=$withval], [req_ecmult_gen_precision=auto])
171
78cd96b1
CF
172AC_CHECK_TYPES([__int128])
173
a724d729
AP
174if test x"$enable_coverage" = x"yes"; then
175 AC_DEFINE(COVERAGE, 1, [Define this symbol to compile out all VERIFY code])
ecba8138
JN
176 CFLAGS="-O0 --coverage $CFLAGS"
177 LDFLAGS="--coverage $LDFLAGS"
a724d729 178else
ecba8138 179 CFLAGS="-O3 $CFLAGS"
a724d729
AP
180fi
181
aa0b1fd1 182if test x"$use_ecmult_static_precomputation" != x"no"; then
2d5f4ceb 183 # Temporarily switch to an environment for the native compiler
aa0b1fd1
CF
184 save_cross_compiling=$cross_compiling
185 cross_compiling=no
2d5f4ceb 186 SAVE_CC="$CC"
aa0b1fd1 187 CC="$CC_FOR_BUILD"
2d5f4ceb
TR
188 SAVE_CFLAGS="$CFLAGS"
189 CFLAGS="$CFLAGS_FOR_BUILD"
190 SAVE_CPPFLAGS="$CPPFLAGS"
191 CPPFLAGS="$CPPFLAGS_FOR_BUILD"
192 SAVE_LDFLAGS="$LDFLAGS"
193 LDFLAGS="$LDFLAGS_FOR_BUILD"
194
195 warn_CFLAGS_FOR_BUILD="-Wall -Wextra -Wno-unused-function"
196 saved_CFLAGS="$CFLAGS"
ecba8138 197 CFLAGS="$warn_CFLAGS_FOR_BUILD $CFLAGS"
2d5f4ceb
TR
198 AC_MSG_CHECKING([if native ${CC_FOR_BUILD} supports ${warn_CFLAGS_FOR_BUILD}])
199 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
200 [ AC_MSG_RESULT([yes]) ],
201 [ AC_MSG_RESULT([no])
202 CFLAGS="$saved_CFLAGS"
203 ])
204
205 AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
aa0b1fd1 206 AC_RUN_IFELSE(
2d5f4ceb 207 [AC_LANG_PROGRAM([], [])],
aa0b1fd1
CF
208 [working_native_cc=yes],
209 [working_native_cc=no],[dnl])
2d5f4ceb
TR
210
211 CFLAGS_FOR_BUILD="$CFLAGS"
212
213 # Restore the environment
aa0b1fd1 214 cross_compiling=$save_cross_compiling
2d5f4ceb
TR
215 CC="$SAVE_CC"
216 CFLAGS="$SAVE_CFLAGS"
217 CPPFLAGS="$SAVE_CPPFLAGS"
218 LDFLAGS="$SAVE_LDFLAGS"
aa0b1fd1
CF
219
220 if test x"$working_native_cc" = x"no"; then
2d5f4ceb 221 AC_MSG_RESULT([no])
aa0b1fd1 222 set_precomp=no
2d5f4ceb 223 m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
aa0b1fd1 224 if test x"$use_ecmult_static_precomputation" = x"yes"; then
2d5f4ceb 225 AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
aa0b1fd1 226 else
2d5f4ceb 227 AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
aa0b1fd1
CF
228 fi
229 else
2d5f4ceb 230 AC_MSG_RESULT([yes])
aa0b1fd1
CF
231 set_precomp=yes
232 fi
233else
234 set_precomp=no
235fi
236
1ba4a60a 237if test x"$req_asm" = x"auto"; then
0e9baf6f
CF
238 SECP_64BIT_ASM_CHECK
239 if test x"$has_64bit_asm" = x"yes"; then
1ba4a60a
PW
240 set_asm=x86_64
241 fi
242 if test x"$set_asm" = x; then
243 set_asm=no
78cd96b1 244 fi
1ba4a60a
PW
245else
246 set_asm=$req_asm
247 case $set_asm in
248 x86_64)
249 SECP_64BIT_ASM_CHECK
250 if test x"$has_64bit_asm" != x"yes"; then
251 AC_MSG_ERROR([x86_64 assembly optimization requested but not available])
252 fi
253 ;;
001f1763
WL
254 arm)
255 ;;
1ba4a60a
PW
256 no)
257 ;;
258 *)
259 AC_MSG_ERROR([invalid assembly optimization selection])
260 ;;
261 esac
262fi
78cd96b1 263
1ba4a60a
PW
264if test x"$req_field" = x"auto"; then
265 if test x"set_asm" = x"x86_64"; then
266 set_field=64bit
267 fi
78cd96b1
CF
268 if test x"$set_field" = x; then
269 SECP_INT128_CHECK
270 if test x"$has_int128" = x"yes"; then
0e9baf6f 271 set_field=64bit
78cd96b1
CF
272 fi
273 fi
78cd96b1 274 if test x"$set_field" = x; then
0e9baf6f 275 set_field=32bit
78cd96b1
CF
276 fi
277else
278 set_field=$req_field
279 case $set_field in
0e9baf6f 280 64bit)
1ba4a60a
PW
281 if test x"$set_asm" != x"x86_64"; then
282 SECP_INT128_CHECK
283 if test x"$has_int128" != x"yes"; then
284 AC_MSG_ERROR([64bit field explicitly requested but neither __int128 support or x86_64 assembly available])
285 fi
286 fi
78cd96b1 287 ;;
0e9baf6f 288 32bit)
78cd96b1
CF
289 ;;
290 *)
291 AC_MSG_ERROR([invalid field implementation selection])
292 ;;
293 esac
294fi
295
1d52a8b1 296if test x"$req_scalar" = x"auto"; then
1ba4a60a
PW
297 SECP_INT128_CHECK
298 if test x"$has_int128" = x"yes"; then
299 set_scalar=64bit
1d52a8b1
PW
300 fi
301 if test x"$set_scalar" = x; then
302 set_scalar=32bit
303 fi
304else
305 set_scalar=$req_scalar
306 case $set_scalar in
307 64bit)
308 SECP_INT128_CHECK
1ba4a60a
PW
309 if test x"$has_int128" != x"yes"; then
310 AC_MSG_ERROR([64bit scalar explicitly requested but __int128 support not available])
311 fi
1d52a8b1
PW
312 ;;
313 32bit)
314 ;;
315 *)
316 AC_MSG_ERROR([invalid scalar implementation selected])
317 ;;
318 esac
319fi
320
78cd96b1
CF
321if test x"$req_bignum" = x"auto"; then
322 SECP_GMP_CHECK
323 if test x"$has_gmp" = x"yes"; then
324 set_bignum=gmp
325 fi
326
78cd96b1 327 if test x"$set_bignum" = x; then
1ba4a60a 328 set_bignum=no
78cd96b1
CF
329 fi
330else
331 set_bignum=$req_bignum
332 case $set_bignum in
333 gmp)
334 SECP_GMP_CHECK
1ba4a60a
PW
335 if test x"$has_gmp" != x"yes"; then
336 AC_MSG_ERROR([gmp bignum explicitly requested but libgmp not available])
337 fi
78cd96b1 338 ;;
1ba4a60a 339 no)
78cd96b1
CF
340 ;;
341 *)
342 AC_MSG_ERROR([invalid bignum implementation selection])
343 ;;
344 esac
345fi
346
1ba4a60a 347# select assembly optimization
001f1763
WL
348use_external_asm=no
349
1ba4a60a
PW
350case $set_asm in
351x86_64)
352 AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations])
353 ;;
001f1763
WL
354arm)
355 use_external_asm=yes
356 ;;
1ba4a60a
PW
357no)
358 ;;
359*)
360 AC_MSG_ERROR([invalid assembly optimizations])
361 ;;
362esac
363
78cd96b1
CF
364# select field implementation
365case $set_field in
0e9baf6f 36664bit)
78cd96b1
CF
367 AC_DEFINE(USE_FIELD_5X52, 1, [Define this symbol to use the FIELD_5X52 implementation])
368 ;;
0e9baf6f 36932bit)
78cd96b1
CF
370 AC_DEFINE(USE_FIELD_10X26, 1, [Define this symbol to use the FIELD_10X26 implementation])
371 ;;
372*)
373 AC_MSG_ERROR([invalid field implementation])
374 ;;
375esac
376
377# select bignum implementation
378case $set_bignum in
379gmp)
597128d3
PW
380 AC_DEFINE(HAVE_LIBGMP, 1, [Define this symbol if libgmp is installed])
381 AC_DEFINE(USE_NUM_GMP, 1, [Define this symbol to use the gmp implementation for num])
d1502eb4
PW
382 AC_DEFINE(USE_FIELD_INV_NUM, 1, [Define this symbol to use the num-based field inverse implementation])
383 AC_DEFINE(USE_SCALAR_INV_NUM, 1, [Define this symbol to use the num-based scalar inverse implementation])
78cd96b1 384 ;;
1ba4a60a 385no)
597128d3
PW
386 AC_DEFINE(USE_NUM_NONE, 1, [Define this symbol to use no num implementation])
387 AC_DEFINE(USE_FIELD_INV_BUILTIN, 1, [Define this symbol to use the native field inverse implementation])
388 AC_DEFINE(USE_SCALAR_INV_BUILTIN, 1, [Define this symbol to use the native scalar inverse implementation])
389 ;;
78cd96b1
CF
390*)
391 AC_MSG_ERROR([invalid bignum implementation])
392 ;;
393esac
394
1d52a8b1
PW
395#select scalar implementation
396case $set_scalar in
39764bit)
398 AC_DEFINE(USE_SCALAR_4X64, 1, [Define this symbol to use the 4x64 scalar implementation])
399 ;;
40032bit)
401 AC_DEFINE(USE_SCALAR_8X32, 1, [Define this symbol to use the 8x32 scalar implementation])
402 ;;
403*)
404 AC_MSG_ERROR([invalid scalar implementation])
405 ;;
406esac
407
2842dc52
TR
408#set ecmult window size
409if test x"$req_ecmult_window" = x"auto"; then
410 set_ecmult_window=15
411else
412 set_ecmult_window=$req_ecmult_window
413fi
414
415error_window_size=['window size for ecmult precomputation not an integer in range [2..24] or "auto"']
416case $set_ecmult_window in
417''|*[[!0-9]]*)
418 # no valid integer
419 AC_MSG_ERROR($error_window_size)
420 ;;
421*)
422 if test "$set_ecmult_window" -lt 2 -o "$set_ecmult_window" -gt 24 ; then
423 # not in range
424 AC_MSG_ERROR($error_window_size)
425 fi
426 AC_DEFINE_UNQUOTED(ECMULT_WINDOW_SIZE, $set_ecmult_window, [Set window size for ecmult precomputation])
427 ;;
428esac
429
dcb2e3b3 430#set ecmult gen precision
431if test x"$req_ecmult_gen_precision" = x"auto"; then
432 set_ecmult_gen_precision=4
433else
434 set_ecmult_gen_precision=$req_ecmult_gen_precision
435fi
436
437case $set_ecmult_gen_precision in
4382|4|8)
439 AC_DEFINE_UNQUOTED(ECMULT_GEN_PREC_BITS, $set_ecmult_gen_precision, [Set ecmult gen precision bits])
440 ;;
441*)
442 AC_MSG_ERROR(['ecmult gen precision not 2, 4, 8 or "auto"'])
443 ;;
444esac
445
78cd96b1
CF
446if test x"$use_tests" = x"yes"; then
447 SECP_OPENSSL_CHECK
28ade27d 448 if test x"$has_openssl_ec" = x"yes"; then
a9b2a5d8
AP
449 if test x"$enable_openssl_tests" != x"no"; then
450 AC_DEFINE(ENABLE_OPENSSL_TESTS, 1, [Define this symbol if OpenSSL EC functions are available])
451 SECP_TEST_INCLUDES="$SSL_CFLAGS $CRYPTO_CFLAGS"
452 SECP_TEST_LIBS="$CRYPTO_LIBS"
453
454 case $host in
455 *mingw*)
456 SECP_TEST_LIBS="$SECP_TEST_LIBS -lgdi32"
457 ;;
458 esac
459 fi
460 else
461 if test x"$enable_openssl_tests" = x"yes"; then
462 AC_MSG_ERROR([OpenSSL tests requested but OpenSSL with EC support is not available])
463 fi
464 fi
465else
466 if test x"$enable_openssl_tests" = x"yes"; then
467 AC_MSG_ERROR([OpenSSL tests requested but tests are not enabled])
78cd96b1
CF
468 fi
469fi
470
3093576a
G
471if test x"$use_jni" != x"no"; then
472 AX_JNI_INCLUDE_DIR
eee808d8 473 have_jni_dependencies=yes
eee808d8
PW
474 if test x"$enable_module_ecdh" = x"no"; then
475 have_jni_dependencies=no
476 fi
3093576a 477 if test "x$JNI_INCLUDE_DIRS" = "x"; then
eee808d8
PW
478 have_jni_dependencies=no
479 fi
480 if test "x$have_jni_dependencies" = "xno"; then
3093576a 481 if test x"$use_jni" = x"yes"; then
e06e878f 482 AC_MSG_ERROR([jni support explicitly requested but headers/dependencies were not found. Enable ECDH and try again.])
3093576a 483 fi
eee808d8 484 AC_MSG_WARN([jni headers/dependencies not found. jni support disabled])
3093576a
G
485 use_jni=no
486 else
487 use_jni=yes
488 for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do
489 JNI_INCLUDES="$JNI_INCLUDES -I$JNI_INCLUDE_DIR"
490 done
491 fi
492fi
493
7277fd76 494if test x"$set_bignum" = x"gmp"; then
78cd96b1 495 SECP_LIBS="$SECP_LIBS $GMP_LIBS"
e2274c58 496 SECP_INCLUDES="$SECP_INCLUDES $GMP_CPPFLAGS"
78cd96b1
CF
497fi
498
499if test x"$use_endomorphism" = x"yes"; then
c35ff1ea 500 AC_DEFINE(USE_ENDOMORPHISM, 1, [Define this symbol to use endomorphism optimization])
78cd96b1
CF
501fi
502
00c5d2e1 503if test x"$set_precomp" = x"yes"; then
fbecc38a
TD
504 AC_DEFINE(USE_ECMULT_STATIC_PRECOMPUTATION, 1, [Define this symbol to use a statically generated ecmult table])
505fi
506
0739bbb6
AP
507if test x"$enable_module_ecdh" = x"yes"; then
508 AC_DEFINE(ENABLE_MODULE_ECDH, 1, [Define this symbol to enable the ECDH module])
509fi
510
9f443be0
PW
511if test x"$enable_module_recovery" = x"yes"; then
512 AC_DEFINE(ENABLE_MODULE_RECOVERY, 1, [Define this symbol to enable the ECDSA pubkey recovery module])
513fi
514
ae55e850
PW
515AC_C_BIGENDIAN()
516
001f1763
WL
517if test x"$use_external_asm" = x"yes"; then
518 AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
519fi
520
5db782e6
TR
521if test x"$use_external_default_callbacks" = x"yes"; then
522 AC_DEFINE(USE_EXTERNAL_DEFAULT_CALLBACKS, 1, [Define this symbol if an external implementation of the default callbacks is used])
523fi
524
83221ecb
PW
525if test x"$enable_experimental" = x"yes"; then
526 AC_MSG_NOTICE([******])
527 AC_MSG_NOTICE([WARNING: experimental build])
528 AC_MSG_NOTICE([Experimental features do not have stable APIs or properties, and may not be safe for production use.])
529 AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh])
83221ecb
PW
530 AC_MSG_NOTICE([******])
531else
83221ecb
PW
532 if test x"$enable_module_ecdh" = x"yes"; then
533 AC_MSG_ERROR([ECDH module is experimental. Use --enable-experimental to allow.])
534 fi
001f1763
WL
535 if test x"$set_asm" = x"arm"; then
536 AC_MSG_ERROR([ARM assembly optimization is experimental. Use --enable-experimental to allow.])
537 fi
83221ecb
PW
538fi
539
78cd96b1 540AC_CONFIG_HEADERS([src/libsecp256k1-config.h])
c7ee71f7 541AC_CONFIG_FILES([Makefile libsecp256k1.pc])
3093576a 542AC_SUBST(JNI_INCLUDES)
78cd96b1
CF
543AC_SUBST(SECP_INCLUDES)
544AC_SUBST(SECP_LIBS)
545AC_SUBST(SECP_TEST_LIBS)
546AC_SUBST(SECP_TEST_INCLUDES)
a724d729 547AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"])
78cd96b1 548AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])
20b8877b 549AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"])
8336040f 550AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
00c5d2e1 551AM_CONDITIONAL([USE_ECMULT_STATIC_PRECOMPUTATION], [test x"$set_precomp" = x"yes"])
0739bbb6 552AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
9f443be0 553AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
270f6c80 554AM_CONDITIONAL([USE_JNI], [test x"$use_jni" = x"yes"])
001f1763
WL
555AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"])
556AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"])
e2274c58
CF
557
558dnl make sure nothing new is exported so that we don't break the cache
559PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
560unset PKG_CONFIG_PATH
561PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP"
562
78cd96b1 563AC_OUTPUT
3965027c
EK
564
565echo
566echo "Build Options:"
5db782e6
TR
567echo " with endomorphism = $use_endomorphism"
568echo " with ecmult precomp = $set_precomp"
569echo " with external callbacks = $use_external_default_callbacks"
570echo " with jni = $use_jni"
571echo " with benchmarks = $use_benchmark"
572echo " with coverage = $enable_coverage"
573echo " module ecdh = $enable_module_ecdh"
574echo " module recovery = $enable_module_recovery"
3965027c 575echo
5db782e6
TR
576echo " asm = $set_asm"
577echo " bignum = $set_bignum"
578echo " field = $set_field"
579echo " scalar = $set_scalar"
580echo " ecmult window size = $set_ecmult_window"
dcb2e3b3 581echo " ecmult gen prec. bits = $set_ecmult_gen_precision"
3965027c 582echo
5db782e6
TR
583echo " CC = $CC"
584echo " CFLAGS = $CFLAGS"
585echo " CPPFLAGS = $CPPFLAGS"
586echo " LDFLAGS = $LDFLAGS"
3965027c 587echo
This page took 0.125994 seconds and 4 git commands to generate.