mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
54245985fb
b19c000063 Merge #607: Use size_t shifts when computing a size_t 4d01bc2d9c Merge #606: travis: Remove unused sudo:false e6d01e9347 Use size_t shifts when computing a size_t 7667532bd7 travis: Remove unused sudo:false ee99f12f3d Merge #599: Switch x86_64 asm to use "i" instead of "n" for immediate values. d58bc93f2c Switch x86_64 asm to use "i" instead of "n" for immediate values. 05362ee042 Merge #597: Add $(COMMON_LIB) to exhaustive tests to fix ARM asm build 83483869ac Add $(COMMON_LIB) to exhaustive tests to fix ARM asm build aa15154a48 Merge #568: Fix integer overflow in ecmult_multi_var when n is large 2277af5ff0 Fix integer overflow in ecmult_multi_var when n is large 85d0e1bcce Merge #591: Make bench_internal obey secp256k1_fe_sqrt's contract wrt aliasing. 14196379ec Merge #580: Add trivial ecmult_multi algorithm which does not require a scratch space a697d82da9 Add trivial ecmult_multi to the benchmark tool bade617417 Add trivial ecmult_multi algorithm. It is selected when no scratch space is given and just multiplies and adds the points. 5545e13dea Merge #584: configure: Use CFLAGS_FOR_BUILD when checking native compiler 20c5869df2 Merge #516: improvements to random seed in src/tests.c b76e45d5d6 Make bench_internal obey secp256k1_fe_sqrt's contract wrt aliasing. 870a977644 Merge #562: Make use of TAG_PUBKEY constants in secp256k1_eckey_pubkey_parse be40c4d0b5 Fixup for C90 mixed declarations. c71dd2c08f Merge #509: Fix algorithm selection in bench_ecmult 6492bf88cc Merge #518: Summarize build options after running configure 0e9ada1941 Merge #567: Correct order of libs returned on pkg-config --libs --static libsecp2… e96901a4b9 Merge #587: Make randomization of a non-signing context a noop 58df8d03ad Merge #511: Portability fix for the configure scripts generated 2ebdad772a Merge #552: Make constants static: 1c131affd3 Merge #551: secp256k1_fe_sqrt: Verify that the arguments don't alias. ba698f883b Merge #539: Assorted minor corrections 949e85b009 Merge #550: Optimize secp256k1_fe_normalize_weak calls. a34bcaadf1 Actually pass CFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD to linker 2d5f4cebdc configure: Use CFLAGS_FOR_BUILD when checking native compiler b408c6a8b2 Merge #579: Use __GNUC_PREREQ for detecting __builtin_expect 6198375218 Make randomization of a non-signing context a noop c663397f46 Use __GNUC_PREREQ for detecting __builtin_expect e34ceb333b Merge #557: Eliminate scratch memory used when generating contexts b3bf5f99a3 ecmult_impl: expand comment to explain how effective affine interacts with everything efa783f8f0 Store z-ratios in the 'x' coord they'll recover ffd3b346fe add `secp256k1_ge_set_all_gej_var` test which deals with many infinite points 84740acd2a ecmult_impl: save one fe_inv_var 47045270fa ecmult_impl: eliminate scratch memory used when generating context 7f7a2ed3a8 ecmult_gen_impl: eliminate scratch memory used when generating context 314a61d724 Merge #553: add static context object which has no capabilities 89a20a8945 Correct order of libs returned on pkg-config --libs --static libsecp256k1 call. 1086fda4c1 Merge #354: [ECDH API change] Support custom hash function d3cb1f95eb Make use of TAG_PUBKEY constants in secp256k1_eckey_pubkey_parse 40fde611bd prevent attempts to modify `secp256k1_context_no_precomp` ed7c08417a add static context object which has no capabilities 496c5b43b8 Make constants static: static const secp256k1_ge secp256k1_ge_const_g; static const int CURVE_B; bf8b86cc07 secp256k1_fe_sqrt: Verify that the arguments don't alias. 9bd89c836b Optimize secp256k1_fe_normalize_weak calls. Move secp256k1_fe_normalize_weak calls out of ECMULT_TABLE_GET_GE and ECMULT_TABLE_GET_GE_STORAGE and into secp256k1_ge_globalz_set_table_gej instead. 52ab96fedb clean dependendies in field_*_impl.h deff5edd42 Correct math typos in field_*.h 4efb3f8dd1 Add check that restrict pointers don't alias with all parameters. 1e6f1f5ad5 Merge #529: fix tests.c in the count == 0 case c8fbc3c397 [ECDH API change] Allow pass arbitrary data to hash function b00be65056 [ECDH API change] Support custom hash function 95e99f196f fix tests.c in the count == 0 case 452d8e4d2a Merge #523: scratch: add stack frame support 6fe50439ae scratch: add stack frame support 9bc2e26502 Merge #522: parameterize ecmult_const over input size 7c1b91ba4b parameterize ecmult_const over input size dbc3ddd5e2 Merge #513: Increase sparsity of pippenger fixed window naf representation 3965027c81 Summarize build options in configure script 0f0517369c Fix algorithm selection in bench_ecmult fb9271dcf0 Merge #510: add a couple missing `const`s to ecmult_pippenger_wnaf cd5f6028e5 Merge #515: Fix typo 09146ae854 Merge #512: secp256k1_ec_privkey_negate - fix documentation ec0a7b3ae3 Don't touch leading zeros in wnaf_fixed. 9e36d1bfe2 Fix bug in wnaf_fixed where the wnaf array is not completely zeroed when given a 0 scalar. 96f68a0afc Don't invert scalar in wnaf_fixed when it is even because a caller might intentionally give a scalar with many leading zeros. 8b3841c91d fix bug in fread() failure check cddef0c0be tests: add warning message when /dev/urandom fails 9b7c47a21e Fix typo 6dbb007869 Increase sparsity of pippenger fixed window naf representation 1646ace4d5 secp256k1_ec_privkey_negate - fix documentation 270f6c80db Portability fix for the configure scripts generated 9b3ff0309d add a couple missing `const`s to ecmult_pippenger_wnaf cd329dbc3e Merge #460: [build] Update ax_jni_include_dir.m4 macro 7f9c1a1565 Merge #498: tests: Avoid calling fclose(...) with an invalid argument f99aa8d4d3 Merge #499: tests: Make sure we get the requested number of bytes from /dev/urandom b549d3d5f7 Merge #472: [build] Set --enable-jni to no by default instead of auto. d333521516 Merge #494: Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS 2ef8ea5d21 Merge #495: Add bench_ecmult to .gitignore 82a96e4587 tests: Make sure we get the requested number of bytes from /dev/urandom 5aae5b5bb2 Avoid calling fclose(...) with an invalid argument cb32940df3 Add bench_ecmult to .gitignore 31abd3ab8d Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS c95f6f1360 Merge #487: fix tests typo, s/changed/unchanged fb46c83881 Merge #463: Reduce usage of hardcoded size constants 02f5001dfc Merge #490: Disambiguate bench functions and types 1f46d6089e Disambiguate bench functions and types f54c6c5083 Merge #480: Enable benchmark building by default c77fc08597 Merge #486: Add pippenger_wnaf for multi-multiplication d2f9c6b5dc Use more precise pippenger bucket windows 4c950bbeaf Save some additions per window in _pippenger_wnaf a58f543f5a Add flags for choosing algorithm in ecmult_multi benchmark 36b22c9337 Use scratch space dependent batching in ecmult_multi 355a38f113 Add pippenger_wnaf ecmult_multi bc65aa794e Add bench_ecmult dba5471b69 Add ecmult_multi tests 8c1c831bdb Generalize Strauss to support multiple points 548de42ecf add resizeable scratch space API 0e96cdc6b6 fix typo, s/changed/unchanged c7680e570f Reduce usage of hardcoded size constants 6ad5cdb42a Merge #479: Get rid of reserved _t in type names 7a78f60598 Print whether we're building benchmarks 4afec9f1ae Build benchmarks by default d1dc9dfc0a Get rid of reserved _t in type names 57752d28b3 [build] Set --enable-jni to no by default instead of auto. e7daa9b3c2 [build] Tweak JNI macro to warn instead of error for JNI not found. 5b22977922 [build] Update ax_jni_include_dir.m4 macro to deal with recent versions of macOS git-subtree-dir: src/secp256k1 git-subtree-split: b19c000063be11018b4d1a6b0a85871ab9d0bdcf
524 lines
16 KiB
Text
524 lines
16 KiB
Text
AC_PREREQ([2.60])
|
|
AC_INIT([libsecp256k1],[0.1])
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
|
AC_CONFIG_MACRO_DIR([build-aux/m4])
|
|
AC_CANONICAL_HOST
|
|
AH_TOP([#ifndef LIBSECP256K1_CONFIG_H])
|
|
AH_TOP([#define LIBSECP256K1_CONFIG_H])
|
|
AH_BOTTOM([#endif /*LIBSECP256K1_CONFIG_H*/])
|
|
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
|
LT_INIT
|
|
|
|
dnl make the compilation flags quiet unless V=1 is used
|
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|
|
|
PKG_PROG_PKG_CONFIG
|
|
|
|
AC_PATH_TOOL(AR, ar)
|
|
AC_PATH_TOOL(RANLIB, ranlib)
|
|
AC_PATH_TOOL(STRIP, strip)
|
|
AX_PROG_CC_FOR_BUILD
|
|
|
|
if test "x$CFLAGS" = "x"; then
|
|
CFLAGS="-g"
|
|
fi
|
|
|
|
AM_PROG_CC_C_O
|
|
|
|
AC_PROG_CC_C89
|
|
if test x"$ac_cv_prog_cc_c89" = x"no"; then
|
|
AC_MSG_ERROR([c89 compiler support required])
|
|
fi
|
|
AM_PROG_AS
|
|
|
|
case $host_os in
|
|
*darwin*)
|
|
if test x$cross_compiling != xyes; then
|
|
AC_PATH_PROG([BREW],brew,)
|
|
if test x$BREW != x; then
|
|
dnl These Homebrew packages may be keg-only, meaning that they won't be found
|
|
dnl in expected paths because they may conflict with system files. Ask
|
|
dnl Homebrew where each one is located, then adjust paths accordingly.
|
|
|
|
openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
|
|
gmp_prefix=`$BREW --prefix gmp 2>/dev/null`
|
|
if test x$openssl_prefix != x; then
|
|
PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
|
|
export PKG_CONFIG_PATH
|
|
fi
|
|
if test x$gmp_prefix != x; then
|
|
GMP_CPPFLAGS="-I$gmp_prefix/include"
|
|
GMP_LIBS="-L$gmp_prefix/lib"
|
|
fi
|
|
else
|
|
AC_PATH_PROG([PORT],port,)
|
|
dnl if homebrew isn't installed and macports is, add the macports default paths
|
|
dnl as a last resort.
|
|
if test x$PORT != x; then
|
|
CPPFLAGS="$CPPFLAGS -isystem /opt/local/include"
|
|
LDFLAGS="$LDFLAGS -L/opt/local/lib"
|
|
fi
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
CFLAGS="$CFLAGS -W"
|
|
|
|
warn_CFLAGS="-std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings"
|
|
saved_CFLAGS="$CFLAGS"
|
|
CFLAGS="$CFLAGS $warn_CFLAGS"
|
|
AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}])
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
|
[ AC_MSG_RESULT([yes]) ],
|
|
[ AC_MSG_RESULT([no])
|
|
CFLAGS="$saved_CFLAGS"
|
|
])
|
|
|
|
saved_CFLAGS="$CFLAGS"
|
|
CFLAGS="$CFLAGS -fvisibility=hidden"
|
|
AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
|
[ AC_MSG_RESULT([yes]) ],
|
|
[ AC_MSG_RESULT([no])
|
|
CFLAGS="$saved_CFLAGS"
|
|
])
|
|
|
|
AC_ARG_ENABLE(benchmark,
|
|
AS_HELP_STRING([--enable-benchmark],[compile benchmark (default is yes)]),
|
|
[use_benchmark=$enableval],
|
|
[use_benchmark=yes])
|
|
|
|
AC_ARG_ENABLE(coverage,
|
|
AS_HELP_STRING([--enable-coverage],[enable compiler flags to support kcov coverage analysis]),
|
|
[enable_coverage=$enableval],
|
|
[enable_coverage=no])
|
|
|
|
AC_ARG_ENABLE(tests,
|
|
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
|
|
[use_tests=$enableval],
|
|
[use_tests=yes])
|
|
|
|
AC_ARG_ENABLE(openssl_tests,
|
|
AS_HELP_STRING([--enable-openssl-tests],[enable OpenSSL tests, if OpenSSL is available (default is auto)]),
|
|
[enable_openssl_tests=$enableval],
|
|
[enable_openssl_tests=auto])
|
|
|
|
AC_ARG_ENABLE(experimental,
|
|
AS_HELP_STRING([--enable-experimental],[allow experimental configure options (default is no)]),
|
|
[use_experimental=$enableval],
|
|
[use_experimental=no])
|
|
|
|
AC_ARG_ENABLE(exhaustive_tests,
|
|
AS_HELP_STRING([--enable-exhaustive-tests],[compile exhaustive tests (default is yes)]),
|
|
[use_exhaustive_tests=$enableval],
|
|
[use_exhaustive_tests=yes])
|
|
|
|
AC_ARG_ENABLE(endomorphism,
|
|
AS_HELP_STRING([--enable-endomorphism],[enable endomorphism (default is no)]),
|
|
[use_endomorphism=$enableval],
|
|
[use_endomorphism=no])
|
|
|
|
AC_ARG_ENABLE(ecmult_static_precomputation,
|
|
AS_HELP_STRING([--enable-ecmult-static-precomputation],[enable precomputed ecmult table for signing (default is yes)]),
|
|
[use_ecmult_static_precomputation=$enableval],
|
|
[use_ecmult_static_precomputation=auto])
|
|
|
|
AC_ARG_ENABLE(module_ecdh,
|
|
AS_HELP_STRING([--enable-module-ecdh],[enable ECDH shared secret computation (experimental)]),
|
|
[enable_module_ecdh=$enableval],
|
|
[enable_module_ecdh=no])
|
|
|
|
AC_ARG_ENABLE(module_recovery,
|
|
AS_HELP_STRING([--enable-module-recovery],[enable ECDSA pubkey recovery module (default is no)]),
|
|
[enable_module_recovery=$enableval],
|
|
[enable_module_recovery=no])
|
|
|
|
AC_ARG_ENABLE(jni,
|
|
AS_HELP_STRING([--enable-jni],[enable libsecp256k1_jni (default is no)]),
|
|
[use_jni=$enableval],
|
|
[use_jni=no])
|
|
|
|
AC_ARG_WITH([field], [AS_HELP_STRING([--with-field=64bit|32bit|auto],
|
|
[Specify Field Implementation. Default is auto])],[req_field=$withval], [req_field=auto])
|
|
|
|
AC_ARG_WITH([bignum], [AS_HELP_STRING([--with-bignum=gmp|no|auto],
|
|
[Specify Bignum Implementation. Default is auto])],[req_bignum=$withval], [req_bignum=auto])
|
|
|
|
AC_ARG_WITH([scalar], [AS_HELP_STRING([--with-scalar=64bit|32bit|auto],
|
|
[Specify scalar implementation. Default is auto])],[req_scalar=$withval], [req_scalar=auto])
|
|
|
|
AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto]
|
|
[Specify assembly optimizations to use. Default is auto (experimental: arm)])],[req_asm=$withval], [req_asm=auto])
|
|
|
|
AC_CHECK_TYPES([__int128])
|
|
|
|
if test x"$enable_coverage" = x"yes"; then
|
|
AC_DEFINE(COVERAGE, 1, [Define this symbol to compile out all VERIFY code])
|
|
CFLAGS="$CFLAGS -O0 --coverage"
|
|
LDFLAGS="--coverage"
|
|
else
|
|
CFLAGS="$CFLAGS -O3"
|
|
fi
|
|
|
|
if test x"$use_ecmult_static_precomputation" != x"no"; then
|
|
# Temporarily switch to an environment for the native compiler
|
|
save_cross_compiling=$cross_compiling
|
|
cross_compiling=no
|
|
SAVE_CC="$CC"
|
|
CC="$CC_FOR_BUILD"
|
|
SAVE_CFLAGS="$CFLAGS"
|
|
CFLAGS="$CFLAGS_FOR_BUILD"
|
|
SAVE_CPPFLAGS="$CPPFLAGS"
|
|
CPPFLAGS="$CPPFLAGS_FOR_BUILD"
|
|
SAVE_LDFLAGS="$LDFLAGS"
|
|
LDFLAGS="$LDFLAGS_FOR_BUILD"
|
|
|
|
warn_CFLAGS_FOR_BUILD="-Wall -Wextra -Wno-unused-function"
|
|
saved_CFLAGS="$CFLAGS"
|
|
CFLAGS="$CFLAGS $warn_CFLAGS_FOR_BUILD"
|
|
AC_MSG_CHECKING([if native ${CC_FOR_BUILD} supports ${warn_CFLAGS_FOR_BUILD}])
|
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
|
|
[ AC_MSG_RESULT([yes]) ],
|
|
[ AC_MSG_RESULT([no])
|
|
CFLAGS="$saved_CFLAGS"
|
|
])
|
|
|
|
AC_MSG_CHECKING([for working native compiler: ${CC_FOR_BUILD}])
|
|
AC_RUN_IFELSE(
|
|
[AC_LANG_PROGRAM([], [])],
|
|
[working_native_cc=yes],
|
|
[working_native_cc=no],[dnl])
|
|
|
|
CFLAGS_FOR_BUILD="$CFLAGS"
|
|
|
|
# Restore the environment
|
|
cross_compiling=$save_cross_compiling
|
|
CC="$SAVE_CC"
|
|
CFLAGS="$SAVE_CFLAGS"
|
|
CPPFLAGS="$SAVE_CPPFLAGS"
|
|
LDFLAGS="$SAVE_LDFLAGS"
|
|
|
|
if test x"$working_native_cc" = x"no"; then
|
|
AC_MSG_RESULT([no])
|
|
set_precomp=no
|
|
m4_define([please_set_for_build], [Please set CC_FOR_BUILD, CFLAGS_FOR_BUILD, CPPFLAGS_FOR_BUILD, and/or LDFLAGS_FOR_BUILD.])
|
|
if test x"$use_ecmult_static_precomputation" = x"yes"; then
|
|
AC_MSG_ERROR([native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
|
|
else
|
|
AC_MSG_WARN([Disabling statically generated ecmult table because the native compiler ${CC_FOR_BUILD} does not produce working binaries. please_set_for_build])
|
|
fi
|
|
else
|
|
AC_MSG_RESULT([yes])
|
|
set_precomp=yes
|
|
fi
|
|
else
|
|
set_precomp=no
|
|
fi
|
|
|
|
if test x"$req_asm" = x"auto"; then
|
|
SECP_64BIT_ASM_CHECK
|
|
if test x"$has_64bit_asm" = x"yes"; then
|
|
set_asm=x86_64
|
|
fi
|
|
if test x"$set_asm" = x; then
|
|
set_asm=no
|
|
fi
|
|
else
|
|
set_asm=$req_asm
|
|
case $set_asm in
|
|
x86_64)
|
|
SECP_64BIT_ASM_CHECK
|
|
if test x"$has_64bit_asm" != x"yes"; then
|
|
AC_MSG_ERROR([x86_64 assembly optimization requested but not available])
|
|
fi
|
|
;;
|
|
arm)
|
|
;;
|
|
no)
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR([invalid assembly optimization selection])
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
if test x"$req_field" = x"auto"; then
|
|
if test x"set_asm" = x"x86_64"; then
|
|
set_field=64bit
|
|
fi
|
|
if test x"$set_field" = x; then
|
|
SECP_INT128_CHECK
|
|
if test x"$has_int128" = x"yes"; then
|
|
set_field=64bit
|
|
fi
|
|
fi
|
|
if test x"$set_field" = x; then
|
|
set_field=32bit
|
|
fi
|
|
else
|
|
set_field=$req_field
|
|
case $set_field in
|
|
64bit)
|
|
if test x"$set_asm" != x"x86_64"; then
|
|
SECP_INT128_CHECK
|
|
if test x"$has_int128" != x"yes"; then
|
|
AC_MSG_ERROR([64bit field explicitly requested but neither __int128 support or x86_64 assembly available])
|
|
fi
|
|
fi
|
|
;;
|
|
32bit)
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR([invalid field implementation selection])
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
if test x"$req_scalar" = x"auto"; then
|
|
SECP_INT128_CHECK
|
|
if test x"$has_int128" = x"yes"; then
|
|
set_scalar=64bit
|
|
fi
|
|
if test x"$set_scalar" = x; then
|
|
set_scalar=32bit
|
|
fi
|
|
else
|
|
set_scalar=$req_scalar
|
|
case $set_scalar in
|
|
64bit)
|
|
SECP_INT128_CHECK
|
|
if test x"$has_int128" != x"yes"; then
|
|
AC_MSG_ERROR([64bit scalar explicitly requested but __int128 support not available])
|
|
fi
|
|
;;
|
|
32bit)
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR([invalid scalar implementation selected])
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
if test x"$req_bignum" = x"auto"; then
|
|
SECP_GMP_CHECK
|
|
if test x"$has_gmp" = x"yes"; then
|
|
set_bignum=gmp
|
|
fi
|
|
|
|
if test x"$set_bignum" = x; then
|
|
set_bignum=no
|
|
fi
|
|
else
|
|
set_bignum=$req_bignum
|
|
case $set_bignum in
|
|
gmp)
|
|
SECP_GMP_CHECK
|
|
if test x"$has_gmp" != x"yes"; then
|
|
AC_MSG_ERROR([gmp bignum explicitly requested but libgmp not available])
|
|
fi
|
|
;;
|
|
no)
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR([invalid bignum implementation selection])
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
# select assembly optimization
|
|
use_external_asm=no
|
|
|
|
case $set_asm in
|
|
x86_64)
|
|
AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations])
|
|
;;
|
|
arm)
|
|
use_external_asm=yes
|
|
;;
|
|
no)
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR([invalid assembly optimizations])
|
|
;;
|
|
esac
|
|
|
|
# select field implementation
|
|
case $set_field in
|
|
64bit)
|
|
AC_DEFINE(USE_FIELD_5X52, 1, [Define this symbol to use the FIELD_5X52 implementation])
|
|
;;
|
|
32bit)
|
|
AC_DEFINE(USE_FIELD_10X26, 1, [Define this symbol to use the FIELD_10X26 implementation])
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR([invalid field implementation])
|
|
;;
|
|
esac
|
|
|
|
# select bignum implementation
|
|
case $set_bignum in
|
|
gmp)
|
|
AC_DEFINE(HAVE_LIBGMP, 1, [Define this symbol if libgmp is installed])
|
|
AC_DEFINE(USE_NUM_GMP, 1, [Define this symbol to use the gmp implementation for num])
|
|
AC_DEFINE(USE_FIELD_INV_NUM, 1, [Define this symbol to use the num-based field inverse implementation])
|
|
AC_DEFINE(USE_SCALAR_INV_NUM, 1, [Define this symbol to use the num-based scalar inverse implementation])
|
|
;;
|
|
no)
|
|
AC_DEFINE(USE_NUM_NONE, 1, [Define this symbol to use no num implementation])
|
|
AC_DEFINE(USE_FIELD_INV_BUILTIN, 1, [Define this symbol to use the native field inverse implementation])
|
|
AC_DEFINE(USE_SCALAR_INV_BUILTIN, 1, [Define this symbol to use the native scalar inverse implementation])
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR([invalid bignum implementation])
|
|
;;
|
|
esac
|
|
|
|
#select scalar implementation
|
|
case $set_scalar in
|
|
64bit)
|
|
AC_DEFINE(USE_SCALAR_4X64, 1, [Define this symbol to use the 4x64 scalar implementation])
|
|
;;
|
|
32bit)
|
|
AC_DEFINE(USE_SCALAR_8X32, 1, [Define this symbol to use the 8x32 scalar implementation])
|
|
;;
|
|
*)
|
|
AC_MSG_ERROR([invalid scalar implementation])
|
|
;;
|
|
esac
|
|
|
|
if test x"$use_tests" = x"yes"; then
|
|
SECP_OPENSSL_CHECK
|
|
if test x"$has_openssl_ec" = x"yes"; then
|
|
if test x"$enable_openssl_tests" != x"no"; then
|
|
AC_DEFINE(ENABLE_OPENSSL_TESTS, 1, [Define this symbol if OpenSSL EC functions are available])
|
|
SECP_TEST_INCLUDES="$SSL_CFLAGS $CRYPTO_CFLAGS"
|
|
SECP_TEST_LIBS="$CRYPTO_LIBS"
|
|
|
|
case $host in
|
|
*mingw*)
|
|
SECP_TEST_LIBS="$SECP_TEST_LIBS -lgdi32"
|
|
;;
|
|
esac
|
|
fi
|
|
else
|
|
if test x"$enable_openssl_tests" = x"yes"; then
|
|
AC_MSG_ERROR([OpenSSL tests requested but OpenSSL with EC support is not available])
|
|
fi
|
|
fi
|
|
else
|
|
if test x"$enable_openssl_tests" = x"yes"; then
|
|
AC_MSG_ERROR([OpenSSL tests requested but tests are not enabled])
|
|
fi
|
|
fi
|
|
|
|
if test x"$use_jni" != x"no"; then
|
|
AX_JNI_INCLUDE_DIR
|
|
have_jni_dependencies=yes
|
|
if test x"$enable_module_ecdh" = x"no"; then
|
|
have_jni_dependencies=no
|
|
fi
|
|
if test "x$JNI_INCLUDE_DIRS" = "x"; then
|
|
have_jni_dependencies=no
|
|
fi
|
|
if test "x$have_jni_dependencies" = "xno"; then
|
|
if test x"$use_jni" = x"yes"; then
|
|
AC_MSG_ERROR([jni support explicitly requested but headers/dependencies were not found. Enable ECDH and try again.])
|
|
fi
|
|
AC_MSG_WARN([jni headers/dependencies not found. jni support disabled])
|
|
use_jni=no
|
|
else
|
|
use_jni=yes
|
|
for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do
|
|
JNI_INCLUDES="$JNI_INCLUDES -I$JNI_INCLUDE_DIR"
|
|
done
|
|
fi
|
|
fi
|
|
|
|
if test x"$set_bignum" = x"gmp"; then
|
|
SECP_LIBS="$SECP_LIBS $GMP_LIBS"
|
|
SECP_INCLUDES="$SECP_INCLUDES $GMP_CPPFLAGS"
|
|
fi
|
|
|
|
if test x"$use_endomorphism" = x"yes"; then
|
|
AC_DEFINE(USE_ENDOMORPHISM, 1, [Define this symbol to use endomorphism optimization])
|
|
fi
|
|
|
|
if test x"$set_precomp" = x"yes"; then
|
|
AC_DEFINE(USE_ECMULT_STATIC_PRECOMPUTATION, 1, [Define this symbol to use a statically generated ecmult table])
|
|
fi
|
|
|
|
if test x"$enable_module_ecdh" = x"yes"; then
|
|
AC_DEFINE(ENABLE_MODULE_ECDH, 1, [Define this symbol to enable the ECDH module])
|
|
fi
|
|
|
|
if test x"$enable_module_recovery" = x"yes"; then
|
|
AC_DEFINE(ENABLE_MODULE_RECOVERY, 1, [Define this symbol to enable the ECDSA pubkey recovery module])
|
|
fi
|
|
|
|
AC_C_BIGENDIAN()
|
|
|
|
if test x"$use_external_asm" = x"yes"; then
|
|
AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used])
|
|
fi
|
|
|
|
if test x"$enable_experimental" = x"yes"; then
|
|
AC_MSG_NOTICE([******])
|
|
AC_MSG_NOTICE([WARNING: experimental build])
|
|
AC_MSG_NOTICE([Experimental features do not have stable APIs or properties, and may not be safe for production use.])
|
|
AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh])
|
|
AC_MSG_NOTICE([******])
|
|
else
|
|
if test x"$enable_module_ecdh" = x"yes"; then
|
|
AC_MSG_ERROR([ECDH module is experimental. Use --enable-experimental to allow.])
|
|
fi
|
|
if test x"$set_asm" = x"arm"; then
|
|
AC_MSG_ERROR([ARM assembly optimization is experimental. Use --enable-experimental to allow.])
|
|
fi
|
|
fi
|
|
|
|
AC_CONFIG_HEADERS([src/libsecp256k1-config.h])
|
|
AC_CONFIG_FILES([Makefile libsecp256k1.pc])
|
|
AC_SUBST(JNI_INCLUDES)
|
|
AC_SUBST(SECP_INCLUDES)
|
|
AC_SUBST(SECP_LIBS)
|
|
AC_SUBST(SECP_TEST_LIBS)
|
|
AC_SUBST(SECP_TEST_INCLUDES)
|
|
AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"])
|
|
AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])
|
|
AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"])
|
|
AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
|
|
AM_CONDITIONAL([USE_ECMULT_STATIC_PRECOMPUTATION], [test x"$set_precomp" = x"yes"])
|
|
AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
|
|
AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
|
|
AM_CONDITIONAL([USE_JNI], [test x"$use_jni" = x"yes"])
|
|
AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"])
|
|
AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"])
|
|
|
|
dnl make sure nothing new is exported so that we don't break the cache
|
|
PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
|
|
unset PKG_CONFIG_PATH
|
|
PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP"
|
|
|
|
AC_OUTPUT
|
|
|
|
echo
|
|
echo "Build Options:"
|
|
echo " with endomorphism = $use_endomorphism"
|
|
echo " with ecmult precomp = $set_precomp"
|
|
echo " with jni = $use_jni"
|
|
echo " with benchmarks = $use_benchmark"
|
|
echo " with coverage = $enable_coverage"
|
|
echo " module ecdh = $enable_module_ecdh"
|
|
echo " module recovery = $enable_module_recovery"
|
|
echo
|
|
echo " asm = $set_asm"
|
|
echo " bignum = $set_bignum"
|
|
echo " field = $set_field"
|
|
echo " scalar = $set_scalar"
|
|
echo
|
|
echo " CC = $CC"
|
|
echo " CFLAGS = $CFLAGS"
|
|
echo " CPPFLAGS = $CPPFLAGS"
|
|
echo " LDFLAGS = $LDFLAGS"
|
|
echo
|