-
Notifications
You must be signed in to change notification settings - Fork 19
/
configure.ac
499 lines (403 loc) · 13.7 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
# autoconf file for HARP
AC_INIT([harp],[1.24])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE(foreign subdir-objects 1.12 -Wall)
AC_PREREQ(2.63)
AC_CONFIG_MACRO_DIR([m4])
# set extra version variable
AC_DEFINE_UNQUOTED(HARP_VERSION, ["$VERSION"], [This is the current version of HARP])
# autoheader config include
AC_CONFIG_HEADERS([config.h])
AH_TOP([
#ifndef HARP_CONFIG_H
#define HARP_CONFIG_H
])
AH_BOTTOM([
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
# ifdef HAVE_STDINT_H
# include <stdint.h>
# else
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
# endif
#endif
/* needed for expat */
#ifdef WORDS_BIGENDIAN
#define BYTEORDER 4321
#else
#define BYTEORDER 1234
#endif
#define XML_DEV_URANDOM 1
#ifndef HAVE_STRDUP
char *strdup(const char *);
#endif
#ifndef HAVE_STRCASECMP
int strcasecmp(const char *, const char *);
#endif
#if !defined(HAVE_STRNCASECMP) || !defined(HAVE_VSNPRINTF)
/* include string.h for size_t definition */
#include <string.h>
#endif
#ifndef HAVE_STRNCASECMP
int strncasecmp(const char *, const char *, size_t);
#endif
#if defined(HAVE_STRCASECMP) || defined(HAVE_STRNCASECMP)
#ifdef HAVE_STRINGS_H
/* include strings.h for definition of strcasecmp and strncasecmp */
#include <strings.h>
#endif
#endif
#ifndef HAVE_VSNPRINTF
/* include stdarg.h for va_list definition */
#include <stdarg.h>
int vsnprintf(const char *, size_t, const char *, va_list ap);
#endif
/* Make sure we use the HDF 1.6 compatibility API */
#define H5_USE_16_API
/* H5Oget_info did not exist in HDF 1.6, so make sure to use 1.8 for this */
#define H5Oget_info_vers 1
#define H5Oget_info_by_name_vers 1
#define H5O_info_t_vers 1
#ifdef WIN32
/* need to include this before we redefine lseek, etc. */
#include <io.h>
/* include sys/stat.h because we are going to override stat */
#include <sys/stat.h>
#if (_MSC_VER < 1600) && !defined(__MINGW32__)
/* For Visual Studio > 2010 and MinGW we can use stdint.h
* For earlier versions of Visual Studio we need to provide our own defines
*/
#ifndef int8_t
#define int8_t signed char
#endif
#ifndef int16_t
#define int16_t signed short
#endif
#ifndef int32_t
#define int32_t int
#endif
#ifndef int64_t
#define int64_t __int64
#endif
#ifndef uint8_t
#define uint8_t unsigned char
#endif
#ifndef uint16_t
#define uint16_t unsigned short
#endif
#ifndef uint32_t
#define uint32_t unsigned int
#endif
#ifndef uint64_t
#define uint64_t unsigned __int64
#endif
#endif
/* redefines for special string handling functions */
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if defined(_MSC_VER) && _MSC_VER < 1500
#define vsnprintf _vsnprintf
#endif
/* redefines for file handling functions */
#define open(arg1,arg2) _open(arg1,arg2)
#define close(arg1) _close(arg1)
/* WARNING: On Windows we can't read blocks larger than 4GB with the read() function */
#define read(arg1,arg2,arg3) _read(arg1,arg2,(unsigned int)arg3)
#define lseek(arg1,arg2,arg3) _lseeki64(arg1,arg2,arg3)
#define off_t __int64
#define stat _stati64
#define S_IFREG _S_IFREG
#define getcwd(arg1,arg2) _getcwd(arg1,arg2)
/* define ssize_t */
#ifdef _WIN64
#define ssize_t __int64
#else
#define ssize_t long
#endif
/* prevent HDF5 header files from redefining the above types */
#define H5_SIZEOF_INT64_T 8
#define H5_SIZEOF_UINT32_T 4
#define H5_SIZEOF_UINT64_T 8
#ifdef _WIN64
#define H5_SIZEOF_SSIZE_T 8
#else
#define H5_SIZEOF_SSIZE_T 4
#endif
#define YYMALLOC malloc
#define YYFREE free
#endif
#endif /* !defined(HARP_CONFIG_H) */
])
# autoheader config include
AC_CONFIG_HEADERS([libharp/harp.h])
# Other files generated by configure
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([doc/Doxyfile])
AC_CONFIG_FILES([R/DESCRIPTION])
AC_CONFIG_FILES([R/create_rds.r])
AC_CONFIG_FILES([idl/harp_idl.dlm])
# Set dynamic library version
# Rules to update the library version information:
# 1. Start with version information of `0:0:0' for each libtool library.
# 2. Update the version information only immediately before a public release.
# 3. If the library source code has changed at all since the last update,
# then increment revision (`c:r:a' becomes `c:r+1:a').
# 4. If any interfaces have been added, removed, or changed since the last
# update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then
# increment age.
# 6. If any interfaces have been removed or changed since the last public
# release, then set age to 0.
LIBHARP_CURRENT=14
LIBHARP_REVISION=12
LIBHARP_AGE=1
AC_SUBST(LIBHARP_CURRENT)
AC_SUBST(LIBHARP_REVISION)
AC_SUBST(LIBHARP_AGE)
# HARP format version
HARP_FORMAT_VERSION_MAJOR=1
HARP_FORMAT_VERSION_MINOR=0
AC_SUBST(HARP_FORMAT_VERSION_MAJOR)
AC_SUBST(HARP_FORMAT_VERSION_MINOR)
AC_DEFINE_UNQUOTED(HARP_FORMAT_VERSION_MAJOR, [$HARP_FORMAT_VERSION_MAJOR], [Current HARP format major version number.])
AC_DEFINE_UNQUOTED(HARP_FORMAT_VERSION_MINOR, [$HARP_FORMAT_VERSION_MINOR], [Current HARP format minor version number.])
AC_DEFINE_UNQUOTED(HARP_CONVENTION, ["HARP-$HARP_FORMAT_VERSION_MAJOR.$HARP_FORMAT_VERSION_MINOR"], [String to use in netCDF Conventions attribute])
AC_DEFINE([HARP_EXPAT_NAME_MANGLE], 1, [Define to enable name mangling of symbols for the built-in expat library.])
AC_DEFINE([HARP_NETCDF_NAME_MANGLE], 1, [Define to enable name mangling of symbols for the built-in netcdf library.])
AC_DEFINE([HARP_UDUNITS2_NAME_MANGLE], 1, [Define to enable name mangling of symbols for the built-in udunits2 library.])
# codadef versions
AC_SUBST(CODADEFSH, $srcdir/codadef.sh)
ST_CODADEF_VERSION([definitions],[ACE_FTS])
ST_CODADEF_VERSION([definitions],[ACSAF])
ST_CODADEF_VERSION([definitions],[AEOLUS])
ST_CODADEF_VERSION([definitions],[AURA_HIRDLS])
ST_CODADEF_VERSION([definitions],[AURA_MLS])
ST_CODADEF_VERSION([definitions],[AURA_OMI])
ST_CODADEF_VERSION([definitions],[AURA_TES])
ST_CODADEF_VERSION([definitions],[CALIPSO])
ST_CODADEF_VERSION([definitions],[CLOUDNET])
ST_CODADEF_VERSION([definitions],[EARLINET])
ST_CODADEF_VERSION([definitions],[EARTHCARE])
ST_CODADEF_VERSION([definitions],[ECMWF])
ST_CODADEF_VERSION([definitions],[ENVISAT_GOMOS])
ST_CODADEF_VERSION([definitions],[ENVISAT_MIPAS])
ST_CODADEF_VERSION([definitions],[ENVISAT_SCIAMACHY])
ST_CODADEF_VERSION([definitions],[EPS])
ST_CODADEF_VERSION([definitions],[ERS_GOME])
ST_CODADEF_VERSION([definitions],[ESACCI_AEROSOL])
ST_CODADEF_VERSION([definitions],[ESACCI_CLOUD])
ST_CODADEF_VERSION([definitions],[ESACCI_GHG])
ST_CODADEF_VERSION([definitions],[ESACCI_OZONE])
ST_CODADEF_VERSION([definitions],[GEOMS])
ST_CODADEF_VERSION([definitions],[GOSAT])
ST_CODADEF_VERSION([definitions],[NPP_SUOMI])
ST_CODADEF_VERSION([definitions],[OCO])
ST_CODADEF_VERSION([definitions],[ODIN_OSIRIS])
ST_CODADEF_VERSION([definitions],[ODIN_SMR])
ST_CODADEF_VERSION([definitions],[QA4ECV])
ST_CODADEF_VERSION([definitions],[S5P_PAL])
ST_CODADEF_VERSION([definitions],[Sentinel5P])
ST_CODADEF_VERSION([definitions],[TEMIS])
# *** checks for programs ***
AC_PROG_CC
# AM_PROG_AR is only available since automake 1.11.2
m4_define_default([AM_PROG_AR])
AM_PROG_AR
AM_PROG_CC_C_O
# configure libtool
LT_INIT
AC_SUBST(LIBTOOL_DEPS)
# lex and yacc
AM_PROG_LEX
AC_PROG_YACC
# install tool
AC_PROG_INSTALL
AC_PROG_AWK
AM_PATH_PYTHON
AC_ARG_VAR(R, [The R statistical software program])
if test "$R" = "" ; then
AC_PATH_PROG([R], [R])
fi
AC_ARG_VAR(DOXYGEN, [The documentation generation program Doxygen])
if test "$DOXYGEN" = "" ; then
AC_PATH_PROG([DOXYGEN], [doxygen])
fi
AC_ARG_VAR(SPHINXBUILD, [The documentation generation program sphinx-build])
if test "$SPHINXBUILD" = "" ; then
AC_PATH_PROG([SPHINXBUILD], [sphinx-build])
fi
AC_ARG_VAR(INDENT, [The GNU indent program])
if test "$INDENT" = "" ; then
AC_PATH_PROG([INDENT], [indent], :)
fi
# *** checks for libraries ****
ST_CHECK_LIB_M
# *** checks for header files ***
AC_HEADER_STDBOOL
AC_CHECK_HEADERS([dirent.h unistd.h strings.h])
# *** checks for types ***
AC_TYPE_SIZE_T
AC_TYPE_INT8_T
AC_TYPE_UINT8_T
AC_TYPE_INT16_T
AC_TYPE_UINT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT64_T
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(size_t)
# sets WORDS_BIGENDIAN
AC_C_BIGENDIAN
# defines _FILE_OFFSET_BITS and _LARGE_FILES if necessary
AC_SYS_LARGEFILE
# *** checks for structures ***
AC_STRUCT_TM
# *** checks for compiler characteristics ***
# check for warning flags
VL_PROG_CC_WARNINGS
# *** checks for library functions ***
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([floor pread stat memmove bcopy strerror])
AC_REPLACE_FUNCS([strdup strcasecmp strncasecmp vsnprintf])
# *** directories ***
examplesdir="\${pkgdatadir}/examples"
# Directories for optional components start empty and will be set later.
harppythondir=
harprdir=
idldlmexecdir=
matlabmexexecdir=
codamatlabexamplesdir=
harpmatlabexamplesdir=
definitionsdir="\${datadir}/coda/definitions"
AC_SUBST(examplesdir)
AC_SUBST(harppythondir)
AC_SUBST(harprdir)
AC_SUBST(harprlibdir)
AC_SUBST(harprMetadir)
AC_SUBST(harprRdir)
AC_SUBST(idldlmexecdir)
AC_SUBST(matlabmexexecdir)
AC_SUBST(codamatlabexamplesdir)
AC_SUBST(harpmatlabexamplesdir)
AC_SUBST(definitionsdir)
# *** harp-python ***
AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python],[build the Python interface])],
[ac_cv_enable_python=$enableval],
[AC_CACHE_CHECK([build Python interface], ac_cv_enable_python, ac_cv_enable_python=no)])
if test $ac_cv_enable_python = yes ; then
if test -z "$PYTHON" ; then
AC_MSG_ERROR(BOXED_TEXT([ERROR: Python is required to build the Python interface.
Try setting the PYTHON environment variable to the location of your Python interpreter.]))
fi
harppythondir="$pythondir/harp"
fi
AM_CONDITIONAL(BUILD_PYTHON, test $ac_cv_enable_python = yes)
# *** harp-R ***
AC_ARG_ENABLE([R],
[AS_HELP_STRING([--enable-R],[build the R interface])],
[ac_cv_enable_R=$enableval],
[AC_CACHE_CHECK([build R interface], ac_cv_enable_R, ac_cv_enable_R=no)])
if test $ac_cv_enable_R = yes ; then
if test $ac_cv_path_R = no ; then
AC_MSG_ERROR(BOXED_TEXT([ERROR: R is required to build the R interface.
Try setting the R environment variable to the location of your R program.]))
fi
RHOME=`${R} RHOME`
RCPPFLAGS=-I$RHOME/include
harprdir="$libdir/R/site-library/harp"
harprlibdir="\${harprdir}/libs"
harprMetadir="\${harprdir}/Meta"
harprRdir="\${harprdir}/R"
fi
AC_SUBST(RCPPFLAGS)
AM_CONDITIONAL(BUILD_R, test $ac_cv_enable_R = yes)
# *** harp-idl ***
AC_ARG_ENABLE(idl,
[AS_HELP_STRING([--enable-idl],[build the IDL interface])],
[ac_cv_enable_idl=$enableval],
[AC_CACHE_CHECK([build IDL interface], ac_cv_enable_idl, ac_cv_enable_idl=no)])
if test $ac_cv_enable_idl = yes ; then
ST_CHECK_IDL
if test $st_cv_have_idl = no ; then
AC_MSG_ERROR(BOXED_TEXT([ERROR: IDL is required to build the IDL interface.
Try setting the IDL environment variable to the root of your IDL installation
if you have IDL installed.]))
fi
idldlmexecdir="\${pkglibdir}/idl"
fi
AM_CONDITIONAL(BUILD_IDL, test $ac_cv_enable_idl = yes)
# *** harp-matlab ****
# check whether we should build the MATLAB interface
AC_ARG_ENABLE([matlab],
[AS_HELP_STRING([--enable-matlab],[build the MATLAB interface])],
[ac_cv_enable_matlab=$enableval],
[AC_CACHE_CHECK([build MATLAB interface], ac_cv_enable_matlab, ac_cv_enable_matlab=no)])
if test $ac_cv_enable_matlab = yes ; then
ST_CHECK_MATLAB
if test $st_cv_have_matlab = no ; then
AC_MSG_ERROR(BOXED_TEXT([ERROR: MATLAB is required to build the MATLAB interface.
Try setting the MATLAB environment variable to the root of your MATLAB
installation if you have MATLAB installed.]))
fi
matlabmexexecdir="\${pkglibdir}/matlab"
fi
AM_CONDITIONAL(BUILD_MATLAB, test $ac_cv_enable_matlab = yes)
# *** HDF4 ***
AC_ARG_WITH([hdf4],
[AS_HELP_STRING([--with-hdf4],[build HDF4 support into HARP])],
[ac_cv_with_hdf4=$withval],
[AC_CACHE_CHECK([use HDF4], ac_cv_with_hdf4, ac_cv_with_hdf4=yes)])
if test $ac_cv_with_hdf4 = yes ; then
ST_CHECK_HDF4
if test $st_cv_have_hdf4 = no ; then
AC_MSG_ERROR(BOXED_TEXT([ERROR: HDF4 libraries and/or header files are not found.
Try setting the HDF4_LIB and HDF4_INCLUDE environment variables to the
location of your HDF4 library and include files.]))
fi
fi
AC_SUBST(HDF4LIBS)
AM_CONDITIONAL(WITH_HDF4, test $ac_cv_with_hdf4 = yes)
# *** HDF5 ***
AC_ARG_WITH([hdf5],
[AS_HELP_STRING([--with-hdf5],[build HDF5 support into HARP])],
[ac_cv_with_hdf5=$withval],
[AC_CACHE_CHECK([use HDF5],ac_cv_with_hdf5,ac_cv_with_hdf5=yes)])
if test $ac_cv_with_hdf5 = yes ; then
ST_CHECK_HDF5
if test $st_cv_have_hdf5 = no ; then
AC_MSG_ERROR(BOXED_TEXT([ERROR: HDF5 libraries and/or header files are not found.
Try setting the HDF5_LIB and HDF5_INCLUDE environment variables to the
location of your HDF5 library and include files.]))
fi
fi
AC_SUBST(HDF5LIBS)
AM_CONDITIONAL(WITH_HDF5, test $ac_cv_with_hdf5 = yes)
# *** CODA ***
# make sure to perform this check after checking for HDF4/HDF5
ST_CHECK_CODA
if test $st_cv_have_coda = no ; then
AC_MSG_ERROR(BOXED_TEXT([ERROR: CODA library and/or header file not found.
Try setting the CODA_LIB and CODA_INCLUDE environment variables to the
location of your CODA library and include file.]))
fi
AC_SUBST(CODALIBS)
# *** udunits2/xml ****
AC_DEFINE([XML_NS], 1, [Define to make XML Namespaces functionality available.])
AC_DEFINE([XML_DTD], 1, [Define to make parameter entity parsing functionality available.])
AC_DEFINE([XML_LARGE_SIZE], 1, [Define to set the size of the XML_Size and XML_Index integer types to be at least 64 bits in size.])
AC_DEFINE([XML_CONTEXT_BYTES], 1024, [Define to specify how much context to retain around the current parse point.])
AC_OUTPUT