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)
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)
# 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
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.
#
# 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
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
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
;;
*)
- 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