github.com/luckypickle/go-ethereum-vet@v1.14.2/crypto/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 (about) 1 dnl libsecp25k1 helper checks 2 AC_DEFUN([SECP_INT128_CHECK],[ 3 has_int128=$ac_cv_type___int128 4 ]) 5 6 dnl escape "$0x" below using the m4 quadrigaph @S|@, and escape it again with a \ for the shell. 7 AC_DEFUN([SECP_64BIT_ASM_CHECK],[ 8 AC_MSG_CHECKING(for x86_64 assembly availability) 9 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 10 #include <stdint.h>]],[[ 11 uint64_t a = 11, tmp; 12 __asm__ __volatile__("movq \@S|@0x100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx"); 13 ]])],[has_64bit_asm=yes],[has_64bit_asm=no]) 14 AC_MSG_RESULT([$has_64bit_asm]) 15 ]) 16 17 dnl 18 AC_DEFUN([SECP_OPENSSL_CHECK],[ 19 has_libcrypto=no 20 m4_ifdef([PKG_CHECK_MODULES],[ 21 PKG_CHECK_MODULES([CRYPTO], [libcrypto], [has_libcrypto=yes],[has_libcrypto=no]) 22 if test x"$has_libcrypto" = x"yes"; then 23 TEMP_LIBS="$LIBS" 24 LIBS="$LIBS $CRYPTO_LIBS" 25 AC_CHECK_LIB(crypto, main,[AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])],[has_libcrypto=no]) 26 LIBS="$TEMP_LIBS" 27 fi 28 ]) 29 if test x$has_libcrypto = xno; then 30 AC_CHECK_HEADER(openssl/crypto.h,[ 31 AC_CHECK_LIB(crypto, main,[ 32 has_libcrypto=yes 33 CRYPTO_LIBS=-lcrypto 34 AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed]) 35 ]) 36 ]) 37 LIBS= 38 fi 39 if test x"$has_libcrypto" = x"yes" && test x"$has_openssl_ec" = x; then 40 AC_MSG_CHECKING(for EC functions in libcrypto) 41 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 42 #include <openssl/ec.h> 43 #include <openssl/ecdsa.h> 44 #include <openssl/obj_mac.h>]],[[ 45 EC_KEY *eckey = EC_KEY_new_by_curve_name(NID_secp256k1); 46 ECDSA_sign(0, NULL, 0, NULL, NULL, eckey); 47 ECDSA_verify(0, NULL, 0, NULL, 0, eckey); 48 EC_KEY_free(eckey); 49 ECDSA_SIG *sig_openssl; 50 sig_openssl = ECDSA_SIG_new(); 51 (void)sig_openssl->r; 52 ECDSA_SIG_free(sig_openssl); 53 ]])],[has_openssl_ec=yes],[has_openssl_ec=no]) 54 AC_MSG_RESULT([$has_openssl_ec]) 55 fi 56 ]) 57 58 dnl 59 AC_DEFUN([SECP_GMP_CHECK],[ 60 if test x"$has_gmp" != x"yes"; then 61 CPPFLAGS_TEMP="$CPPFLAGS" 62 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS" 63 LIBS_TEMP="$LIBS" 64 LIBS="$GMP_LIBS $LIBS" 65 AC_CHECK_HEADER(gmp.h,[AC_CHECK_LIB(gmp, __gmpz_init,[has_gmp=yes; GMP_LIBS="$GMP_LIBS -lgmp"; AC_DEFINE(HAVE_LIBGMP,1,[Define this symbol if libgmp is installed])])]) 66 CPPFLAGS="$CPPFLAGS_TEMP" 67 LIBS="$LIBS_TEMP" 68 fi 69 ])