1 dnl Evaluate an expression in octave
3 dnl OCTAVE_EVAL(expr,var) -> var=expr
5 dnl Stolen from octave-forge
7 AC_DEFUN([OCTAVE_EVAL],
9 AC_MSG_CHECKING([for $1 in $OCTAVE])
10 $2=`TERM=;$OCTAVE -qfH --eval "disp($1)"`
15 dnl @synopsis AC_OCTAVE_VERSION
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>
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.
28 AC_DEFUN([AC_OCTAVE_VERSION],
32 AC_HELP_STRING([--with-octave], [choose the octave version]),
33 [ with_octave=$withval ])
35 test -z "$with_octave" && with_octave=octave
37 AC_CHECK_PROG(HAVE_OCTAVE,$with_octave,yes,no)
39 if test "x$ac_cv_prog_HAVE_OCTAVE" = "xyes" ; then
41 OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)
45 AC_SUBST(OCTAVE_VERSION)
49 dnl @synopsis AC_OCTAVE_CONFIG_VERSION
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>
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.
62 AC_DEFUN([AC_OCTAVE_CONFIG_VERSION],
65 AC_ARG_WITH(octave-config,
66 AC_HELP_STRING([--with-octave-config], [choose the octave-config version]),
67 [ with_octave_config=$withval ])
69 test -z "$with_octave_config" && with_octave_config=octave-config
71 AC_CHECK_PROG(HAVE_OCTAVE_CONFIG,$with_octave_config,yes,no)
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)
80 AC_SUBST(OCTAVE_CONFIG)
81 AC_SUBST(OCTAVE_CONFIG_VERSION)
83 ])# AC_OCTAVE_CONFIG_VERSION
85 dnl @synopsis AC_OCTAVE_BUILD
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>
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.
98 AC_DEFUN([AC_OCTAVE_BUILD],
105 OCTAVE_MKOCTFILE_VERSION
106 AC_OCTAVE_CONFIG_VERSION
108 prog_concat="$ac_cv_prog_HAVE_OCTAVE$ac_cv_prog_HAVE_OCTAVE_CONFIG$ac_cv_prog_HAVE_MKOCTFILE"
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. **])
118 case "$MKOCTFILE_VERSION" in
120 AC_MSG_WARN([Octave version 2.X is not supported.])
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}%'`
129 AC_MSG_WARN([Octave version $MKOCTFILE_VERSION is not supported.])
133 AC_MSG_RESULT([building octave libsndfile module... $OCTAVE_BUILD])
136 AC_SUBST(OCTAVE_DEST_ODIR)
137 AC_SUBST(OCTAVE_DEST_MDIR)
141 AM_CONDITIONAL(BUILD_OCTAVE_MOD, test "x$OCTAVE_BUILD" = xyes)