@@ -655,6 +655,35 @@ if [ -n "$CFG_ENABLE_DEBUG" ]; then
655
655
CFG_ENABLE_DEBUG_JEMALLOC=1
656
656
fi
657
657
658
+ at_most_one_opt () {
659
+ local ARG=$1
660
+ OP=$( echo $ARG | tr ' a-z-' ' A-Z_' )
661
+ DISABLE_NAME=\$ CFG_DISABLE_${OP}
662
+ ENABLE_NAME=\$ CFG_ENABLE_${OP}
663
+ eval VD=$DISABLE_NAME
664
+ eval VE=$ENABLE_NAME
665
+ if [ -n " ${VD} " ] && [ -n " ${VE} " ]; then
666
+ msg " configure script bug: at most one of"
667
+ msg " $DISABLE_NAME and $ENABLE_NAME may be set;"
668
+ msg " you should report this as a bug, supplying your"
669
+ msg " CFG_CONFIGURE_ARGS=$CFG_CONFIGURE_ARGS "
670
+ err " configure script bug, at_most_one_opt $ARG "
671
+ fi
672
+ }
673
+
674
+ # At most one of each of the following enable/disable option pairs
675
+ # should be set. Check that. (i.e. if we are going to have some
676
+ # prioritization scheme, e.g. based on order of inputs to configure,
677
+ # then such prioritization should be explicitly applied before this
678
+ # point.)
679
+ at_most_one_opt optimize
680
+ at_most_one_opt optimize-cxx
681
+ at_most_one_opt optimize-llvm
682
+ at_most_one_opt llvm-assertions
683
+ at_most_one_opt debug-assertions
684
+ at_most_one_opt debuginfo
685
+ at_most_one_opt debug-jemalloc
686
+
658
687
# OK, now write the debugging options
659
688
if [ -n " $CFG_DISABLE_OPTIMIZE " ]; then putvar CFG_DISABLE_OPTIMIZE; fi
660
689
if [ -n " $CFG_DISABLE_OPTIMIZE_CXX " ]; then putvar CFG_DISABLE_OPTIMIZE_CXX; fi
0 commit comments