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