Skip to content

Commit 1002155

Browse files
committed
Add --enable-debug to control multiple perf options
1 parent 7cbf823 commit 1002155

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

configure

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -523,19 +523,16 @@ fi
523523
BOOL_OPTIONS=""
524524
VAL_OPTIONS=""
525525

526+
opt debug 0 "debug mode"
526527
opt valgrind 0 "run tests with valgrind (memcheck by default)"
527528
opt helgrind 0 "run tests with helgrind instead of memcheck"
528529
opt valgrind-rpass 1 "run rpass-valgrind tests with valgrind"
529530
opt docs 1 "build standard library documentation"
530531
opt compiler-docs 0 "build compiler documentation"
531-
opt optimize 1 "build optimized rust code"
532-
opt optimize-cxx 1 "build optimized C++ code"
533-
opt optimize-llvm 1 "build optimized LLVM"
534532
opt optimize-tests 1 "build tests with optimizations"
535533
opt libcpp 1 "build with llvm with libc++ instead of libstdc++ when using clang"
536534
opt llvm-assertions 0 "build LLVM with assertions"
537535
opt debug-assertions 0 "build with debugging assertions"
538-
opt debuginfo 0 "build with debugger metadata"
539536
opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
540537
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
541538
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
@@ -546,6 +543,14 @@ opt dist-host-only 0 "only install bins for the host architecture"
546543
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
547544
opt llvm-version-check 1 "don't check if the LLVM version is supported, build anyway"
548545

546+
# Optimization and debugging options. These may be overridden by the release channel, etc.
547+
opt_nosave optimize 1 "build optimized rust code"
548+
opt_nosave optimize-cxx 1 "build optimized C++ code"
549+
opt_nosave optimize-llvm 1 "build optimized LLVM"
550+
opt_nosave llvm-assertions 0 "build LLVM with assertions"
551+
opt_nosave debug-assertions 0 "build with debugging assertions"
552+
opt_nosave debuginfo 0 "build with debugger metadata"
553+
549554
valopt localstatedir "/var/lib" "local state directory"
550555
valopt sysconfdir "/etc" "install system configuration files"
551556

@@ -620,6 +625,24 @@ case "$CFG_RELEASE_CHANNEL" in
620625
;;
621626
esac
622627

628+
# Adjust perf and debug options for debug mode
629+
if [ -n "$CFG_ENABLE_DEBUG" ]; then
630+
msg "debug mode enabled, setting performance options"
631+
CFG_DISABLE_OPTIMIZE=1
632+
CFG_DISABLE_OPTIMIZE_CXX=1
633+
CFG_DISABLE_OPTIMIZE_LLVM=1
634+
CFG_ENABLE_LLVM_ASSERTIONS=1
635+
CFG_ENABLE_DEBUG_ASSERTIONS=1
636+
fi
637+
638+
# OK, now write the debugging options
639+
if [ -n "$CFG_DISABLE_OPTIMIZE" ]; then putvar CFG_DISABLE_OPTIMIZE; fi
640+
if [ -n "$CFG_DISABLE_OPTIMIZE_CXX" ]; then putvar CFG_DISABLE_OPTIMIZE_CXX; fi
641+
if [ -n "$CFG_DISABLE_OPTIMIZE_LLVM" ]; then putvar CFG_DISABLE_OPTIMIZE_LLVM; fi
642+
if [ -n "$CFG_ENABLE_LLVM_ASSERTIONS" ]; then putvar CFG_ENABLE_LLVM_ASSERTIONS; fi
643+
if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTIONS; fi
644+
if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi
645+
623646
# A magic value that allows the compiler to use unstable features
624647
# during the bootstrap even when doing so would normally be an error
625648
# because of feature staging or because the build turns on
@@ -1425,6 +1448,11 @@ move_if_changed config.tmp config.mk
14251448
rm -f config.tmp
14261449
touch config.stamp
14271450

1428-
step_msg "complete"
1451+
if [ -z "$CFG_ENABLE_DEBUG" ]; then
1452+
step_msg "configured in release mode. for development consider --enable-debug"
1453+
else
1454+
step_msg "complete"
1455+
fi
1456+
14291457
msg "run \`make help\`"
14301458
msg

0 commit comments

Comments
 (0)