| 1 |
dnl Evaluate an expression in octave |
| 2 |
dnl |
| 3 |
dnl OCTAVE_EVAL(expr,var) -> var=expr |
| 4 |
dnl |
| 5 |
dnl Stolen from octave-forge |
| 6 |
|
| 7 |
AC_DEFUN([OCTAVE_EVAL], |
| 8 |
[ |
| 9 |
AC_MSG_CHECKING([for $1 in $OCTAVE]) |
| 10 |
$2=`TERM=;$OCTAVE -qfH --eval "disp($1)"` |
| 11 |
AC_MSG_RESULT($$2) |
| 12 |
AC_SUBST($2) |
| 13 |
]) # OCTAVE_EVAL |
| 14 |
|
| 15 |
dnl @synopsis AC_OCTAVE_VERSION |
| 16 |
dnl |
| 17 |
dnl Find the version of Octave. |
| 18 |
dnl @version 1.0 Aug 23 2007 |
| 19 |
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> |
| 20 |
dnl |
| 21 |
dnl Permission to use, copy, modify, distribute, and sell this file for any |
| 22 |
dnl purpose is hereby granted without fee, provided that the above copyright |
| 23 |
dnl and this permission notice appear in all copies. No representations are |
| 24 |
dnl made about the suitability of this software for any purpose. It is |
| 25 |
dnl provided "as is" without express or implied warranty. |
| 26 |
dnl |
| 27 |
|
| 28 |
AC_DEFUN([AC_OCTAVE_VERSION], |
| 29 |
[ |
| 30 |
|
| 31 |
AC_ARG_WITH(octave, |
| 32 |
AS_HELP_STRING([--with-octave], [choose the octave version]), |
| 33 |
[ with_octave=$withval ]) |
| 34 |
|
| 35 |
test -z "$with_octave" && with_octave=octave |
| 36 |
|
| 37 |
AC_CHECK_PROG(HAVE_OCTAVE,$with_octave,yes,no) |
| 38 |
|
| 39 |
if test "x$ac_cv_prog_HAVE_OCTAVE" = "xyes" ; then |
| 40 |
OCTAVE=$with_octave |
| 41 |
OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION) |
| 42 |
fi |
| 43 |
|
| 44 |
AC_SUBST(OCTAVE) |
| 45 |
AC_SUBST(OCTAVE_VERSION) |
| 46 |
|
| 47 |
])# AC_OCTAVE_VERSION |
| 48 |
|
| 49 |
dnl @synopsis AC_OCTAVE_CONFIG_VERSION |
| 50 |
dnl |
| 51 |
dnl Find the version of Octave. |
| 52 |
dnl @version 1.0 Aug 23 2007 |
| 53 |
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> |
| 54 |
dnl |
| 55 |
dnl Permission to use, copy, modify, distribute, and sell this file for any |
| 56 |
dnl purpose is hereby granted without fee, provided that the above copyright |
| 57 |
dnl and this permission notice appear in all copies. No representations are |
| 58 |
dnl made about the suitability of this software for any purpose. It is |
| 59 |
dnl provided "as is" without express or implied warranty. |
| 60 |
dnl |
| 61 |
|
| 62 |
AC_DEFUN([AC_OCTAVE_CONFIG_VERSION], |
| 63 |
[ |
| 64 |
|
| 65 |
AC_ARG_WITH(octave-config, |
| 66 |
AS_HELP_STRING([--with-octave-config], [choose the octave-config version]), |
| 67 |
[ with_octave_config=$withval ]) |
| 68 |
|
| 69 |
test -z "$with_octave_config" && with_octave_config=octave-config |
| 70 |
|
| 71 |
AC_CHECK_PROG(HAVE_OCTAVE_CONFIG,$with_octave_config,yes,no) |
| 72 |
|
| 73 |
if test "x$ac_cv_prog_HAVE_OCTAVE_CONFIG" = "xyes" ; then |
| 74 |
OCTAVE_CONFIG=$with_octave_config |
| 75 |
AC_MSG_CHECKING([for version of $OCTAVE_CONFIG]) |
| 76 |
OCTAVE_CONFIG_VERSION=`$OCTAVE_CONFIG --version` |
| 77 |
AC_MSG_RESULT($OCTAVE_CONFIG_VERSION) |
| 78 |
fi |
| 79 |
|
| 80 |
AC_SUBST(OCTAVE_CONFIG) |
| 81 |
AC_SUBST(OCTAVE_CONFIG_VERSION) |
| 82 |
|
| 83 |
])# AC_OCTAVE_CONFIG_VERSION |
| 84 |
|
| 85 |
dnl @synopsis AC_OCTAVE_BUILD |
| 86 |
dnl |
| 87 |
dnl Check programs and headers required for building octave plugins. |
| 88 |
dnl @version 1.0 Aug 23 2007 |
| 89 |
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> |
| 90 |
dnl |
| 91 |
dnl Permission to use, copy, modify, distribute, and sell this file for any |
| 92 |
dnl purpose is hereby granted without fee, provided that the above copyright |
| 93 |
dnl and this permission notice appear in all copies. No representations are |
| 94 |
dnl made about the suitability of this software for any purpose. It is |
| 95 |
dnl provided "as is" without express or implied warranty. |
| 96 |
|
| 97 |
|
| 98 |
AC_DEFUN([AC_OCTAVE_BUILD], |
| 99 |
[ |
| 100 |
|
| 101 |
dnl Default to no. |
| 102 |
OCTAVE_BUILD=no |
| 103 |
|
| 104 |
AC_OCTAVE_VERSION |
| 105 |
OCTAVE_MKOCTFILE_VERSION |
| 106 |
AC_OCTAVE_CONFIG_VERSION |
| 107 |
|
| 108 |
prog_concat="$ac_cv_prog_HAVE_OCTAVE$ac_cv_prog_HAVE_OCTAVE_CONFIG$ac_cv_prog_HAVE_MKOCTFILE" |
| 109 |
|
| 110 |
if test "x$prog_concat" = "xyesyesyes" ; then |
| 111 |
if test "x$OCTAVE_VERSION" != "x$MKOCTFILE_VERSION" ; then |
| 112 |
AC_MSG_WARN([** Mismatch between versions of octave and mkoctfile. **]) |
| 113 |
AC_MSG_WARN([** Octave libsndfile modules will not be built. **]) |
| 114 |
elif test "x$OCTAVE_VERSION" != "x$OCTAVE_CONFIG_VERSION" ; then |
| 115 |
AC_MSG_WARN([** Mismatch between versions of octave and octave-config. **]) |
| 116 |
AC_MSG_WARN([** Octave libsndfile modules will not be built. **]) |
| 117 |
else |
| 118 |
case "$MKOCTFILE_VERSION" in |
| 119 |
2.*) |
| 120 |
AC_MSG_WARN([Octave version 2.X is not supported.]) |
| 121 |
;; |
| 122 |
3.*) |
| 123 |
OCTAVE_DEST_ODIR=`$OCTAVE_CONFIG --oct-site-dir | sed 's%^/usr%${prefix}%'` |
| 124 |
OCTAVE_DEST_MDIR=`$OCTAVE_CONFIG --m-site-dir | sed 's%^/usr%${prefix}%'` |
| 125 |
|
| 126 |
OCTAVE_BUILD=yes |
| 127 |
;; |
| 128 |
*) |
| 129 |
AC_MSG_WARN([Octave version $MKOCTFILE_VERSION is not supported.]) |
| 130 |
;; |
| 131 |
esac |
| 132 |
fi |
| 133 |
AC_MSG_RESULT([building octave libsndfile module... $OCTAVE_BUILD]) |
| 134 |
fi |
| 135 |
|
| 136 |
AC_SUBST(OCTAVE_DEST_ODIR) |
| 137 |
AC_SUBST(OCTAVE_DEST_MDIR) |
| 138 |
|
| 139 |
AC_SUBST(MKOCTFILE) |
| 140 |
|
| 141 |
AM_CONDITIONAL(BUILD_OCTAVE_MOD, test "x$OCTAVE_BUILD" = xyes) |
| 142 |
|
| 143 |
])# AC_OCTAVE_BUILD |