1085.1.4
by Monty Taylor
pandora-build v1 |
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. |
|
5 |
||
1085.1.3
by Monty Taylor
Split out warnings - start using the pandora build system. |
6 |
AC_DEFUN([PANDORA_OPTIMIZE],[ |
7 |
dnl Build optimized or debug version ?
|
|
8 |
dnl First check for gcc and g++
|
|
1093.2.2
by mordred
pandora-build v0.18 |
9 |
AS_IF([test "$GCC" = "yes" -a "$INTELCC" = "no"],[ |
1085.1.3
by Monty Taylor
Split out warnings - start using the pandora build system. |
10 |
|
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.
|
|
14 |
case "$target_cpu" in
|
|
15 |
*ppc* | *powerpc*)
|
|
16 |
AM_CFLAGS="-mno-fused-madd ${AM_CFLAGS}"
|
|
17 |
AM_CXXFLAGS="-mno-fused-madd ${AM_CXXFLAGS}"
|
|
18 |
;;
|
|
19 |
esac
|
|
20 |
||
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
|
|
23 |
CC="${CC} -std=gnu99"
|
|
24 |
||
1841.1.3
by Barry.Leslie at PrimeBase
Merged changes from lp:pbms. These changes should remove any danger |
25 |
AM_CPPFLAGS="-g ${AM_CPPFLAGS}"
|
1085.1.3
by Monty Taylor
Split out warnings - start using the pandora build system. |
26 |
|
27 |
DEBUG_CFLAGS="-O0"
|
|
28 |
DEBUG_CXXFLAGS="-O0"
|
|
29 |
||
30 |
OPTIMIZE_CFLAGS="-O3"
|
|
31 |
OPTIMIZE_CXXFLAGS="-O3"
|
|
32 |
]) |
|
1093.2.2
by mordred
pandora-build v0.18 |
33 |
AS_IF([test "$INTELCC" = "yes"],[ |
34 |
AM_CPPFLAGS="-g ${AM_CPPFLAGS}"
|
|
35 |
||
36 |
DEBUG_CFLAGS="-O0"
|
|
37 |
DEBUG_CXXFLAGS="-O0"
|
|
38 |
||
39 |
OPTIMIZE_CFLAGS="-xHOST -O3 -no-prec-div -static"
|
|
40 |
OPTIMIZE_CXXFLAGS="${OPTIMIZE_CFLAGS}"
|
|
41 |
||
42 |
]) |
|
1085.1.3
by Monty Taylor
Split out warnings - start using the pandora build system. |
43 |
AS_IF([test "$SUNCC" = "yes"],[ |
44 |
dnl Once we can use a modern autoconf, we can replace the -xc99=all here
|
|
45 |
dnl with using AC_CC_STD_C99 above
|
|
46 |
CC="${CC} -xc99=all"
|
|
1085.1.4
by Monty Taylor
pandora-build v1 |
47 |
CXX="${CXX} -xlang=c99"
|
1085.1.3
by Monty Taylor
Split out warnings - start using the pandora build system. |
48 |
|
1085.1.4
by Monty Taylor
pandora-build v1 |
49 |
AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}"
|
1241.15.1
by Monty Taylor
Fixed a potential linking problem that we have not yet seen but which we found in the protobuf codebase. |
50 |
AM_CXXFLAGS="-mt -compat=5 -library=stlport4 -library=Crun -template=no%extdef ${AM_CXXFLAGS}"
|
1085.1.10
by Monty Taylor
pandora-build v0.9 |
51 |
|
52 |
DEBUG_CXXFLAGS="-g"
|
|
1085.1.3
by Monty Taylor
Split out warnings - start using the pandora build system. |
53 |
|
54 |
dnl TODO: Make a test for -xO4 usability here
|
|
55 |
OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin"
|
|
1085.1.4
by Monty Taylor
pandora-build v1 |
56 |
OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}"
|
1085.1.10
by Monty Taylor
pandora-build v0.9 |
57 |
OPTIMIZE_CXXFLAGS="-g0 ${OPTIMIZE_FLAGS}"
|
58 |
||
1085.1.3
by Monty Taylor
Split out warnings - start using the pandora build system. |
59 |
]) |
60 |
||
61 |
AC_ARG_WITH([debug], |
|
62 |
[AS_HELP_STRING([--with-debug], |
|
63 |
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], |
|
64 |
[with_debug=$withval], |
|
65 |
[with_debug=no]) |
|
66 |
AS_IF([test "$with_debug" = "yes"],[ |
|
67 |
# Debugging. No optimization.
|
|
68 |
AM_CFLAGS="${AM_CFLAGS} ${DEBUG_CFLAGS} -DDEBUG"
|
|
69 |
AM_CXXFLAGS="${AM_CXXFLAGS} ${DEBUG_CXXFLAGS} -DDEBUG"
|
|
70 |
],[ |
|
71 |
# Optimized version. No debug
|
|
72 |
AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}"
|
|
73 |
AM_CXXFLAGS="${AM_CXXFLAGS} ${OPTIMIZE_CXXFLAGS}"
|
|
74 |
]) |
|
75 |
]) |