diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2014-12-04 19:17:07 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2014-12-04 19:17:07 +0100 |
commit | 0dcfb91d5603f2212536d78260a3f2b16cb05a34 (patch) | |
tree | a6203ba53b1cfd074a527536f04674624a956192 /src/secp256k1/configure.ac | |
parent | ffe3291466b5760e4179d604c54093717b127cc5 (diff) | |
parent | 87bddb7a3a83aaad96b5b54b4bac34d8a71b3810 (diff) |
Update libsecp256k1
Diffstat (limited to 'src/secp256k1/configure.ac')
-rw-r--r-- | src/secp256k1/configure.ac | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/src/secp256k1/configure.ac b/src/secp256k1/configure.ac index 2da5709834..6e6fccd7fd 100644 --- a/src/secp256k1/configure.ac +++ b/src/secp256k1/configure.ac @@ -33,10 +33,35 @@ case $host in esac case $host_os in - darwin*) - CPPFLAGS="$CPPFLAGS -I/opt/local/include" - LDFLAGS="$LDFLAGS -L/opt/local/lib" - ;; + *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" @@ -70,7 +95,7 @@ AC_ARG_ENABLE(endomorphism, AC_ARG_WITH([field], [AS_HELP_STRING([--with-field=gmp|64bit|64bit_asm|32bit|auto], [Specify Field Implementation. Default is auto])],[req_field=$withval], [req_field=auto]) -AC_ARG_WITH([bignum], [AS_HELP_STRING([--with-bignum=gmp|auto], +AC_ARG_WITH([bignum], [AS_HELP_STRING([--with-bignum=gmp|none|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], @@ -154,7 +179,7 @@ if test x"$req_bignum" = x"auto"; then fi if test x"$set_bignum" = x; then - AC_MSG_ERROR([no working bignum implementation found]) + set_bignum=none fi else set_bignum=$req_bignum @@ -162,8 +187,7 @@ else gmp) SECP_GMP_CHECK ;; - openssl) - SECP_OPENSSL_CHECK + none) ;; *) AC_MSG_ERROR([invalid bignum implementation selection]) @@ -196,9 +220,15 @@ 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]) - AC_DEFINE(USE_FIELD_INV_NUM, 1, [Define this symbol to use the USE_FIELD_INV_NUM implementation]) + 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]) + ;; +none) + 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]) @@ -236,10 +266,11 @@ fi if test x"$set_field" = x"gmp" || 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]) + AC_DEFINE(USE_ENDOMORPHISM, 1, [Define this symbol to use endomorphism optimization]) fi AC_MSG_NOTICE([Using field implementation: $set_field]) @@ -256,4 +287,10 @@ AC_SUBST(YASM_BINFMT) AM_CONDITIONAL([USE_ASM], [test x"$set_field" == x"64bit_asm"]) AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"]) AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" != x"no"]) + +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 |