• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl Evaluate an expression in octave
2dnl
3dnl OCTAVE_EVAL(expr,var) -> var=expr
4dnl
5dnl Stolen from octave-forge
6
7AC_DEFUN([OCTAVE_EVAL],
8[
9AC_MSG_CHECKING([for $1 in $OCTAVE])
10$2=`TERM=;$OCTAVE -qfH --eval "disp($1)"`
11AC_MSG_RESULT($$2)
12AC_SUBST($2)
13]) # OCTAVE_EVAL
14
15dnl @synopsis AC_OCTAVE_VERSION
16dnl
17dnl Find the version of Octave.
18dnl @version 1.0	Aug 23 2007
19dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
20dnl
21dnl Permission to use, copy, modify, distribute, and sell this file for any
22dnl purpose is hereby granted without fee, provided that the above copyright
23dnl and this permission notice appear in all copies.  No representations are
24dnl made about the suitability of this software for any purpose.  It is
25dnl provided "as is" without express or implied warranty.
26dnl
27
28AC_DEFUN([AC_OCTAVE_VERSION],
29[
30
31AC_ARG_WITH(octave,
32	AC_HELP_STRING([--with-octave], [choose the octave version]),
33	[ with_octave=$withval ])
34
35test -z "$with_octave" && with_octave=octave
36
37AC_CHECK_PROG(HAVE_OCTAVE,$with_octave,yes,no)
38
39if test "x$ac_cv_prog_HAVE_OCTAVE" = "xyes" ; then
40	OCTAVE=$with_octave
41	OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)
42	fi
43
44AC_SUBST(OCTAVE)
45AC_SUBST(OCTAVE_VERSION)
46
47])# AC_OCTAVE_VERSION
48
49dnl @synopsis AC_OCTAVE_CONFIG_VERSION
50dnl
51dnl Find the version of Octave.
52dnl @version 1.0	Aug 23 2007
53dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
54dnl
55dnl Permission to use, copy, modify, distribute, and sell this file for any
56dnl purpose is hereby granted without fee, provided that the above copyright
57dnl and this permission notice appear in all copies.  No representations are
58dnl made about the suitability of this software for any purpose.  It is
59dnl provided "as is" without express or implied warranty.
60dnl
61
62AC_DEFUN([AC_OCTAVE_CONFIG_VERSION],
63[
64
65AC_ARG_WITH(octave-config,
66	AC_HELP_STRING([--with-octave-config], [choose the octave-config version]),
67	[ with_octave_config=$withval ])
68
69test -z "$with_octave_config" && with_octave_config=octave-config
70
71AC_CHECK_PROG(HAVE_OCTAVE_CONFIG,$with_octave_config,yes,no)
72
73if 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
80AC_SUBST(OCTAVE_CONFIG)
81AC_SUBST(OCTAVE_CONFIG_VERSION)
82
83])# AC_OCTAVE_CONFIG_VERSION
84
85dnl @synopsis AC_OCTAVE_BUILD
86dnl
87dnl Check programs and headers required for building octave plugins.
88dnl @version 1.0	Aug 23 2007
89dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
90dnl
91dnl Permission to use, copy, modify, distribute, and sell this file for any
92dnl purpose is hereby granted without fee, provided that the above copyright
93dnl and this permission notice appear in all copies.  No representations are
94dnl made about the suitability of this software for any purpose.  It is
95dnl provided "as is" without express or implied warranty.
96
97
98AC_DEFUN([AC_OCTAVE_BUILD],
99[
100
101dnl Default to no.
102OCTAVE_BUILD=no
103
104AC_OCTAVE_VERSION
105OCTAVE_MKOCTFILE_VERSION
106AC_OCTAVE_CONFIG_VERSION
107
108prog_concat="$ac_cv_prog_HAVE_OCTAVE$ac_cv_prog_HAVE_OCTAVE_CONFIG$ac_cv_prog_HAVE_MKOCTFILE"
109
110if 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
136AC_SUBST(OCTAVE_DEST_ODIR)
137AC_SUBST(OCTAVE_DEST_MDIR)
138
139AC_SUBST(MKOCTFILE)
140
141AM_CONDITIONAL(BUILD_OCTAVE_MOD, test "x$OCTAVE_BUILD" = xyes)
142
143])# AC_OCTAVE_BUILD
144