summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorKarl Wette <karl.wette@gmail.com>2014-10-05 14:31:24 +0200
committerKarl Wette <karl.wette@gmail.com>2014-10-05 14:56:33 +0200
commit8e37bcf1a88ba4df783b39c77e6132a51a4536a5 (patch)
tree6452bf8262ada2902d8022d9e2b36e9469c83dba /configure.ac
parent952eee8f5904f85411d28dd375cc7df67f74b95a (diff)
downloadswig-8e37bcf1a88ba4df783b39c77e6132a51a4536a5.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.ac27
1 files changed, 20 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 78c276029..017fc5a0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -937,25 +937,38 @@ 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
AC_MSG_RESULT([$OCTAVE_CXXFLAGS])
+ AC_LANG_PUSH([C++])
+ AX_CHECK_COMPILE_FLAG([-O0],[OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} -O0"],[],[-Werror])
+ AC_LANG_POP([C++])
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}"