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