diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rwxr-xr-x | configure.sh | 11 |
2 files changed, 11 insertions, 2 deletions
@@ -37,7 +37,6 @@ CCONFIG=-std=c2x -fPIC \ -fno-signed-zeros -fno-trapping-math \ -fvisibility=hidden -fdollars-in-identifiers \ -DGC_THREADS -LTO= LDFLAGS= INCLUDE_DIRS= CWARN=-Wall -Wextra -Wno-format -Wno-format-security -Wshadow \ @@ -68,7 +67,6 @@ endif OWNER=$(shell ls -ld '$(PREFIX)' | awk '{print $$3}') ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"), 1) - LTO += -flto=auto -fno-fat-lto-objects -Wl,-flto CWARN += -Werror -Wsign-conversion -Walloc-zero -Wduplicated-branches -Wduplicated-cond -Wjump-misses-init \ -Wlogical-op -Wpacked-not-aligned -Wshadow=compatible-local -Wshadow=global -Wshadow=local \ -Wsuggest-attribute=const -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ diff --git a/configure.sh b/configure.sh index 1b5bd272..a4a8daa5 100755 --- a/configure.sh +++ b/configure.sh @@ -37,8 +37,19 @@ read DEFAULT_C_COMPILER if [ -z "$DEFAULT_C_COMPILER" ]; then DEFAULT_C_COMPILER="cc"; fi DEFAULT_C_COMPILER="${DEFAULT_C_COMPILER/#\~/$HOME}" +printf '\033[1mDo you want to build the compiler with Link Time Optimization (LTO)?\033[m\n\033[2m(This makes building the Tomo compiler slower, but makes running Tomo programs faster)\033[m\n\033[1m[y/N]\033[m ' +read USE_LTO +if [ "$USE_LTO" = "y" -o "$USE_LTO" = "Y" ]; then + if $DEFAULT_C_COMPILER -v 2>&1 | grep -q "gcc version"; then + LTO="-flto=auto -fno-fat-lto-objects -Wl,-flto"; + elif $DEFAULT_C_COMPILER -v 2>&1 | grep -q "clang version"; then + LTO="-flto=thin"; + fi +fi + cat <<END >config.mk PREFIX=$PREFIX DEFAULT_C_COMPILER=$DEFAULT_C_COMPILER SUDO=$SUDO +LTO=$LTO END |
