Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/configure.ac
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | case $host_os in | ||||
*darwin*) | *darwin*) | ||||
if test x$cross_compiling != xyes; then | if test x$cross_compiling != xyes; then | ||||
AC_PATH_PROG([BREW],brew,) | AC_PATH_PROG([BREW],brew,) | ||||
if test x$BREW != x; then | if test x$BREW != x; then | ||||
# These Homebrew packages may be keg-only, meaning that they won't be found | # These Homebrew packages may be keg-only, meaning that they won't be found | ||||
# in expected paths because they may conflict with system files. Ask | # in expected paths because they may conflict with system files. Ask | ||||
# Homebrew where each one is located, then adjust paths accordingly. | # Homebrew where each one is located, then adjust paths accordingly. | ||||
openssl_prefix=`$BREW --prefix openssl 2>/dev/null` | openssl_prefix=`$BREW --prefix openssl 2>/dev/null` | ||||
gmp_prefix=`$BREW --prefix gmp 2>/dev/null` | |||||
valgrind_prefix=`$BREW --prefix valgrind 2>/dev/null` | valgrind_prefix=`$BREW --prefix valgrind 2>/dev/null` | ||||
if test x$openssl_prefix != x; then | if test x$openssl_prefix != x; then | ||||
PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" | PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" | ||||
export PKG_CONFIG_PATH | export PKG_CONFIG_PATH | ||||
CRYPTO_CPPFLAGS="-I$openssl_prefix/include" | CRYPTO_CPPFLAGS="-I$openssl_prefix/include" | ||||
fi | fi | ||||
if test x$gmp_prefix != x; then | |||||
GMP_CPPFLAGS="-I$gmp_prefix/include" | |||||
GMP_LIBS="-L$gmp_prefix/lib" | |||||
fi | |||||
if test x$valgrind_prefix != x; then | if test x$valgrind_prefix != x; then | ||||
VALGRIND_CPPFLAGS="-I$valgrind_prefix/include" | VALGRIND_CPPFLAGS="-I$valgrind_prefix/include" | ||||
fi | fi | ||||
else | else | ||||
AC_PATH_PROG([PORT],port,) | AC_PATH_PROG([PORT],port,) | ||||
# If homebrew isn't installed and macports is, add the macports default paths | # If homebrew isn't installed and macports is, add the macports default paths | ||||
# as a last resort. | # as a last resort. | ||||
if test x$PORT != x; then | if test x$PORT != x; then | ||||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | |||||
# Legal values are int64 (for [u]int64_t), int128 (for [unsigned] __int128), and auto (the default). | # Legal values are int64 (for [u]int64_t), int128 (for [unsigned] __int128), and auto (the default). | ||||
AC_ARG_WITH([test-override-wide-multiply], [] ,[set_widemul=$withval], [set_widemul=auto]) | AC_ARG_WITH([test-override-wide-multiply], [] ,[set_widemul=$withval], [set_widemul=auto]) | ||||
AC_ARG_ENABLE(jni, | AC_ARG_ENABLE(jni, | ||||
AS_HELP_STRING([--enable-jni],[enable libsecp256k1_jni [default=no]]), | AS_HELP_STRING([--enable-jni],[enable libsecp256k1_jni [default=no]]), | ||||
[use_jni=$enableval], | [use_jni=$enableval], | ||||
[use_jni=no]) | [use_jni=no]) | ||||
AC_ARG_WITH([bignum], [AS_HELP_STRING([--with-bignum=gmp|no|auto], | |||||
[bignum implementation to use [default=auto]])],[req_bignum=$withval], [req_bignum=auto]) | |||||
AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto], | AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto], | ||||
[assembly optimizations to use (experimental: arm) [default=auto]])],[req_asm=$withval], [req_asm=auto]) | [assembly optimizations to use (experimental: arm) [default=auto]])],[req_asm=$withval], [req_asm=auto]) | ||||
AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto], | AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE|auto], | ||||
[window size for ecmult precomputation for verification, specified as integer in range [2..24].] | [window size for ecmult precomputation for verification, specified as integer in range [2..24].] | ||||
[Larger values result in possibly better performance at the cost of an exponentially larger precomputed table.] | [Larger values result in possibly better performance at the cost of an exponentially larger precomputed table.] | ||||
[The table will store 2^(SIZE-1) * 64 bytes of data but can be larger in memory due to platform-specific padding and alignment.] | [The table will store 2^(SIZE-1) * 64 bytes of data but can be larger in memory due to platform-specific padding and alignment.] | ||||
["auto" is a reasonable setting for desktop machines (currently 15). [default=auto]] | ["auto" is a reasonable setting for desktop machines (currently 15). [default=auto]] | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | else | ||||
no) | no) | ||||
;; | ;; | ||||
*) | *) | ||||
AC_MSG_ERROR([invalid assembly optimization selection]) | AC_MSG_ERROR([invalid assembly optimization selection]) | ||||
;; | ;; | ||||
esac | esac | ||||
fi | 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 | # Select assembly optimization | ||||
use_external_asm=no | use_external_asm=no | ||||
case $set_asm in | case $set_asm in | ||||
x86_64) | x86_64) | ||||
AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations]) | AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations]) | ||||
;; | ;; | ||||
arm) | arm) | ||||
Show All 21 Lines | int64) | ||||
;; | ;; | ||||
auto) | auto) | ||||
;; | ;; | ||||
*) | *) | ||||
AC_MSG_ERROR([invalid wide multiplication implementation]) | AC_MSG_ERROR([invalid wide multiplication implementation]) | ||||
;; | ;; | ||||
esac | 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 | |||||
# Set ecmult window size | # Set ecmult window size | ||||
if test x"$req_ecmult_window" = x"auto"; then | if test x"$req_ecmult_window" = x"auto"; then | ||||
set_ecmult_window=15 | set_ecmult_window=15 | ||||
else | else | ||||
set_ecmult_window=$req_ecmult_window | set_ecmult_window=$req_ecmult_window | ||||
fi | fi | ||||
error_window_size=['window size for ecmult precomputation not an integer in range [2..24] or "auto"'] | error_window_size=['window size for ecmult precomputation not an integer in range [2..24] or "auto"'] | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | if test x"$use_jni" != x"no"; then | ||||
else | else | ||||
use_jni=yes | use_jni=yes | ||||
for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do | for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do | ||||
JNI_INCLUDES="$JNI_INCLUDES -I$JNI_INCLUDE_DIR" | JNI_INCLUDES="$JNI_INCLUDES -I$JNI_INCLUDE_DIR" | ||||
done | done | ||||
fi | fi | ||||
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"$enable_valgrind" = x"yes"; then | if test x"$enable_valgrind" = x"yes"; then | ||||
SECP_INCLUDES="$SECP_INCLUDES $VALGRIND_CPPFLAGS" | SECP_INCLUDES="$SECP_INCLUDES $VALGRIND_CPPFLAGS" | ||||
fi | fi | ||||
# Handle static precomputation (after everything which modifies CFLAGS and friends) | # Handle static precomputation (after everything which modifies CFLAGS and friends) | ||||
if test x"$use_ecmult_static_precomputation" != x"no"; then | if test x"$use_ecmult_static_precomputation" != x"no"; then | ||||
if test x"$cross_compiling" = x"no"; then | if test x"$cross_compiling" = x"no"; then | ||||
set_precomp=yes | set_precomp=yes | ||||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | |||||
echo " module ecdh = $enable_module_ecdh" | echo " module ecdh = $enable_module_ecdh" | ||||
echo " module recovery = $enable_module_recovery" | echo " module recovery = $enable_module_recovery" | ||||
echo " module multiset = $enable_module_multiset" | echo " module multiset = $enable_module_multiset" | ||||
echo " module schnorr = $enable_module_schnorr" | echo " module schnorr = $enable_module_schnorr" | ||||
echo " module extrakeys = $enable_module_extrakeys" | echo " module extrakeys = $enable_module_extrakeys" | ||||
echo " module schnorrsig = $enable_module_schnorrsig" | echo " module schnorrsig = $enable_module_schnorrsig" | ||||
echo | echo | ||||
echo " asm = $set_asm" | echo " asm = $set_asm" | ||||
echo " bignum = $set_bignum" | |||||
echo " ecmult window size = $set_ecmult_window" | echo " ecmult window size = $set_ecmult_window" | ||||
echo " ecmult gen prec. bits = $set_ecmult_gen_precision" | echo " ecmult gen prec. bits = $set_ecmult_gen_precision" | ||||
# Hide test-only options unless they're used. | # Hide test-only options unless they're used. | ||||
if test x"$set_widemul" != xauto; then | if test x"$set_widemul" != xauto; then | ||||
echo " wide multiplication = $set_widemul" | echo " wide multiplication = $set_widemul" | ||||
fi | fi | ||||
echo | echo | ||||
echo " valgrind = $enable_valgrind" | echo " valgrind = $enable_valgrind" | ||||
Show All 11 Lines |