chiark / gitweb /
Plugins installation honor prefix
authorxantares <xantares09@hotmail.com>
Fri, 30 Aug 2013 15:12:57 +0000 (17:12 +0200)
committerxantares <xantares09@hotmail.com>
Fri, 30 Aug 2013 15:12:57 +0000 (17:12 +0200)
configure.ac

index a7815973c2f46929e7d27fa4bff19bbbc69ceeb6..728f68e69dc550ca3e4bd958beb557eb01389b16 100644 (file)
@@ -33,6 +33,10 @@ if test "x$with_cxx" = xyes; then
 fi
 AC_SUBST(NLOPT_SUFFIX)
 
+if test "$prefix" = "NONE"; then
+   prefix=$ac_default_prefix
+fi
+
 AC_ARG_WITH(mthreads,
         [AC_HELP_STRING([--with-mthreads], [use -mthreads compiler flag])],
         with_mthrads=$withval,with_mthreads=no)
@@ -138,8 +142,14 @@ if test "x$GUILE" = xunknown; then
    AC_MSG_WARN([can't find guile, disabling Guile wrapper])
    GUILE_CONFIG=unknown
 elif test x"$GUILE_INSTALL_DIR" = "x"; then
+   AC_CHECK_PROGS(GUILE_CONFIG, guile-config, echo)
+   AC_MSG_CHECKING(guile prefix)
+   GUILE_PREFIX=`guile-config info prefix`
+   AC_MSG_RESULT($GUILE_PREFIX)
    AC_MSG_CHECKING([for Guile installation directory])
    GUILE_INSTALL_DIR=`guile -c '(display (%site-dir))'`
+   # strip guile install path to honor prefix
+   GUILE_INSTALL_DIR=`echo "$GUILE_INSTALL_DIR" | sed "s|$GUILE_PREFIX|$prefix|g"`
    AC_MSG_RESULT([$GUILE_INSTALL_DIR])
 fi
 
@@ -214,7 +224,11 @@ elif test x"$OCT_INSTALL_DIR" = "x"; then
        # try to find installation directory
        AC_CHECK_PROGS(OCTAVE, octave, echo)
        AC_CHECK_PROGS(OCTAVE_CONFIG, octave-config, echo)
-
+       
+       AC_MSG_CHECKING(octave prefix)
+       OCTAVE_PREFIX=`octave-config --print PREFIX 2> /dev/null`
+       AC_MSG_RESULT($OCTAVE_PREFIX)
+       
        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
@@ -227,6 +241,8 @@ elif test x"$OCT_INSTALL_DIR" = "x"; 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
+               # strip octave install path to honor prefix
+               OCT_INSTALL_DIR=`echo "$OCT_INSTALL_DIR" | sed "s|$OCTAVE_PREFIX|$prefix|g"`
                AC_MSG_RESULT($OCT_INSTALL_DIR)
        else
                AC_MSG_RESULT(unknown)
@@ -245,6 +261,8 @@ elif test x"$OCT_INSTALL_DIR" = "x"; 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
+               # strip octave install path to honor prefix
+               M_INSTALL_DIR=`echo "$M_INSTALL_DIR" | sed "s|$OCTAVE_PREFIX|$prefix|g"`
                AC_MSG_RESULT($M_INSTALL_DIR)
        else
                AC_MSG_RESULT(unknown)