chiark / gitweb /
updated Octave install-directory detection for recent Octave versions
authorstevenj <stevenj@alum.mit.edu>
Thu, 29 Oct 2009 01:16:41 +0000 (21:16 -0400)
committerstevenj <stevenj@alum.mit.edu>
Thu, 29 Oct 2009 01:16:41 +0000 (21:16 -0400)
darcs-hash:20091029011641-c8de0-0c02209397ba9a1e9f38b883a60a0e49ad6af6ad.gz

configure.ac

index e3398c6df4da97c50c2524c0a901dc7c2c3633ca..206822741c93944c4bf5bc61c520b8d6c47606e5 100644 (file)
@@ -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")