Mercurial > forge
annotate main/netcdf/src/configure.base @ 12698:1a348ee9a848 octave-forge
checking for netcdf4 support
author | abarth93 |
---|---|
date | Wed, 02 Dec 2015 09:22:02 +0000 |
parents | fa07b71bcbfb |
children |
rev | line source |
---|---|
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 | |
12630
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
53 AC_CHECK_PROG(OCTAVE_CONFIG,octave-config,octave-config) |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
54 test -z "$OCTAVE_CONFIG" && AC_MSG_WARN([no octave-config found on path]) |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
55 |
11914 | 56 AC_SUBST(ver) |
57 AC_SUBST(subver) | |
58 AC_SUBST(mpath) | |
59 AC_SUBST(opath) | |
60 AC_SUBST(xpath) | |
61 AC_SUBST(altpath) | |
62 AC_SUBST(altmpath) | |
63 AC_SUBST(altopath) | |
64 | |
65 AC_ARG_WITH(path, | |
66 [ --with-path install path prefix], | |
67 [ path=$withval ]) | |
68 AC_ARG_WITH(mpath, | |
69 [ --with-mpath override path for m-files], | |
70 [mpath=$withval]) | |
71 AC_ARG_WITH(opath, | |
72 [ --with-opath override path for oct-files], | |
73 [opath=$withval]) | |
74 AC_ARG_WITH(xpath, | |
75 [ --with-xpath override path for executables], | |
76 [xpath=$withval]) | |
77 AC_ARG_WITH(altpath, | |
78 [ --with-altpath alternative functions install path prefix], | |
79 [ altpath=$withval ]) | |
80 AC_ARG_WITH(altmpath, | |
81 [ --with-altmpath override path for alternative m-files], | |
82 [altmpath=$withval]) | |
83 AC_ARG_WITH(altopath, | |
84 [ --with-altopath override path for alternative oct-files], | |
85 [altopath=$withval]) | |
86 | |
87 if test -n "$path" ; then | |
88 test -z "$mpath" && mpath=$path | |
89 test -z "$opath" && opath=$path/oct | |
90 test -z "$xpath" && xpath=$path/bin | |
91 test -z "$altpath" && altpath=$path-alternatives | |
92 fi | |
93 | |
94 if test -n "$altpath" ; then | |
95 test -z "$altmpath" && altmpath=$altpath | |
96 test -z "$altopath" && altopath=$altpath/oct | |
97 fi | |
98 | |
99 dnl Don't query if path/ver are given in the configure environment | |
100 #if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$altmpath" || test -z "$altopath" || test -z "$ver" ; then | |
101 if test -z "$mpath" || test -z "$opath" || test -z "$xpath" || test -z "$ver" ; then | |
102 dnl Construct program to get mkoctfile version and local install paths | |
103 cat > conftest.cc <<EOF | |
104 #include <octave/config.h> | |
105 #include <octave/version.h> | |
106 #include <octave/defaults.h> | |
107 | |
108 #define INFOV "\nINFOV=" OCTAVE_VERSION "\n" | |
109 | |
110 #define INFOH "\nINFOH=" OCTAVE_CANONICAL_HOST_TYPE "\n" | |
111 | |
112 #ifdef OCTAVE_LOCALVERFCNFILEDIR | |
113 # define INFOM "\nINFOM=" OCTAVE_LOCALVERFCNFILEDIR "\n" | |
114 #else | |
115 # define INFOM "\nINFOM=" OCTAVE_LOCALFCNFILEPATH "\n" | |
116 #endif | |
117 | |
118 #ifdef OCTAVE_LOCALVEROCTFILEDIR | |
119 # define INFOO "\nINFOO=" OCTAVE_LOCALVEROCTFILEDIR "\n" | |
120 #else | |
121 # define INFOO "\nINFOO=" OCTAVE_LOCALOCTFILEPATH "\n" | |
122 #endif | |
123 | |
124 #ifdef OCTAVE_LOCALVERARCHLIBDIR | |
125 # define INFOX "\nINFOX=" OCTAVE_LOCALVERARCHLIBDIR "\n" | |
126 #else | |
127 # define INFOX "\nINFOX=" OCTAVE_LOCALARCHLIBDIR "\n" | |
128 #endif | |
129 | |
130 const char *infom = INFOM; | |
131 const char *infoo = INFOO; | |
132 const char *infox = INFOX; | |
133 const char *infoh = INFOH; | |
134 const char *infov = INFOV; | |
135 EOF | |
136 | |
137 dnl Compile program perhaps with a special version of mkoctfile | |
138 $MKOCTFILE conftest.cc || AC_MSG_ERROR(Could not run $MKOCTFILE) | |
139 | |
140 dnl Strip the config info from the compiled file | |
141 eval `strings conftest.o | grep "^INFO.=" | sed -e "s,//.*$,,"` | |
142 rm -rf conftest* | |
143 | |
144 dnl set the appropriate variables if they are not already set | |
145 ver=`echo $INFOV | sed -e "s/\.//" -e "s/\..*$//"` | |
146 subver=`echo $INFOV | sed -e "[s/^[^.]*[.][^.]*[.]//]"` | |
147 alt_mbase=`echo $INFOM | sed -e "[s,\/[^\/]*$,,]"` | |
148 alt_obase=`echo $INFOO | sed -e "[s,/site.*$,/site,]"` | |
149 test -z "$mpath" && mpath=$INFOM/octave-forge | |
150 test -z "$opath" && opath=$INFOO/octave-forge | |
151 test -z "$xpath" && xpath=$INFOX | |
152 test -z "$altmpath" && altmpath=$alt_mbase/octave-forge-alternatives/m | |
153 test -z "$altopath" && altopath=$alt_obase/octave-forge-alternatives/oct/$INFOH | |
154 fi | |
155 | |
156 dnl ******************************************************************* | |
157 | |
158 dnl Get LDFLAGS and CPPFLAGS set by user | |
159 dnl These flags will be added to the mkoctfile command line | |
11915 | 160 NETCDF_LIBS="$LDFLAGS" |
161 NETCDF_CFLAGS="$CPPFLAGS" | |
11914 | 162 |
163 | |
164 dnl XXX FIXME XXX Should we allow the user to override these? | |
165 dnl Do we even need them? The individual makefiles can call mkoctfile -p | |
166 dnl themselves, so the only reason to keep them is for configure, and | |
167 dnl for those things which are not built using mkoctfile (e.g., aurecord) | |
168 dnl but it is not clear we should be using octave compile flags for those. | |
169 | |
11915 | 170 dnl netcdf does not need CFLAGS, CPPFLAGS,... from mkoctfile |
11914 | 171 dnl -> comment corresponding lines |
172 | |
173 # dnl C compiler and flags | |
174 # AC_MSG_RESULT([retrieving compile and link flags from $MKOCTFILE]) | |
175 # CC=`$MKOCTFILE -p CC` | |
176 # CFLAGS=`$MKOCTFILE -p CFLAGS` | |
177 # CPPFLAGS=`$MKOCTFILE -p CPPFLAGS` | |
178 # CPPFLAGS="not used" | |
179 # CPICFLAG=`$MKOCTFILE -p CPICFLAG` | |
180 # LDFLAGS=`$MKOCTFILE -p LDFLAGS` | |
181 # LIBS=`$MKOCTFILE -p LIBS` | |
182 # AC_SUBST(CC) | |
183 # AC_SUBST(CFLAGS) | |
184 # AC_SUBST(CPPFLAGS) | |
185 # AC_SUBST(CPICFLAG) | |
186 | |
187 # dnl Fortran compiler and flags | |
188 # F77=`$MKOCTFILE -p F77` | |
189 # FFLAGS=`$MKOCTFILE -p FFLAGS` | |
190 # FPICFLAG=`$MKOCTFILE -p FPICFLAG` | |
191 # AC_SUBST(F77) | |
192 # AC_SUBST(FFLAGS) | |
193 # AC_SUBST(FPICFLAG) | |
194 | |
195 # dnl C++ compiler and flags | |
196 # CXX=`$MKOCTFILE -p CXX` | |
197 # CXXFLAGS=`$MKOCTFILE -p CXXFLAGS` | |
198 # CXXPICFLAG=`$MKOCTFILE -p CXXPICFLAG` | |
199 # AC_SUBST(CXX) | |
200 # AC_SUBST(CXXFLAGS) | |
201 # AC_SUBST(CXXPICFLAG) | |
202 | |
203 dnl ******************************************************************* | |
204 | |
205 dnl Check for features of your version of mkoctfile. | |
206 dnl All checks should be designed so that the default | |
207 dnl action if the tests are not performed is to do whatever | |
208 dnl is appropriate for the most recent version of Octave. | |
209 | |
210 dnl Define the following macro: | |
211 dnl OF_CHECK_LIB(lib,fn,true,false,helpers) | |
212 dnl This is just like AC_CHECK_LIB, but it doesn't update LIBS | |
213 AC_DEFUN(OF_CHECK_LIB, | |
214 [save_LIBS="$LIBS" | |
215 AC_CHECK_LIB($1,$2,$3,$4,$5) | |
216 LIBS="$save_LIBS" | |
217 ]) | |
218 | |
219 dnl Define the following macro: | |
220 dnl TRY_MKOCTFILE(msg,program,action_if_true,action_if_false) | |
221 dnl | |
222 AC_DEFUN(TRY_MKOCTFILE, | |
223 [AC_MSG_CHECKING($1) | |
224 cat > conftest.cc << EOF | |
225 #include <octave/config.h> | |
226 $2 | |
227 EOF | |
228 ac_try="$MKOCTFILE -c conftest.cc" | |
229 if AC_TRY_EVAL(ac_try) ; then | |
230 AC_MSG_RESULT(yes) | |
231 $3 | |
232 else | |
233 AC_MSG_RESULT(no) | |
234 $4 | |
235 fi | |
236 ]) | |
237 | |
238 dnl | |
239 dnl Check if F77_FUNC works with MKOCTFILE | |
240 dnl | |
241 TRY_MKOCTFILE([for F77_FUNC], | |
242 [int F77_FUNC (hello, HELLO) (const int &n);],, | |
243 [MKOCTFILE="$MKOCTFILE -DF77_FUNC=F77_FCN"]) | |
244 | |
245 dnl ********************************************************** | |
246 | |
247 dnl Evaluate an expression in octave | |
248 dnl | |
249 dnl OCTAVE_EVAL(expr,var) -> var=expr | |
250 dnl | |
251 AC_DEFUN(OCTAVE_EVAL, | |
252 [AC_MSG_CHECKING([for $1 in Octave]) | |
253 $2=`echo "disp($1)" | $OCTAVE -qf` | |
254 AC_MSG_RESULT($$2) | |
255 AC_SUBST($2) | |
256 ]) | |
257 | |
12630
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
258 AC_DEFUN(OCTAVE_CONFIG_EVAL, |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
259 [AC_MSG_CHECKING([for $1 in octave-config]) |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
260 $2=`$OCTAVE_CONFIG -p $1` |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
261 AC_MSG_RESULT($$2) |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
262 AC_SUBST($2) |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
263 ]) |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
264 |
11914 | 265 dnl Check status of an octave variable |
266 dnl | |
267 dnl OCTAVE_CHECK_EXIST(variable,action_if_true,action_if_false) | |
268 dnl | |
269 AC_DEFUN(OCTAVE_CHECK_EXIST, | |
270 [AC_MSG_CHECKING([for $1 in Octave]) | |
271 if test `echo 'disp(exist("$1"))' | $OCTAVE -qf`X != 0X ; then | |
272 AC_MSG_RESULT(yes) | |
273 $2 | |
274 else | |
275 AC_MSG_RESULT(no) | |
276 $3 | |
277 fi | |
278 ]) | |
279 | |
280 dnl should check that $(OCTAVE) --version matches $(MKOCTFILE) --version | |
281 AC_CHECK_PROG(OCTAVE,octave,octave) | |
12630
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
282 OCTAVE_CONFIG_EVAL(VERSION,OCTAVE_VERSION) |
11914 | 283 |
284 dnl grab canonical host type so we can write system specific install stuff | |
12630
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
285 OCTAVE_CONFIG_EVAL(CANONICAL_HOST_TYPE,canonical_host_type) |
11914 | 286 |
287 dnl grab SHLEXT from octave config | |
12630
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
288 OCTAVE_CONFIG_EVAL(SHLEXT,SHLEXT) |
11914 | 289 |
290 AC_PROG_LN_S | |
291 | |
292 AC_PROG_RANLIB | |
293 | |
294 dnl Use $(COPY_FLAGS) to set options for cp when installing .oct files. | |
295 COPY_FLAGS="-Rfp" | |
296 case "$canonical_host_type" in | |
297 *-*-linux*) | |
298 COPY_FLAGS="-fdp" | |
299 ;; | |
300 esac | |
301 AC_SUBST(COPY_FLAGS) | |
302 | |
303 dnl Use $(STRIP) in the makefile to strip executables. If not found, | |
304 dnl STRIP expands to ':', which in the makefile does nothing. | |
305 dnl Don't need this for .oct files since mkoctfile handles them directly | |
306 STRIP=${STRIP-strip} | |
307 AC_CHECK_PROG(STRIP,$STRIP,$STRIP,:) | |
308 | |
309 dnl Strip on windows, don't strip on Mac OS/X or IRIX | |
310 dnl For the rest, you can force strip using MKOCTFILE="mkoctfile -s" | |
311 dnl or avoid strip using STRIP=: before ./configure | |
312 case "$canonical_host_type" in | |
313 powerpc-apple-darwin*|*-sgi-*) | |
314 STRIP=: | |
315 ;; | |
316 *-cygwin-*|*-mingw-*) | |
317 MKOCTFILE="$MKOCTFILE -s" | |
318 ;; | |
319 esac | |
320 | |
11915 | 321 dnl checking for nc-config |
11914 | 322 |
12630
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
323 dnl AC_CHECK_PROG(NC_CONFIG, nc-config, nc-config) |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
324 AC_CHECK_TOOL(NC_CONFIG, nc-config, nc-config) |
11915 | 325 if test -z "$NC_CONFIG"; then |
326 AC_MSG_ERROR([nc-config not found], 1); | |
11914 | 327 fi |
328 | |
12698 | 329 |
330 dnl The following will be either "yes" or "no" | |
331 AC_MSG_CHECKING(for netcdf4 support) | |
332 NETCDF_V4=`$NC_CONFIG --has-nc4` | |
333 if test x$NETCDF_V4 != yes; then | |
334 AC_MSG_RESULT(yes) | |
335 else | |
336 AC_MSG_RESULT(no) | |
337 AC_MSG_ERROR(netcdf4 support missing. Did you disable netcdf4 features?) | |
338 fi | |
339 | |
340 dnl other way to check this | |
341 dnl NETCDF_LIBS="$NETCDF_LIBS `$NC_CONFIG --libs`" | |
342 dnl NETCDF_CFLAGS="$NETCDF_CFLAGS `$NC_CONFIG --cflags`" | |
343 dnl CFLAGS="$NETCDF_CFLAGS $CFLAGS" | |
344 dnl CXXFLAGS="$NETCDF_CFLAGS $CXXFLAGS" | |
345 dnl LDFLAGS="$NETCDF_LIBS $LDFLAGS" | |
346 dnl AC_CHECK_LIB([netcdf], [nc_set_chunk_cache], , [AC_MSG_ERROR(nc_set_chunk_cache was not found in the netCDF library. Did you disable netcdf4 features?)]) | |
11914 | 347 |
348 | |
349 CONFIGURE_OUTPUTS="Makeconf" | |
350 STATUS_MSG=" | |
351 octave commands will install into the following directories: | |
352 m-files: $mpath | |
353 oct-files: $opath | |
354 binaries: $xpath | |
355 alternatives: | |
356 m-files: $altmpath | |
357 oct-files: $altopath | |
358 | |
359 shell commands will install into the following directories: | |
360 binaries: $bindir | |
361 man pages: $mandir | |
362 libraries: $libdir | |
363 headers: $includedir | |
364 | |
365 octave-forge is configured with | |
12630
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
366 octave: $OCTAVE (version $OCTAVE_VERSION) |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
367 mkoctfile: $MKOCTFILE for Octave $subver |
fa07b71bcbfb
merge patch from bug #44837, of-netcdf wont cross compile
abarth93
parents:
11915
diff
changeset
|
368 octave-config: $OCTAVE_CONFIG for Octave $subver |
11915 | 369 netCDF compiler flags: $NETCDF_CFLAGS |
370 netCDF libraries: $NETCDF_LIBS" |