1
dnl Copyright (C) 2009 Sun Microsystems
2
dnl This file is free software; Sun Microsystems
3
dnl gives unlimited permission to copy and/or distribute it,
4
dnl with or without modifications, as long as this notice is preserved.
6
AC_DEFUN([PANDORA_OPTIMIZE],[
7
dnl Build optimized or debug version ?
8
dnl First check for gcc and g++
9
AS_IF([test "$GCC" = "yes" -a "$INTELCC" = "no"],[
11
dnl The following is required for portable results of floating point
12
dnl calculations on PowerPC. The same must also be done for IA-64, but
13
dnl this options is missing in the IA-64 gcc backend.
16
AM_CFLAGS="-mno-fused-madd ${AM_CFLAGS}"
17
AM_CXXFLAGS="-mno-fused-madd ${AM_CXXFLAGS}"
21
dnl Once we can use a modern autoconf, we can replace the std=gnu99 here
22
dnl with using AC_CC_STD_C99 above
25
AM_CPPFLAGS="-ggdb3 ${AM_CPPFLAGS}"
31
OPTIMIZE_CXXFLAGS="-O3"
33
AS_IF([test "$INTELCC" = "yes"],[
34
dnl Once we can use a modern autoconf, we can replace the std=gnu99 here
35
dnl with using AC_CC_STD_C99 above
38
AM_CPPFLAGS="-g ${AM_CPPFLAGS}"
43
OPTIMIZE_CFLAGS="-xHOST -O3 -no-prec-div -static"
44
OPTIMIZE_CXXFLAGS="${OPTIMIZE_CFLAGS}"
47
AS_IF([test "$SUNCC" = "yes"],[
48
dnl Once we can use a modern autoconf, we can replace the -xc99=all here
49
dnl with using AC_CC_STD_C99 above
51
CXX="${CXX} -xlang=c99"
53
AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}"
54
AM_CXXFLAGS="-mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}"
58
dnl TODO: Make a test for -xO4 usability here
59
OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin"
60
OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}"
61
OPTIMIZE_CXXFLAGS="-g0 ${OPTIMIZE_FLAGS}"
66
[AS_HELP_STRING([--with-debug],
67
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
68
[with_debug=$withval],
70
AS_IF([test "$with_debug" = "yes"],[
71
# Debugging. No optimization.
72
AM_CFLAGS="${AM_CFLAGS} ${DEBUG_CFLAGS} -DDEBUG"
73
AM_CXXFLAGS="${AM_CXXFLAGS} ${DEBUG_CXXFLAGS} -DDEBUG"
75
# Optimized version. No debug
76
AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}"
77
AM_CXXFLAGS="${AM_CXXFLAGS} ${OPTIMIZE_CXXFLAGS}"