diff options
author | Karl Wette <karl.wette@gmail.com> | 2014-10-05 14:31:24 +0200 |
---|---|---|
committer | Karl Wette <karl.wette@ligo.org> | 2014-10-22 12:03:49 +0200 |
commit | 18a9c095f82a6046ab2b4a4e1ce4af13150ca1d6 (patch) | |
tree | f167662e11681cca7e8e77a2158a8ab2c8df072c /configure.ac | |
parent | f84e1f823b029d2507d6a9a57c729bb824aa952e (diff) | |
download | swig-18a9c095f82a6046ab2b4a4e1ce4af13150ca1d6.tar.gz |
Octave: disable optimization of tests for faster compiles/less memory usage
- Filter out all but -g... and -W... flags from OCTAVE_CXXFLAGS
- Use AX_CHECK_COMPILE_FLAG() to check if -O0 is supported, if so
add to end of OCTAVE_CXXFLAGS to ensure optimization is disabled
- Also run mkoctfile under "env -" to protect it from environment
- Also use more standard-compliant sed expressions
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 78c276029..22d66d1ef 100644 --- a/configure.ac +++ b/configure.ac @@ -937,25 +937,43 @@ fi if test -n "$OCTAVE"; then AC_MSG_CHECKING([for Octave preprocessor flags]) OCTAVE_CPPFLAGS= - for n in CPPFLAGS INCFLAGS; do - OCTAVE_CPPFLAGS="${OCTAVE_CPPFLAGS} "`unset CPPFLAGS; ${mkoctfile} -p $n` + for var in CPPFLAGS INCFLAGS ALL_CXXFLAGS; do + for flag in `env - ${mkoctfile} -p ${var}`; do + case ${flag} in + -D*|-I*) OCTAVE_CPPFLAGS="${OCTAVE_CPPFLAGS} ${flag}";; + *) ;; + esac + done done AC_MSG_RESULT([$OCTAVE_CPPFLAGS]) AC_MSG_CHECKING([for Octave compiler flags]) OCTAVE_CXXFLAGS= - for n in ALL_CXXFLAGS; do - OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} "`unset CXXFLAGS; ${mkoctfile} -p $n` + for var in ALL_CXXFLAGS; do + for flag in `env - ${mkoctfile} -p ${var}`; do + case ${flag} in + -g*|-W*) OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} ${flag}";; + *) ;; + esac + done done + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="-Werror -O0" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[]) + ],[ + OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} -O0" + ]) + CXXFLAGS="${save_CXXFLAGS}" AC_MSG_RESULT([$OCTAVE_CXXFLAGS]) AC_MSG_CHECKING([for Octave linker flags]) OCTAVE_LDFLAGS= - for n in RDYNAMIC_FLAG LFLAGS RLD_FLAG OCTAVE_LIBS LIBS; do - OCTAVE_LDFLAGS="${OCTAVE_LDFLAGS} "`${mkoctfile} -p $n` + for var in RDYNAMIC_FLAG LFLAGS RLD_FLAG OCTAVE_LIBS LIBS; do + OCTAVE_LDFLAGS="${OCTAVE_LDFLAGS} "`env - ${mkoctfile} -p ${var}` done AC_MSG_RESULT([$OCTAVE_LDFLAGS]) for octave_opt in --silent --norc --no-history --no-window-system; do AC_MSG_CHECKING([if Octave option '${octave_opt}' is supported]) - octave_out=`${OCTAVE} ${octave_opt} /dev/null 2>&1 | sed -n '1{/unrecognized/p}'` + octave_out=`${OCTAVE} ${octave_opt} /dev/null 2>&1 | sed -n '1p' | sed -n '/unrecognized/p'` AS_IF([test "x${octave_out}" = x],[ AC_MSG_RESULT([yes]) OCTAVE="${OCTAVE} ${octave_opt}" |