Debian Codegraph @

matio-1.5.30/configure.ac

raw
1 dnl configure.ac
2 dnl
3 dnl NOTE: Process this file with GNU autoconf to produce a configure script.
4 dnl
5 dnl Copyright (c) 2015-2026, The matio contributors
6 dnl Copyright (c) 2005-2014, Christopher C. Hulbert
7 dnl All rights reserved.
8 dnl
9 dnl Redistribution and use in source and binary forms, with or without
10 dnl modification, are permitted provided that the following conditions are met:
11 dnl
12 dnl 1. Redistributions of source code must retain the above copyright notice, this
13 dnl list of conditions and the following disclaimer.
14 dnl
15 dnl 2. Redistributions in binary form must reproduce the above copyright notice,
16 dnl this list of conditions and the following disclaimer in the documentation
17 dnl and/or other materials provided with the distribution.
18 dnl
19 dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 dnl AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 dnl DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 dnl SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 dnl CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30 AC_INIT([MATIO],[1.5.30],[[email protected]],[],[https://sourceforge.net/projects/matio])
31 AC_CONFIG_SRCDIR([src/matio.h])
32 AC_CONFIG_AUX_DIR([config])
33 AC_CONFIG_MACRO_DIR([config])
34 AM_INIT_AUTOMAKE([foreign 1.8 no-dependencies])
35 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
36 AM_MAINTAINER_MODE
37 AC_PREREQ([2.60])
38 AC_CANONICAL_HOST
39 AC_DEFINE_UNQUOTED([MATIO_PLATFORM],"${host}",[Platform])
40 AC_DEFINE_UNQUOTED([MATIO_MAJOR_VERSION],1,[Matio major version number])
41 AC_DEFINE_UNQUOTED([MATIO_MINOR_VERSION],5,[Matio minor version number])
42 AC_DEFINE_UNQUOTED([MATIO_RELEASE_LEVEL],30,[Matio release level number])
43 AC_DEFINE_UNQUOTED([MATIO_VERSION],1530,[Matio version number])
44 PACKAGE_RELEASE_DATE="6 January 2026"
45 AC_DEFINE_UNQUOTED([MATIO_VERSION_STR],"1.5.30",[Matio version number])
46 AC_SUBST(PACKAGE_RELEASE_DATE)
47
48 AC_ARG_VAR([FCLDFLAGS],[Fortran compiler-specific flags at link time])
49 AC_ARG_VAR([LT_CFLAGS],[C compiler flags passed to libtool in compile mode])
50 AC_ARG_VAR([LT_LDFLAGS],[Flags passed to libtool in link mode])
51
52 dnl
53 dnl Build programs, C compiler, F77 compiler, make, install, etc.
54 dnl
55 AC_PROG_CC([pgcc icc gcc cc])
56 AC_USE_SYSTEM_EXTENSIONS
57
58 AC_ARG_ENABLE(coverage,
59 [ --enable-coverage Enable coverage testing],
60 [CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"])
61
62 dnl
63 dnl Check whether to build in debug mode
64 dnl
65 AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug=yes],[Turn on debugging]),
66 debug=$enableval,debug=no)
67 AC_MSG_CHECKING(debug mode)
68 if test "$debug" = "no"
69 then
70 AC_MSG_RESULT(no)
71 AC_DEFINE_UNQUOTED([NODEBUG],[],[Debug disabled])
72 else
73 AC_MSG_RESULT(yes)
74 AC_DEFINE_UNQUOTED([DEBUG],[],[Debug enabled])
75 debug=yes
76 fi
77
78 dnl
79 dnl Check whether to build in profile mode
80 dnl
81 AC_ARG_ENABLE(profile,AS_HELP_STRING([--enable-profile=yes],[Turn on profile]),
82 profile=$enableval,profile=no)
83 AC_MSG_CHECKING(profile mode)
84 if test "$profile" = "no"
85 then
86 AC_MSG_RESULT(no)
87 AC_DEFINE_UNQUOTED([NODEBUG],[],[Debug disabled])
88 else
89 AC_MSG_RESULT(yes)
90 AC_DEFINE_UNQUOTED([DEBUG],[],[Debug enabled])
91 profile=yes
92 fi
93
94 dnl
95 dnl Check for user-defined suffix to the library/include directories for
96 dnl installation and search. i.e. --with-libdir-suffix=64 looks in lib64 and
97 dnl --with-libdir-suffix=/x86_64 would look in lib/x86_64
98 dnl
99 MATIO_CHECK_LIBDIR_SUFFIX
100
101 dnl
102 dnl Set library directories to include libdir suffix
103 dnl
104 acl_libdirstem="lib$with_libdir_suffix"
105
106 dnl
107 dnl If debugging is enabled, add debugging options to the flags
108 dnl
109 if test "$debug" = "yes"
110 then
111 CFLAGS="$CFLAGS $DEBUG_CFLAGS"
112 FCFLAGS="$FCFLAGS $DEBUG_FCFLAGS"
113 else
114 CFLAGS="$REL_CFLAGS $CFLAGS"
115 FCFLAGS="$REL_FCFLAGS $FCFLAGS"
116 fi
117
118 dnl
119 dnl If profiling is enabled, add profile options to the flags
120 dnl
121 if test "$profile" = "yes"
122 then
123 CFLAGS="$PROFILE_CFLAGS $CFLAGS"
124 FCFLAGS="$PROFILE_FCFLAGS $FCFLAGS"
125 fi
126
127 AC_ENABLE_SHARED
128 AC_ENABLE_STATIC
129 LT_INIT
130
131 AC_PROG_MAKE_SET
132 AC_PROG_INSTALL
133
134 AC_PROG_GREP
135
136 dnl
137 dnl Large file support
138 dnl
139 AC_SYS_LARGEFILE
140 AC_MSG_CHECKING(for large file support in 32-bit OS)
141 if test "$ac_cv_sys_file_offset_bits" != no \
142 -o "$ac_cv_sys_large_files" != no ; then
143 AC_DEFINE_UNQUOTED([_LARGEFILE64_SOURCE],[1],[Define if 64-bit file address support in 32-bit OS.])
144 AC_DEFINE_UNQUOTED([_FILE_OFFSET_BITS],[64],[Define if 64-bit file address support in 32-bit OS.])
145 AC_MSG_RESULT(yes)
146 else
147 AC_MSG_RESULT(no)
148 fi
149 AC_CHECK_FUNCS([fseeko])
150 AC_CHECK_FUNCS([ftello])
151 AC_CHECK_FUNCS([fseeko64])
152 AC_CHECK_FUNCS([ftello64])
153 AC_CHECK_FUNCS([_fseeki64])
154 AC_CHECK_FUNCS([_ftelli64])
155
156 dnl
157 dnl Libraries
158 dnl
159
160 AC_CHECK_LIB([m],[pow])
161
162 dnl
163 dnl Headers
164 dnl
165
166 AC_CONFIG_HEADERS([src/matioConfig.h src/matio_pubconf.h])
167 AC_CHECK_HEADERS_ONCE([stdarg.h])
168 AC_CHECK_HEADERS_ONCE([varargs.h])
169 AC_CHECK_HEADER([inttypes.h],[AC_DEFINE_UNQUOTED([MATIO_HAVE_INTTYPES_H],[1],[Matio has access to inttypes.h])])
170 AC_CHECK_HEADER([stdint.h],[AC_DEFINE_UNQUOTED([MATIO_HAVE_STDINT_H],[1],[Matio has access to stdint.h])])
171 AC_CHECK_HEADER([intsafe.h],[AC_DEFINE_UNQUOTED([HAVE_INTSAFE_H],[1],[Matio has access to intsafe.h])])
172 AC_CHECK_HEADER([strings.h],[AC_DEFINE_UNQUOTED([HAVE_STRINGS_H],[1],[Matio has access to strings.h])])
173 AC_CHECK_HEADER([unistd.h],[AC_DEFINE_UNQUOTED([HAVE_UNISTD_H],[1],[Matio has access to unistd.h])])
174 AC_CHECK_HEADERS([float.h locale.h stddef.h])
175 AC_CHECK_MEMBERS([struct lconv.decimal_point, struct lconv.thousands_sep], [], [], [#include <locale.h>])
176
177 AC_CHECK_TYPES([ptrdiff_t])
178 AC_CHECK_FUNCS([localeconv])
179
180 MATIO_CHECK_GETOPT_LONG
181
182 AC_CHECK_SIZEOF([double])
183 AC_CHECK_SIZEOF([float])
184 AC_CHECK_SIZEOF([long long])
185 AC_CHECK_SIZEOF([long])
186 AC_CHECK_SIZEOF([int])
187 AC_CHECK_SIZEOF([short])
188 AC_CHECK_SIZEOF([char])
189 AC_CHECK_SIZEOF([void *])
190 AC_CHECK_SIZEOF([off_t])
191 AC_CHECK_SIZEOF([size_t])
192
193 dnl
194 dnl Substitute size of int, size_t, and void * to matio_t.inc
195 SIZEOF_INT="$ac_cv_sizeof_int"
196 SIZEOF_SIZE_T="$ac_cv_sizeof_size_t"
197 SIZEOF_VOID_P="$ac_cv_sizeof_void_p"
198 AC_SUBST(SIZEOF_INT)
199 AC_SUBST(SIZEOF_SIZE_T)
200 AC_SUBST(SIZEOF_VOID_P)
201
202 CHECK_MATIO_INT64_T
203 CHECK_MATIO_UINT64_T
204 CHECK_MATIO_INT32_T
205 CHECK_MATIO_UINT32_T
206 CHECK_MATIO_INT16_T
207 CHECK_MATIO_UINT16_T
208 CHECK_MATIO_INT8_T
209 CHECK_MATIO_UINT8_T
210
211 if test "x$ac_have_mat_uint64_t" = "xyes"; then
212 HAVE_UINT64=1
213 else
214 HAVE_UINT64=0
215 fi
216 if test "x$ac_have_mat_int64_t" = "xyes"; then
217 HAVE_INT64=1
218 else
219 HAVE_INT64=0
220 fi
221 AC_SUBST([HAVE_UINT64],[$HAVE_UINT64])
222 AC_SUBST([HAVE_INT64], [$HAVE_INT64])
223
224 AC_TYPE_OFF_T
225 AC_TYPE_OFF64_T
226 AC_TYPE_LONG_DOUBLE
227 AC_TYPE_LONG_LONG_INT
228 AC_TYPE_UNSIGNED_LONG_LONG_INT
229 AC_TYPE_SIZE_T
230 AC_TYPE_INTMAX_T
231 AC_TYPE_UINTMAX_T
232 AC_TYPE_UINTPTR_T
233 AC_CHECK_VA_COPY
234
235 AC_CACHE_CHECK([for vsnprintf()],matio_cv_have_vsnprintf,[
236 AC_LINK_IFELSE([AC_LANG_SOURCE([[
237 #include <stdlib.h>
238 #include <stdarg.h>
239 #include <stdio.h>
240 int main() {
241 va_list ap;
242 vsnprintf(NULL,0,"%d",ap);
243 return 0;
244 }]])],
245 [matio_cv_have_vsnprintf=yes],
246 [matio_cv_have_vsnprintf=no])
247 ])
248
249 AC_CACHE_CHECK([for snprintf()],matio_cv_have_snprintf,[
250 AC_LINK_IFELSE([AC_LANG_SOURCE([[
251 #include <stdlib.h>
252 #include <stdarg.h>
253 #include <stdio.h>
254 int main() {
255 snprintf(NULL,0,"%d",0);
256 return 0;
257 }]])],
258 [matio_cv_have_snprintf=yes],
259 [matio_cv_have_snprintf=no])
260 ])
261
262 AC_CACHE_CHECK([for vasprintf()],matio_cv_have_vasprintf,[
263 AC_LINK_IFELSE([AC_LANG_SOURCE([[
264 #include <stdlib.h>
265 #include <stdarg.h>
266 #include <stdio.h>
267 int main() {
268 va_list ap;
269 vasprintf(NULL,"%d",ap);
270 return 0;
271 }]])],
272 [matio_cv_have_vasprintf=yes],
273 [matio_cv_have_vasprintf=no])
274 ])
275
276 AC_CACHE_CHECK([for asprintf()],matio_cv_have_asprintf,[
277 AC_LINK_IFELSE([AC_LANG_SOURCE([[
278 #include <stdlib.h>
279 #include <stdarg.h>
280 #include <stdio.h>
281 int main() {
282 asprintf(NULL,0,"%d",0);
283 return 0;
284 }]])],
285 [matio_cv_have_asprintf=yes],
286 [matio_cv_have_asprintf=no])
287 ])
288
289 if test "$matio_cv_have_vsnprintf" = "yes"
290 then
291 AC_DEFINE_UNQUOTED([HAVE_VSNPRINTF],[1],[Define to 1 if you have a C99 compliant `vsnprintf' function.])
292 fi
293 if test "$matio_cv_have_snprintf" = "yes"
294 then
295 AC_DEFINE_UNQUOTED([HAVE_SNPRINTF],[1],[Define to 1 if you have a C99 compliant `snprintf' function.])
296 fi
297 if test "$matio_cv_have_vasprintf" = "yes"
298 then
299 AC_DEFINE_UNQUOTED([HAVE_VASPRINTF],[1],[Define to 1 if you have the `vasprintf' function.])
300 fi
301 if test "$matio_cv_have_asprintf" = "yes"
302 then
303 AC_DEFINE_UNQUOTED([HAVE_ASPRINTF],[1],[Define to 1 if you have the `asprintf' function.])
304 fi
305
306 MATIO_CHECK_MATLAB
307
308 MATIO_CHECK_ZLIB
309
310 MATIO_CHECK_HDF5
311 dnl
312 dnl Check whether to enable MAT v7.3 files
313 dnl
314 AC_ARG_ENABLE(mat73,
315 AS_HELP_STRING([--enable-mat73=yes],[Enable MAT v7.3 file support]),
316 mat73=$enableval,mat73=yes)
317 AC_MSG_CHECKING(enable MAT v7.3 file support)
318 if test "x$mat73" = "xno" -o "x$ac_have_hdf5" = "xno" -o "x$matio_hdf5_is_v18" = "xno"
319 then
320 AC_MSG_RESULT([no])
321 mat73=no
322 else
323 AC_MSG_RESULT([yes])
324 AC_DEFINE_UNQUOTED([MAT73],[1],[MAT v7.3 file support])
325 mat73=yes
326 fi
327 AM_CONDITIONAL([MAT73], [test "x$mat73" = "xyes"])
328
329 MATIO_CHECK_DEFAULT_FILE_VERSION
330
331 dnl
332 dnl Check whether to enable extended sparse matrix data types
333 dnl
334 AC_ARG_ENABLE(extended-sparse,AS_HELP_STRING([--enable-extended-sparse=yes],[Enable extended sparse matrix data types not supported in Matlab]),
335 extended_sparse=$enableval,extended_sparse=yes)
336 AC_MSG_CHECKING(enable extended sparse types)
337 if test "$extended_sparse" = "no"
338 then
339 extended_sparse=no
340 AC_MSG_RESULT(no)
341 else
342 extended_sparse=yes
343 AC_MSG_RESULT(yes)
344 AC_DEFINE_UNQUOTED([EXTENDED_SPARSE],[],[Extended sparse matrix data types])
345 fi
346 AM_CONDITIONAL([EXTENDED_SPARSE], [test "x$extended_sparse" = "xyes"])
347
348 linux="no"
349 winnt="no"
350 sun="no"
351 case $build_os in
352 *linux*)
353 linux="yes"
354 AC_DEFINE_UNQUOTED([LINUX],[],[OS is Linux]);;
355 *mingw*)
356 winnt="yes"
357 AC_DEFINE_UNQUOTED([WINNT],[],[OS is WinNT]);;
358 *cygwin*)
359 winnt="yes"
360 AC_DEFINE_UNQUOTED([WINNT],[],[OS is CygWin]);;
361 *sun*)
362 sun="yes"
363 AC_DEFINE_UNQUOTED([SUN],[],[OS is Sun]);;
364 *solaris*)
365 sun="yes"
366 AC_DEFINE_UNQUOTED([SUN],[],[OS is Solaris]);;
367 esac
368
369 AM_CONDITIONAL([LINUX], [test "x$linux" = "xyes"])
370 AM_CONDITIONAL([WINNT], [test "x$winnt" = "xyes"])
371 AM_CONDITIONAL([SUN], [test "x$sun" = "xyes"])
372
373 winnt="no"
374 case "${host_os}" in
375 cygwin*|mingw*)
376 winnt=yes;;
377 esac
378
379 AM_CONDITIONAL([IS_WIN32], [test "x$winnt" = "xyes"])
380
381 # Initialize the test suite.
382 AC_CONFIG_TESTDIR([test])
383 AC_SUBST([AUTOM4TE], [${AUTOM4TE=autom4te}])
384 AC_SUBST([AUTOTEST], ['$(AUTOM4TE) --language=Autotest'])
385
386 AC_CONFIG_FILES([Makefile \
387 matio.pc \
388 snprintf/Makefile \
389 src/Makefile \
390 getopt/Makefile \
391 tools/Makefile \
392 test/Makefile \
393 documentation/Makefile])
394 AC_OUTPUT
395
396 AC_MSG_RESULT([])
397 AC_MSG_RESULT([ MATIO Configuration Summary ])
398 AC_MSG_RESULT([==============================================================])
399 AC_MSG_RESULT([ C Compiler: $CC])
400 AC_MSG_RESULT([ CFLAGS: $CFLAGS])
401 AC_MSG_RESULT([ Shared Libraries: $enable_shared])
402 AC_MSG_RESULT([ Static Libraries: $enable_static])
403 AC_MSG_RESULT([ default MAT version: $file_ver])
404 AC_MSG_RESULT([])
405 AC_MSG_RESULT([Features --------------------------------------------])
406 AC_MSG_RESULT([ MAT v7.3 file support: $mat73])
407 AC_MSG_RESULT([Extended sparse support: $extended_sparse])
408 AC_MSG_RESULT([])
409 AC_MSG_RESULT([Packages --------------------------------------------])
410 AC_MSG_RESULT([ zlib: $ZLIB_LIBS])
411 AC_MSG_RESULT([ hdf5: $HDF5_LIBS])
412 AC_MSG_RESULT([ MATLAB: $MATLABEXE])
413 AC_MSG_RESULT([])
414 AC_MSG_RESULT([])