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
This commit is contained in:
Karl Wette 2013-07-05 22:37:15 +02:00 • committed by William S Fulton
commit 479df82616
3 changed files with 28 additions and 14 deletions

View file

@ -398,7 +398,7 @@ python_clean:
################################################################## ##################################################################
# Make sure these locate your Octave installation # 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@ OCTAVE_CXX = $(DEFS) @OCTAVE_CPPFLAGS@ @OCTAVE_CXXFLAGS@
# Extra Octave specific dynamic linking options # Extra Octave specific dynamic linking options

View file

@ -3,7 +3,7 @@
####################################################################### #######################################################################
LANGUAGE = octave LANGUAGE = octave
OCTAVE = @OCTAVE@ -qf OCTAVE = @OCTAVE@
SCRIPTSUFFIX = _runme.m SCRIPTSUFFIX = _runme.m
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@

View file

@ -938,7 +938,7 @@ if test x"${OCTAVEBIN}" = xno -o x"${with_alllang}" = xno ; then
# First figure out what the name of Octave is # First figure out what the name of Octave is
elif test "x$OCTAVEBIN" = xyes; then elif test "x$OCTAVEBIN" = xyes; then
AC_CHECK_PROGS(OCTAVE, octave) AC_PATH_PROG(OCTAVE, [octave])
else else
OCTAVE="$OCTAVEBIN" OCTAVE="$OCTAVEBIN"
@ -946,31 +946,45 @@ fi
if test -n "$OCTAVE"; then if test -n "$OCTAVE"; then
AC_MSG_CHECKING([for mkoctfile]) AC_MSG_CHECKING([for mkoctfile])
AS_IF([test "x`${OCTAVE} -qfH --eval 'mkoctfile -p CXX' 2>/dev/null`" != x],[ mkoctfile="`dirname ${OCTAVE}`/mkoctfile"
AC_MSG_RESULT([yes]) 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]) AC_MSG_CHECKING([for Octave preprocessor flags])
OCTAVE_CPPFLAGS= OCTAVE_CPPFLAGS=
for n in CPPFLAGS INCFLAGS; do for n in CPPFLAGS INCFLAGS; do
OCTAVE_CPPFLAGS="${OCTAVE_CPPFLAGS} "`$OCTAVE -qfH --eval "mkoctfile -p $n"` OCTAVE_CPPFLAGS="${OCTAVE_CPPFLAGS} "`${mkoctfile} -p $n`
done done
AC_MSG_RESULT($OCTAVE_CPPFLAGS) AC_MSG_RESULT([$OCTAVE_CPPFLAGS])
AC_MSG_CHECKING([for Octave compiler flags]) AC_MSG_CHECKING([for Octave compiler flags])
OCTAVE_CXXFLAGS= OCTAVE_CXXFLAGS=
for n in ALL_CXXFLAGS; do for n in ALL_CXXFLAGS; do
OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} "`$OCTAVE -qfH --eval "mkoctfile -p $n"` OCTAVE_CXXFLAGS="${OCTAVE_CXXFLAGS} "`${mkoctfile} -p $n`
done done
AC_MSG_RESULT($OCTAVE_CXXFLAGS) AC_MSG_RESULT([$OCTAVE_CXXFLAGS])
AC_MSG_CHECKING([for Octave linker flags]) AC_MSG_CHECKING([for Octave linker flags])
OCTAVE_LDFLAGS= OCTAVE_LDFLAGS=
for n in RDYNAMIC_FLAG LFLAGS RLD_FLAG OCTAVE_LIBS LIBS; do 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 done
AC_MSG_RESULT($OCTAVE_LDFLAGS)
else
AC_MSG_RESULT(could not figure out how to run octave)
fi fi
AC_SUBST(OCTAVE) AC_SUBST(OCTAVE)