forked from tbeu/matio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
389 lines (348 loc) · 11.4 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
dnl configure.ac
dnl
dnl NOTE: Process this file with GNU autoconf to produce a configure script.
dnl
dnl Copyright (c) 2005-2021, Christopher C. Hulbert
dnl All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions are met:
dnl
dnl 1. Redistributions of source code must retain the above copyright notice, this
dnl list of conditions and the following disclaimer.
dnl
dnl 2. Redistributions in binary form must reproduce the above copyright notice,
dnl this list of conditions and the following disclaimer in the documentation
dnl and/or other materials provided with the distribution.
dnl
dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
dnl DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
dnl SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
dnl CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AC_INIT([MATIO],[1.5.21],[[email protected]],[],[https://sourceforge.net/projects/matio])
AC_CONFIG_SRCDIR([src/matio.h])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
AM_INIT_AUTOMAKE([foreign 1.8 no-dependencies])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AM_MAINTAINER_MODE
AC_PREREQ([2.60])
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED([MATIO_PLATFORM],"${host}",[Platform])
AC_DEFINE_UNQUOTED([MATIO_MAJOR_VERSION],1,[Matio major version number])
AC_DEFINE_UNQUOTED([MATIO_MINOR_VERSION],5,[Matio minor version number])
AC_DEFINE_UNQUOTED([MATIO_RELEASE_LEVEL],21,[Matio release level number])
AC_DEFINE_UNQUOTED([MATIO_VERSION],1521,[Matio version number])
PACKAGE_RELEASE_DATE="25 March 2021"
AC_DEFINE_UNQUOTED([MATIO_VERSION_STR],"1.5.21",[Matio version number])
AC_SUBST(PACKAGE_RELEASE_DATE)
AC_ARG_VAR([FCLDFLAGS],[Fortran compiler-specific flags at link time])
AC_ARG_VAR([LT_CFLAGS],[C compiler flags passed to libtool in compile mode])
AC_ARG_VAR([LT_LDFLAGS],[Flags passed to libtool in link mode])
dnl
dnl Build programs, C compiler, F77 compiler, make, install, etc.
dnl
AC_PROG_CC([pgcc icc gcc cc])
AC_ARG_ENABLE(coverage,
[ --enable-coverage Enable coverage testing],
[CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"])
dnl
dnl Check whether to build in debug mode
dnl
AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug=yes],[Turn on debugging]),
debug=$enableval,debug=no)
AC_MSG_CHECKING(debug mode)
if test "$debug" = "no"
then
AC_MSG_RESULT(no)
AC_DEFINE_UNQUOTED([NODEBUG],[],[Debug disabled])
else
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([DEBUG],[],[Debug enabled])
debug=yes
fi
dnl
dnl Check whether to build in profile mode
dnl
AC_ARG_ENABLE(profile,AS_HELP_STRING([--enable-profile=yes],[Turn on profile]),
profile=$enableval,profile=no)
AC_MSG_CHECKING(profile mode)
if test "$profile" = "no"
then
AC_MSG_RESULT(no)
AC_DEFINE_UNQUOTED([NODEBUG],[],[Debug disabled])
else
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([DEBUG],[],[Debug enabled])
profile=yes
fi
dnl
dnl Check for user-defined suffix to the library/include directories for
dnl installation and search. i.e. --with-libdir-suffix=64 looks in lib64 and
dnl --with-libdir-suffix=/x86_64 would look in lib/x86_64
dnl
MATIO_CHECK_LIBDIR_SUFFIX
dnl
dnl Set library directories to include libdir suffix
dnl
acl_libdirstem="lib$with_libdir_suffix"
dnl
dnl If debugging is enabled, add debugging options to the flags
dnl
if test "$debug" = "yes"
then
CFLAGS="$CFLAGS $DEBUG_CFLAGS"
FCFLAGS="$FCFLAGS $DEBUG_FCFLAGS"
else
CFLAGS="$REL_CFLAGS $CFLAGS"
FCFLAGS="$REL_FCFLAGS $FCFLAGS"
fi
dnl
dnl If profiling is enabled, add profile options to the flags
dnl
if test "$profile" = "yes"
then
CFLAGS="$PROFILE_CFLAGS $CFLAGS"
FCFLAGS="$PROFILE_FCFLAGS $FCFLAGS"
fi
AC_ENABLE_SHARED
AC_ENABLE_STATIC
LT_INIT
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_GREP
dnl
dnl Libraries
dnl
AC_CHECK_LIB([m],[pow])
dnl
dnl Headers
dnl
AC_CONFIG_HEADERS([src/matioConfig.h src/matio_pubconf.h])
AC_HEADER_STDC
AC_CHECK_HEADERS_ONCE([stdarg.h])
AC_CHECK_HEADERS_ONCE([varargs.h])
AC_CHECK_HEADER([inttypes.h],[AC_DEFINE_UNQUOTED([MATIO_HAVE_INTTYPES_H],[1],[Matio has access to inttypes.h])])
AC_CHECK_HEADER([stdint.h],[AC_DEFINE_UNQUOTED([MATIO_HAVE_STDINT_H],[1],[Matio has access to stdint.h])])
AC_CHECK_HEADER([intsafe.h],[AC_DEFINE_UNQUOTED([HAVE_INTSAFE_H],[1],[Matio has access to intsafe.h])])
AC_CHECK_HEADER([strings.h],[AC_DEFINE_UNQUOTED([HAVE_STRINGS_H],[1],[Matio has access to strings.h])])
AC_CHECK_HEADER([unistd.h],[AC_DEFINE_UNQUOTED([HAVE_UNISTD_H],[1],[Matio has access to unistd.h])])
AC_CHECK_HEADERS([locale.h stddef.h])
AC_CHECK_MEMBERS([struct lconv.decimal_point, struct lconv.thousands_sep], [], [], [#include <locale.h>])
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_FUNCS([localeconv])
MATIO_CHECK_GETOPT_LONG
AC_CHECK_SIZEOF([double])
AC_CHECK_SIZEOF([float])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([char])
AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([size_t])
dnl
dnl Substitute size of int, size_t, and void * to matio_t.inc
SIZEOF_INT="$ac_cv_sizeof_int"
SIZEOF_SIZE_T="$ac_cv_sizeof_size_t"
SIZEOF_VOID_P="$ac_cv_sizeof_void_p"
AC_SUBST(SIZEOF_INT)
AC_SUBST(SIZEOF_SIZE_T)
AC_SUBST(SIZEOF_VOID_P)
CHECK_MATIO_INT64_T
CHECK_MATIO_UINT64_T
CHECK_MATIO_INT32_T
CHECK_MATIO_UINT32_T
CHECK_MATIO_INT16_T
CHECK_MATIO_UINT16_T
CHECK_MATIO_INT8_T
CHECK_MATIO_UINT8_T
if test "x$ac_have_mat_uint64_t" = "xyes"; then
HAVE_UINT64=1
else
HAVE_UINT64=0
fi
if test "x$ac_have_mat_int64_t" = "xyes"; then
HAVE_INT64=1
else
HAVE_INT64=0
fi
AC_SUBST([HAVE_UINT64],[$HAVE_UINT64])
AC_SUBST([HAVE_INT64], [$HAVE_INT64])
AC_TYPE_LONG_DOUBLE
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_TYPE_SIZE_T
AC_TYPE_INTMAX_T
AC_TYPE_UINTMAX_T
AC_TYPE_UINTPTR_T
AC_CHECK_VA_COPY
AC_CACHE_CHECK([for vsnprintf()],matio_cv_have_vsnprintf,[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
int main() {
va_list ap;
vsnprintf(NULL,0,"%d",ap);
return 0;
}]])],
[matio_cv_have_vsnprintf=yes],
[matio_cv_have_vsnprintf=no])
])
AC_CACHE_CHECK([for snprintf()],matio_cv_have_snprintf,[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
int main() {
snprintf(NULL,0,"%d",0);
return 0;
}]])],
[matio_cv_have_snprintf=yes],
[matio_cv_have_snprintf=no])
])
AC_CACHE_CHECK([for vasprintf()],matio_cv_have_vasprintf,[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
int main() {
va_list ap;
vasprintf(NULL,"%d",ap);
return 0;
}]])],
[matio_cv_have_vasprintf=yes],
[matio_cv_have_vasprintf=no])
])
AC_CACHE_CHECK([for asprintf()],matio_cv_have_asprintf,[
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
int main() {
asprintf(NULL,0,"%d",0);
return 0;
}]])],
[matio_cv_have_asprintf=yes],
[matio_cv_have_asprintf=no])
])
if test "$matio_cv_have_vsnprintf" = "yes"
then
AC_DEFINE_UNQUOTED([HAVE_VSNPRINTF],[1],[Define to 1 if you have a C99 compliant `vsnprintf' function.])
fi
if test "$matio_cv_have_snprintf" = "yes"
then
AC_DEFINE_UNQUOTED([HAVE_SNPRINTF],[1],[Define to 1 if you have a C99 compliant `snprintf' function.])
fi
if test "$matio_cv_have_vasprintf" = "yes"
then
AC_DEFINE_UNQUOTED([HAVE_VASPRINTF],[1],[Define to 1 if you have the `vasprintf' function.])
fi
if test "$matio_cv_have_asprintf" = "yes"
then
AC_DEFINE_UNQUOTED([HAVE_ASPRINTF],[1],[Define to 1 if you have the `asprintf' function.])
fi
MATIO_CHECK_MATLAB
MATIO_CHECK_ZLIB
MATIO_CHECK_HDF5
dnl
dnl Check whether to enable MAT v7.3 files
dnl
AC_ARG_ENABLE(mat73,
AS_HELP_STRING([--enable-mat73=yes],[Enable MAT v7.3 file support]),
mat73=$enableval,mat73=yes)
AC_MSG_CHECKING(enable MAT v7.3 file support)
if test "x$mat73" = "xno" -o "x$ac_have_hdf5" = "xno" -o "x$matio_hdf5_is_v18" = "xno"
then
AC_MSG_RESULT([no])
mat73=no
else
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([MAT73],[1],[MAT v7.3 file support])
mat73=yes
fi
AM_CONDITIONAL([MAT73], [test "x$mat73" = "xyes"])
MATIO_CHECK_DEFAULT_FILE_VERSION
dnl
dnl Check whether to enable extended sparse matrix data types
dnl
AC_ARG_ENABLE(extended-sparse,AS_HELP_STRING([--enable-extended-sparse=yes],[Enable extended sparse matrix data types not supported in Matlab]),
extended_sparse=$enableval,extended_sparse=yes)
AC_MSG_CHECKING(enable extended sparse types)
if test "$extended_sparse" = "no"
then
extended_sparse=no
AC_MSG_RESULT(no)
else
extended_sparse=yes
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([EXTENDED_SPARSE],[],[Extended sparse matrix data types])
fi
AM_CONDITIONAL([EXTENDED_SPARSE], [test "x$extended_sparse" = "xyes"])
linux="no"
winnt="no"
sun="no"
case $build_os in
*linux*)
linux="yes"
AC_DEFINE_UNQUOTED([LINUX],[],[OS is Linux]);;
*mingw*)
winnt="yes"
AC_DEFINE_UNQUOTED([WINNT],[],[OS is WinNT]);;
*cygwin*)
winnt="yes"
AC_DEFINE_UNQUOTED([WINNT],[],[OS is CygWin]);;
*sun*)
sun="yes"
AC_DEFINE_UNQUOTED([SUN],[],[OS is Sun]);;
*solaris*)
sun="yes"
AC_DEFINE_UNQUOTED([SUN],[],[OS is Solaris]);;
esac
AM_CONDITIONAL([LINUX], [test "x$linux" = "xyes"])
AM_CONDITIONAL([WINNT], [test "x$winnt" = "xyes"])
AM_CONDITIONAL([SUN], [test "x$sun" = "xyes"])
winnt="no"
case "${host_os}" in
cygwin*|mingw*)
winnt=yes;;
esac
AM_CONDITIONAL([IS_WIN32], [test "x$winnt" = "xyes"])
# Initialize the test suite.
AC_CONFIG_TESTDIR([test])
AC_SUBST([AUTOM4TE], [${AUTOM4TE=autom4te}])
AC_SUBST([AUTOTEST], ['$(AUTOM4TE) --language=Autotest'])
AC_CONFIG_FILES([Makefile \
matio.pc \
src/Makefile \
getopt/Makefile \
tools/Makefile \
test/Makefile \
documentation/Makefile])
AC_OUTPUT
AC_MSG_RESULT([])
AC_MSG_RESULT([ MATIO Configuration Summary ])
AC_MSG_RESULT([==============================================================])
AC_MSG_RESULT([ C Compiler: $CC])
AC_MSG_RESULT([ CFLAGS: $CFLAGS])
AC_MSG_RESULT([ Shared Libraries: $enable_shared])
AC_MSG_RESULT([ Static Libraries: $enable_static])
AC_MSG_RESULT([ default MAT version: $file_ver])
AC_MSG_RESULT([])
AC_MSG_RESULT([Features --------------------------------------------])
AC_MSG_RESULT([ MAT v7.3 file support: $mat73])
AC_MSG_RESULT([Extended sparse support: $extended_sparse])
AC_MSG_RESULT([])
AC_MSG_RESULT([Packages --------------------------------------------])
AC_MSG_RESULT([ zlib: $ZLIB_LIBS])
AC_MSG_RESULT([ hdf5: $HDF5_LIBS])
AC_MSG_RESULT([ MATLAB: $MATLABEXE])
AC_MSG_RESULT([])
AC_MSG_RESULT([])