@@ -385,6 +385,10 @@ SECP_CFLAGS="$SECP_CFLAGS $WERROR_CFLAGS"
385
385
# ## Handle module options
386
386
# ##
387
387
388
+ # Besides testing whether modules are enabled, the following code also enables
389
+ # module dependencies. The order of the tests matters: the dependency must be
390
+ # tested first.
391
+
388
392
if test x"$enable_module_ecdh" = x"yes"; then
389
393
AC_DEFINE ( ENABLE_MODULE_ECDH , 1 , [ Define this symbol to enable the ECDH module] )
390
394
fi
@@ -398,30 +402,30 @@ if test x"$enable_module_recovery" = x"yes"; then
398
402
AC_DEFINE ( ENABLE_MODULE_RECOVERY , 1 , [ Define this symbol to enable the ECDSA pubkey recovery module] )
399
403
fi
400
404
401
- if test x"$enable_module_generator" = x"yes"; then
402
- AC_DEFINE ( ENABLE_MODULE_GENERATOR , 1 , [ Define this symbol to enable the NUMS generator module] )
405
+ if test x"$enable_module_whitelist" = x"yes"; then
406
+ enable_module_rangeproof=yes
407
+ AC_DEFINE ( ENABLE_MODULE_WHITELIST , 1 , [ Define this symbol to enable the key whitelisting module] )
408
+ fi
409
+
410
+ if test x"$enable_module_surjectionproof" = x"yes"; then
411
+ enable_module_rangeproof=yes
412
+ AC_DEFINE ( ENABLE_MODULE_SURJECTIONPROOF , 1 , [ Define this symbol to enable the surjection proof module] )
403
413
fi
404
414
405
415
if test x"$enable_module_rangeproof" = x"yes"; then
416
+ enable_module_generator=yes
406
417
AC_DEFINE ( ENABLE_MODULE_RANGEPROOF , 1 , [ Define this symbol to enable the Pedersen / zero knowledge range proof module] )
407
418
fi
408
419
409
- if test x"$enable_module_whitelist " = x"yes"; then
410
- AC_DEFINE ( ENABLE_MODULE_WHITELIST , 1 , [ Define this symbol to enable the key whitelisting module] )
420
+ if test x"$enable_module_generator " = x"yes"; then
421
+ AC_DEFINE ( ENABLE_MODULE_GENERATOR , 1 , [ Define this symbol to enable the NUMS generator module] )
411
422
fi
412
423
413
- if test x"$enable_module_surjectionproof" = x"yes"; then
414
- AC_DEFINE ( ENABLE_MODULE_SURJECTIONPROOF , 1 , [ Define this symbol to enable the surjection proof module] )
415
- fi
416
- # Test if extrakeys is set _after_ the MuSig module to allow the MuSig
417
- # module to set enable_module_schnorrsig=yes
418
424
if test x"$enable_module_schnorrsig" = x"yes"; then
419
425
AC_DEFINE ( ENABLE_MODULE_SCHNORRSIG , 1 , [ Define this symbol to enable the schnorrsig module] )
420
426
enable_module_extrakeys=yes
421
427
fi
422
428
423
- # Test if extrakeys is set after the schnorrsig module to allow the schnorrsig
424
- # module to set enable_module_extrakeys=yes
425
429
if test x"$enable_module_extrakeys" = x"yes"; then
426
430
AC_DEFINE ( ENABLE_MODULE_EXTRAKEYS , 1 , [ Define this symbol to enable the extrakeys module] )
427
431
fi
@@ -450,37 +454,24 @@ if test x"$enable_experimental" = x"yes"; then
450
454
AC_MSG_NOTICE ( [ ******] )
451
455
AC_MSG_NOTICE ( [ WARNING: experimental build] )
452
456
AC_MSG_NOTICE ( [ Experimental features do not have stable APIs or properties, and may not be safe for production use.] )
453
- AC_MSG_NOTICE ( [ Building NUMS generator module: $enable_module_generator] )
454
- AC_MSG_NOTICE ( [ Building range proof module: $enable_module_rangeproof] )
455
- AC_MSG_NOTICE ( [ Building key whitelisting module: $enable_module_whitelist] )
456
- AC_MSG_NOTICE ( [ Building surjection proof module: $enable_module_surjectionproof] )
457
- AC_MSG_NOTICE ( [ Building MuSig module: $enable_module_musig] )
458
- AC_MSG_NOTICE ( [ Building ECDSA sign-to-contract module: $enable_module_ecdsa_s2c] )
459
- AC_MSG_NOTICE ( [ Building ECDSA adaptor signatures module: $enable_module_ecdsa_adaptor] )
460
457
AC_MSG_NOTICE ( [ ******] )
461
-
462
-
463
- if test x"$enable_module_schnorrsig" != x"yes"; then
464
- if test x"$enable_module_musig" = x"yes"; then
465
- AC_MSG_ERROR ( [ MuSig module requires the schnorrsig module. Use --enable-module-schnorrsig to allow.] )
466
- fi
458
+ else
459
+ # The order of the following tests matters. If the user enables a dependent
460
+ # module (which automatically enables the module dependencies) we want to
461
+ # print an error for the dependent module, not the module dependency. Hence,
462
+ # we first test dependent modules.
463
+ if test x"$enable_module_whitelist" = x"yes"; then
464
+ AC_MSG_ERROR ( [ Key whitelisting module is experimental. Use --enable-experimental to allow.] )
467
465
fi
468
-
469
- if test x"$enable_module_generator" != x"yes"; then
470
- if test x"$enable_module_rangeproof" = x"yes"; then
471
- AC_MSG_ERROR ( [ Rangeproof module requires the generator module. Use --enable-module-generator to allow.] )
472
- fi
466
+ if test x"$enable_module_surjectionproof" = x"yes"; then
467
+ AC_MSG_ERROR ( [ Surjection proof module is experimental. Use --enable-experimental to allow.] )
473
468
fi
474
-
475
- if test x"$enable_module_rangeproof" != x"yes"; then
476
- if test x"$enable_module_whitelist" = x"yes"; then
477
- AC_MSG_ERROR ( [ Whitelist module requires the rangeproof module. Use --enable-module-rangeproof to allow.] )
478
- fi
479
- if test x"$enable_module_surjectionproof" = x"yes"; then
480
- AC_MSG_ERROR ( [ Surjection proof module requires the rangeproof module. Use --enable-module-rangeproof to allow.] )
481
- fi
469
+ if test x"$enable_module_rangeproof" = x"yes"; then
470
+ AC_MSG_ERROR ( [ Range proof module is experimental. Use --enable-experimental to allow.] )
471
+ fi
472
+ if test x"$enable_module_generator" = x"yes"; then
473
+ AC_MSG_ERROR ( [ NUMS generator module is experimental. Use --enable-experimental to allow.] )
482
474
fi
483
- else
484
475
if test x"$enable_module_musig" = x"yes"; then
485
476
AC_MSG_ERROR ( [ MuSig module is experimental. Use --enable-experimental to allow.] )
486
477
fi
@@ -493,18 +484,6 @@ else
493
484
if test x"$set_asm" = x"arm"; then
494
485
AC_MSG_ERROR ( [ ARM assembly optimization is experimental. Use --enable-experimental to allow.] )
495
486
fi
496
- if test x"$enable_module_generator" = x"yes"; then
497
- AC_MSG_ERROR ( [ NUMS generator module is experimental. Use --enable-experimental to allow.] )
498
- fi
499
- if test x"$enable_module_rangeproof" = x"yes"; then
500
- AC_MSG_ERROR ( [ Range proof module is experimental. Use --enable-experimental to allow.] )
501
- fi
502
- if test x"$enable_module_whitelist" = x"yes"; then
503
- AC_MSG_ERROR ( [ Key whitelisting module is experimental. Use --enable-experimental to allow.] )
504
- fi
505
- if test x"$enable_module_surjectionproof" = x"yes"; then
506
- AC_MSG_ERROR ( [ Surjection proof module is experimental. Use --enable-experimental to allow.] )
507
- fi
508
487
fi
509
488
510
489
# ##
@@ -555,6 +534,10 @@ echo " module ecdh = $enable_module_ecdh"
555
534
echo " module recovery = $enable_module_recovery"
556
535
echo " module extrakeys = $enable_module_extrakeys"
557
536
echo " module schnorrsig = $enable_module_schnorrsig"
537
+ echo " module generator = $enable_module_generator"
538
+ echo " module rangeproof = $enable_module_rangeproof"
539
+ echo " module surjectionproof = $enable_module_surjectionproof"
540
+ echo " module whitelist = $enable_module_whitelist"
558
541
echo " module musig = $enable_module_musig"
559
542
echo " module ecdsa-s2c = $enable_module_ecdsa_s2c"
560
543
echo " module ecdsa-adaptor = $enable_module_ecdsa_adaptor"
0 commit comments