Added --disable-optimizations. silc.client.1.1
authorPekka Riikonen <priikone@silcnet.org>
Sun, 3 Jun 2007 20:35:26 +0000 (20:35 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 3 Jun 2007 20:35:26 +0000 (20:35 +0000)
configure.ad
lib/silccrypt/configure.ad
lib/silcmath/configure.ad

index 3a855ec38f860e65c7a8d2388b6cb5f6a31cddb6..4dd8e659b18c83e6fc96cc292b7def4e87e0a0b1 100644 (file)
@@ -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.
index 283a5ee92ec21c37d91e97ceb36fec3ebff7c3a3..dbc58ab636f0c7f3b64db59676fe106c83d0e16d 100644 (file)
@@ -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
 
index 4bc79b116adb376fb634ad7c092975e3700b5ee6..7631711996974069b6d73c6f7db60f59c4a31867 100644 (file)
@@ -4,7 +4,7 @@
 #
 #  Author: Pekka Riikonen <priikone@silcnet.org>
 #
-#  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