From 4a7c8b4e56accaaaf098155a580df023bfb91c69 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 3 Jun 2007 20:35:26 +0000 Subject: [PATCH] Added --disable-optimizations. --- configure.ad | 50 ++++++++++++++++++++++++++++++++++---- lib/silccrypt/configure.ad | 2 +- lib/silcmath/configure.ad | 26 ++++++++++++++------ 3 files changed, 64 insertions(+), 14 deletions(-) diff --git a/configure.ad b/configure.ad index 3a855ec3..4dd8e659 100644 --- a/configure.ad +++ b/configure.ad @@ -293,6 +293,23 @@ AC_ARG_ENABLE(debug, AC_MSG_RESULT(no) ]) +# Disable all compiler optimizations +# +AC_MSG_CHECKING(whether to enable compiler optimizations) +want_cc_optimizations=true +AC_ARG_ENABLE(optimizations, + [ --disable-optimizations do not use any compiler optimizations], + [ + AC_MSG_RESULT(no) + AC_DEFINE([SILC_NO_CC_OPTIMIZATIONS], [], [SILC_NO_CC_OPTIMIZATIONS]) + want_cc_optimizations=false + ], + [ + AC_MSG_RESULT(yes) + want_cc_optimizations=true + ]) +AM_CONDITIONAL(SILC_NO_CC_OPTIMIZATIONS, test x$want_cc_optimizations = xfalse) + # Disable all assembler optimizations # AC_MSG_CHECKING(whether to enable assembler optimizations) @@ -439,9 +456,9 @@ fi if test "$GCC"; then # GCC specific options if test "x$summary_debug" = "xyes"; then - SILC_ADD_CFLAGS(-g -O) + SILC_ADD_CFLAGS(-g) else - SILC_ADD_CFLAGS(-g -O2) + SILC_ADD_CFLAGS(-g) fi SILC_ADD_CFLAGS(-Wall -finline-functions) SILC_ADD_CFLAGS(-Wno-pointer-sign) @@ -449,14 +466,13 @@ else # Other compilers case "$target" in alpha*-dec-osf*) - SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O))) + SILC_ADD_CFLAGS(-g3) ;; mips*-sgi-irix*) - SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O))) + SILC_ADD_CFLAGS(-g3) ;; *) SILC_ADD_CFLAGS(-g) - SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O)) ;; esac @@ -466,6 +482,30 @@ else fi fi +if test x$want_cc_optimizations = xtrue; then + if test "$GCC"; then + # GCC specific options + if test "x$summary_debug" = "xyes"; then + SILC_ADD_CFLAGS(-O) + else + SILC_ADD_CFLAGS(-O2) + fi + else + # Other compilers + case "$target" in + alpha*-dec-osf*) + SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O)) + ;; + mips*-sgi-irix*) + SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O)) + ;; + *) + SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O)) + ;; + esac + fi +fi + # # Workaround a bug in GCC 2.x which causes memory exhaustion # when compiling sha1 with optimizations on UltraSPARC. diff --git a/lib/silccrypt/configure.ad b/lib/silccrypt/configure.ad index 283a5ee9..dbc58ab6 100644 --- a/lib/silccrypt/configure.ad +++ b/lib/silccrypt/configure.ad @@ -45,7 +45,7 @@ esac fi SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fno-regmove) -if test x$summary_debug = xno; then +if test x$summary_debug = xno -a x$want_cc_optimizations = xtrue; then SILC_ADD_CC_FLAGS(SILC_CRYPTO, -fomit-frame-pointer -O3) fi diff --git a/lib/silcmath/configure.ad b/lib/silcmath/configure.ad index 4bc79b11..76317119 100644 --- a/lib/silcmath/configure.ad +++ b/lib/silcmath/configure.ad @@ -4,7 +4,7 @@ # # Author: Pekka Riikonen # -# Copyright (C) 2005 Pekka Riikonen +# Copyright (C) 2005 - 2007 Pekka Riikonen # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,10 +21,12 @@ if test x$compile_libs = xtrue; then AC_MSG_NOTICE([configuring math library]) #ifdef SILC_DIST_TMA -SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2)) -SILC_ADD_CC_FLAGS(MATH, -funroll-all-loops) +if test x$want_cc_optimizations = xtrue; then + SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2)) + SILC_ADD_CC_FLAGS(MATH, -funroll-all-loops) +fi if test x$enable_stack_trace != xyes; then -SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer) + SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer) fi #endif SILC_DIST_TMA @@ -36,20 +38,26 @@ case "$target" in alpha*-*-*) if test ! "$GCC"; then SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM) - SILC_ADD_CC_FLAGS(MATH, -O -Olimit 4000) + if test x$want_cc_optimizations = xtrue; then + SILC_ADD_CC_FLAGS(MATH, -O -Olimit 4000) + fi SILC_ADD_CC_FLAGS(MATH, -std1 -DOSF1) fi ;; sparcv9-*-* | sparc64-*-*) - SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2)) + if test x$want_cc_optimizations = xtrue; then + SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2)) + fi if test ! "$GCC"; then SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM) fi ;; ultrasparc*-*-*) - SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2)) + if test x$want_cc_optimizations = xtrue; then + SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2)) + fi if test ! "$GCC"; then SILC_ADD_CC_FLAGS(MATH, -DTFM_NO_ASM) fi @@ -103,7 +111,9 @@ case "$target" in ;; *) - SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2)) + if test x$want_cc_optimizations = xtrue; then + SILC_ADD_CC_FLAGS(MATH, -O3, SILC_ADD_CC_FLAGS(MATH, -O2)) + fi if test x$enable_stack_trace != xyes; then SILC_ADD_CC_FLAGS(MATH, -fomit-frame-pointer) fi -- 2.24.0