@@ -85,9 +85,9 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])],
8585 ] )
8686
8787AC_ARG_ENABLE ( benchmark ,
88- AS_HELP_STRING ( [ --enable-benchmark] ,[ compile benchmark (default is no )] ) ,
88+ AS_HELP_STRING ( [ --enable-benchmark] ,[ compile benchmark (default is yes )] ) ,
8989 [ use_benchmark=$enableval] ,
90- [ use_benchmark=no ] )
90+ [ use_benchmark=yes ] )
9191
9292AC_ARG_ENABLE ( coverage ,
9393 AS_HELP_STRING ( [ --enable-coverage] ,[ enable compiler flags to support kcov coverage analysis] ) ,
@@ -134,10 +134,30 @@ AC_ARG_ENABLE(module_recovery,
134134 [ enable_module_recovery=$enableval] ,
135135 [ enable_module_recovery=no] )
136136
137+ AC_ARG_ENABLE ( module_generator ,
138+ AS_HELP_STRING ( [ --enable-module-generator] ,[ enable NUMS generator module (default is no)] ) ,
139+ [ enable_module_generator=$enableval] ,
140+ [ enable_module_generator=no] )
141+
142+ AC_ARG_ENABLE ( module_rangeproof ,
143+ AS_HELP_STRING ( [ --enable-module-rangeproof] ,[ enable Pedersen / zero-knowledge range proofs module (default is no)] ) ,
144+ [ enable_module_rangeproof=$enableval] ,
145+ [ enable_module_rangeproof=no] )
146+
147+ AC_ARG_ENABLE ( module_whitelist ,
148+ AS_HELP_STRING ( [ --enable-module-whitelist] ,[ enable key whitelisting module (default is no)] ) ,
149+ [ enable_module_whitelist=$enableval] ,
150+ [ enable_module_whitelist=no] )
151+
137152AC_ARG_ENABLE ( jni ,
138- AS_HELP_STRING ( [ --enable-jni] ,[ enable libsecp256k1_jni (default is auto )] ) ,
153+ AS_HELP_STRING ( [ --enable-jni] ,[ enable libsecp256k1_jni (default is no )] ) ,
139154 [ use_jni=$enableval] ,
140- [ use_jni=auto] )
155+ [ use_jni=no] )
156+
157+ AC_ARG_ENABLE ( module_surjectionproof ,
158+ AS_HELP_STRING ( [ --enable-module-surjectionproof] ,[ enable surjection proof module (default is no)] ) ,
159+ [ enable_module_surjectionproof=$enableval] ,
160+ [ enable_module_surjectionproof=no] )
141161
142162AC_ARG_WITH ( [ field] , [ AS_HELP_STRING ( [ --with-field=64bit|32bit|auto] ,
143163[ Specify Field Implementation. Default is auto] ) ] ,[ req_field=$withval] , [ req_field=auto] )
@@ -167,6 +187,12 @@ else
167187 CFLAGS="$CFLAGS -O3"
168188fi
169189
190+ AC_MSG_CHECKING ( [ for __builtin_popcount] )
191+ AC_COMPILE_IFELSE ( [ AC_LANG_SOURCE ( [ [ void myfunc() {__builtin_popcount(0);}] ] ) ] ,
192+ [ AC_MSG_RESULT ( [ yes] ) ;AC_DEFINE ( HAVE_BUILTIN_POPCOUNT ,1 ,[ Define this symbol if __builtin_popcount is available] ) ] ,
193+ [ AC_MSG_RESULT ( [ no] )
194+ ] )
195+
170196if test x"$use_ecmult_static_precomputation" != x"no"; then
171197 save_cross_compiling=$cross_compiling
172198 cross_compiling=no
@@ -195,6 +221,12 @@ else
195221 set_precomp=no
196222fi
197223
224+ AC_MSG_CHECKING ( [ for __builtin_clzll] )
225+ AC_COMPILE_IFELSE ( [ AC_LANG_SOURCE ( [ [ void myfunc() { __builtin_clzll(1);}] ] ) ] ,
226+ [ AC_MSG_RESULT ( [ yes] ) ;AC_DEFINE ( HAVE_BUILTIN_CLZLL ,1 ,[ Define this symbol if __builtin_clzll is available] ) ] ,
227+ [ AC_MSG_RESULT ( [ no] )
228+ ] )
229+
198230if test x"$req_asm" = x"auto"; then
199231 SECP_64BIT_ASM_CHECK
200232 if test x"$has_64bit_asm" = x"yes"; then
@@ -435,6 +467,22 @@ if test x"$enable_module_recovery" = x"yes"; then
435467 AC_DEFINE ( ENABLE_MODULE_RECOVERY , 1 , [ Define this symbol to enable the ECDSA pubkey recovery module] )
436468fi
437469
470+ if test x"$enable_module_generator" = x"yes"; then
471+ AC_DEFINE ( ENABLE_MODULE_GENERATOR , 1 , [ Define this symbol to enable the NUMS generator module] )
472+ fi
473+
474+ if test x"$enable_module_rangeproof" = x"yes"; then
475+ AC_DEFINE ( ENABLE_MODULE_RANGEPROOF , 1 , [ Define this symbol to enable the Pedersen / zero knowledge range proof module] )
476+ fi
477+
478+ if test x"$enable_module_whitelist" = x"yes"; then
479+ AC_DEFINE ( ENABLE_MODULE_WHITELIST , 1 , [ Define this symbol to enable the key whitelisting module] )
480+ fi
481+
482+ if test x"$enable_module_surjectionproof" = x"yes"; then
483+ AC_DEFINE ( ENABLE_MODULE_SURJECTIONPROOF , 1 , [ Define this symbol to enable the surjection proof module] )
484+ fi
485+
438486AC_C_BIGENDIAN ( )
439487
440488if test x"$use_external_asm" = x"yes"; then
@@ -447,6 +495,7 @@ AC_MSG_NOTICE([Using field implementation: $set_field])
447495AC_MSG_NOTICE ( [ Using bignum implementation: $set_bignum] )
448496AC_MSG_NOTICE ( [ Using scalar implementation: $set_scalar] )
449497AC_MSG_NOTICE ( [ Using endomorphism optimizations: $use_endomorphism] )
498+ AC_MSG_NOTICE ( [ Building benchmarks: $use_benchmark] )
450499AC_MSG_NOTICE ( [ Building for coverage analysis: $enable_coverage] )
451500AC_MSG_NOTICE ( [ Building ECDH module: $enable_module_ecdh] )
452501AC_MSG_NOTICE ( [ Building ECDSA pubkey recovery module: $enable_module_recovery] )
@@ -457,14 +506,45 @@ if test x"$enable_experimental" = x"yes"; then
457506 AC_MSG_NOTICE ( [ WARNING: experimental build] )
458507 AC_MSG_NOTICE ( [ Experimental features do not have stable APIs or properties, and may not be safe for production use.] )
459508 AC_MSG_NOTICE ( [ Building ECDH module: $enable_module_ecdh] )
509+ AC_MSG_NOTICE ( [ Building NUMS generator module: $enable_module_generator] )
510+ AC_MSG_NOTICE ( [ Building range proof module: $enable_module_rangeproof] )
511+ AC_MSG_NOTICE ( [ Building key whitelisting module: $enable_module_whitelist] )
512+ AC_MSG_NOTICE ( [ Building surjection proof module: $enable_module_surjectionproof] )
460513 AC_MSG_NOTICE ( [ ******] )
514+
515+ if test x"$enable_module_generator" != x"yes"; then
516+ if test x"$enable_module_rangeproof" = x"yes"; then
517+ AC_MSG_ERROR ( [ Rangeproof module requires the generator module. Use --enable-module-generator to allow.] )
518+ fi
519+ fi
520+
521+ if test x"$enable_module_rangeproof" != x"yes"; then
522+ if test x"$enable_module_whitelist" = x"yes"; then
523+ AC_MSG_ERROR ( [ Whitelist module requires the rangeproof module. Use --enable-module-rangeproof to allow.] )
524+ fi
525+ if test x"$enable_module_surjectionproof" = x"yes"; then
526+ AC_MSG_ERROR ( [ Surjection proof module requires the rangeproof module. Use --enable-module-rangeproof to allow.] )
527+ fi
528+ fi
461529else
462530 if test x"$enable_module_ecdh" = x"yes"; then
463531 AC_MSG_ERROR ( [ ECDH module is experimental. Use --enable-experimental to allow.] )
464532 fi
465533 if test x"$set_asm" = x"arm"; then
466534 AC_MSG_ERROR ( [ ARM assembly optimization is experimental. Use --enable-experimental to allow.] )
467535 fi
536+ if test x"$enable_module_generator" = x"yes"; then
537+ AC_MSG_ERROR ( [ NUMS generator module is experimental. Use --enable-experimental to allow.] )
538+ fi
539+ if test x"$enable_module_rangeproof" = x"yes"; then
540+ AC_MSG_ERROR ( [ Range proof module is experimental. Use --enable-experimental to allow.] )
541+ fi
542+ if test x"$enable_module_whitelist" = x"yes"; then
543+ AC_MSG_ERROR ( [ Key whitelisting module is experimental. Use --enable-experimental to allow.] )
544+ fi
545+ if test x"$enable_module_surjectionproof" = x"yes"; then
546+ AC_MSG_ERROR ( [ Surjection proof module is experimental. Use --enable-experimental to allow.] )
547+ fi
468548fi
469549
470550AC_CONFIG_HEADERS ( [ src/libsecp256k1-config.h] )
@@ -481,9 +561,13 @@ AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
481561AM_CONDITIONAL([ USE_ECMULT_STATIC_PRECOMPUTATION] , [ test x"$set_precomp" = x"yes"] )
482562AM_CONDITIONAL([ ENABLE_MODULE_ECDH] , [ test x"$enable_module_ecdh" = x"yes"] )
483563AM_CONDITIONAL([ ENABLE_MODULE_RECOVERY] , [ test x"$enable_module_recovery" = x"yes"] )
564+ AM_CONDITIONAL([ ENABLE_MODULE_GENERATOR] , [ test x"$enable_module_generator" = x"yes"] )
565+ AM_CONDITIONAL([ ENABLE_MODULE_RANGEPROOF] , [ test x"$enable_module_rangeproof" = x"yes"] )
566+ AM_CONDITIONAL([ ENABLE_MODULE_WHITELIST] , [ test x"$enable_module_whitelist" = x"yes"] )
484567AM_CONDITIONAL([ USE_JNI] , [ test x"$use_jni" == x"yes"] )
485568AM_CONDITIONAL([ USE_EXTERNAL_ASM] , [ test x"$use_external_asm" = x"yes"] )
486569AM_CONDITIONAL([ USE_ASM_ARM] , [ test x"$set_asm" = x"arm"] )
570+ AM_CONDITIONAL([ ENABLE_MODULE_SURJECTIONPROOF] , [ test x"$enable_module_surjectionproof" = x"yes"] )
487571
488572dnl make sure nothing new is exported so that we don't break the cache
489573PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH"
0 commit comments