@@ -29,6 +29,7 @@ AC_PROG_CC_C89
2929if test x"$ac_cv_prog_cc_c89" = x"no"; then
3030 AC_MSG_ERROR ( [ c89 compiler support required] )
3131fi
32+ AM_PROG_AS
3233
3334case $host_os in
3435 *darwin*)
@@ -137,8 +138,8 @@ AC_ARG_WITH([bignum], [AS_HELP_STRING([--with-bignum=gmp|no|auto],
137138AC_ARG_WITH ( [ scalar] , [ AS_HELP_STRING ( [ --with-scalar=64bit|32bit|auto] ,
138139[ Specify scalar implementation. Default is auto] ) ] ,[ req_scalar=$withval] , [ req_scalar=auto] )
139140
140- AC_ARG_WITH ( [ asm] , [ AS_HELP_STRING ( [ --with-asm=x86_64|no|auto]
141- [ Specify assembly optimizations to use. Default is auto] ) ] ,[ req_asm=$withval] , [ req_asm=auto] )
141+ AC_ARG_WITH ( [ asm] , [ AS_HELP_STRING ( [ --with-asm=x86_64|arm| no|auto]
142+ [ Specify assembly optimizations to use. Default is auto (experimental: arm) ] ) ] ,[ req_asm=$withval] , [ req_asm=auto] )
142143
143144AC_CHECK_TYPES ( [ __int128] )
144145
165166 AC_MSG_ERROR ( [ x86_64 assembly optimization requested but not available] )
166167 fi
167168 ;;
169+ arm)
170+ ;;
168171 no)
169172 ;;
170173 *)
@@ -257,10 +260,15 @@ else
257260fi
258261
259262# select assembly optimization
263+ use_external_asm=no
264+
260265case $set_asm in
261266x86_64)
262267 AC_DEFINE ( USE_ASM_X86_64 , 1 , [ Define this symbol to enable x86_64 assembly optimizations] )
263268 ;;
269+ arm)
270+ use_external_asm=yes
271+ ;;
264272no)
265273 ;;
266274*)
371379
372380AC_C_BIGENDIAN ( )
373381
382+ if test x"$use_external_asm" = x"yes"; then
383+ AC_DEFINE ( USE_EXTERNAL_ASM , 1 , [ Define this symbol if an external (non-inline) assembly implementation is used] )
384+ fi
385+
374386AC_MSG_NOTICE ( [ Using assembly optimizations: $set_asm] )
375387AC_MSG_NOTICE ( [ Using field implementation: $set_field] )
376388AC_MSG_NOTICE ( [ Using bignum implementation: $set_bignum] )
395407 if test x"$enable_module_ecdh" = x"yes"; then
396408 AC_MSG_ERROR ( [ ECDH module is experimental. Use --enable-experimental to allow.] )
397409 fi
410+ if test x"$set_asm" = x"arm"; then
411+ AC_MSG_ERROR ( [ ARM assembly optimization is experimental. Use --enable-experimental to allow.] )
412+ fi
398413fi
399414
400415AC_CONFIG_HEADERS ( [ src/libsecp256k1-config.h] )
@@ -411,6 +426,8 @@ AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
411426AM_CONDITIONAL([ ENABLE_MODULE_SCHNORR] , [ test x"$enable_module_schnorr" = x"yes"] )
412427AM_CONDITIONAL([ ENABLE_MODULE_RECOVERY] , [ test x"$enable_module_recovery" = x"yes"] )
413428AM_CONDITIONAL([ USE_JNI] , [ test x"$use_jni" == x"yes"] )
429+ AM_CONDITIONAL([ USE_EXTERNAL_ASM] , [ test x"$use_external_asm" = x"yes"] )
430+ AM_CONDITIONAL([ USE_ASM_ARM] , [ test x"$set_asm" = x"arm"] )
414431
415432dnl make sure nothing new is exported so that we don't break the cache
416433PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
0 commit comments