diff options
author | Karl Wette <karl.wette@ligo.org> | 2013-07-05 22:37:15 +0200 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2013-07-16 20:59:50 +0100 |
commit | 479df82616be2a7f08cd4df68c2c7b51073d9e2b (patch) | |
tree | f488746815e7276dc894b1e2091071a084534cdb | |
parent | e8c6384f77b05514f26338fae463860b865ddf97 (diff) | |
download | swig-479df82616be2a7f08cd4df68c2c7b51073d9e2b.tar.gz |
Octave: more robust configuration
- do not rely on --eval argument to find mkoctfile, instead assume it
is in the same directory as octave itself (which it always should be)
- check Octave options to make sure they are supported, including
--no-window-system to prevent warnings if building without an X server
- disable Octave if any vital tests fail
-rw-r--r-- | Examples/Makefile.in | 2 | ||||
-rw-r--r-- | Examples/test-suite/octave/Makefile.in | 2 | ||||
-rw-r--r-- | configure.ac | 38 |
3 files changed, 28 insertions, 14 deletions
diff --git a/Examples/Makefile.in b/Examples/Makefile.in index 280923df2..df754427c 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -398,7 +398,7 @@ python_clean: ################################################################## # Make sure these locate your Octave installation -OCTAVE = OCTAVE_HISTFILE=/dev/null @OCTAVE@ -qfH +OCTAVE = OCTAVE_HISTFILE=/dev/null @OCTAVE@ OCTAVE_CXX = $(DEFS) @OCTAVE_CPPFLAGS@ @OCTAVE_CXXFLAGS@ # Extra Octave specific dynamic linking options diff --git a/Examples/test-suite/octave/Makefile.in b/Examples/test-suite/octave/Makefile.in index 88f533fd1..fe957eeb0 100644 --- a/Examples/test-suite/octave/Makefile.in +++ b/Examples/test-suite/octave/Makefile.in @@ -3,7 +3,7 @@ ####################################################################### LANGUAGE = octave -OCTAVE = @OCTAVE@ -qf +OCTAVE = @OCTAVE@ SCRIPTSUFFIX = _runme.m srcdir = @srcdir@ top_srcdir = @top_srcdir@ diff --git a/configure.ac b/configure.ac index 616610eda..1d3250afb 100644 --- a/configure.ac +++ b/configure.ac @@ -938,7 +938,7 @@ if test x"${OCTAVEBIN}" = xno -o x"${with_alllang}" = xno ; then # First figure out what the name of Octave is elif test "x$OCTAVEBIN" = xyes; then - AC_CHECK_PROGS(OCTAVE, octave) + AC_PATH_PROG(OCTAVE, [octave]) else OCTAVE="$OCTAVEBIN" @@ -946,31 +946,45 @@ fi if test -n "$OCTAVE"; then AC_MSG_CHECKING([for mkoctfile]) - AS_IF([test "x`${OCTAVE} -qfH --eval 'mkoctfile -p CXX' 2>/dev/null`" != x],[ - AC_MSG_RESULT([yes]) + mkoctfile="`dirname ${OCTAVE}`/mkoctfile" + AS_IF([test -x "${mkoctfile}"],[ + AC_MSG_RESULT([${mkoctfile}]) ],[ - AC_MSG_ERROR([mkoctfile is not installed]) + AC_MSG_RESULT([not found, disabling Octave]) + OCTAVE= ]) +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} "`$OCTAVE -qfH --eval "mkoctfile -p $n"` + OCTAVE_CPPFLAGS="${OCTAVE_CPPFLAGS} "`${mkoctfile} -p $n` done - AC_MSG_RESULT($OCTAVE_CPPFLAGS) + AC_MSG_RESULT([$OCTAVE_CPPFLAGS]) AC_MSG_CHECKING([for Octave compiler flags]) OCTAVE_CXXFLAGS= for n in ALL_CXXFLAGS; do - OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} "`$OCTAVE -qfH --eval "mkoctfile -p $n"` + OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} "`${mkoctfile} -p $n` done - AC_MSG_RESULT($OCTAVE_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} "`$OCTAVE -qfH --eval "mkoctfile -p $n"` + OCTAVE_LDFLAGS="${OCTAVE_LDFLAGS} "`${mkoctfile} -p $n` + done + AC_MSG_RESULT([$OCTAVE_LDFLAGS]) +fi +if test -n "$OCTAVE"; then + for octave_opt in --silent --norc --no-history --no-window-system; do + AC_MSG_CHECKING([if Octave option '${octave_opt}' is supported]) + ${OCTAVE} ${octave_opt} /dev/null >/dev/null 2>&1 + AS_IF([test $? -eq 0],[ + AC_MSG_RESULT([yes]) + OCTAVE="${OCTAVE} ${octave_opt}" + ],[ + AC_MSG_RESULT([no]) + ]) done - AC_MSG_RESULT($OCTAVE_LDFLAGS) -else - AC_MSG_RESULT(could not figure out how to run octave) fi AC_SUBST(OCTAVE) |