blob: 89dae23adb1d50fe9c236200a05513d0c4dcd7b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
--- trunk/c++/src/build-system/configure.ac 2012/12/21 15:12:14 56664
+++ trunk/c++/src/build-system/configure.ac 2012/12/27 15:43:29 56694
@@ -623,6 +623,13 @@
* ) AC_SUBST(PROJECTS, "\$(top_srcdir)/$with_projects") ;;
esac
+# Check for custom optimization flags before potentially going with defaults.
+skip_fast_flags=no
+if test -z "${DEF_FAST_FLAGS}${FAST_CXXFLAGS}"; then
+ case " $CFLAGS $CXXFLAGS" in
+ *\ -O* | *\ -xO* ) skip_fast_flags=yes ;;
+ esac
+fi
#### Always define this
AC_DEFINE(NCBI_CXX_TOOLKIT, 1, [This is the NCBI C++ Toolkit.])
@@ -1431,7 +1438,7 @@
wsrx="[[$wschars]]"
#### Flags to enable (potentially unsafe) extra optimization.
-if test -z "$DEF_FAST_FLAGS" -o -z "$FAST_CXXFLAGS" ; then
+if test "$skip_fast_flags" = no -a -z "$DEF_FAST_FLAGS" ; then
case "$compiler:$compiler_version" in
GCC:2* | GCC:344 )
# GCC 2.9x sometimes experiences internal errors at high optimization;
@@ -1502,8 +1509,6 @@
DEF_FAST_FLAGS="-O"
;;
esac
-else
- DEF_FAST_FLAGS="-O"
fi
: ${FAST_CFLAGS="$DEF_FAST_FLAGS"}
@@ -2608,9 +2613,15 @@
CXXFLAGS="$CXXFLAGS -O" ; fi
if echo " $LDFLAGS " | grep -v "$optrx" >/dev/null ; then
LDFLAGS="$LDFLAGS -O" ; fi
- FAST_CFLAGS="$NOPT_CFLAGS $FAST_CFLAGS"
- FAST_CXXFLAGS="$NOPT_CXXFLAGS $FAST_CXXFLAGS"
- FAST_LDFLAGS="$NOPT_LDFLAGS $FAST_LDFLAGS"
+ if test "$skip_fast_flags" = yes ; then
+ FAST_CFLAGS="$CFLAGS"
+ FAST_CXXFLAGS="$CXXFLAGS"
+ FAST_LDFLAGS="$LDFLAGS"
+ else
+ FAST_CFLAGS="$NOPT_CFLAGS $FAST_CFLAGS"
+ FAST_CXXFLAGS="$NOPT_CXXFLAGS $FAST_CXXFLAGS"
+ FAST_LDFLAGS="$NOPT_LDFLAGS $FAST_LDFLAGS"
+ fi
fi
changequote([, ])dnl
fi
|