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