11914
|
1 dnl The configure script is generated by autogen.sh from configure.base |
|
2 dnl and the various configure.add files in the source tree. Edit |
|
3 dnl configure.base and reprocess rather than modifying ./configure. |
|
4 |
|
5 dnl autoconf 2.13 certainly doesn't work! What is the minimum requirement? |
|
6 AC_PREREQ(2.2) |
|
7 |
|
8 AC_INIT(configure.base) |
|
9 |
|
10 PACKAGE=octave-forge |
|
11 MAJOR_VERSION=0 |
|
12 MINOR_VERSION=1 |
|
13 PATCH_LEVEL=0 |
|
14 |
|
15 dnl Kill caching --- this ought to be the default |
|
16 define([AC_CACHE_LOAD], )dnl |
|
17 define([AC_CACHE_SAVE], )dnl |
|
18 |
|
19 dnl uncomment to put support files in another directory |
|
20 dnl AC_CONFIG_AUX_DIR(admin) |
|
21 |
|
22 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$PATCH_LEVEL |
|
23 AC_SUBST(PACKAGE) |
|
24 AC_SUBST(VERSION) |
|
25 |
|
26 dnl need to find admin files, so keep track of the top dir. |
|
27 TOPDIR=`pwd` |
|
28 AC_SUBST(TOPDIR) |
|
29 |
|
30 dnl if mkoctfile doesn't work, then we need the following: |
|
31 dnl AC_PROG_CXX |
|
32 dnl AC_PROG_F77 |
|
33 |
|
34 dnl Need C compiler regardless so define it in a way that |
|
35 dnl makes autoconf happy and we can override whatever we |
|
36 dnl need with mkoctfile -p. |
|
37 dnl XXX FIXME XXX should use mkoctfile to get CC and CFLAGS |
|
38 AC_PROG_CC |
|
39 |
|
40 dnl XXX FIXME XXX need tests for -p -c -s in mkoctfile. |
|
41 |
|
42 dnl ******************************************************************* |
|
43 dnl Sort out mkoctfile version number and install paths |
|
44 |
|
45 dnl XXX FIXME XXX latest octave has octave-config so we don't |
|
46 dnl need to discover things here. Doesn't have --exe-site-dir |
|
47 dnl but defines --oct-site-dir and --m-site-dir |
|
48 |
|
49 dnl Check for mkoctfile |
|
50 AC_CHECK_PROG(MKOCTFILE,mkoctfile,mkoctfile) |
|
51 test -z "$MKOCTFILE" && AC_MSG_WARN([no mkoctfile found on path]) |
|
52 |
|
53 AC_SUBST(ver) |
|
54 AC_SUBST(subver) |
|
55 AC_SUBST(mpath) |
|
56 AC_SUBST(opath) |
|
57 AC_SUBST(xpath) |
|
58 AC_SUBST(altpath) |
|
59 AC_SUBST(altmpath) |
|
60 AC_SUBST(altopath) |
|
61 |
|
62 AC_ARG_WITH(path, |
|
63 [ --with-path install path prefix], |
|
64 [ path=$withval ]) |
|
65 AC_ARG_WITH(mpath, |
|
66 [ --with-mpath override path for m-files], |
|
67 [mpath=$withval]) |
|
68 AC_ARG_WITH(opath, |
|
69 [ --with-opath override path for oct-files], |
|
70 [opath=$withval]) |
|
71 AC_ARG_WITH(xpath, |
|
72 [ --with-xpath override path for executables], |
|
73 [xpath=$withval]) |
|
74 AC_ARG_WITH(altpath, |
|
75 [ --with-altpath alternative functions install path prefix], |
|
76 [ altpath=$withval ]) |
|
77 AC_ARG_WITH(altmpath, |
|
78 [ --with-altmpath override path for alternative m-files], |
|
79 [altmpath=$withval]) |
|
80 AC_ARG_WITH(altopath, |
|
81 [ --with-altopath override path for alternative oct-files], |
|
82 [altopath=$withval]) |
|
83 |
|
84 if test -n "$path" ; then |
|
85 test -z "$mpath" && mpath=$path |
|
86 test -z "$opath" && opath=$path/oct |
|
87 test -z "$xpath" && xpath=$path/bin |
|
88 test -z "$altpath" && altpath=$path-alternatives |
|
89 fi |
|
90 |
|
91 if test -n "$altpath" ; then |
|
92 test -z "$altmpath" && altmpath=$altpath |
|
93 test -z "$altopath" && altopath=$altpath/oct |
|
94 fi |
|
95 |
|
96 dnl Don't query if path/ver are given in the configure environment |
|
97 #if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$altmpath" || test -z "$altopath" || test -z "$ver" ; then |
|
98 if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$ver" ; then |
|
99 dnl Construct program to get mkoctfile version and local install paths |
|
100 cat > conftest.cc <<EOF |
|
101 #include <octave/config.h> |
|
102 #include <octave/version.h> |
|
103 #include <octave/defaults.h> |
|
104 |
|
105 #define INFOV "\nINFOV=" OCTAVE_VERSION "\n" |
|
106 |
|
107 #define INFOH "\nINFOH=" OCTAVE_CANONICAL_HOST_TYPE "\n" |
|
108 |
|
109 #ifdef OCTAVE_LOCALVERFCNFILEDIR |
|
110 # define INFOM "\nINFOM=" OCTAVE_LOCALVERFCNFILEDIR "\n" |
|
111 #else |
|
112 # define INFOM "\nINFOM=" OCTAVE_LOCALFCNFILEPATH "\n" |
|
113 #endif |
|
114 |
|
115 #ifdef OCTAVE_LOCALVEROCTFILEDIR |
|
116 # define INFOO "\nINFOO=" OCTAVE_LOCALVEROCTFILEDIR "\n" |
|
117 #else |
|
118 # define INFOO "\nINFOO=" OCTAVE_LOCALOCTFILEPATH "\n" |
|
119 #endif |
|
120 |
|
121 #ifdef OCTAVE_LOCALVERARCHLIBDIR |
|
122 # define INFOX "\nINFOX=" OCTAVE_LOCALVERARCHLIBDIR "\n" |
|
123 #else |
|
124 # define INFOX "\nINFOX=" OCTAVE_LOCALARCHLIBDIR "\n" |
|
125 #endif |
|
126 |
|
127 const char *infom = INFOM; |
|
128 const char *infoo = INFOO; |
|
129 const char *infox = INFOX; |
|
130 const char *infoh = INFOH; |
|
131 const char *infov = INFOV; |
|
132 EOF |
|
133 |
|
134 dnl Compile program perhaps with a special version of mkoctfile |
|
135 $MKOCTFILE conftest.cc || AC_MSG_ERROR(Could not run $MKOCTFILE) |
|
136 |
|
137 dnl Strip the config info from the compiled file |
|
138 eval `strings conftest.o | grep "^INFO.=" | sed -e "s,//.*$,,"` |
|
139 rm -rf conftest* |
|
140 |
|
141 dnl set the appropriate variables if they are not already set |
|
142 ver=`echo $INFOV | sed -e "s/\.//" -e "s/\..*$//"` |
|
143 subver=`echo $INFOV | sed -e "[s/^[^.]*[.][^.]*[.]//]"` |
|
144 alt_mbase=`echo $INFOM | sed -e "[s,\/[^\/]*$,,]"` |
|
145 alt_obase=`echo $INFOO | sed -e "[s,/site.*$,/site,]"` |
|
146 test -z "$mpath" && mpath=$INFOM/octave-forge |
|
147 test -z "$opath" && opath=$INFOO/octave-forge |
|
148 test -z "$xpath" && xpath=$INFOX |
|
149 test -z "$altmpath" && altmpath=$alt_mbase/octave-forge-alternatives/m |
|
150 test -z "$altopath" && altopath=$alt_obase/octave-forge-alternatives/oct/$INFOH |
|
151 fi |
|
152 |
|
153 dnl ******************************************************************* |
|
154 |
|
155 dnl Get LDFLAGS and CPPFLAGS set by user |
|
156 dnl These flags will be added to the mkoctfile command line |
11915
|
157 NETCDF_LIBS="$LDFLAGS" |
|
158 NETCDF_CFLAGS="$CPPFLAGS" |
11914
|
159 |
|
160 |
|
161 dnl XXX FIXME XXX Should we allow the user to override these? |
|
162 dnl Do we even need them? The individual makefiles can call mkoctfile -p |
|
163 dnl themselves, so the only reason to keep them is for configure, and |
|
164 dnl for those things which are not built using mkoctfile (e.g., aurecord) |
|
165 dnl but it is not clear we should be using octave compile flags for those. |
|
166 |
11915
|
167 dnl netcdf does not need CFLAGS, CPPFLAGS,... from mkoctfile |
11914
|
168 dnl -> comment corresponding lines |
|
169 |
|
170 # dnl C compiler and flags |
|
171 # AC_MSG_RESULT([retrieving compile and link flags from $MKOCTFILE]) |
|
172 # CC=`$MKOCTFILE -p CC` |
|
173 # CFLAGS=`$MKOCTFILE -p CFLAGS` |
|
174 # CPPFLAGS=`$MKOCTFILE -p CPPFLAGS` |
|
175 # CPPFLAGS="not used" |
|
176 # CPICFLAG=`$MKOCTFILE -p CPICFLAG` |
|
177 # LDFLAGS=`$MKOCTFILE -p LDFLAGS` |
|
178 # LIBS=`$MKOCTFILE -p LIBS` |
|
179 # AC_SUBST(CC) |
|
180 # AC_SUBST(CFLAGS) |
|
181 # AC_SUBST(CPPFLAGS) |
|
182 # AC_SUBST(CPICFLAG) |
|
183 |
|
184 # dnl Fortran compiler and flags |
|
185 # F77=`$MKOCTFILE -p F77` |
|
186 # FFLAGS=`$MKOCTFILE -p FFLAGS` |
|
187 # FPICFLAG=`$MKOCTFILE -p FPICFLAG` |
|
188 # AC_SUBST(F77) |
|
189 # AC_SUBST(FFLAGS) |
|
190 # AC_SUBST(FPICFLAG) |
|
191 |
|
192 # dnl C++ compiler and flags |
|
193 # CXX=`$MKOCTFILE -p CXX` |
|
194 # CXXFLAGS=`$MKOCTFILE -p CXXFLAGS` |
|
195 # CXXPICFLAG=`$MKOCTFILE -p CXXPICFLAG` |
|
196 # AC_SUBST(CXX) |
|
197 # AC_SUBST(CXXFLAGS) |
|
198 # AC_SUBST(CXXPICFLAG) |
|
199 |
|
200 dnl ******************************************************************* |
|
201 |
|
202 dnl Check for features of your version of mkoctfile. |
|
203 dnl All checks should be designed so that the default |
|
204 dnl action if the tests are not performed is to do whatever |
|
205 dnl is appropriate for the most recent version of Octave. |
|
206 |
|
207 dnl Define the following macro: |
|
208 dnl OF_CHECK_LIB(lib,fn,true,false,helpers) |
|
209 dnl This is just like AC_CHECK_LIB, but it doesn't update LIBS |
|
210 AC_DEFUN(OF_CHECK_LIB, |
|
211 [save_LIBS="$LIBS" |
|
212 AC_CHECK_LIB($1,$2,$3,$4,$5) |
|
213 LIBS="$save_LIBS" |
|
214 ]) |
|
215 |
|
216 dnl Define the following macro: |
|
217 dnl TRY_MKOCTFILE(msg,program,action_if_true,action_if_false) |
|
218 dnl |
|
219 AC_DEFUN(TRY_MKOCTFILE, |
|
220 [AC_MSG_CHECKING($1) |
|
221 cat > conftest.cc << EOF |
|
222 #include <octave/config.h> |
|
223 $2 |
|
224 EOF |
|
225 ac_try="$MKOCTFILE -c conftest.cc" |
|
226 if AC_TRY_EVAL(ac_try) ; then |
|
227 AC_MSG_RESULT(yes) |
|
228 $3 |
|
229 else |
|
230 AC_MSG_RESULT(no) |
|
231 $4 |
|
232 fi |
|
233 ]) |
|
234 |
|
235 dnl |
|
236 dnl Check if F77_FUNC works with MKOCTFILE |
|
237 dnl |
|
238 TRY_MKOCTFILE([for F77_FUNC], |
|
239 [int F77_FUNC (hello, HELLO) (const int &n);],, |
|
240 [MKOCTFILE="$MKOCTFILE -DF77_FUNC=F77_FCN"]) |
|
241 |
|
242 dnl ********************************************************** |
|
243 |
|
244 dnl Evaluate an expression in octave |
|
245 dnl |
|
246 dnl OCTAVE_EVAL(expr,var) -> var=expr |
|
247 dnl |
|
248 AC_DEFUN(OCTAVE_EVAL, |
|
249 [AC_MSG_CHECKING([for $1 in Octave]) |
|
250 $2=`echo "disp($1)" | $OCTAVE -qf` |
|
251 AC_MSG_RESULT($$2) |
|
252 AC_SUBST($2) |
|
253 ]) |
|
254 |
|
255 dnl Check status of an octave variable |
|
256 dnl |
|
257 dnl OCTAVE_CHECK_EXIST(variable,action_if_true,action_if_false) |
|
258 dnl |
|
259 AC_DEFUN(OCTAVE_CHECK_EXIST, |
|
260 [AC_MSG_CHECKING([for $1 in Octave]) |
|
261 if test `echo 'disp(exist("$1"))' | $OCTAVE -qf`X != 0X ; then |
|
262 AC_MSG_RESULT(yes) |
|
263 $2 |
|
264 else |
|
265 AC_MSG_RESULT(no) |
|
266 $3 |
|
267 fi |
|
268 ]) |
|
269 |
|
270 dnl should check that $(OCTAVE) --version matches $(MKOCTFILE) --version |
|
271 AC_CHECK_PROG(OCTAVE,octave,octave) |
|
272 OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION) |
|
273 |
|
274 dnl grab canonical host type so we can write system specific install stuff |
|
275 OCTAVE_EVAL(octave_config_info('canonical_host_type'),canonical_host_type) |
|
276 |
|
277 dnl grab SHLEXT from octave config |
|
278 OCTAVE_EVAL(octave_config_info('SHLEXT'),SHLEXT) |
|
279 |
|
280 AC_PROG_LN_S |
|
281 |
|
282 AC_PROG_RANLIB |
|
283 |
|
284 dnl Use $(COPY_FLAGS) to set options for cp when installing .oct files. |
|
285 COPY_FLAGS="-Rfp" |
|
286 case "$canonical_host_type" in |
|
287 *-*-linux*) |
|
288 COPY_FLAGS="-fdp" |
|
289 ;; |
|
290 esac |
|
291 AC_SUBST(COPY_FLAGS) |
|
292 |
|
293 dnl Use $(STRIP) in the makefile to strip executables. If not found, |
|
294 dnl STRIP expands to ':', which in the makefile does nothing. |
|
295 dnl Don't need this for .oct files since mkoctfile handles them directly |
|
296 STRIP=${STRIP-strip} |
|
297 AC_CHECK_PROG(STRIP,$STRIP,$STRIP,:) |
|
298 |
|
299 dnl Strip on windows, don't strip on Mac OS/X or IRIX |
|
300 dnl For the rest, you can force strip using MKOCTFILE="mkoctfile -s" |
|
301 dnl or avoid strip using STRIP=: before ./configure |
|
302 case "$canonical_host_type" in |
|
303 powerpc-apple-darwin*|*-sgi-*) |
|
304 STRIP=: |
|
305 ;; |
|
306 *-cygwin-*|*-mingw-*) |
|
307 MKOCTFILE="$MKOCTFILE -s" |
|
308 ;; |
|
309 esac |
|
310 |
11915
|
311 dnl checking for nc-config |
11914
|
312 |
11915
|
313 AC_CHECK_PROG(NC_CONFIG, nc-config, nc-config) |
|
314 if test -z "$NC_CONFIG"; then |
|
315 AC_MSG_ERROR([nc-config not found], 1); |
11914
|
316 fi |
|
317 |
11915
|
318 NETCDF_LIBS="$NETCDF_LIBS `nc-config --libs`" |
|
319 NETCDF_CFLAGS="$NETCDF_CFLAGS `nc-config --cflags`" |
11914
|
320 |
|
321 |
|
322 CONFIGURE_OUTPUTS="Makeconf" |
|
323 STATUS_MSG=" |
|
324 octave commands will install into the following directories: |
|
325 m-files: $mpath |
|
326 oct-files: $opath |
|
327 binaries: $xpath |
|
328 alternatives: |
|
329 m-files: $altmpath |
|
330 oct-files: $altopath |
|
331 |
|
332 shell commands will install into the following directories: |
|
333 binaries: $bindir |
|
334 man pages: $mandir |
|
335 libraries: $libdir |
|
336 headers: $includedir |
|
337 |
|
338 octave-forge is configured with |
|
339 octave: $OCTAVE (version $OCTAVE_VERSION) |
|
340 mkoctfile: $MKOCTFILE for Octave $subver |
11915
|
341 netCDF compiler flags: $NETCDF_CFLAGS |
|
342 netCDF libraries: $NETCDF_LIBS" |