elif test x"$OCT_INSTALL_DIR" = "x"; then
# try to find installation directory
AC_CHECK_PROGS(OCTAVE, octave, echo)
- AC_MSG_CHECKING(for Octave loadpath)
- OCTAVE_LOADPATH=`echo "DEFAULT_LOADPATH" | $OCTAVE -q | cut -d'=' -f2`
- AC_MSG_RESULT($OCTAVE_LOADPATH)
- AC_MSG_CHECKING(where Octave plugins go)
- OCT_INSTALL_DIR=`echo "$OCTAVE_LOADPATH" | tr ':' '\n' | grep "site/oct" | head -1`
+ AC_CHECK_PROGS(OCTAVE_CONFIG, octave-config, echo)
+
+ AC_MSG_CHECKING(where octave plugins go)
+ OCT_INSTALL_DIR=`octave-config --oct-site-dir 2> /dev/null | grep '/'`
+ if test -z "$OCT_INSTALL_DIR"; then
+ OCT_INSTALL_DIR=`octave-config --print OCTFILEDIR 2> /dev/null | grep '/'`
+ fi
+ if test -z "$OCT_INSTALL_DIR"; then
+ OCT_INSTALL_DIR=`echo "path" | $OCTAVE -q 2> /dev/null | grep "/oct/" | head -1`
+ fi
+ if test -z "$OCT_INSTALL_DIR"; then
+ OCT_INSTALL_DIR=`echo "DEFAULT_LOADPATH" | $OCTAVE -q 2> /dev/null | tr ':' '\n' | grep "site/oct" | head -1`
+ fi
if test -n "$OCT_INSTALL_DIR"; then
AC_MSG_RESULT($OCT_INSTALL_DIR)
else
AC_MSG_RESULT(unknown)
- AC_MSG_WARN([can't find where to install GNU Octave plugins])
+ AC_MSG_WARN([can't find where to install octave plugins: won't be able to compile octave plugin])
fi
- AC_MSG_CHECKING(where Octave scripts go)
- M_INSTALL_DIR=`echo "$OCTAVE_LOADPATH" | tr ':' '\n' | grep "site/m" | head -1`
+
+ AC_MSG_CHECKING(where octave scripts go)
+ M_INSTALL_DIR=`octave-config --m-site-dir 2> /dev/null | grep '/'`
+ if test -z "$M_INSTALL_DIR"; then
+ M_INSTALL_DIR=`octave-config --print FCNFILEDIR 2> /dev/null | grep '/'`
+ fi
+ if test -z "$M_INSTALL_DIR"; then
+ M_INSTALL_DIR=`echo "path" | $OCTAVE -q 2> /dev/null | grep "/m" | head -1`
+ fi
+ if test -z "$M_INSTALL_DIR"; then
+ M_INSTALL_DIR=`echo "DEFAULT_LOADPATH" | $OCTAVE -q 2> /dev/null | tr ':' '\n' | grep "site/m" | head -1`
+ fi
if test -n "$M_INSTALL_DIR"; then
AC_MSG_RESULT($M_INSTALL_DIR)
else
AC_MSG_RESULT(unknown)
- AC_MSG_WARN([can't find where to install GNU Octave scripts])
+ AC_MSG_WARN([can't find where to install octave scripts: won't be able to install octave plugin])
+ OCT_INSTALL_DIR=""
fi
fi
AM_CONDITIONAL(WITH_OCTAVE, test x"$OCT_INSTALL_DIR" != "x")