--- trunk/c++/src/build-system/configure 2012/12/21 15:12:14 56664 +++ trunk/c++/src/build-system/configure 2012/12/27 15:43:29 56694 @@ -3151,6 +3151,13 @@ ;; 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 @@ -5715,7 +5722,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; @@ -5786,8 +5793,6 @@ DEF_FAST_FLAGS="-O" ;; esac -else - DEF_FAST_FLAGS="-O" fi : ${FAST_CFLAGS="$DEF_FAST_FLAGS"} @@ -8936,9 +8941,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 fi