aboutsummaryrefslogtreecommitdiff
path: root/src/secp256k1/build-aux/m4
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-12-11 01:58:25 +0100
committerPieter Wuille <pieter.wuille@gmail.com>2014-12-11 01:58:25 +0100
commit253e2071327266f2adf73c3869eed85a76507216 (patch)
tree71dec0c131379366547da62dfe77c45a5ddbe445 /src/secp256k1/build-aux/m4
parent34468066ff54881eedd06e9aca39c3aa455cfe7c (diff)
parentecae2acb06d44509425a9cdad38ed9a5bce15cbe (diff)
downloadbitcoin-253e2071327266f2adf73c3869eed85a76507216.tar.xz
Update libsecp256k1
Diffstat (limited to 'src/secp256k1/build-aux/m4')
-rw-r--r--src/secp256k1/build-aux/m4/bitcoin_secp.m451
1 files changed, 17 insertions, 34 deletions
diff --git a/src/secp256k1/build-aux/m4/bitcoin_secp.m4 b/src/secp256k1/build-aux/m4/bitcoin_secp.m4
index 4ca28f99cf..1373478c9c 100644
--- a/src/secp256k1/build-aux/m4/bitcoin_secp.m4
+++ b/src/secp256k1/build-aux/m4/bitcoin_secp.m4
@@ -11,38 +11,16 @@ fi
dnl
AC_DEFUN([SECP_64BIT_ASM_CHECK],[
-if test x"$host_cpu" == x"x86_64"; then
- AC_CHECK_PROG(YASM, yasm, yasm)
-else
- if test x"$set_field" = x"64bit_asm"; then
- AC_MSG_ERROR([$set_field field support explicitly requested but is not compatible with this host])
- fi
-fi
-if test x$YASM = x; then
- if test x"$set_field" = x"64bit_asm"; then
- AC_MSG_ERROR([$set_field field support explicitly requested but yasm was not found])
- fi
- has_64bit_asm=no
-else
- case x"$host_os" in
- xdarwin*)
- YASM_BINFMT=macho64
- ;;
- x*-gnux32)
- YASM_BINFMT=elfx32
- ;;
- *)
- YASM_BINFMT=elf64
- ;;
- esac
- if $YASM -f help | grep -q $YASM_BINFMT; then
- has_64bit_asm=yes
- else
- if test x"$set_field" = x"64bit_asm"; then
- AC_MSG_ERROR([$set_field field support explicitly requested but yasm doesn't support $YASM_BINFMT format])
- fi
- AC_MSG_WARN([yasm too old for $YASM_BINFMT format])
- has_64bit_asm=no
+AC_MSG_CHECKING(for x86_64 assembly availability)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <stdint.h>]],[[
+ uint64_t a = 11, tmp;
+ __asm__ __volatile__("movq $0x100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx");
+ ]])],[has_64bit_asm=yes],[has_64bit_asm=no])
+AC_MSG_RESULT([$has_64bit_asm])
+if test x"$set_field" == x"64bit_asm"; then
+ if test x"$has_64bit_asm" == x"no"; then
+ AC_MSG_ERROR([$set_field field support explicitly requested but no x86_64 assembly available])
fi
fi
])
@@ -52,8 +30,13 @@ AC_DEFUN([SECP_OPENSSL_CHECK],[
if test x"$use_pkgconfig" = x"yes"; then
: #NOP
m4_ifdef([PKG_CHECK_MODULES],[
- PKG_CHECK_MODULES([CRYPTO], [libcrypto], [has_libcrypto=yes; AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])],[has_libcrypto=no])
- : #NOP
+ PKG_CHECK_MODULES([CRYPTO], [libcrypto], [has_libcrypto=yes],[has_libcrypto=no])
+ if test x"$has_libcrypto" = x"yes"; then
+ TEMP_LIBS="$LIBS"
+ LIBS="$LIBS $CRYPTO_LIBS"
+ AC_CHECK_LIB(crypto, main,[AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])],[has_libcrypto=no])
+ LIBS="$TEMP_LIBS"
+ fi
])
else
AC_CHECK_HEADER(openssl/crypto.h,[AC_CHECK_LIB(crypto, main,[has_libcrypto=yes; CRYPTO_LIBS=-lcrypto; AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])]