source: branches/1.4/cf/rpLangOctave.m4 @ 5382

Last change on this file since 5382 was 2298, checked in by gah, 13 years ago

fixes for grid.sh build for opensees

File size: 3.5 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=
36
37if test "$with_octave" != "no" ; then
38  if test "$with_octave" = "yes" ; then
39    AC_PATH_PROG(OCTAVE, octave)
40    AC_PATH_PROG(MKOCTFILE, mkoctfile)
41  else
42    OCTAVE=$with_octave
43    MKOCTFILE=`dirname $with_octave`/mkoctfile
44  fi
45fi
46
47if test "x${OCTAVE}" != "x" ; then
48  OCTAVE_VERSION=`${OCTAVE} -v | grep version | cut -d' ' -f4`
49  OCTAVE_VERSION_MAJOR=`echo ${OCTAVE_VERSION} | cut -d'.' -f1`
50  if test "${OCTAVE_VERSION_MAJOR}" == "3" ; then
51    OCTAVE3=$OCTAVE
52    MKOCTFILE3=$MKOCTFILE
53  fi
54  if test "${OCTAVE_VERSION_MAJOR}" == "2" ; then
55    OCTAVE2=$OCTAVE
56    MKOCTFILE2=$MKOCTFILE
57  fi
58fi
59
60#
61# Check for octave3 before octave2 so that we can override the
62# OCTAVE_VERSION variables. 
63#
64# Rappture doesn't normally really support both octave2 and octave3
65# simultaneously.  NANOhub has a hacked version of octave3 that
66# looks for OCTAVE_LOADPATH before looking at OCTAVE_PATH (i.e.
67# OCTAVE_PATH tells octave2 where to load the rappture bindings
68# and OCTAVE_LOADPATH tells octave3 where to load).
69#
70# Usually you will have installed either octave2 or octave3, but
71# not both. 
72#
73
74# Check if octave3 was designated *in addition* to the installed version.
75# This can override the default version if they are the same versions.
76
77AC_ARG_WITH(
78    [mkoctfile3],
79    [AS_HELP_STRING([--with-mkoctfile3[=DIR]],
80        [path of octave compiler `mkoctfile' @<:@default=no@:>@])],
81    [],
82    [with_mkoctfile3=no])
83
84if test "$with_mkoctfile3" != "no" ; then
85  if test "$with_mkoctfile3" = "yes" ; then
86    AC_PATH_PROG(mkoctfile3, mkoctfile)
87  else
88    MKOCTFILE3=$with_mkoctfile3
89  fi
90  OCTAVE_VERSION=`${MKOCTFILE3} --version 2>&1 | cut -d' ' -f3`
91  OCTAVE_VERSION_MAJOR=`echo ${OCTAVE_VERSION} | cut -d'.' -f1`
92fi
93
94# Check if mkoctfile2 was designated *in addition* to the installed version.
95# This can override the default version if they are the same versions.
96AC_ARG_WITH(
97    [mkoctfile2],
98    [AS_HELP_STRING([--with-mkoctfile2[=DIR]],
99        [path of octave compiler `mkoctfile' @<:@default=no@:>@])],
100    [],
101    [with_mkoctfile2=no])
102
103if test "$with_mkoctfile2" != "no" ; then
104  if test "$with_mkoctfile2" = "yes" ; then
105    AC_PATH_PROG(mkoctfile2, mkoctfile)
106  else
107    MKOCTFILE2=$with_mkoctfile2
108  fi
109  # Have to use octave to get a version, instead of mkoctfile.
110  octave=`dirname $MKOCTFILE2`/octave
111  OCTAVE_VERSION=`${octave} -v | grep version | cut -d' ' -f4`
112  OCTAVE_VERSION_MAJOR=`echo ${OCTAVE_VERSION} | cut -d'.' -f1`
113fi
114])
Note: See TracBrowser for help on using the repository browser.