From 2fd94889399bc1910b056d57eadd0cbfca653598 Mon Sep 17 00:00:00 2001 From: stevenj Date: Wed, 28 Oct 2009 21:16:41 -0400 Subject: [PATCH] updated Octave install-directory detection for recent Octave versions darcs-hash:20091029011641-c8de0-0c02209397ba9a1e9f38b883a60a0e49ad6af6ad.gz --- configure.ac | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index e3398c6..2068227 100644 --- a/configure.ac +++ b/configure.ac @@ -102,24 +102,43 @@ elif test "$MKOCTFILE" = "echo"; then 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") -- 2.30.2