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
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

View file

@ -3,7 +3,7 @@
#######################################################################
LANGUAGE = octave
OCTAVE = @OCTAVE@ -qf
OCTAVE = @OCTAVE@
SCRIPTSUFFIX = _runme.m
srcdir = @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
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)