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