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