Skip to content

Commit a9d8065

Browse files
committed
Auto merge of #24408 - richo:configure-optimize-default, r=pnkfelix
Optimization is now on by default. Closes #24405
2 parents a4eb5a6 + fd69ac1 commit a9d8065

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

configure

+17-2
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,15 @@ valopt_core() {
192192
then
193193
local UOP=$(echo $OP | tr '[:lower:]' '[:upper:]' | tr '\-' '\_')
194194
local V="CFG_${UOP}"
195+
local V_PROVIDED="${V}_PROVIDED"
195196
eval $V="$DEFAULT"
196197
for arg in $CFG_CONFIGURE_ARGS
197198
do
198199
if echo "$arg" | grep -q -- "--$OP="
199200
then
200201
val=$(echo "$arg" | cut -f2 -d=)
201202
eval $V=$val
203+
eval $V_PROVIDED=1
202204
fi
203205
done
204206
if [ "$SAVE" = "save" ]
@@ -247,8 +249,10 @@ opt_core() {
247249
if [ $DEFAULT -eq 0 ]
248250
then
249251
FLAG="enable"
252+
DEFAULT_FLAG="disable"
250253
else
251254
FLAG="disable"
255+
DEFAULT_FLAG="enable"
252256
DOC="don't $DOC"
253257
fi
254258

@@ -261,11 +265,19 @@ opt_core() {
261265
OP=$(echo $OP | tr 'a-z-' 'A-Z_')
262266
FLAG=$(echo $FLAG | tr 'a-z' 'A-Z')
263267
local V="CFG_${FLAG}_${OP}"
268+
local V_PROVIDED="CFG_${FLAG}_${OP}_PROVIDED"
264269
eval $V=1
270+
eval $V_PROVIDED=1
265271
if [ "$SAVE" = "save" ]
266272
then
267273
putvar $V
268274
fi
275+
elif [ "$arg" = "--${DEFAULT_FLAG}-${OP}" ]
276+
then
277+
OP=$(echo $OP | tr 'a-z-' 'A-Z_')
278+
DEFAULT_FLAG=$(echo $DEFAULT_FLAG | tr 'a-z' 'A-Z')
279+
local V_PROVIDED="CFG_${DEFAULT_FLAG}_${OP}_PROVIDED"
280+
eval $V_PROVIDED=1
269281
fi
270282
done
271283
else
@@ -633,8 +645,11 @@ esac
633645
# Adjust perf and debug options for debug mode
634646
if [ -n "$CFG_ENABLE_DEBUG" ]; then
635647
msg "debug mode enabled, setting performance options"
636-
CFG_DISABLE_OPTIMIZE=1
637-
CFG_DISABLE_OPTIMIZE_CXX=1
648+
if [ -z "$CFG_ENABLE_OPTIMIZE_PROVIDED" ]; then
649+
msg "optimization not explicitly enabled, disabling optimization"
650+
CFG_DISABLE_OPTIMIZE=1
651+
CFG_DISABLE_OPTIMIZE_CXX=1
652+
fi
638653
CFG_ENABLE_LLVM_ASSERTIONS=1
639654
CFG_ENABLE_DEBUG_ASSERTIONS=1
640655
CFG_ENABLE_DEBUG_JEMALLOC=1

0 commit comments

Comments
 (0)