-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathconfigure.ac
488 lines (394 loc) · 14.2 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
# autoconf file for CODA
AC_INIT([CODA],[2.25.4])
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(CODA_VERSION, ["$VERSION"], [This is the current version of coda])
# autoheader config include
AC_CONFIG_HEADERS([config.h])
AH_TOP([
#ifndef CODA_CONFIG_H
#define CODA_CONFIG_H
])
AH_BOTTOM([
#ifdef HAVE_PREAD
/* some platforms (e.g. Linux) require this definition in order to enable support for pread */
/* Use 600 instead of 500 to prevent Mac OS X to complain about missing strdup definitions */
#define _XOPEN_SOURCE 600
#endif
#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 1.6 compatibility API for HDF 1.8 */
#define H5_USE_16_API
/* Make sure we build the PCRE library statically on Windows */
#define PCRE2_STATIC
#ifdef WIN32
/* include windows specific headers */
#include <windows.h>
#include <io.h>
#include <direct.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
/* we need to redefine ELEMENT_TYPE because it conflicts with io.h contents */
#define ELEMENT_TYPE ELEMENT_TYPE_RENAMED
/* redefines for special string handling functions */
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#if defined(_MSC_VER) && _MSC_VER < 1400
#define snprintf _snprintf
#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 YYMALLOC malloc
#define YYFREE free
#endif
#endif /* !defined(CODA_CONFIG_H) */
])
# Other files generated by configure
AC_CONFIG_HEADERS([coda.h:libcoda/coda.h.in])
AC_CONFIG_FILES([Makefile fortran/Makefile])
AC_CONFIG_FILES([java/build.xml])
AC_CONFIG_FILES([libcoda/doc/Doxyfile java/doc/Doxyfile])
AC_CONFIG_FILES([idl/coda_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.
LIBCODA_CURRENT=16
LIBCODA_REVISION=10
LIBCODA_AGE=0
AC_SUBST(LIBCODA_CURRENT)
AC_SUBST(LIBCODA_REVISION)
AC_SUBST(LIBCODA_AGE)
# *** checks for programs ***
AC_PROG_CC
AC_PROG_F77
# 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
# check for fortran 77 compiler characteristics needed for wrapping c to fortran
ST_CHECK_WRAPFORTRAN_F77_OPTIONS
# 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(DOXYGEN, [The documentation generation program Doxygen])
if test "$DOXYGEN" = "" ; then
AC_PATH_PROG([DOXYGEN], [doxygen])
fi
AC_ARG_VAR(INDENT, [The GNU indent program])
if test "$INDENT" = "" ; then
AC_PATH_PROG([INDENT], [indent], :)
fi
AC_ARG_VAR(SWIG, [The SWIG wrapper generation program])
if test "$SWIG" = "" ; then
AC_PATH_PROG([SWIG], [swig])
fi
AC_SUBST(SWIGFLAGS)
# *** checks for libraries ****
ST_CHECK_LIB_M
# *** checks for header files ***
AC_CHECK_HEADERS([dirent.h unistd.h strings.h sys/socket.h sys/mman.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
# sets WORDS_BIGENDIAN
AC_C_BIGENDIAN
# defines _FILE_OFFSET_BITS and _LARGE_FILES if necessary
AC_SYS_LARGEFILE
# check for thread local storage specifier
ST_THREAD_LOCAL_STORAGE
# *** checks for structures ***
AC_STRUCT_TM
# *** checks for compiler characteristics ***
# check for warning flags
VL_PROG_CC_WARNINGS
# check for no-long-long warning flag
ST_PROG_CC_OPT([-Wno-long-long], [ac_cv_no_long_long_warning])
if test "$ac_cv_no_long_long_warning" != "" ; then
CFLAGS="$CFLAGS $ac_cv_no_long_long_warning"
fi
# *** checks for library functions ***
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_CHECK_FUNCS([floor pread stat memmove bcopy])
AC_REPLACE_FUNCS([strdup strcasecmp strncasecmp vsnprintf])
# *** sub-package mode ***
AC_ARG_ENABLE([coda-subpackage-mode],
[AS_HELP_STRING([--enable-coda-subpackage-mode],[only build the CODA library and codadd, but don't install anything for CODA. This is intended for when CODA is used as a sub-package within a larger software pacakge])],
[ac_cv_enable_coda_subpackage_mode=$enableval],
[AC_CACHE_CHECK([build CODA as sub-package],ac_cv_enable_coda_subpackage_mode,ac_cv_enable_coda_subpackage_mode=no)])
AM_CONDITIONAL(SUBPACKAGE_MODE, test $ac_cv_enable_coda_subpackage_mode = yes)
# *** directories ***
if test $ac_cv_enable_coda_subpackage_mode = yes ; then
bindir=
includedir=
libdir=
fortrandir=
definitionsdir=
pkgdatadir=
else
fortrandir="\${pkgdatadir}/fortran"
definitionsdir="\${pkgdatadir}/definitions"
pkgdatadir="\${datadir}/$PACKAGE"
fi
AC_SUBST(fortrandir)
AC_SUBST(definitionsdir)
AC_SUBST(pkgdatadir)
# The directories for optional components start empty and will be set later
idldlmexecdir=
matlabmexexecdir=
codapythondir=
javadir=
AC_SUBST(idldlmexecdir)
AC_SUBST(matlabmexexecdir)
AC_SUBST(codapythondir)
AC_SUBST(javadir)
# *** coda-idl ***
if test $ac_cv_enable_coda_subpackage_mode = yes ; then
ac_cv_enable_idl=no
else
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)])
fi
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)
# *** coda-matlab ***
if test $ac_cv_enable_coda_subpackage_mode = yes ; then
ac_cv_enable_matlab=no
else
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)])
fi
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)
# *** coda-python ***
if test $ac_cv_enable_coda_subpackage_mode = yes ; then
ac_cv_enable_python=no
else
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)])
fi
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 full path to your python executable if you have Python installed.]))
fi
codapythondir="$pythondir/coda"
fi
AM_CONDITIONAL(BUILD_PYTHON, test $ac_cv_enable_python = yes)
# *** coda-java ***
if test $ac_cv_enable_coda_subpackage_mode = yes ; then
ac_cv_enable_java=no
else
AC_ARG_ENABLE([java],
[AS_HELP_STRING([--enable-java],[build the Java interface])],
[ac_cv_enable_java=$enableval],
[AC_CACHE_CHECK([build Java interface], ac_cv_enable_java, ac_cv_enable_java=no)])
fi
if test $ac_cv_enable_java = yes ; then
ST_CHECK_JAVA
if test $st_cv_have_java = no ; then
AC_MSG_ERROR(BOXED_TEXT([ERROR: The Sun Java Development Kit (JDK) is required to build the Java interface.
Try setting the JAVA and JAVAC environment variables to the full paths to your java and javac executables if you have Java installed.]))
fi
if test `uname -s` = Darwin; then
JNIEXT=.jnilib
else
JNIEXT=.so
fi
if test `uname -s` = Darwin && ! test -e $JAVA_HOME/include; then
if test -x /usr/bin/javaconfig; then
JNICPPFLAGS=-I`javaconfig Headers`
elif test -e /System/Library/Frameworks/JavaVM.framework/Headers; then # javaconfig does not exist on Mac 10.8
JNICPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
fi
else
AC_CHECK_FILE($JAVA_HOME/include/jni.h, ,
[AC_MSG_ERROR([BOXED_TEXT([ERROR: The Java Native Interface (jni.h) is required for the Java interface. Make sure you have the full JDK installed, not just the Runtime Environment (JRE).])])])
JNICPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/"`uname -s | tr A-Z a-z`" $CPPFLAGS"
fi
AC_SUBST(JNICPPFLAGS)
AC_SUBST(JNIEXT)
javadir="\${pkgdatadir}/java"
fi
AM_CONDITIONAL(BUILD_JAVA, test $ac_cv_enable_java = yes)
# *** hdf ***
AC_ARG_WITH([hdf4],
[AS_HELP_STRING([--with-hdf4],[build HDF4 support into CODA])],
[ac_cv_with_hdf4=$withval],
[AC_CACHE_CHECK([use HDF4], ac_cv_with_hdf4, ac_cv_with_hdf4=no)])
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
AC_ARG_ENABLE(hdf4-vdata-attributes,
[AS_HELP_STRING([--disable-hdf4-vdata-attributes],[use this option if you have HDF4.2r1 or earlier])],
[ac_cv_enable_hdf4_vdata_attributes=$enableval],
[AC_CACHE_CHECK([enable HDF4 Vdata attributes], ac_cv_enable_hdf4_vdata_attributes,
ac_cv_enable_hdf4_vdata_attributes=yes)])
if test $ac_cv_enable_hdf4_vdata_attributes = yes ; then
AC_DEFINE([ENABLE_HDF4_VDATA_ATTRIBUTES], 1, [Define to 1 if HDF4 Vdata/Vgroup attributes can be used (only enable if CODA is linked against HDF4 library version 4.2r2 or higher).])
fi
fi
AC_SUBST(HDF4LIBS)
AM_CONDITIONAL(WITH_HDF4, test $ac_cv_with_hdf4 = yes)
AC_ARG_WITH([hdf5],
[AS_HELP_STRING([--with-hdf5],[build HDF5 support into CODA])],
[ac_cv_with_hdf5=$withval],
[AC_CACHE_CHECK([use HDF5],ac_cv_with_hdf5,ac_cv_with_hdf5=no)])
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)
# *** xml ****
AC_DEFINE([XML_GE], 1, [Define as 1/0 to enable/disable support for general entities.])
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_DEFINE([CODA_EXPAT_NAME_MANGLE], 1, [Define to enable name mangling of symbols for the built-in expat library.])
# *** extra ***
AC_ARG_ENABLE([printf-warnings],
[AS_HELP_STRING([--enable-printf-warnings],[enables compiler warnings for the printf-like functions in CODA. This only works if compiling with the GNU compiler. Don't use this option for official installations of CODA (since this will prevent coda.h being used by other compilers).])],
[ac_cv_enable_printf_warnings=$enableval],
[AC_CACHE_CHECK([enable printf warnings],ac_cv_enable_printf_warnings,ac_cv_enable_printf_warnings=no)])
if test $ac_cv_enable_printf_warnings = yes && test "$GCC" = yes ; then
AC_DEFINE(PRINTF_ATTR,
[__attribute__ ((format(printf, 2, 3)))],
[Define to the compiler attribute to test for printf format compliance])
fi
AC_OUTPUT