Skip to content

Commit 402d0c8

Browse files
committed
configure belt-and-suspenders: ensure we do not have conflicting options set.
1 parent e42b624 commit 402d0c8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

configure

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,35 @@ if [ -n "$CFG_ENABLE_DEBUG" ]; then
655655
CFG_ENABLE_DEBUG_JEMALLOC=1
656656
fi
657657

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+
658687
# OK, now write the debugging options
659688
if [ -n "$CFG_DISABLE_OPTIMIZE" ]; then putvar CFG_DISABLE_OPTIMIZE; fi
660689
if [ -n "$CFG_DISABLE_OPTIMIZE_CXX" ]; then putvar CFG_DISABLE_OPTIMIZE_CXX; fi

0 commit comments

Comments
 (0)