source: branches/1.7/cf/rpLangOctave.m4 @ 6688

Last change on this file since 6688 was 6688, checked in by clarksm, 6 years ago

Add support for octave series 4

File size: 4.2 KB
Line 
1
2#
3# Octave variables:
4#
5#       OCTAVE                  Path to default octave executable.  Will use
6#                               to determine the version.
7#       OCTAVE_VERSION          Full version of octave (X.X.X).  Used in
8#                               Makefiles to indicate if we are building
9#                               the octave language bindings.  The empty
10#                               string indicates octave is not available.
11#       OCTAVE_VERSION_MAJOR    Single verion number of octave.  Used in
12#                               rappture.env scripts to indicate how to set
13#                               OCTAVE_PATH and OCTAVE_LOADPATH variables.
14#       MKOCTFILE               Path to the default octave compiler.  This
15#                               variable isn't used directly.  Either
16#                               MKOCTFILE2 or MKOCTFILE3 will be set to its
17#                               value.
18#       MKOCTFILE2              Path to octave version 2 compiler.
19#       MKOCTFILE3              Path to octave version 3 compiler.
20#
21
22# Standard octave search (use the installed version of octave)
23AC_DEFUN([RP_LANG_OCTAVE],[
24AC_ARG_WITH(
25    [octave],
26    [AS_HELP_STRING([--with-octave[=DIR]],
27        [path of default octave compiler `mkoctfile' @<:@default=yes@:>@])],
28    [],
29    [with_octave=yes])
30
31OCTAVE=
32OCTAVE_VERSION=
33OCTAVE_VERSION_MAJOR=
34MKOCTFILE2=
35MKOCTFILE3=
36MKOCTFILE4=
37
38if test "$with_octave" != "no" ; then
39  if test "$with_octave" = "yes" ; then
40    AC_PATH_PROG(OCTAVE, octave)
41    AC_PATH_PROG(MKOCTFILE, mkoctfile)
42  else
43    OCTAVE=$with_octave
44    MKOCTFILE=`dirname $with_octave`/mkoctfile
45  fi
46fi
47
48if test "x${OCTAVE}" != "x" ; then
49  OCTAVE_VERSION=`${OCTAVE} -v | grep version | cut -d' ' -f4`
50  OCTAVE_VERSION_MAJOR=`echo ${OCTAVE_VERSION} | cut -d'.' -f1`
51  if test "${OCTAVE_VERSION_MAJOR}" == "4" ; then
52    OCTAVE4=$OCTAVE
53    MKOCTFILE4=$MKOCTFILE
54  fi
55  if test "${OCTAVE_VERSION_MAJOR}" == "3" ; then
56    OCTAVE3=$OCTAVE
57    MKOCTFILE3=$MKOCTFILE
58  fi
59  if test "${OCTAVE_VERSION_MAJOR}" == "2" ; then
60    OCTAVE2=$OCTAVE
61    MKOCTFILE2=$MKOCTFILE
62  fi
63fi
64
65#
66# Check for octave3 before octave2 so that we can override the
67# OCTAVE_VERSION variables. 
68#
69# Rappture doesn't normally really support both octave2 and octave3
70# simultaneously.  NANOhub has a hacked version of octave3 that
71# looks for OCTAVE_LOADPATH before looking at OCTAVE_PATH (i.e.
72# OCTAVE_PATH tells octave2 where to load the rappture bindings
73# and OCTAVE_LOADPATH tells octave3 where to load).
74#
75# Usually you will have installed either octave2 or octave3, but
76# not both. 
77#
78
79# Check if octave4 was designated *in addition* to the installed version.
80# This can override the default version if they are the same versions.
81
82AC_ARG_WITH(
83    [mkoctfile4],
84    [AS_HELP_STRING([--with-mkoctfile4[=DIR]],
85        [path of octave compiler `mkoctfile' @<:@default=no@:>@])],
86    [],
87    [with_mkoctfile4=no])
88
89if test "$with_mkoctfile4" != "no" ; then
90  if test "$with_mkoctfile4" = "yes" ; then
91    AC_PATH_PROG(mkoctfile4, mkoctfile)
92  else
93    MKOCTFILE4=$with_mkoctfile4
94  fi
95  OCTAVE_VERSION=`${MKOCTFILE4} --version 2>&1 | cut -d' ' -f3`
96  OCTAVE_VERSION_MAJOR=`echo ${OCTAVE_VERSION} | cut -d'.' -f1`
97fi
98
99# Check if octave3 was designated *in addition* to the installed version.
100# This can override the default version if they are the same versions.
101
102AC_ARG_WITH(
103    [mkoctfile3],
104    [AS_HELP_STRING([--with-mkoctfile3[=DIR]],
105        [path of octave compiler `mkoctfile' @<:@default=no@:>@])],
106    [],
107    [with_mkoctfile3=no])
108
109if test "$with_mkoctfile3" != "no" ; then
110  if test "$with_mkoctfile3" = "yes" ; then
111    AC_PATH_PROG(mkoctfile3, mkoctfile)
112  else
113    MKOCTFILE3=$with_mkoctfile3
114  fi
115  OCTAVE_VERSION=`${MKOCTFILE3} --version 2>&1 | cut -d' ' -f3`
116  OCTAVE_VERSION_MAJOR=`echo ${OCTAVE_VERSION} | cut -d'.' -f1`
117fi
118
119# Check if mkoctfile2 was designated *in addition* to the installed version.
120# This can override the default version if they are the same versions.
121AC_ARG_WITH(
122    [mkoctfile2],
123    [AS_HELP_STRING([--with-mkoctfile2[=DIR]],
124        [path of octave compiler `mkoctfile' @<:@default=no@:>@])],
125    [],
126    [with_mkoctfile2=no])
127
128if test "$with_mkoctfile2" != "no" ; then
129  if test "$with_mkoctfile2" = "yes" ; then
130    AC_PATH_PROG(mkoctfile2, mkoctfile)
131  else
132    MKOCTFILE2=$with_mkoctfile2
133  fi
134  # Have to use octave to get a version, instead of mkoctfile.
135  octave=`dirname $MKOCTFILE2`/octave
136  OCTAVE_VERSION=`${octave} -v | grep version | cut -d' ' -f4`
137  OCTAVE_VERSION_MAJOR=`echo ${OCTAVE_VERSION} | cut -d'.' -f1`
138fi
139])
Note: See TracBrowser for help on using the repository browser.