Chris@40: dnl Evaluate an expression in octave Chris@40: dnl Chris@40: dnl OCTAVE_EVAL(expr,var) -> var=expr Chris@40: dnl Chris@40: dnl Stolen from octave-forge Chris@40: Chris@40: AC_DEFUN([OCTAVE_EVAL], Chris@40: [ Chris@40: AC_MSG_CHECKING([for $1 in $OCTAVE]) Chris@40: $2=`TERM=;$OCTAVE -qfH --eval "disp($1)"` Chris@40: AC_MSG_RESULT($$2) Chris@40: AC_SUBST($2) Chris@40: ]) # OCTAVE_EVAL Chris@40: Chris@40: dnl @synopsis AC_OCTAVE_VERSION Chris@40: dnl Chris@40: dnl Find the version of Octave. Chris@40: dnl @version 1.0 Aug 23 2007 Chris@40: dnl @author Erik de Castro Lopo Chris@40: dnl Chris@40: dnl Permission to use, copy, modify, distribute, and sell this file for any Chris@40: dnl purpose is hereby granted without fee, provided that the above copyright Chris@40: dnl and this permission notice appear in all copies. No representations are Chris@40: dnl made about the suitability of this software for any purpose. It is Chris@40: dnl provided "as is" without express or implied warranty. Chris@40: dnl Chris@40: Chris@40: AC_DEFUN([AC_OCTAVE_VERSION], Chris@40: [ Chris@40: Chris@40: AC_ARG_WITH(octave, Chris@40: AC_HELP_STRING([--with-octave], [choose the octave version]), Chris@40: [ with_octave=$withval ]) Chris@40: Chris@40: test -z "$with_octave" && with_octave=octave Chris@40: Chris@40: AC_CHECK_PROG(HAVE_OCTAVE,$with_octave,yes,no) Chris@40: Chris@40: if test "x$ac_cv_prog_HAVE_OCTAVE" = "xyes" ; then Chris@40: OCTAVE=$with_octave Chris@40: OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION) Chris@40: fi Chris@40: Chris@40: AC_SUBST(OCTAVE) Chris@40: AC_SUBST(OCTAVE_VERSION) Chris@40: Chris@40: ])# AC_OCTAVE_VERSION Chris@40: Chris@40: dnl @synopsis AC_OCTAVE_CONFIG_VERSION Chris@40: dnl Chris@40: dnl Find the version of Octave. Chris@40: dnl @version 1.0 Aug 23 2007 Chris@40: dnl @author Erik de Castro Lopo Chris@40: dnl Chris@40: dnl Permission to use, copy, modify, distribute, and sell this file for any Chris@40: dnl purpose is hereby granted without fee, provided that the above copyright Chris@40: dnl and this permission notice appear in all copies. No representations are Chris@40: dnl made about the suitability of this software for any purpose. It is Chris@40: dnl provided "as is" without express or implied warranty. Chris@40: dnl Chris@40: Chris@40: AC_DEFUN([AC_OCTAVE_CONFIG_VERSION], Chris@40: [ Chris@40: Chris@40: AC_ARG_WITH(octave-config, Chris@40: AC_HELP_STRING([--with-octave-config], [choose the octave-config version]), Chris@40: [ with_octave_config=$withval ]) Chris@40: Chris@40: test -z "$with_octave_config" && with_octave_config=octave-config Chris@40: Chris@40: AC_CHECK_PROG(HAVE_OCTAVE_CONFIG,$with_octave_config,yes,no) Chris@40: Chris@40: if test "x$ac_cv_prog_HAVE_OCTAVE_CONFIG" = "xyes" ; then Chris@40: OCTAVE_CONFIG=$with_octave_config Chris@40: AC_MSG_CHECKING([for version of $OCTAVE_CONFIG]) Chris@40: OCTAVE_CONFIG_VERSION=`$OCTAVE_CONFIG --version` Chris@40: AC_MSG_RESULT($OCTAVE_CONFIG_VERSION) Chris@40: fi Chris@40: Chris@40: AC_SUBST(OCTAVE_CONFIG) Chris@40: AC_SUBST(OCTAVE_CONFIG_VERSION) Chris@40: Chris@40: ])# AC_OCTAVE_CONFIG_VERSION Chris@40: Chris@40: dnl @synopsis AC_OCTAVE_BUILD Chris@40: dnl Chris@40: dnl Check programs and headers required for building octave plugins. Chris@40: dnl @version 1.0 Aug 23 2007 Chris@40: dnl @author Erik de Castro Lopo Chris@40: dnl Chris@40: dnl Permission to use, copy, modify, distribute, and sell this file for any Chris@40: dnl purpose is hereby granted without fee, provided that the above copyright Chris@40: dnl and this permission notice appear in all copies. No representations are Chris@40: dnl made about the suitability of this software for any purpose. It is Chris@40: dnl provided "as is" without express or implied warranty. Chris@40: Chris@40: Chris@40: AC_DEFUN([AC_OCTAVE_BUILD], Chris@40: [ Chris@40: Chris@40: dnl Default to no. Chris@40: OCTAVE_BUILD=no Chris@40: Chris@40: AC_OCTAVE_VERSION Chris@40: OCTAVE_MKOCTFILE_VERSION Chris@40: AC_OCTAVE_CONFIG_VERSION Chris@40: Chris@40: prog_concat="$ac_cv_prog_HAVE_OCTAVE$ac_cv_prog_HAVE_OCTAVE_CONFIG$ac_cv_prog_HAVE_MKOCTFILE" Chris@40: Chris@40: if test "x$prog_concat" = "xyesyesyes" ; then Chris@40: if test "x$OCTAVE_VERSION" != "x$MKOCTFILE_VERSION" ; then Chris@40: AC_MSG_WARN([** Mismatch between versions of octave and mkoctfile. **]) Chris@40: AC_MSG_WARN([** Octave libsndfile modules will not be built. **]) Chris@40: elif test "x$OCTAVE_VERSION" != "x$OCTAVE_CONFIG_VERSION" ; then Chris@40: AC_MSG_WARN([** Mismatch between versions of octave and octave-config. **]) Chris@40: AC_MSG_WARN([** Octave libsndfile modules will not be built. **]) Chris@40: else Chris@40: case "$MKOCTFILE_VERSION" in Chris@40: 2.*) Chris@40: AC_MSG_WARN([Octave version 2.X is not supported.]) Chris@40: ;; Chris@40: 3.*) Chris@40: OCTAVE_DEST_ODIR=`$OCTAVE_CONFIG --oct-site-dir | sed 's%^/usr%${prefix}%'` Chris@40: OCTAVE_DEST_MDIR=`$OCTAVE_CONFIG --m-site-dir | sed 's%^/usr%${prefix}%'` Chris@40: Chris@40: OCTAVE_BUILD=yes Chris@40: ;; Chris@40: *) Chris@40: AC_MSG_WARN([Octave version $MKOCTFILE_VERSION is not supported.]) Chris@40: ;; Chris@40: esac Chris@40: fi Chris@40: AC_MSG_RESULT([building octave libsndfile module... $OCTAVE_BUILD]) Chris@40: fi Chris@40: Chris@40: AC_SUBST(OCTAVE_DEST_ODIR) Chris@40: AC_SUBST(OCTAVE_DEST_MDIR) Chris@40: Chris@40: AC_SUBST(MKOCTFILE) Chris@40: Chris@40: AM_CONDITIONAL(BUILD_OCTAVE_MOD, test "x$OCTAVE_BUILD" = xyes) Chris@40: Chris@40: ])# AC_OCTAVE_BUILD