1## Process this file with autoconf to produce configure.
2##
3## Copyright by The HDF Group.
4## Copyright by the Board of Trustees of the University of Illinois.
5## All rights reserved.
6##
7## This file is part of HDF5.  The full HDF5 copyright notice, including
8## terms governing use, modification, and redistribution, is contained in
9## the COPYING file, which can be found at the root of the source code
10## distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
11## If you do not have access to either file, you may request a copy from
12## help@hdfgroup.org.
13
14## ----------------------------------------------------------------------
15## Initialize configure.
16##
17AC_REVISION($Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest $)
18AC_PREREQ([2.69])
19
20## AC_INIT takes the name of the package, the version number, and an
21## email address to report bugs. AC_CONFIG_SRCDIR takes a unique file
22## as its argument.
23##
24## NOTE: Do not forget to change the version number here when we do a
25## release!!!
26##
27AC_INIT([HDF5], [1.10.6], [help@hdfgroup.org])
28
29AC_CONFIG_SRCDIR([src/H5.c])
30AC_CONFIG_HEADERS([src/H5config.h])
31
32AC_CONFIG_AUX_DIR([bin])
33AC_CONFIG_MACRO_DIR([m4])
34
35## AM_INIT_AUTOMAKE takes a list of options that should be applied to
36## every Makefile.am when automake is run.
37AM_INIT_AUTOMAKE([foreign subdir-objects])
38m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where available - automake 1.11
39
40## AM_MAINTAINER_MODE turns off "rebuild rules" that contain dependencies
41## for Makefiles, configure, src/H5config.h, etc. If AM_MAINTAINER_MODE
42## is enabled, these files will be rebuilt if out of date. This is a
43## problem because if users try to build on a machine with
44## the wrong versions of autoconf and automake, these files will be
45## rebuilt with the wrong versions and bad things can happen.
46## Also, CVS doesn't preserve dependencies between timestamps, so
47## Makefiles will often think rebuilding needs to occur when it doesn't.
48##
49## By default, it is enabled. Users can configure with
50## --disable-maintainer-mode to prevent running the autotools.
51AM_MAINTAINER_MODE([disable])
52
53## ----------------------------------------------------------------------
54## Set prefix default (install directory) to a directory in the build area.
55## This allows multiple src-dir builds within one host.
56AC_PREFIX_DEFAULT([`pwd`/hdf5])
57
58## Run post processing on files created by configure.
59## src/H5pubconf.h:
60## Generate src/H5pubconf.h from src/H5config.h by prepending H5_ to all
61## macro names. This avoid name conflict between HDF5 macro names and those
62## generated by another software package that uses the HDF5 library.
63## src/libhdf5.settings:
64## Remove all lines begun with "#" which are generated by CONDITIONAL's of
65## configure.
66AC_CONFIG_COMMANDS([pubconf], [
67  echo "creating src/H5pubconf.h"
68  sed 's/#define /#define H5_/' <src/H5config.h |\
69    sed 's/#undef /#undef H5_/' >pubconf
70  if test ! -f src/H5pubconf.h; then
71    /bin/mv -f pubconf src/H5pubconf.h
72  elif (diff pubconf src/H5pubconf.h >/dev/null); then
73    rm -f pubconf
74    echo "src/H5pubconf.h is unchanged"
75  else
76    /bin/mv -f pubconf src/H5pubconf.h
77  fi
78  echo "Post process src/libhdf5.settings"
79  sed '/^#/d' < src/libhdf5.settings > libhdf5.settings.TMP
80  cp libhdf5.settings.TMP src/libhdf5.settings
81  rm -f libhdf5.settings.TMP
82])
83
84## It's possible to configure for a host other than the one on which
85## configure is currently running by using the --host=foo flag.
86## For machines on which HDF5 is often configured, it can be convenient
87## to specify the name of the machine rather than its canonical type.
88##
89## There are currently no hosts, but if there were they would be
90## listed by hostname and the alias would point to a file in
91## the config directory:
92##
93##case $host_alias in
94##  <some host>)
95##    host_alias=<config file in config directory>
96##    ;;
97##esac
98
99AC_CANONICAL_HOST
100AC_SUBST([CPPFLAGS])
101AC_SUBST([JNIFLAGS])
102AC_SUBST([AR_FLAGS])
103
104## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but
105## not exported to h5cc (or h5fc, etc.)
106AC_SUBST([H5_CFLAGS])
107AC_SUBST([H5_CPPFLAGS])
108AC_SUBST([H5_FCFLAGS])
109AC_SUBST([H5_CXXFLAGS])
110AC_SUBST([H5_JNIFLAGS])
111AC_SUBST([H5_JAVACFLAGS])
112AC_SUBST([H5_JAVAFLAGS])
113AC_SUBST([H5_LDFLAGS])
114
115## AM_CFLAGS (and company) are for CFLAGS that should be used on HDF5,
116## and WILL be exported to h5cc (or h5fc, etc) if set by configure.
117AC_SUBST([AM_CFLAGS])
118AC_SUBST([AM_FCFLAGS])
119AC_SUBST([AM_CXXFLAGS])
120AC_SUBST([AM_CPPFLAGS])
121AC_SUBST([AM_JNIFLAGS])
122AC_SUBST([AM_JAVACFLAGS])
123AC_SUBST([AM_JAVAFLAGS])
124AC_SUBST([AM_LDFLAGS])
125
126## Make sure flags are initialized.
127AM_CFLAGS="${AM_CFLAGS}"
128AM_CXXFLAGS="${AM_CXXFLAGS}"
129AM_FCFLAGS="${AM_FCFLAGS}"
130AM_CPPFLAGS="${AM_CPPFLAGS}"
131AM_JNIFLAGS="${AM_JNIFLAGS}"
132AM_JAVACFLAGS="${AM_JAVACFLAGS}"
133AM_JAVAFLAGS="${AM_JAVAFLAGS}"
134AM_LDFLAGS="${AM_LDFLAGS}"
135CFLAGS="${CFLAGS}"
136CXXFLAGS="${CXXFLAGS}"
137FCFLAGS="${FCFLAGS}"
138CPPFLAGS="${CPPFLAGS}"
139JNIFLAGS="${JNIFLAGS}"
140JAVACFLAGS="${JAVACFLAGS}"
141JAVAFLAGS="${JAVAFLAGS}"
142LDFLAGS="${LDFLAGS}"
143AR_FLAGS="${AR_FLAGS}"
144
145## Configure may need to alter any of the *FLAGS variables in order for
146## various checks to work correctly. Save the user's value here so it
147## can be restored once all configure checks are complete.
148saved_user_CFLAGS="$CFLAGS"
149saved_user_CXXFLAGS="$CXXFLAGS"
150saved_user_FCFLAGS="$FCFLAGS"
151saved_user_JAVACFLAGS="$JAVACFLAGS"
152saved_user_JAVAFLAGS="$JAVAFLAGS"
153saved_user_LDFLAGS="$LDFLAGS"
154saved_user_CPPFLAGS="$CPPFLAGS"
155
156## Support F9X variable to define Fortran compiler if FC variable is
157## not used.  This should be deprecated in the future.
158if test "x" = "x$FC"; then
159  FC=${F9X}
160fi
161
162## ----------------------------------------------------------------------
163## Dump all shell variables values.
164##
165AC_MSG_CHECKING([shell variables initial values])
166set >&AS_MESSAGE_LOG_FD
167AC_MSG_RESULT([done])
168
169## ----------------------------------------------------------------------
170## Save system information for the library settings file.
171##
172AC_SUBST([UNAME_INFO])
173UNAME_INFO=`uname -a`
174
175## ----------------------------------------------------------------------
176## Some platforms have broken basename, and/or xargs programs. Check
177## that it actually does what it's supposed to do. Catch this early
178## since configure and scripts relies upon them heavily and there's
179## no use continuing if it's broken.
180##
181AC_MSG_CHECKING([if basename works])
182BASENAME_TEST="`basename /foo/bar/baz/qux/basename_works`"
183if test $BASENAME_TEST != "basename_works"; then
184  AC_MSG_ERROR([basename program doesn't work])
185else
186  AC_MSG_RESULT([yes])
187fi
188
189## xargs basename used in configure to get the CC_BASENAME value
190AC_MSG_CHECKING([if xargs works])
191XARGS_TEST="`echo /foo/bar/baz/qux/xargs_works | xargs basename`"
192if test $XARGS_TEST != "xargs_works"; then
193  AC_MSG_ERROR([xargs program doesn't work])
194else
195  AC_MSG_RESULT([yes])
196fi
197
198## ----------------------------------------------------------------------
199## Check that the cache file was build on the same host as what we're
200## running on now.
201##
202AC_CACHE_CHECK([for cached host], [hdf5_cv_host], [hdf5_cv_host="none"]);
203if test $hdf5_cv_host = "none"; then
204  hdf5_cv_host=$host
205elif test $hdf5_cv_host != $host; then
206  echo "The config.cache file was generated on $hdf5_cv_host but"
207  echo "this is $host.  Please remove that file and try again."
208  AC_MSG_ERROR([config.cache file is invalid])
209fi
210
211## ----------------------------------------------------------------------
212## Source any special files that we need.  These files normally aren't
213## present but can be used by the maintainers to fine tune things like
214## turning on debug or profiling flags for the compiler.  The search order
215## is:
216##
217##    CPU-VENDOR-OS
218##    VENDOR-OS
219##    CPU-OS
220##    CPU-VENDOR
221##    OS
222##    VENDOR
223##    CPU
224##
225## If the `OS' ends with a version number then remove it. For instance,
226## `freebsd3.1' would become `freebsd'
227
228case $host_os in
229  aix*)
230    host_os_novers=aix
231    ;;
232  freebsd*)
233    host_os_novers=freebsd
234    ;;
235  solaris*)
236    host_os_novers=solaris
237    ;;
238  *)
239    host_os_novers=$host_os
240    ;;
241esac
242
243host_config="none"
244for f in $host_cpu-$host_vendor-$host_os \
245         $host_cpu-$host_vendor-$host_os_novers \
246         $host_vendor-$host_os \
247         $host_vendor-$host_os_novers \
248         $host_cpu-$host_os \
249         $host_cpu-$host_os_novers \
250         $host_cpu-$host_vendor \
251         $host_os \
252         $host_os_novers \
253         $host_vendor \
254         $host_cpu ; do
255  AC_MSG_CHECKING([for config $f])
256  if test -f "$srcdir/config/$f"; then
257    host_config=$srcdir/config/$f
258    AC_MSG_RESULT([found])
259    break
260  fi
261  AC_MSG_RESULT([no])
262done
263if test "X$host_config" != "Xnone"; then
264  CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`"
265  . $host_config
266fi
267
268## Source any special site-specific file
269hname="`hostname`"
270while test -n "$hname"; do
271  file=$srcdir/config/site-specific/host-$hname
272  AC_MSG_CHECKING([for config $file])
273  if test -f "$file"; then
274    . $file
275    AC_MSG_RESULT([found])
276    break
277  fi
278  AC_MSG_RESULT([no])
279  hname_tmp=$hname
280  hname="`echo $hname | cut -d. -f2-99`"
281  test "$hname_tmp" = "$hname" && break
282done
283
284
285## ----------------------------------------------------------------------
286## Determine build mode (debug, production, clean).
287## This has to be done early since the build mode is referred to
288## frequently.
289##
290AC_MSG_CHECKING([build mode])
291AC_ARG_ENABLE([build-mode],
292              [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)],
293                              [Sets the build mode. Debug turns on symbols, API
294                               tracing, asserts, and debug optimization,
295                               as well as several other minor configure options
296                               that aid in debugging.
297                               Production turns high optimizations on.
298                               Clean turns nothing on and disables optimization
299                               (i.e.: a 'clean slate' configuration).
300                               All these settings can be overridden by using
301                               specific configure flags.
302                               [default=production]
303                               ])],
304              [BUILD_MODE=$enableval])
305
306## Set the default
307## Depends on branch, set via script at branch creation time
308if test "X-$BUILD_MODE" = X- ; then
309    BUILD_MODE=production
310fi
311
312## Allow this variable to be substituted in
313## other files (src/libhdf5.settings.in, etc.)
314AC_SUBST([BUILD_MODE])
315
316case "X-$BUILD_MODE" in
317  X-clean)
318    AC_MSG_RESULT([clean])
319    ;;
320  X-debug)
321    AC_DEFINE([DEBUG_BUILD], [1], [Define if this is a debug build.])
322    H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS"
323    H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS"
324    H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS"
325    H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS"
326    AC_MSG_RESULT([debug])
327    ;;
328  X-production)
329    H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS"
330    H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS"
331    H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS"
332    H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS"
333    AC_MSG_RESULT([production])
334    ;;
335  *)
336    AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.])
337esac
338
339## ----------------------------------------------------------------------
340## Some built-in configure checks can only see CFLAGS (not AM_CFLAGS), so
341## we need to add this in so configure works as intended. We will need to
342## reset this value at the end of configure, to preserve the user's settings.
343CFLAGS="${AM_CFLAGS} ${CFLAGS}"
344FCFLAGS="${AM_FCFLAGS} ${FCFLAGS}"
345JAVACFLAGS="${AM_JAVACFLAGS} ${JAVACFLAGS}"
346JAVAFLAGS="${AM_JAVAFLAGS} ${JAVAFLAGS}"
347CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
348CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
349LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
350
351## ----------------------------------------------------------------------
352## Enable dependency tracking unless the configure options or a
353## site-specific file told us not to.  This prevents configure from
354## silently disabling dependencies for some compilers.
355##
356if test -z "${enable_dependency_tracking}"; then
357  enable_dependency_tracking="yes"
358fi
359
360## ----------------------------------------------------------------------
361## Check for programs.
362##
363AC_PROG_CC
364CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`"
365
366## ----------------------------------------------------------------------------
367## Configure disallows unsupported combinations of options. However, users
368## may want to override and build with unsupported combinations for their
369## own use. They can use the --enable-unsupported configure flag, which
370## ignores any errors from configure due to incompatible flags.
371AC_MSG_CHECKING([if unsupported combinations of configure options are allowed])
372AC_ARG_ENABLE([unsupported],
373              [AS_HELP_STRING([--enable-unsupported],
374                              [Allow unsupported combinations of configure options])],
375              [ALLOW_UNSUPPORTED=$enableval])
376
377case "X-$ALLOW_UNSUPPORTED" in
378  X-|X-no)
379    AC_MSG_RESULT([no])
380    ;;
381  X-yes)
382    AC_MSG_RESULT([yes])
383    ;;
384  *)
385    ;;
386esac
387
388## ----------------------------------------------------------------------
389## Data types and their sizes.
390##
391AC_TYPE_OFF_T
392AC_CHECK_TYPE([size_t], [],
393        [AC_DEFINE_UNQUOTED([size_t], [unsigned long],
394                [Define to `unsigned long' if <sys/types.h> does not define.])])
395AC_CHECK_TYPE([ssize_t], [],
396        [AC_DEFINE_UNQUOTED([ssize_t], [long],
397                [Define to `long' if <sys/types.h> does not define.])])
398AC_CHECK_TYPE([ptrdiff_t], [],
399        [AC_DEFINE_UNQUOTED([ptrdiff_t], [long],
400                [Define to `long' if <sys/types.h> does not define.])])
401AC_C_BIGENDIAN
402AC_CHECK_SIZEOF([char])
403AC_CHECK_SIZEOF([short])
404AC_CHECK_SIZEOF([int])
405AC_CHECK_SIZEOF([unsigned])
406AC_CHECK_SIZEOF([long])
407AC_CHECK_SIZEOF([long long])
408AC_CHECK_SIZEOF([__int64])
409AC_CHECK_SIZEOF([float])
410AC_CHECK_SIZEOF([double])
411AC_CHECK_SIZEOF([long double])
412
413## ----------------------------------------------------------------------
414## Check for non-standard extension __FLOAT128
415##
416HAVE_FLOAT128=0
417HAVE_QUADMATH=0
418FLT128_DIG=0
419LDBL_DIG=0
420
421AC_CHECK_SIZEOF([__float128])
422AC_CHECK_SIZEOF([_Quad])
423AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], [])
424PAC_FC_LDBL_DIG
425
426AC_SUBST([PAC_C_MAX_REAL_PRECISION])
427
428if test "$ac_cv_sizeof___float128" != 0 && test "$FLT128_DIG" != 0 ; then
429  AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available])
430  PAC_C_MAX_REAL_PRECISION=$FLT128_DIG
431else
432  PAC_C_MAX_REAL_PRECISION=$LDBL_DIG
433fi
434AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C])
435AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION])
436
437## ----------------------------------------------------------------------
438## Check if they would like the Fortran interface compiled
439##
440
441## This needs to be exposed for the library info file even if Fortran is disabled.
442AC_SUBST([HDF_FORTRAN])
443
444## Default is no Fortran
445HDF_FORTRAN=no
446
447AC_SUBST([HDF5_INTERFACES]) HDF5_INTERFACES=""
448AC_MSG_CHECKING([if Fortran interface enabled])
449AC_ARG_ENABLE([fortran],
450              [AS_HELP_STRING([--enable-fortran],
451                              [Compile the Fortran interface [default=no]])],
452              [HDF_FORTRAN=$enableval])
453
454if test "X$HDF_FORTRAN" = "Xyes"; then
455  echo "yes"
456else
457  echo "no"
458fi
459
460if test "X$HDF_FORTRAN" = "Xyes"; then
461
462## We will output an include file for Fortran, H5config_f.inc which
463## contains various configure definitions used by the Fortran Library.
464## Prepend H5_ to all macro names. This avoids name conflict between HDF5 macro
465## names and those generated by another software package that uses the HDF5 library.
466  AC_CONFIG_HEADERS([fortran/src/H5config_f.inc],
467    [cat fortran/src/H5config_f.inc | sed '1d;s%^/\* \(.*\) \*/%\1%;s/#define /#define H5_/;s/#undef /#undef H5_/' >fortran/src/H5config_f.inc.tmp; mv -f fortran/src/H5config_f.inc.tmp fortran/src/H5config_f.inc])
468
469  AC_SUBST([FC])
470
471  HDF5_INTERFACES="$HDF5_INTERFACES fortran"
472
473  ## --------------------------------------------------------------------
474  ## HDF5 integer variables for the H5fortran_types.f90 file.
475  ##
476  AC_SUBST([R_LARGE])
477  AC_SUBST([R_INTEGER])
478  AC_SUBST([HADDR_T])
479  AC_SUBST([HSIZE_T])
480  AC_SUBST([HSSIZE_T])
481  AC_SUBST([HID_T])
482  AC_SUBST([SIZE_T])
483  AC_SUBST([OBJECT_NAMELEN_DEFAULT_F])
484
485  ## --------------------------------------------------------------------
486  ## Fortran source extention
487  ##
488  AC_FC_SRCEXT([f90])
489
490  AC_SUBST([F9XSUFFIXFLAG])
491  AC_SUBST([FSEARCH_DIRS])
492
493  ## --------------------------------------------------------------------
494  ## Check for a Fortran compiler and how to include modules.
495  ##
496  AC_PROG_FC([PAC_FC_SEARCH_LIST],)
497  AC_F9X_MODS
498
499  ## Change to the Fortran 90 language
500  AC_LANG_PUSH(Fortran)
501
502  ## Checking if the compiler supports the required Fortran 2003 features and
503  ## stopping if it does not.
504  PAC_PROG_FC_HAVE_F2003_REQUIREMENTS
505
506  if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then
507    AC_MSG_ERROR([Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran])
508  fi
509
510  ## --------------------------------------------------------------------
511  ## Define wrappers for the C compiler to use Fortran function names
512  ##
513  AC_FC_WRAPPERS
514
515  ## --------------------------------------------------------------------
516  ## See if the fortran compiler supports the intrinsic function "SIZEOF"
517  PAC_PROG_FC_SIZEOF
518
519  ## See if the fortran compiler supports the intrinsic function "C_SIZEOF"
520  PAC_PROG_FC_C_SIZEOF
521
522  ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE"
523  PAC_PROG_FC_STORAGE_SIZE
524
525  ## Set the sizeof function for use later in the fortran tests
526  if test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xyes";then
527    FC_SIZEOF_A="STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)"
528    FC_SIZEOF_B="STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)"
529    FC_SIZEOF_C="STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)"
530  else
531    if test "X$HAVE_SIZEOF_FORTRAN" = "Xyes";then
532      FC_SIZEOF_A="SIZEOF(a)"
533      FC_SIZEOF_B="SIZEOF(b)"
534      FC_SIZEOF_C="SIZEOF(c)"
535    else
536      ## If neither intrinsic functions SIZEOF or STORAGE_SIZE is available then stop configure with an error
537      AC_MSG_ERROR([Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE])
538    fi
539  fi
540
541  ## See if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV"
542  PAC_PROG_FC_ISO_FORTRAN_ENV
543  ## Check KIND and size of native integer
544  PAC_FC_NATIVE_INTEGER
545
546  ## Find all available KINDs
547  PAC_FC_AVAIL_KINDS
548  ## Find all sizeofs for available KINDs
549  PAC_FC_SIZEOF_INT_KINDS
550  PAC_FC_SIZEOF_REAL_KINDS
551
552  AC_SUBST([PAC_FC_ALL_REAL_KINDS])
553  AC_SUBST([PAC_FC_MAX_REAL_PRECISION])
554  AC_SUBST([PAC_FORTRAN_NUM_INTEGER_KINDS])
555  AC_SUBST([PAC_FC_ALL_INTEGER_KINDS])
556  AC_SUBST([PAC_FC_ALL_REAL_KINDS_SIZEOF])
557  AC_SUBST([PAC_FC_ALL_INTEGER_KINDS_SIZEOF])
558  AC_SUBST([PAC_FORTRAN_NATIVE_INTEGER_KIND])
559  AC_SUBST([PAC_FORTRAN_NATIVE_INTEGER_SIZEOF])
560  AC_SUBST([PAC_FORTRAN_NATIVE_REAL_KIND])
561  AC_SUBST([PAC_FORTRAN_NATIVE_REAL_SIZEOF])
562  AC_SUBST([PAC_FORTRAN_NATIVE_DOUBLE_KIND])
563  AC_SUBST([PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF])
564  AC_SUBST([HAVE_Fortran_INTEGER_SIZEOF_16])
565  AC_SUBST([FORTRAN_HAVE_C_LONG_DOUBLE])
566  AC_SUBST([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE])
567  AC_SUBST([H5CONFIG_F_NUM_RKIND])
568  AC_SUBST([H5CONFIG_F_RKIND])
569  AC_SUBST([H5CONFIG_F_RKIND_SIZEOF])
570  AC_SUBST([H5CONFIG_F_NUM_IKIND])
571  AC_SUBST([H5CONFIG_F_IKIND])
572  AC_SUBST([Fortran_COMPILER_ID])
573  Fortran_COMPILER_ID=none
574  AC_DEFINE_UNQUOTED([Fortran_COMPILER_ID], $Fortran_COMPILER_ID, [Define Fortran compiler ID])
575
576  ## Setting definition if there is a 16 byte fortran integer
577  if `echo $PAC_FC_ALL_INTEGER_KINDS_SIZEOF | grep '16' >/dev/null`; then
578    HAVE_Fortran_INTEGER_SIZEOF_16="1"
579    AC_DEFINE([HAVE_Fortran_INTEGER_SIZEOF_16], [1], [Determine if INTEGER*16 is available])
580  else
581    HAVE_Fortran_INTEGER_SIZEOF_16="0"
582    AC_DEFINE([HAVE_Fortran_INTEGER_SIZEOF_16], [0], [Determine if INTEGER*16 is available])
583  fi
584
585  if test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xyes"; then
586    AC_DEFINE([FORTRAN_HAVE_STORAGE_SIZE], [1], [Define if we have Fortran intrinsic STORAGE_SIZE])
587  fi
588
589  if test "X$HAVE_C_SIZEOF_FORTRAN" = "Xyes"; then
590    AC_DEFINE([FORTRAN_HAVE_C_SIZEOF], [1], [Define if we have Fortran intrinsic C_SIZEOF])
591  fi
592
593  if test "X$HAVE_SIZEOF_FORTRAN" = "Xyes"; then
594    AC_DEFINE([FORTRAN_HAVE_SIZEOF], [1], [Define if we have Fortran intrinsic SIZEOF])
595  fi
596
597  ## See if C_LONG_DOUBLE is available
598  PAC_PROG_FC_HAVE_C_LONG_DOUBLE
599
600  FORTRAN_HAVE_C_LONG_DOUBLE="0"
601  if test "X$HAVE_C_LONG_DOUBLE_FORTRAN" = "Xyes"; then
602    FORTRAN_HAVE_C_LONG_DOUBLE="1"
603    AC_DEFINE([FORTRAN_HAVE_C_LONG_DOUBLE], [1], [Define if we have Fortran C_LONG_DOUBLE])
604  fi
605
606  ## Is C_LONG_DOUBLE different from C_DOUBLE
607  FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="0"
608  if test "$FORTRAN_HAVE_C_LONG_DOUBLE" = "1"; then
609    PAC_PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE
610    if test "X$C_LONG_DOUBLE_IS_UNIQUE_FORTRAN" = "Xyes"; then
611      FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="1"
612      AC_DEFINE([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE], [1], [Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE])
613    else
614      FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="0"
615    fi
616  fi
617
618  FORTRAN_SIZEOF_LONG_DOUBLE=${ac_cv_sizeof_long_double}
619  AC_DEFINE_UNQUOTED([FORTRAN_SIZEOF_LONG_DOUBLE], ["${ac_cv_sizeof_long_double}"], [Determine the size of C long double])
620
621  dnl get the largest sizeof for REAL kinds
622  max_real_fortran_sizeof="`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -ne 's/.*,\([[0-9]]*\)}/\1/p'`"
623  max_real_fortran_kind="`echo $PAC_FC_ALL_REAL_KINDS | sed -ne 's/.*,\([[0-9]]*\)}/\1/p'`"
624
625  dnl remove the invalid kind from the list
626  if test "$ac_cv_sizeof___float128" != 0;then
627    if test "$ac_cv_sizeof___float128" != "$max_real_fortran_sizeof" &&
628       test "${ac_cv_sizeof_long_double}" != "$max_real_fortran_sizeof" &&
629       dnl account for the fact that the C compiler can have 16-byte __float128 and the Fortran compiler only has 8-byte doubles,
630       dnl so we don't want to remove the 8-byte Fortran doubles. This is sometimes the case if different C and Fortran vendors
631       dnl are used (for example gnu and pgi).
632       test "${ac_cv_sizeof_double}" != "$max_real_fortran_sizeof" ; then
633          AC_MSG_WARN([
634           Fortran REAL(KIND=$max_real_fortran_kind) is $max_real_fortran_sizeof Bytes, but no corresponding C float type exists of that size
635                     !!! Fortran interfaces will not be generated for REAL(KIND=$max_real_fortran_kind) !!!
636          ])
637      PAC_FC_ALL_REAL_KINDS="`echo $PAC_FC_ALL_REAL_KINDS | sed -e 's/,[[0-9]]\+}/}/g'`"
638      PAC_FC_ALL_REAL_KINDS_SIZEOF="`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/,[[0-9]]\+}/}/g'`"
639
640    fi
641  fi
642  AC_MSG_CHECKING([for Fortran interoperable KINDS with C])
643  AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS])
644
645  dnl count the number of real kinds
646  H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = `echo \"[$]PAC_FC_ALL_REAL_KINDS\" |  tr -d -c ',\n' | awk '{ print length + 1; }'`"
647  H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $PAC_FC_ALL_REAL_KINDS | sed -e 's/{//g' | sed -e 's/}//g' | sed -e 's/ /,/g'`/)"
648  H5CONFIG_F_RKIND_SIZEOF="INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/{//g' | sed -e 's/}//g'| sed -e 's/ /,/g'`/)"
649
650  AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_RKIND], $H5CONFIG_F_NUM_RKIND, [Define number of valid Fortran REAL KINDs])
651  AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND], $H5CONFIG_F_RKIND, [Define valid Fortran REAL KINDs])
652  AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND_SIZEOF], $H5CONFIG_F_RKIND_SIZEOF, [Define valid Fortran REAL KINDs Sizeof])
653
654## Change back to the C language
655  AC_LANG_POP(Fortran)
656else
657  FC="no"
658fi
659
660## ----------------------------------------------------------------------
661## Check if they would like the C++ interface compiled
662##
663## This needs to be exposed for the library info file even if C++ is disabled.
664AC_SUBST([HDF_CXX])
665
666## Default is no C++
667HDF_CXX=no
668
669## We need to check for a C++ compiler unconditionally, since
670## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will
671## miss even if c++ is not enabled.
672AC_PROG_CXX
673AC_PROG_CXXCPP    ## this is checked for when AC_HEADER_STDC is done
674
675AC_MSG_CHECKING([if c++ interface enabled])
676
677AC_ARG_ENABLE([cxx],
678              [AS_HELP_STRING([--enable-cxx],
679                              [Compile the C++ interface [default=no]])],
680              [HDF_CXX=$enableval])
681
682if test "X$HDF_CXX" = "Xyes"; then
683  echo "yes"
684  HDF5_INTERFACES="$HDF5_INTERFACES c++"
685
686  ## Expose the compiler for *.in files
687  AC_SUBST([CXX])
688
689  ## Change to the C++ language
690  AC_LANG_PUSH(C++)
691
692  ## Checking if C++ needs old style header files in includes
693  PAC_PROG_CXX_HEADERS
694
695  ## Checking if C++ can handle namespaces
696  PAC_PROG_CXX_NAMESPACE
697
698  ## if C++ can handle static cast
699  PAC_PROG_CXX_STATIC_CAST
700
701  ## Checking if C++ has offsetof extension,
702  ## note: this test has to be the last of the C++ tests because it sets a definition
703  ## which would be used in the other tests, causing them to fail.
704  PAC_PROG_CXX_OFFSETOF
705
706else
707  AC_MSG_RESULT([no])
708  CXX="no"
709fi
710
711## Change back to the C language
712AC_LANG_POP(C++)
713
714
715## ----------------------------------------------------------------------
716## Check if they would like the High Level library  compiled
717##
718
719## This needs to be exposed for the library info file even if the HL
720## library is disabled.
721AC_SUBST([HDF5_HL])
722
723## The high-level library is enabled unless the build mode is clean.
724if test "X-$BUILD_MODE" = "X-clean" ; then
725  HDF5_HL=no
726else
727  HDF5_HL=yes
728fi
729
730## high-level library directories (set when needed, blank until then)
731##
732## main high-level library
733AC_SUBST(HL)
734HL=""
735## Fortran high-level library
736AC_SUBST(HL_FOR)
737HL_FOR=""
738
739AC_MSG_CHECKING([if the high-level library is enabled])
740AC_ARG_ENABLE([hl],
741     [AS_HELP_STRING([--enable-hl],
742                     [Enable the high-level library.
743                     [default=yes (unless build mode = clean)]
744                     ])],
745     [HDF5_HL=$enableval])
746
747if test "X-$HDF5_HL" = "X-yes"; then
748 AC_MSG_RESULT([yes])
749 HL="hl"
750 AC_DEFINE([INCLUDE_HL], [1],
751           [Define if the high-level library headers should be included in hdf5.h])
752else
753  AC_MSG_RESULT([no])
754fi
755
756
757## ----------------------------------------------------------------------
758## Check which archiving tool to use. This needs to be done before
759## the AM_PROG_LIBTOOL macro.
760##
761if test -z "$AR"; then
762  AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH])
763fi
764AC_SUBST([AR])
765
766# Set the default ar flags to cr
767# The Automake default is to use cru and the 'u' causes ar
768# to emit warnings on some platforms.
769AR_FLAGS=cr
770
771
772## Export the AR macro so that it will be placed in the libtool file
773## correctly.
774export AR
775
776AC_PROG_MAKE_SET
777AC_PROG_INSTALL
778
779
780## ----------------------------------------------------------------------
781## Set up ${TR} which is used to process the package list for extra
782## debugging output in the C library.
783
784AC_PATH_PROG([TR], [tr])
785
786
787## ----------------------------------------------------------------------
788## Check that time can be used with srcdir.  This is okay on most systems,
789## but seems to cause problems on Cygwin.
790## The solution on Cygwin is not to record execution time for tests.
791##
792## Note: This is still true as of Cygwin 1.7.32 (Aug 2014) on both 32-
793## and 64-bit platforms. Given how long this has been true, it seems
794## unlikely to change, but we should probably re-test this periodically.
795
796AC_MSG_CHECKING([if srcdir= and time commands work together])
797
798AC_SUBST([TIME])
799TIME=time
800TIME_TEST=`foo="bar" ${TIME} echo 'baz' 2> /dev/null | grep baz`
801
802if test "X${TIME_TEST}" = "Xbaz"; then
803  AC_MSG_RESULT([yes])
804else
805  AC_MSG_RESULT([no])
806  TIME=
807fi
808
809
810## The following variables are used to distinguish between building a
811## serial and parallel library.
812##
813##    HAVE_PARALLEL    -- defined in H5config.h if we are building
814##               a parallel library even if configure wasn't
815##               able to find some header file or library that
816##               might be required. This is defined if the
817##               user explicitly states
818##               that a parallel library is being built by supplying
819##               the `--enable-parallel' configure switch.
820##
821##    PARALLEL        -- This variable is set to a non-null value if
822##               we're building a parallel version of the library.
823##
824##    RUNSERIAL            -- This is a command which will be prepended to
825##               the executable name to run the executable using
826##               a single process. For serial versions of the
827##               library this will normally be empty. For parallel
828##               versions it might be something like `mpiexec -n 1'.
829##               The value of this variable is substituted in *.in
830##               files.
831##
832##    RUNPARALLEL    -- This is a command which will be prepended to
833##               the executable name to run the executable on
834##               multiple processors. For the serial library the
835##               value will normally be the empty string. For
836##               parallel library it should be something like
837##               "mpiexec -n \$\${NPROCS:=6}" where NPROCS will
838##               eventually contain the number of processors on which
839##               to run the executable (the double dollarsigns are to
840##               protect the expansion until make executes the
841##               command).  The value of this variable is
842##               substituted in *.in files.
843##
844AC_SUBST([PARALLEL])
845AC_SUBST([RUNSERIAL])
846AC_SUBST([RUNPARALLEL])
847AC_SUBST([TESTPARALLEL])
848
849## ----------------------------------------------------------------------
850## Check if they would like the Java native interface (JNI) compiled
851##
852
853## This needs to be exposed for the library info file even if Java is disabled.
854AC_SUBST([HDF_JAVA])
855
856## Default is no Java
857HDF_JAVA=no
858
859AC_SUBST([H5_CLASSPATH]) H5_CLASSPATH=""
860AC_MSG_CHECKING([if Java JNI interface enabled])
861
862AC_ARG_ENABLE([java],
863              [AS_HELP_STRING([--enable-java],
864                              [Compile the Java JNI interface [default=no]])],
865              [HDF_JAVA=$enableval])
866
867if test "X$HDF_JAVA" = "Xyes"; then
868  if test "X${enable_shared}" != "Xno"; then
869    echo "yes"
870    if test "X$CLASSPATH" = "X"; then
871      H5_CLASSPATH=".:$srcdir/java/lib"
872    else
873      H5_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib"
874    fi
875    ## Checks for programs.
876    AX_JAVA_OPTIONS
877    H5_JAVACFLAGS=$JAVACFLAGS
878    H5_JAVAFLAGS=$JAVAFLAGS
879    AX_PROG_JAVAC
880    AX_PROG_JAVA
881    AX_PROG_JAR
882    AX_PROG_JAVADOC
883    ## Find the include directories needed for building JNI code
884    AX_JNI_INCLUDE_DIR()
885    for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
886    do
887      JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR"
888    done
889    ## Find junit for testing the JNI code
890    AX_CHECK_CLASSPATH()
891    CLASSPATH_ENV=$H5_CLASSPATH
892    AX_CHECK_JUNIT()
893    AX_CHECK_JAVA_HOME
894
895    AC_MSG_RESULT([yes])
896  else
897    AC_MSG_ERROR([Java requires shared libraries to be built])
898    HDF_JAVA="no"
899    AC_MSG_RESULT([no])
900  fi
901else
902  AC_MSG_RESULT([no])
903fi
904
905## ----------------------------------------------------------------------
906## Fortran libraries are not currently supported on Mac. Disable them.
907## (this is overridable with --enable-unsupported).
908##
909AC_SUBST([H5_FORTRAN_SHARED])
910H5_FORTRAN_SHARED="no"
911if test "X${HDF_FORTRAN}" = "Xyes" && test "X${enable_shared}" != "Xno"; then
912  AC_MSG_CHECKING([if shared Fortran libraries are supported])
913  H5_FORTRAN_SHARED="yes"
914  ## tell libtool to do the right thing with COMMON symbols, this fixes
915  ## corrupt values with COMMON and EQUIVALENCE when building shared
916  ## Fortran libraries on OSX with gnu and Intel compilers (HDFFV-2772).
917  case "`uname`" in
918    Darwin*)
919    H5_LDFLAGS="$H5_LDFLAGS -Wl,-commons,use_dylibs"
920    ;;
921  esac
922
923  ## Report results of check(s)
924
925  if test "X${H5_FORTRAN_SHARED}" = "Xno"; then
926    AC_MSG_RESULT([no])
927    AC_MSG_WARN([$CHECK_WARN])
928    if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
929      AC_MSG_WARN([Disabling shared Fortran libraries.])
930      AC_MSG_WARN([To override this behavior, please use --enable-unsupported configure option.])
931        if test "X${enable_static}" = "Xno"; then
932          AC_MSG_ERROR([both static and shared Fortran libraries are disabled])
933        fi
934    else
935      AC_MSG_WARN([Allowing unsupported Fortran shared libraries due to use of --enable-unsupported flag])
936      H5_FORTRAN_SHARED="yes"
937    fi
938  else
939    AC_MSG_RESULT([yes])
940  fi
941fi
942
943AM_CONDITIONAL([FORTRAN_SHARED_CONDITIONAL], [test "X$H5_FORTRAN_SHARED" = "Xyes"])
944
945## ----------------------------------------------------------------------
946## Check if they would like to disable building tests
947##
948
949## This needs to be exposed for the library info file.
950AC_SUBST([HDF5_TESTS])
951
952## Default is to build tests
953HDF5_TESTS=yes
954
955AC_MSG_CHECKING([if building tests is disabled])
956
957AC_ARG_ENABLE([tests],
958              [AS_HELP_STRING([--enable-tests],
959                              [Compile the HDF5 tests [default=yes]])],
960              [HDF5_TESTS=$enableval])
961
962if test "X$HDF5_TESTS" = "Xno"; then
963  echo "Building HDF5 tests is disabled"
964fi
965
966## ----------------------------------------------------------------------
967## Check if they would like to disable building tools
968##
969
970## This needs to be exposed for the library info file.
971AC_SUBST([HDF5_TOOLS])
972
973## Default is to build tests and tools
974HDF5_TOOLS=yes
975
976AC_MSG_CHECKING([if building tools is disabled])
977
978AC_ARG_ENABLE([tools],
979              [AS_HELP_STRING([--enable-tools],
980                              [Compile the HDF5 tools [default=yes]])],
981              [HDF5_TOOLS=$enableval])
982
983if test "X$HDF5_TOOLS" = "Xno"; then
984  echo "Building HDF5 tools is disabled"
985fi
986
987## ----------------------------------------------------------------------
988## Create libtool.  If shared/static libraries are going to be enabled
989## or disabled, it should happen before these macros.
990LT_PREREQ([2.2])
991
992## ----------------------------------------------------------------------
993## dlopen - This will use an improved version of libtool
994## win32-dll - This will build clean dlls on win32 platforms.
995LT_INIT([dlopen,win32-dll])
996
997## ----------------------------------------------------------------------
998## Check if we should install only statically linked executables.
999##   This check needs to occur after libtool is initialized because
1000##   we check a libtool cache value and may issue a warning based
1001##   on its result.
1002AC_SUBST([STATIC_EXEC])
1003
1004## Default is no
1005STATIC_EXEC=no
1006
1007AC_MSG_CHECKING([if we should install only statically linked executables])
1008AC_ARG_ENABLE([static_exec],
1009              [AS_HELP_STRING([--enable-static-exec],
1010                              [Install only statically linked executables
1011                               [default=no]])],
1012              [STATIC_EXEC=$enableval])
1013
1014if test "X$STATIC_EXEC" = "Xyes"; then
1015  echo "yes"
1016  ## Issue a warning if -static flag is not supported.
1017  if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then
1018    echo "    warning: -static flag not supported on this system; executable won't statically link shared system libraries."
1019    LT_STATIC_EXEC=""
1020  else
1021    LT_STATIC_EXEC="-all-static"
1022  fi
1023else
1024  echo "no"
1025  LT_STATIC_EXEC=""
1026fi
1027AM_CONDITIONAL([USE_PLUGINS_CONDITIONAL], [test "X$LT_STATIC_EXEC" = X])
1028
1029AC_SUBST([LT_STATIC_EXEC])
1030
1031## Fix up the INSTALL macro if it's a relative path. We want the
1032## full-path to the binary instead.
1033case "$INSTALL" in
1034  *install-sh*)
1035    INSTALL='\${top_srcdir}/bin/install-sh -c'
1036    ;;
1037esac
1038
1039## ----------------------------------------------------------------------
1040## Some users have reported problems with libtool's use of '-Wl,-rpath' to
1041## link shared libraries in nondefault directories. Allow users to
1042## disable embedding the rpath information in the executables and to
1043## instead solely rely on the information in LD_LIBRARY_PATH.
1044AC_MSG_CHECKING([if -Wl,-rpath should be used to link shared libs in nondefault directories])
1045AC_ARG_ENABLE([sharedlib-rpath],
1046              [AS_HELP_STRING([--disable-sharedlib-rpath],
1047               [Disable use of the '=Wl,-rpath' linker option])],
1048              [RPATH=$enableval])
1049
1050case "X-$RPATH" in
1051  X-no)
1052    AC_MSG_RESULT([no])
1053    runpath_var=
1054    hardcode_libdir_flag_spec=
1055    hardcode_libdir_flag_spec_ld=
1056    hardcode_into_libs=no
1057    ;;
1058  X-|X-yes)
1059    AC_MSG_RESULT([yes])
1060    ;;
1061  *)
1062    AC_MSG_RESULT([error])
1063    AC_MSG_ERROR([\'$enableval\' is not a valid rpath type])
1064    ;;
1065esac
1066
1067## ----------------------------------------------------------------------
1068## Check for system libraries. "dl" stands for dynamically loaded library
1069##
1070AC_CHECK_LIB([m], [ceil])
1071AC_CHECK_LIB([dl], [dlopen])
1072
1073## ----------------------------------------------------------------------
1074## Check for system header files.
1075##
1076AC_HEADER_STDC
1077AC_HEADER_TIME
1078
1079## Unix
1080AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h])
1081AC_CHECK_HEADERS([sys/socket.h sys/types.h sys/file.h])
1082AC_CHECK_HEADERS([stddef.h setjmp.h features.h])
1083AC_CHECK_HEADERS([dirent.h])
1084AC_CHECK_HEADERS([stdint.h], [C9x=yes])
1085AC_CHECK_HEADERS([stdbool.h])
1086
1087## Darwin
1088AC_CHECK_HEADERS([mach/mach_time.h])
1089## Also need to detect Darwin for pubconf
1090case $host_os in
1091  darwin*)
1092    AC_DEFINE([HAVE_DARWIN], [1], [Define if Darwin or Mac OS X])
1093  ;;
1094esac
1095
1096## Windows
1097case "`uname`" in
1098  CYGWIN*)
1099    AC_CHECK_HEADERS([io.h sys/timeb.h])
1100    UNAME_CYGWIN="yes"
1101    ;;
1102  MINGW*)
1103    AC_CHECK_HEADERS([io.h winsock2.h sys/timeb.h])
1104    AC_HAVE_LIBRARY([ws2_32])
1105    ;;
1106  *)
1107    AC_CHECK_HEADERS([io.h winsock2.h sys/timeb.h])
1108    ;;
1109esac
1110
1111## ----------------------------------------------------------------------
1112## Some platforms require that all symbols are resolved when a library
1113## is linked. We can use the -no-undefined flag to tell libtool that
1114## it will be able to build shared libraries on these architectures,
1115## as it will not do so by default.
1116##
1117if test "X${enable_shared}" = "Xyes"; then
1118  AC_MSG_CHECKING([if libtool needs -no-undefined flag to build shared libraries])
1119  case "`uname`" in
1120    CYGWIN*|MINGW*|AIX*)
1121      ## Add in the -no-undefined flag to LDFLAGS for libtool.
1122      AC_MSG_RESULT([yes])
1123      H5_LDFLAGS="$H5_LDFLAGS -no-undefined"
1124      ;;
1125    *)
1126      ## Don't add in anything.
1127      AC_MSG_RESULT([no])
1128      ;;
1129  esac
1130fi
1131
1132## ----------------------------------------------------------------------
1133## Use the macro _AC_SYS_LARGEFILE_MACRO_VALUE to test defines
1134## that might need to be set for largefile support to behave
1135## correctly. This macro is defined in acsite.m4 and overrides
1136## the version provided by Autoconf (as of v2.65). The custom
1137## macro additionally adds the appropriate defines to AM_CPPFLAGS
1138## so that later configure checks have them visible.
1139
1140## Check for _FILE_OFFSET_BITS
1141_AC_SYS_LARGEFILE_MACRO_VALUE([_FILE_OFFSET_BITS], [64],
1142  [ac_cv_sys_file_offset_bits],
1143  [Number of bits in a file offset, on hosts where this is settable.],
1144  [_AC_SYS_LARGEFILE_TEST_INCLUDES])
1145
1146## Check for _LARGE_FILES
1147if test "$ac_cv_sys_file_offset_bits" = unknown; then
1148  _AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1],
1149    [ac_cv_sys_large_files],
1150    [Define for large files, on AIX-style hosts.],
1151    [_AC_SYS_LARGEFILE_TEST_INCLUDES])
1152fi
1153
1154## ----------------------------------------------------------------------
1155## Add necessary defines for Linux Systems.
1156##
1157case "$host_cpu-$host_vendor-$host_os" in
1158  *linux*)
1159    ## Add POSIX support on Linux systems, so <features.h> defines
1160    ## __USE_POSIX, which is required to get the prototype for fdopen
1161    ## defined correctly in <stdio.h>.
1162    ##
1163    ## This flag was removed from h5cc as of 2009-10-17 when it was found
1164    ## that the flag broke compiling netCDF-4 code with h5cc, but kept in
1165    ## H5_CPPFLAGS because fdopen and HDfdopen fail without it. HDfdopen
1166    ## is used only by H5_debug_mask which is used only when debugging in
1167    ## H5_init_library (all in H5.c).  When the flag was removed this was
1168    ## the only compile failure noted.
1169    ##
1170    ## This was originally defined as _POSIX_SOURCE which was updated to
1171    ## _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
1172    ## functionality so clock_gettime and CLOCK_MONOTONIC are defined
1173    ## correctly. This was later updated to 200112L so that
1174    ## posix_memalign() is visible for the direct VFD code on Linux
1175    ## systems. Even later, this was changed to 200809L to support
1176    ## pread/pwrite in VFDs.
1177    ##
1178    ## POSIX feature information can be found in the gcc manual at:
1179    ## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
1180    H5_CPPFLAGS="-D_POSIX_C_SOURCE=200809L $H5_CPPFLAGS"
1181
1182    ## Need to add this so that O_DIRECT is visible for the direct
1183    ## VFD on Linux systems.
1184    H5_CPPFLAGS="-D_GNU_SOURCE $H5_CPPFLAGS"
1185    ;;
1186esac
1187
1188## Need to add the AM_ and H5_ into CFLAGS/CPPFLAGS to make them visible
1189## for configure checks.
1190## Note: Both will be restored by the end of configure.
1191CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS"
1192CFLAGS="$H5_CFLAGS $AM_CFLAGS $CFLAGS"
1193
1194## Checkpoint the cache
1195AC_CACHE_SAVE
1196
1197## Posix.1g types (C9x)
1198cat >>confdefs.h <<\EOF
1199#include <sys/types.h>
1200EOF
1201
1202if test "X$C9x" = "Xyes"; then
1203  cat >>confdefs.h <<\EOF
1204#include <stdint.h>
1205EOF
1206fi
1207
1208AC_CHECK_SIZEOF(        [int8_t])
1209AC_CHECK_SIZEOF(       [uint8_t])
1210AC_CHECK_SIZEOF(  [int_least8_t])
1211AC_CHECK_SIZEOF( [uint_least8_t])
1212AC_CHECK_SIZEOF(   [int_fast8_t])
1213AC_CHECK_SIZEOF(  [uint_fast8_t])
1214
1215AC_CHECK_SIZEOF(       [int16_t])
1216AC_CHECK_SIZEOF(      [uint16_t])
1217AC_CHECK_SIZEOF( [int_least16_t])
1218AC_CHECK_SIZEOF([uint_least16_t])
1219AC_CHECK_SIZEOF(  [int_fast16_t])
1220AC_CHECK_SIZEOF( [uint_fast16_t])
1221
1222AC_CHECK_SIZEOF(       [int32_t])
1223AC_CHECK_SIZEOF(      [uint32_t])
1224AC_CHECK_SIZEOF( [int_least32_t])
1225AC_CHECK_SIZEOF([uint_least32_t])
1226AC_CHECK_SIZEOF(  [int_fast32_t])
1227AC_CHECK_SIZEOF( [uint_fast32_t])
1228
1229AC_CHECK_SIZEOF(       [int64_t])
1230AC_CHECK_SIZEOF(      [uint64_t])
1231AC_CHECK_SIZEOF( [int_least64_t])
1232AC_CHECK_SIZEOF([uint_least64_t])
1233AC_CHECK_SIZEOF(  [int_fast64_t])
1234AC_CHECK_SIZEOF( [uint_fast64_t])
1235
1236AC_CHECK_SIZEOF([size_t])
1237AC_CHECK_SIZEOF([ssize_t])
1238AC_CHECK_SIZEOF([ptrdiff_t])
1239
1240cat >>confdefs.h <<\EOF
1241#include <sys/types.h> /*for off_t definition*/
1242EOF
1243AC_CHECK_SIZEOF([off_t])
1244
1245if test "X$C9x" = "Xyes"; then
1246  cat >>confdefs.h <<\EOF
1247#ifdef HAVE_STDBOOL_H
1248#include <stdbool.h> /* for bool definition */
1249#else
1250#define bool _Bool
1251#endif
1252EOF
1253AC_CHECK_SIZEOF([bool])
1254fi
1255
1256AC_CHECK_SIZEOF(time_t, [], [
1257#ifdef HAVE_SYS_TYPES_H
1258#include <sys/types.h>
1259#endif
1260#ifdef HAVE_TIME_H
1261#include <time.h>
1262#endif
1263])
1264
1265## Checkpoint the cache
1266AC_CACHE_SAVE
1267
1268## ----------------------------------------------------------------------
1269## Check if the dev_t type is a scalar type (must come after the check for
1270## sys/types.h)
1271AC_MSG_CHECKING([if dev_t is scalar])
1272AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1273#ifdef HAVE_SYS_TYPES_H
1274#include <sys/types.h>
1275#endif
1276  ]],
1277  [[dev_t d1, d2; if(d1==d2) return 0;]])],
1278  [AC_DEFINE([DEV_T_IS_SCALAR], [1],
1279            [Define if dev_t is a scalar])
1280  AC_MSG_RESULT([yes])],
1281  [AC_MSG_RESULT([no])])
1282
1283## ----------------------------------------------------------------------
1284## Fake --with-xxx option to allow us to create a help message for the
1285## following --with-xxx options which can take either a =DIR or =INC,LIB
1286## specifier.
1287##
1288AC_ARG_WITH([fnord],
1289  [
1290 For the following --with-xxx options, you can specify where the header
1291 files and libraries are in two different ways:
1292
1293    --with-xxx=INC,LIB - Specify individually the include directory and
1294                         library directory separated by a comma
1295    --with-xxx=DIR     - Specify only the directory which contains the
1296                         include/ and lib/ subdirectories
1297  ])
1298
1299## ----------------------------------------------------------------------
1300## Is dmalloc (debug malloc library) requested? It has a header file
1301## `dmalloc.h' and a library `-ldmalloc' and their locations might be
1302## specified with the `--with-dmalloc' command-line switch. The value
1303## is an include path and/or a library path. If the library path is
1304## specified then it must be preceded by a comma.
1305##
1306AC_SUBST([HAVE_DMALLOC])
1307
1308## Default is not present
1309HAVE_DMALLOC=no
1310
1311AC_ARG_WITH([dmalloc],
1312            [AS_HELP_STRING([--with-dmalloc=DIR],
1313                            [Use dmalloc memory debugging aid [default=no]])],,
1314            [withval=no])
1315
1316case "X-$withval" in
1317  X-yes)
1318    HAVE_DMALLOC="yes"
1319    AC_CHECK_HEADERS([dmalloc.h],, [unset HAVE_DMALLOC])
1320    if test "x$HAVE_DMALLOC" = "xyes"; then
1321      AC_CHECK_LIB([dmalloc], [dmalloc_shutdown],, [unset HAVE_DMALLOC])
1322    fi
1323    if test -z "$HAVE_DMALLOC" -a -n "$HDF5_CONFIG_ABORT"; then
1324      AC_MSG_ERROR([couldn't find dmalloc library])
1325    fi
1326    ;;
1327  X-|X-no|X-none)
1328    HAVE_DMALLOC="no"
1329    AC_MSG_CHECKING([for dmalloc library])
1330    AC_MSG_RESULT([suppressed])
1331    ;;
1332  *)
1333    HAVE_DMALLOC="yes"
1334    case "$withval" in
1335      *,*)
1336        dmalloc_inc="`echo $withval |cut -f1 -d,`"
1337        dmalloc_lib="`echo $withval |cut -f2 -d, -s`"
1338        ;;
1339      *)
1340        if test -n "$withval"; then
1341          dmalloc_inc="$withval/include"
1342          dmalloc_lib="$withval/lib"
1343        fi
1344        ;;
1345    esac
1346
1347    saved_CPPFLAGS="$CPPFLAGS"
1348    saved_AM_CPPFLAGS="$AM_CPPFLAGS"
1349    saved_LDFLAGS="$LDFLAGS"
1350    saved_AM_LDFLAGS="$AM_LDFLAGS"
1351
1352    if test -n "$dmalloc_inc"; then
1353      CPPFLAGS="$CPPFLAGS -I$dmalloc_inc"
1354      AM_CPPFLAGS="$AM_CPPFLAGS -I$dmalloc_inc"
1355    fi
1356
1357    AC_CHECK_HEADERS([dmalloc.h],,[CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_DMALLOC])
1358
1359    if test "x$HAVE_DMALLOC" = "xyes"; then
1360      if test -n "$dmalloc_lib"; then
1361        LDFLAGS="$LDFLAGS -L$dmalloc_lib"
1362        AM_LDFLAGS="$AM_LDFLAGS -L$dmalloc_lib"
1363      fi
1364
1365      AC_CHECK_LIB([dmalloc], [dmalloc_shutdown],, [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_DMALLOC])
1366    fi
1367
1368    if test -z "$HAVE_DMALLOC" -a -n "$HDF5_CONFIG_ABORT"; then
1369      AC_MSG_ERROR([couldn't find dmalloc library])
1370    fi
1371    ;;
1372esac
1373
1374## ----------------------------------------------------------------------
1375## Make the external filters list available to *.in files
1376## At this point it's unset (no external filters by default) but it
1377## will be filled in during the deflate (zlib) and szip processing
1378## below.
1379##
1380AC_SUBST([EXTERNAL_FILTERS])
1381
1382## ----------------------------------------------------------------------
1383## Is the GNU zlib present? It has a header file `zlib.h' and a library
1384## `-lz' and their locations might be specified with the `--with-zlib'
1385## command-line switch. The value is an include path and/or a library path.
1386## If the library path is specified then it must be preceded by a comma.
1387##
1388AC_SUBST([USE_FILTER_DEFLATE]) USE_FILTER_DEFLATE="no"
1389AC_ARG_WITH([zlib],
1390            [AS_HELP_STRING([--with-zlib=DIR],
1391                            [Use zlib library for external deflate I/O
1392                             filter [default=yes]])],,
1393            [withval=yes])
1394
1395case "X-$withval" in
1396  X-yes)
1397    HAVE_ZLIB="yes"
1398    AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB])
1399    if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
1400      AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])
1401    fi
1402    if test -z "$HAVE_ZLIB"; then
1403      if test -n "$HDF5_CONFIG_ABORT"; then
1404        AC_MSG_ERROR([couldn't find zlib library])
1405      fi
1406    else
1407      AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
1408    fi
1409    ;;
1410  X-|X-no|X-none)
1411    HAVE_ZLIB="no"
1412    AC_MSG_CHECKING([for zlib])
1413    AC_MSG_RESULT([suppressed])
1414    ;;
1415  *)
1416    HAVE_ZLIB="yes"
1417    case "$withval" in
1418      *,*)
1419        zlib_inc="`echo $withval | cut -f1 -d,`"
1420        zlib_lib="`echo $withval | cut -f2 -d, -s`"
1421        ;;
1422      *)
1423        if test -n "$withval"; then
1424          zlib_inc="$withval/include"
1425          zlib_lib="$withval/lib"
1426        fi
1427        ;;
1428    esac
1429
1430    saved_CPPFLAGS="$CPPFLAGS"
1431    saved_AM_CPPFLAGS="$AM_CPPFLAGS"
1432    saved_LDFLAGS="$LDFLAGS"
1433    saved_AM_LDFLAGS="$AM_LDFLAGS"
1434
1435    if test -n "$zlib_inc"; then
1436      CPPFLAGS="$CPPFLAGS -I$zlib_inc"
1437      AM_CPPFLAGS="$AM_CPPFLAGS -I$zlib_inc"
1438    fi
1439
1440    AC_CHECK_HEADERS([zlib.h],
1441                     [HAVE_ZLIB_H="yes"],
1442                     [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_ZLIB])
1443
1444    if test -n "$zlib_lib"; then
1445      LDFLAGS="$LDFLAGS -L$zlib_lib"
1446      AM_LDFLAGS="$AM_LDFLAGS -L$zlib_lib"
1447    fi
1448
1449    if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
1450      AC_CHECK_LIB([z], [compress2],,
1451                   [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_ZLIB])
1452    fi
1453
1454    if test -z "$HAVE_ZLIB"; then
1455      if test -n "$HDF5_CONFIG_ABORT"; then
1456        AC_MSG_ERROR([couldn't find zlib library])
1457      fi
1458    else
1459      AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
1460    fi
1461    ;;
1462esac
1463
1464if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes" -a "x$HAVE_COMPRESS2" = "xyes"; then
1465  AC_DEFINE([HAVE_FILTER_DEFLATE], [1], [Define if support for deflate (zlib) filter is enabled])
1466  USE_FILTER_DEFLATE="yes"
1467
1468  ## Add "deflate" to external filter list
1469  if test "X$EXTERNAL_FILTERS" != "X"; then
1470    EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
1471  fi
1472    EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)"
1473fi
1474
1475
1476## ----------------------------------------------------------------------
1477## Is the szlib present? It has a header file `szlib.h' and a library
1478## `-lsz' and their locations might be specified with the `--with-szlib'
1479## command-line switch. The value is an include path and/or a library path.
1480## If the library path is specified then it must be preceded by a comma.
1481##
1482AC_SUBST([USE_FILTER_SZIP]) USE_FILTER_SZIP="no"
1483AC_ARG_WITH([szlib],
1484            [AS_HELP_STRING([--with-szlib=DIR],
1485                            [Use szlib library for external szlib I/O
1486                             filter [default=no]])],,
1487            [withval=no])
1488
1489case "X-$withval" in
1490  X-yes)
1491    HAVE_SZLIB="yes"
1492    AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZLIB])
1493    if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
1494      AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZLIB])
1495    fi
1496    if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then
1497      AC_MSG_ERROR([couldn't find szlib library])
1498    fi
1499    ;;
1500  X-|X-no|X-none)
1501    HAVE_SZLIB="no"
1502    AC_MSG_CHECKING([for szlib])
1503    AC_MSG_RESULT([suppressed])
1504    ;;
1505  *)
1506    HAVE_SZLIB="yes"
1507    case "$withval" in
1508      *,*)
1509        szlib_inc="`echo $withval |cut -f1 -d,`"
1510        szlib_lib="`echo $withval |cut -f2 -d, -s`"
1511        ;;
1512      *)
1513        if test -n "$withval"; then
1514          szlib_inc="$withval/include"
1515          szlib_lib="$withval/lib"
1516        fi
1517        ;;
1518    esac
1519
1520    saved_CPPFLAGS="$CPPFLAGS"
1521    saved_AM_CPPFLAGS="$AM_CPPFLAGS"
1522    saved_LDFLAGS="$LDFLAGS"
1523    saved_AM_LDFLAGS="$AM_LDFLAGS"
1524
1525    if test -n "$szlib_inc"; then
1526      CPPFLAGS="$CPPFLAGS -I$szlib_inc"
1527      AM_CPPFLAGS="$AM_CPPFLAGS -I$szlib_inc"
1528    fi
1529
1530    AC_CHECK_HEADERS([szlib.h],
1531                     [HAVE_SZLIB_H="yes"],
1532                     [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_SZLIB])
1533
1534    if test -n "$szlib_lib"; then
1535      LDFLAGS="$LDFLAGS -L$szlib_lib"
1536      AM_LDFLAGS="$AM_LDFLAGS -L$szlib_lib"
1537    fi
1538
1539    if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
1540      AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],,
1541                   [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB])
1542    fi
1543
1544    if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then
1545      AC_MSG_ERROR([couldn't find szlib library])
1546    fi
1547    ;;
1548esac
1549
1550if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
1551  ## SZLIB library is available.  Check if it can encode
1552  AC_MSG_CHECKING([for szlib encoder])
1553
1554  ## Set LD_LIBRARY_PATH so encoder test can find the library and run.
1555  ## Also add LL_PATH substitution to Makefiles so they can use the
1556  ## path as well, for testing examples.
1557  if test -z "$LD_LIBRARY_PATH"; then
1558    export LD_LIBRARY_PATH="$szlib_lib"
1559  else
1560    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$szlib_lib"
1561  fi
1562
1563  AC_SUBST([LL_PATH]) LL_PATH="$LD_LIBRARY_PATH"
1564
1565  AC_CACHE_VAL([hdf5_cv_szlib_can_encode],
1566        [AC_RUN_IFELSE(
1567            [AC_LANG_PROGRAM([
1568                #include "szlib.h"
1569            ],[[
1570                /* SZ_encoder_enabled returns 1 if encoder is present */
1571                if(SZ_encoder_enabled() == 1)
1572                    exit(0);
1573                else
1574                    exit(1);
1575            ]])]
1576        , [hdf5_cv_szlib_can_encode=yes], [hdf5_cv_szlib_can_encode=no],)]
1577   )
1578
1579  AC_DEFINE([HAVE_FILTER_SZIP], [1],
1580            [Define if support for szip filter is enabled])
1581  USE_FILTER_SZIP="yes"
1582
1583  if test ${hdf5_cv_szlib_can_encode} = "yes"; then
1584    AC_MSG_RESULT([yes])
1585  fi
1586  if test ${hdf5_cv_szlib_can_encode} = "no"; then
1587    AC_MSG_RESULT([no])
1588  fi
1589
1590  ## Add "szip" to external filter list
1591  if test ${hdf5_cv_szlib_can_encode} = "yes"; then
1592    if test "X$EXTERNAL_FILTERS" != "X"; then
1593      EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
1594    fi
1595      EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)"
1596  fi
1597  if test ${hdf5_cv_szlib_can_encode} = "no"; then
1598    if test "X$EXTERNAL_FILTERS" != "X"; then
1599      EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
1600    fi
1601      EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)"
1602  fi
1603fi
1604
1605AM_CONDITIONAL([BUILD_SHARED_SZIP_CONDITIONAL], [test "X$USE_FILTER_SZIP" = "Xyes" && test "X$LL_PATH" != "X"])
1606
1607## Checkpoint the cache
1608AC_CACHE_SAVE
1609
1610## ----------------------------------------------------------------------
1611## Enable thread-safe version of library.  It requires Pthreads support
1612## on POSIX systems.
1613##
1614AC_SUBST([THREADSAFE])
1615
1616## Default is no thread-safety
1617THREADSAFE=no
1618
1619AC_MSG_CHECKING([for thread safe support])
1620AC_ARG_ENABLE([threadsafe],
1621              [AS_HELP_STRING([--enable-threadsafe],
1622                              [Enable thread-safe capability. Not compatible with the high-level library, Fortran, or C++ wrappers.
1623                              [default=no]])],
1624              [THREADSAFE=$enableval])
1625
1626## The high-level, C++, Fortran and Java interfaces are not compatible
1627## with the thread-safety option because the lock is not hoisted
1628## into the higher-level API calls.
1629
1630## --enable-threadsafe is incompatible with --enable-hl unless
1631## --enable-unsupported has been specified on the configure line.
1632##
1633## Note that the high-level library is enabled by default so most
1634## users will have to add --disable-hl to the configure options.
1635if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
1636  if test "X${HDF5_HL}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then
1637    AC_MSG_ERROR([The thread-safe library is incompatible with the high-level library. --disable-hl can be used to prevent building the high-level library (recommended). Alternatively, --enable-unsupported will allow building the high-level library, though this configuration is not supported by The HDF Group.])
1638  fi
1639fi
1640
1641## The --enable-threadsafe flag is not compatible with --enable-cxx.
1642## If the user tried to specify both flags, throw an error, unless
1643## they also provided the --enable-unsupported flag.
1644if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
1645  if test "X${HDF_CXX}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then
1646    AC_MSG_ERROR([--enable-cxx and --enable-threadsafe flags are incompatible. Use --enable-unsupported to override this error.])
1647  fi
1648fi
1649
1650## --enable-threadsafe is also incompatible with --enable-fortran unless
1651## --enable-unsupported has been specified on the configure line.
1652if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
1653  if test "X${HDF_FORTRAN}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then
1654    AC_MSG_ERROR([--enable-fortran and --enable-threadsafe flags are incompatible. Use --enable-unsupported to override this error.])
1655  fi
1656fi
1657
1658## --enable-threadsafe is also incompatible with --enable-java unless
1659## --enable-unsupported has been specified on the configure line.
1660if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
1661  if test "X${HDF_JAVA}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then
1662    AC_MSG_ERROR([--enable-java and --enable-threadsafe flags are incompatible. Use --enable-unsupported to override this error.])
1663  fi
1664fi
1665
1666
1667case "X-$THREADSAFE" in
1668  X-|X-no)
1669    AC_MSG_RESULT([no])
1670    ;;
1671  X-yes)
1672    THREADSAFE=yes
1673    AC_MSG_RESULT([yes])
1674    ;;
1675  *)
1676    AC_MSG_RESULT([error])
1677    AC_MSG_ERROR([\'$enableval\' is not a valid threadsafe type])
1678    ;;
1679esac
1680
1681if test "X$THREADSAFE" = "Xyes"; then
1682    AC_DEFINE([HAVE_THREADSAFE], [1], [Define if we have thread safe support])
1683
1684    ## ----------------------------------------------------------------------
1685    ## Is the Pthreads library present?  It has a header file `pthread.h' and
1686    ## a library `-lpthread' and their locations might be specified with the
1687    ## `--with-pthread' command-line switch.  The value is an include path
1688    ## and/or a library path.  If the library path is specified then it must
1689    ## be preceded by a comma.
1690    ##
1691    ## Thread-safety in HDF5 only uses Pthreads via configure, so the
1692    ## default is "check", though this only has an effect when
1693    ## --enable-threadsafe is specified.
1694    AC_SUBST([HAVE_PTHREAD]) HAVE_PTHREAD=yes
1695    AC_ARG_WITH([pthread],
1696                [AS_HELP_STRING([--with-pthread=DIR],
1697                                [Specify alternative path to Pthreads library when
1698                                thread-safe capability is built.])],,
1699                [withval=check])
1700
1701    case "$withval" in
1702      check | yes)
1703        AC_CHECK_HEADERS([pthread.h],, [unset HAVE_PTHREAD])
1704        if test "x$HAVE_PTHREAD" = "xyes"; then
1705          AC_CHECK_LIB([pthread], [pthread_self],, [unset HAVE_PTHREAD])
1706        fi
1707        ;;
1708      no)
1709        AC_MSG_ERROR([Must use Pthreads with thread safety])
1710        ;;
1711      *)
1712        case "$withval" in
1713          *,*)
1714            pthread_inc="`echo $withval | cut -f1 -d,`"
1715            pthread_lib="`echo $withval | cut -f2 -d, -s`"
1716            ;;
1717          *)
1718            if test -n "$withval"; then
1719              pthread_inc="$withval/include"
1720              pthread_lib="$withval/lib"
1721            fi
1722            ;;
1723        esac
1724
1725        if test -n "$pthread_inc"; then
1726          saved_CPPFLAGS="$CPPFLAGS"
1727          saved_AM_CPPFLAGS="$AM_CPPFLAGS"
1728          CPPFLAGS="$CPPFLAGS -I$pthread_inc"
1729          AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc"
1730          AC_CHECK_HEADERS([pthread.h],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset HAVE_PTHREAD])
1731        else
1732          AC_CHECK_HEADERS([pthread.h],, [unset HAVE_PTHREAD])
1733        fi
1734
1735        if test "x$HAVE_PTHREAD" = "xyes"; then
1736          if test -n "$pthread_lib"; then
1737            saved_LDFLAGS="$LDFLAGS"
1738            saved_AM_LDFLAGS="$AM_LDFLAGS"
1739            LDFLAGS="$LDFLAGS -L$pthread_lib"
1740            AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib"
1741            AC_CHECK_LIB([pthread], [pthread_self],,
1742                         [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_PTHREAD])
1743          else
1744            AC_CHECK_LIB([pthread], [pthread_self],, [unset HAVE_PTHREAD])
1745          fi
1746        fi
1747        ;;
1748    esac
1749
1750    ## ----------------------------------------------------------------------
1751    ## Check if pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM)
1752    ## is supported on this system
1753    ##
1754    ## Unfortunately, this probably needs to be an AC_RUN_IFELSE since
1755    ## it's impossible to determine if PTHREAD_SCOPE_SYSTEM is
1756    ## supported a priori. POSIX.1-2001 requires that a conformant
1757    ## system need only support one of SYSTEM or PROCESS scopes.
1758    ##
1759    ## For cross-compiling, we've added a pessimistic 'no'. You can
1760    ## hand-hack the config file if you know otherwise.
1761    AC_MSG_CHECKING([Pthreads supports system scope])
1762    AC_CACHE_VAL([hdf5_cv_system_scope_threads],
1763      [AC_RUN_IFELSE(
1764        [AC_LANG_PROGRAM([
1765            #if STDC_HEADERS
1766            #include <stdlib.h>
1767            #include <pthread.h>
1768            #endif
1769        ],[
1770              pthread_attr_t attribute;
1771              int ret;
1772
1773              pthread_attr_init(&attribute);
1774              ret=pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM);
1775              exit(ret==0 ? 0 : 1);
1776        ])]
1777      , [hdf5_cv_system_scope_threads=yes], [hdf5_cv_system_scope_threads=no], [hdf5_cv_system_scope_threads=no])])
1778
1779    if test ${hdf5_cv_system_scope_threads} = "yes"; then
1780      AC_DEFINE([SYSTEM_SCOPE_THREADS], [1],
1781                [Define if your system supports pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM) call.])
1782      AC_MSG_RESULT([yes])
1783    else
1784      AC_MSG_RESULT([no])
1785      AC_MSG_NOTICE([Always 'no' if cross-compiling. Edit the config file if your platform supports pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM).])
1786    fi
1787fi
1788
1789## ----------------------------------------------------------------------
1790## Check for MONOTONIC_TIMER support (used in clock_gettime).  This has
1791## to be done after any POSIX defines to ensure that the test gets
1792## the correct POSIX level on linux.
1793AC_CHECK_DECL([CLOCK_MONOTONIC],[have_clock_monotonic="yes"],[have_clock_monotonic="no"],[[#include <time.h>]])
1794
1795## ----------------------------------------------------------------------
1796## How does one figure out the local time zone?  Anyone know of a
1797## Posix way to do this?
1798##
1799
1800## First check if `struct tm' has a `tm_gmtoff' member.
1801AC_MSG_CHECKING([for tm_gmtoff in struct tm])
1802AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1803  #include <sys/time.h>
1804  #include <time.h>
1805]], [[struct tm tm; tm.tm_gmtoff=0;]])],
1806  [AC_DEFINE([HAVE_TM_GMTOFF], [1],
1807          [Define if tm_gmtoff is a member of struct tm])
1808    AC_MSG_RESULT([yes])],
1809  [AC_MSG_RESULT([no])])
1810
1811## Check whether the global variable `timezone' is defined.
1812AC_MSG_CHECKING([for global timezone variable])
1813
1814case "`uname`" in
1815  CYGWIN*)
1816    AC_MSG_RESULT([disabled in CYGWIN])
1817    ;;
1818  *)
1819    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1820    #include <sys/time.h>
1821    #include <time.h>]], [[timezone=0;]])],
1822    [AC_DEFINE([HAVE_TIMEZONE], [1],
1823              [Define if timezone is a global variable])
1824      AC_MSG_RESULT([yes])],
1825    [AC_MSG_RESULT([no])])
1826    ;;
1827esac
1828
1829
1830## ----------------------------------------------------------------------
1831## Does the struct stat have the st_blocks field?  This field is not Posix.
1832##
1833AC_MSG_CHECKING([for st_blocks in struct stat])
1834AC_COMPILE_IFELSE([AC_LANG_PROGRAM[[
1835  #include <sys/stat.h>]],[[struct stat sb; sb.st_blocks=0;]])],
1836  [AC_DEFINE([HAVE_STAT_ST_BLOCKS], [1],
1837          [Define if struct stat has the st_blocks field])
1838    AC_MSG_RESULT([yes])],
1839  [AC_MSG_RESULT([no])])
1840
1841## ----------------------------------------------------------------------
1842## How do we figure out the width of a tty in characters?
1843##
1844AC_CHECK_FUNCS([_getvideoconfig gettextinfo])
1845case "`uname`" in
1846  CYGWIN*)
1847    ;;
1848  *)
1849    AC_CHECK_FUNCS([GetConsoleScreenBufferInfo getpwuid])
1850    ;;
1851esac
1852AC_CHECK_FUNCS([_scrsize ioctl])
1853
1854AC_MSG_CHECKING([for struct videoconfig])
1855AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[struct videoconfig w; w.numtextcols=0;]])],
1856  [AC_DEFINE([HAVE_STRUCT_VIDEOCONFIG], [1],
1857          [Define if struct videoconfig is defined])
1858    AC_MSG_RESULT([yes])],
1859  [AC_MSG_RESULT([no])])
1860
1861AC_MSG_CHECKING([for struct text_info])
1862AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[struct text_info w; w.screenwidth=0;]])],
1863  [AC_DEFINE([HAVE_STRUCT_TEXT_INFO], [1],
1864          [Define if struct text_info is defined])
1865    AC_MSG_RESULT([yes])],
1866  [AC_MSG_RESULT([no])])
1867
1868AC_MSG_CHECKING([for TIOCGWINSZ])
1869AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1870#include <sys/ioctl.h>
1871]],[[int w=TIOCGWINSZ;]])],
1872  [AC_DEFINE([HAVE_TIOCGWINSZ], [1],
1873          [Define if the ioctl TIOGWINSZ is defined])
1874    AC_MSG_RESULT([yes])],
1875  [AC_MSG_RESULT([no])])
1876
1877AC_MSG_CHECKING([for TIOCGETD])
1878AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1879#include <sys/ioctl.h>
1880]],[[int w=TIOCGETD;]])],
1881  [AC_DEFINE([HAVE_TIOCGETD], [1],
1882          [Define if the ioctl TIOCGETD is defined])
1883    AC_MSG_RESULT([yes])],
1884  [AC_MSG_RESULT([no])])
1885
1886
1887## ----------------------------------------------------------------------
1888## Check for functions.
1889##
1890## NOTE: clock_gettime may require linking to the rt or posix4 library
1891##       so we'll search for it before calling AC_CHECK_FUNCS.
1892AC_SEARCH_LIBS([clock_gettime], [rt posix4])
1893AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork frexpf])
1894AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday])
1895AC_CHECK_FUNCS([lstat rand_r random setsysinfo])
1896AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask])
1897AC_CHECK_FUNCS([snprintf srandom strdup symlink system])
1898AC_CHECK_FUNCS([strtoll strtoull])
1899AC_CHECK_FUNCS([tmpfile asprintf vasprintf vsnprintf waitpid])
1900AC_CHECK_FUNCS([roundf lroundf llroundf round lround llround])
1901
1902## ----------------------------------------------------------------------
1903## Check compiler characteristics
1904##
1905AC_C_CONST
1906
1907AC_MSG_CHECKING([if the compiler understands  __inline__])
1908AC_COMPILE_IFELSE(
1909    [AC_LANG_SOURCE([[static __inline__ void f(void){return;};]])],
1910    [AC_DEFINE([HAVE___INLINE__], [1], [Define if the compiler understands __inline__]) AC_MSG_RESULT([yes])],
1911    [AC_MSG_RESULT([no])]
1912)
1913
1914AC_MSG_CHECKING([if the compiler understands __inline])
1915AC_COMPILE_IFELSE(
1916    [AC_LANG_SOURCE([[static __inline void f(void){return;};]])],
1917    [AC_DEFINE([HAVE___INLINE], [1], [Define if the compiler understands __inline]) AC_MSG_RESULT([yes])],
1918    [AC_MSG_RESULT([no])]
1919)
1920
1921AC_MSG_CHECKING([if the compiler understands inline])
1922AC_COMPILE_IFELSE(
1923    [AC_LANG_SOURCE([[static inline void f(void){return;};]])],
1924    [AC_DEFINE([HAVE_INLINE], [1], [Define if the compiler understands inline]) AC_MSG_RESULT([yes])],
1925    [AC_MSG_RESULT([no])]
1926)
1927
1928AC_MSG_CHECKING([for __attribute__ extension])
1929AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[int __attribute__((unused)) x]])],
1930               [AC_DEFINE([HAVE_ATTRIBUTE], [1],
1931                         [Define if the __attribute__(()) extension is present])
1932                 AC_MSG_RESULT([yes])],
1933               [AC_MSG_RESULT([no])])
1934
1935AC_MSG_CHECKING([for __func__ extension])
1936AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[ const char *fname = __func__; ]])],
1937               [AC_DEFINE([HAVE_C99_FUNC], [1],
1938                         [Define if the compiler understands the __func__ keyword])
1939                 AC_MSG_RESULT([yes])],
1940               [AC_MSG_RESULT([no])])
1941AC_MSG_CHECKING([for __FUNCTION__ extension])
1942AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],,[[ const char *fname = __FUNCTION__; ]])],
1943               [AC_DEFINE([HAVE_FUNCTION], [1],
1944                         [Define if the compiler understands the __FUNCTION__ keyword])
1945                 AC_MSG_RESULT([yes])],
1946               [AC_MSG_RESULT([no])])
1947AC_MSG_CHECKING([for C99 designated initialization support])
1948AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1949                typedef struct {
1950                    int x;
1951                    union {
1952                        int i;
1953                        double d;
1954                    } u;
1955                } di_struct_t;
1956                di_struct_t x = {0, { .d = 0.0}}; ]])],
1957               [AC_DEFINE([HAVE_C99_DESIGNATED_INITIALIZER], [1],
1958                         [Define if the compiler understands C99 designated initialization of structs and unions])
1959                 AC_MSG_RESULT([yes])],
1960               [AC_MSG_RESULT([no])])
1961
1962## ----------------------------------------------------------------------
1963## Try to figure out how to print `long long'.  Some machines use `%lld'
1964## and others use `%qd'.  There may be more!  The final `l' is a
1965## default in case none of the others work.
1966##
1967AC_MSG_CHECKING([how to print long long])
1968AC_CACHE_VAL([hdf5_cv_printf_ll], [
1969
1970for hdf5_cv_printf_ll in l ll L q unknown; do
1971   AC_RUN_IFELSE(
1972        [AC_LANG_PROGRAM([
1973            #include <stdio.h>
1974            #include <stdlib.h>
1975            #include <string.h>
1976        ],[[
1977            char *s = malloc(128);
1978            long long x = (long long)1048576 * (long long)1048576;
1979            sprintf(s,"%${hdf5_cv_printf_ll}d",x);
1980            exit(strcmp(s,"1099511627776"));
1981        ]])]
1982   , [break],,[continue])
1983done])
1984
1985AC_MSG_RESULT([%${hdf5_cv_printf_ll}d and %${hdf5_cv_printf_ll}u])
1986AC_DEFINE_UNQUOTED([PRINTF_LL_WIDTH], ["$hdf5_cv_printf_ll"],
1987                   [Width for printf() for type `long long' or `__int64', use `ll'])
1988
1989## ----------------------------------------------------------------------
1990## Remove old ways of determining debug/production build.
1991## These were used in 1.8.x and earlier. We should probably keep these checks
1992## around to help people migrate to 1.10.x and newer versions.
1993##
1994AC_ARG_ENABLE([debug],
1995              [AS_HELP_STRING([--enable-debug], [OPTION CHANGE: use --enable-build-mode=debug])],
1996              [AC_MSG_ERROR([--enable-debug is no longer supported, use --enable-build-mode=debug instead.])])
1997
1998AC_ARG_ENABLE([production],
1999              [AS_HELP_STRING([--enable-production], [OPTION CHANGE: use --enable-build-mode=production])],
2000              [AC_MSG_ERROR([--enable-production is no longer supported, use --enable-build-mode=production instead.])])
2001
2002
2003## ----------------------------------------------------------------------
2004## Check if the compiler should include symbols
2005##
2006AC_MSG_CHECKING([enable debugging symbols])
2007AC_ARG_ENABLE([symbols],
2008              [AS_HELP_STRING([--enable-symbols=(yes|no|<custom>)],
2009                              [Add debug symbols to the library (e.g.: build with -g).
2010                               This is independent of the build mode and optimization
2011                               level. The custom string allows special settings like
2012                               -ggdb, etc. to be used.
2013                               [default=yes if debug build, otherwise no]
2014                               ])],
2015              [SYMBOLS=$enableval])
2016
2017## Set default
2018if test "X-$SYMBOLS" = X- ; then
2019  if test "X-$BUILD_MODE" = "X-debug" ; then
2020    SYMBOLS=yes
2021  else
2022    SYMBOLS=no
2023  fi
2024fi
2025
2026## Allow this variable to be substituted in
2027## other files (src/libhdf5.settings.in, etc.)
2028AC_SUBST([SYMBOLS])
2029
2030case "X-$SYMBOLS" in
2031  X-yes)
2032    H5_CFLAGS="$H5_CFLAGS $SYMBOLS_CFLAGS"
2033    H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS_CXXFLAGS"
2034    H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS_FCFLAGS"
2035    AC_MSG_RESULT([yes])
2036    ;;
2037  X-no)
2038    H5_CFLAGS="$H5_CFLAGS $NO_SYMBOLS_CFLAGS"
2039    H5_CXXFLAGS="$H5_CXXFLAGS $NO_SYMBOLS_CXXFLAGS"
2040    H5_FCFLAGS="$H5_FCFLAGS $NO_SYMBOLS_FCFLAGS"
2041    AC_MSG_RESULT([no])
2042    ;;
2043  *)
2044    H5_CFLAGS="$H5_CFLAGS $SYMBOLS"
2045    H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS"
2046    H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS"
2047    SYMBOLS="custom ($SYMBOLS)"
2048    AC_MSG_RESULT([$SYMBOLS])
2049    ;;
2050esac
2051
2052## ----------------------------------------------------------------------
2053## Check if the assert macro should be enabled
2054##
2055AC_MSG_CHECKING([enable asserts])
2056AC_ARG_ENABLE([asserts],
2057              [AS_HELP_STRING([--enable-asserts],
2058                              [Determines whether NDEBUG is defined or not, which
2059                               controls assertions.
2060                               This is independent of the build mode and presence
2061                               of debugging symbols.
2062                               [default=yes if debug build, otherwise no]
2063                               ])],
2064              [ASSERTS=$enableval])
2065
2066## Set default
2067if test "X-$ASSERTS" = X- ; then
2068  if test "X-$BUILD_MODE" = "X-debug" ; then
2069    ASSERTS=yes
2070  else
2071    ASSERTS=no
2072  fi
2073fi
2074
2075## Allow this variable to be substituted in
2076## other files (src/libhdf5.settings.in, etc.)
2077AC_SUBST([ASSERTS])
2078
2079case "X-$ASSERTS" in
2080  X-yes)
2081    H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG"
2082    AC_MSG_RESULT([yes])
2083    ;;
2084  X-no)
2085    H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG"
2086    AC_MSG_RESULT([no])
2087    ;;
2088  *)
2089    AC_MSG_ERROR([Unrecognized value: $ASSERTS])
2090    ;;
2091esac
2092
2093## ----------------------------------------------------------------------
2094## Check if developer warnings should be turned on
2095## These are warnings that provide suggestions like gcc's -Wsuggest-attribute.
2096## They do not indicate code problems.
2097##
2098## Note that developers don't need to build with these regularly. They
2099## are just handy to check once in a while (before releases, etc.).
2100##
2101AC_MSG_CHECKING([enable developer warnings])
2102AC_ARG_ENABLE([developer-warnings],
2103              [AS_HELP_STRING([--enable-developer-warnings],
2104                              [Determines whether developer warnings will be
2105                               emitted. These are usually performance suggestions
2106                               (e.g. -Wsuggest-attribute) and do not flag poor code
2107                               quality.
2108                               [default=no]
2109                               ])],
2110              [DEV_WARNINGS=$enableval])
2111
2112## Set default
2113if test "X-$DEV_WARNINGS" = X- ; then
2114  DEV_WARNINGS=no
2115fi
2116
2117## Allow this variable to be substituted in
2118## other files (src/libhdf5.settings.in, etc.)
2119AC_SUBST([DEV_WARNINGS])
2120
2121case "X-$DEV_WARNINGS" in
2122  X-yes)
2123    H5_CFLAGS="$H5_CFLAGS $DEVELOPER_WARNING_CFLAGS"
2124    AC_MSG_RESULT([yes])
2125    ;;
2126  X-no)
2127    H5_CFLAGS="$H5_CFLAGS $NO_DEVELOPER_WARNING_CFLAGS"
2128    AC_MSG_RESULT([no])
2129    ;;
2130  *)
2131    AC_MSG_ERROR([Unrecognized value: $DEV_WARNINGS])
2132    ;;
2133esac
2134
2135## ----------------------------------------------------------------------
2136## Check if the compiler should use profiling flags/settings
2137##
2138AC_MSG_CHECKING([profiling])
2139AC_ARG_ENABLE([profiling],
2140              [AS_HELP_STRING([--enable-profiling=(yes|no|<custom>)],
2141                              [Enable profiling flags (e.g.: -pg).
2142                               This can be set independently from the build mode.
2143                               The custom setting can be used to pass alternative
2144                               profiling flags (e.g.: -P for using Prof with gcc).
2145                               [default=no]
2146                               ])],
2147              [PROFILING=$enableval])
2148
2149## Default is no profiling
2150if test "X-$PROFILING" = X- ; then
2151    PROFILING=no
2152fi
2153
2154## Allow this variable to be substituted in
2155## other files (src/libhdf5.settings.in, etc.)
2156AC_SUBST([PROFILING])
2157
2158case "X-$PROFILING" in
2159  X-yes)
2160    H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS"
2161    H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS"
2162    H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS"
2163    AC_MSG_RESULT([yes])
2164    ;;
2165  X-no)
2166    AC_MSG_RESULT([no])
2167    ;;
2168  *)
2169    H5_CFLAGS="$H5_CFLAGS $PROFILING"
2170    H5_CXXFLAGS="$H5_CXXFLAGS $PROFILING"
2171    H5_FCFLAGS="$H5_FCFLAGS $PROFILING"
2172    PROFILING="custom ($PROFILING)"
2173    AC_MSG_RESULT([$PROFILING])
2174    ;;
2175esac
2176
2177## ----------------------------------------------------------------------
2178## Check if the compiler should use a particular optimization setting
2179##
2180AC_MSG_CHECKING([optimization level])
2181AC_ARG_ENABLE([optimization],
2182              [AS_HELP_STRING([--enable-optimization=(high|debug|none|<custom>)],
2183                              [Enable optimization flags/settings (e.g.: -O3).
2184                               This can be set independently from the build mode.
2185                               Optimizations for a given compiler can be specified
2186                               at several levels: High, with aggressive optimizations
2187                               turned on; debug, with optimizations that are
2188                               unlikely to interfere with debugging or profiling;
2189                               and none, with no optimizations at all.
2190                               See the compiler-specific config/*-flags file for more
2191                               details.
2192                               Alternatively, optimization options can
2193                               be specified directly by specifying them as a
2194                               string value. These custom optimzation flags will
2195                               completely replace all other optimization flags.
2196                               [default depends on build mode: debug=debug,
2197                                production=high, clean=none]
2198                               ])],
2199              [OPTIMIZATION=$enableval])
2200
2201## Set the default optimization level. This depends on the compiler mode.
2202if test "X-$OPTIMIZATION" = X- ; then
2203  case "X-$BUILD_MODE" in
2204  X-debug)
2205    OPTIMIZATION=debug
2206    ;;
2207  X-production)
2208    OPTIMIZATION=high
2209    ;;
2210  X-clean)
2211    OPTIMIZATION=none
2212    ;;
2213  esac
2214fi
2215
2216## Allow this variable to be substituted in
2217## other files (src/libhdf5.settings.in, etc.)
2218AC_SUBST([OPTIMIZATION])
2219
2220case "X-$OPTIMIZATION" in
2221  X-high)
2222    H5_CFLAGS="$H5_CFLAGS $HIGH_OPT_CFLAGS"
2223    H5_CXXFLAGS="$H5_CXXFLAGS $HIGH_OPT_CXXFLAGS"
2224    H5_FCFLAGS="$H5_FCFLAGS $HIGH_OPT_FCFLAGS"
2225    AC_MSG_RESULT([high])
2226    ;;
2227  X-debug)
2228    H5_CFLAGS="$H5_CFLAGS $DEBUG_OPT_CFLAGS"
2229    H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_OPT_CXXFLAGS"
2230    H5_FCFLAGS="$H5_FCFLAGS $DEBUG_OPT_FCFLAGS"
2231    AC_MSG_RESULT([debug])
2232    ;;
2233  X-none)
2234    H5_CFLAGS="$H5_CFLAGS $NO_OPT_CFLAGS"
2235    H5_CXXFLAGS="$H5_CXXFLAGS $NO_OPT_CXXFLAGS"
2236    H5_FCFLAGS="$H5_FCFLAGS $NO_OPT_FCFLAGS"
2237    AC_MSG_RESULT([none])
2238    ;;
2239  *)
2240    H5_CFLAGS="$H5_CFLAGS $OPTIMIZATION"
2241    H5_CXXFLAGS="$H5_CXXFLAGS $OPTIMIZATION"
2242    H5_FCFLAGS="$H5_FCFLAGS $OPTIMIZATION"
2243    OPTIMIZATION="custom ($OPTIMIZATION)"
2244    AC_MSG_RESULT([$OPTIMIZATION])
2245    ;;
2246esac
2247
2248## ----------------------------------------------------------------------
2249## Enable/disable internal package-level debugging output
2250##
2251AC_MSG_CHECKING([for internal debug output])
2252AC_ARG_ENABLE([internal-debug],
2253              [AS_HELP_STRING([--enable-internal-debug=(yes|all|no|none|<pkg list>)],
2254                              [Enable extra debugging output on HDF5 library
2255                               errors. One may also specify a comma-separated
2256                               list of package names without the leading H5.
2257                               This is independent of the build mode
2258                               and is mainly of interest to HDF Group developers.
2259                               Yes/all and no/none are synonymous.
2260                               [default=all if debug build, otherwise none]
2261                               ])],
2262              [INTERNAL_DEBUG_OUTPUT=$enableval])
2263
2264## Set default
2265if test "X-$INTERNAL_DEBUG_OUTPUT" = X- ; then
2266  if test "X-$BUILD_MODE" = "X-debug" ; then
2267    INTERNAL_DEBUG_OUTPUT=all
2268  else
2269    INTERNAL_DEBUG_OUTPUT=none
2270  fi
2271fi
2272
2273AC_SUBST([INTERNAL_DEBUG_OUTPUT])
2274
2275## These are all the packages that use H5*_DEBUG.
2276## There is no harm in specifying a package not in this list;
2277## you'll just get an unused H5<pkg>_DEBUG symbol.
2278##
2279## Some packages that define debug checks or output are
2280## too specialized or have huge performance hits. These
2281## are not listed in the "all" packages list.
2282##
2283## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z"
2284all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z"
2285
2286case "X-$INTERNAL_DEBUG_OUTPUT" in
2287  X-yes|X-all)
2288    INTERNAL_DEBUG_OUTPUT=$all_packages
2289    DEBUG_PKG_LIST=$all_packages
2290    ;;
2291  X-no|X-none)
2292    INTERNAL_DEBUG_OUTPUT=none
2293    DEBUG_PKG_LIST=
2294    ;;
2295  *)
2296    DEBUG_PKG_LIST=$INTERNAL_DEBUG_OUTPUT
2297    ;;
2298esac
2299AC_MSG_RESULT([$INTERNAL_DEBUG_OUTPUT])
2300
2301## Define H5*_DEBUG symbols that control package output
2302## NOTE: No sanity checking done here!
2303if test -n "$DEBUG_PKG_LIST"; then
2304  for pkg in `echo $DEBUG_PKG_LIST | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do
2305    H5_CPPFLAGS="$H5_CPPFLAGS -DH5${pkg}_DEBUG"
2306  done
2307fi
2308
2309## ----------------------------------------------------------------------
2310## Check if they would like the function stack support compiled in
2311##
2312AC_MSG_CHECKING([whether function stack tracking is enabled])
2313AC_ARG_ENABLE([codestack],
2314              [AS_HELP_STRING([--enable-codestack],
2315                              [Enable the function stack tracing (for developer debugging).
2316                               [default=no]
2317                              ])],
2318              [CODESTACK=$enableval])
2319
2320## Set the default level.
2321if test "X-$CODESTACK" = X- ; then
2322  CODESTACK=no
2323fi
2324
2325## Allow this variable to be substituted in
2326## other files (src/libhdf5.settings.in, etc.)
2327AC_SUBST([CODESTACK])
2328
2329case "X-$CODESTACK" in
2330  X-yes)
2331      AC_MSG_RESULT([yes])
2332      AC_DEFINE([HAVE_CODESTACK], [1],
2333                [Define if the function stack tracing code is to be compiled in])
2334    ;;
2335  X-no)
2336      AC_MSG_RESULT([no])
2337    ;;
2338  *)
2339      AC_MSG_ERROR([Unrecognized value: $CODESTACK])
2340    ;;
2341esac
2342
2343## ----------------------------------------------------------------------
2344## Enable tracing of the API
2345##
2346AC_MSG_CHECKING([for API tracing]);
2347AC_ARG_ENABLE([trace],
2348              [AS_HELP_STRING([--enable-trace],
2349                              [Enable HDF5 API tracing capability.
2350                               [default=yes if debug build, otherwise no]
2351                               ])],
2352              [TRACE_API=$enableval])
2353
2354## Set the default level.
2355if test "X-$TRACE_API" = X- ; then
2356  if test "X-$BUILD_MODE" = "X-debug" ; then
2357    TRACE_API=yes
2358  else
2359    TRACE_API=no
2360  fi
2361fi
2362
2363## Allow this variable to be substituted in
2364## other files (src/libhdf5.settings.in, etc.)
2365AC_SUBST([TRACE_API])
2366
2367case "X-$TRACE_API" in
2368  X-yes)
2369    AC_MSG_RESULT([yes])
2370    H5_CPPFLAGS="$H5_CPPFLAGS -DH5_DEBUG_API"
2371    ;;
2372  X-no)
2373    AC_MSG_RESULT([no])
2374    H5_CPPFLAGS="$H5_CPPFLAGS -UH5_DEBUG_API"
2375    ;;
2376  *)
2377    AC_MSG_ERROR([Unrecognized value: $TRACE_API])
2378    ;;
2379esac
2380
2381## ----------------------------------------------------------------------
2382## Check if they would like to use a memory checking tool (like valgrind's
2383##     'memcheck' tool, or Rational Purify, etc) and the library should be
2384##     more scrupulous with it's memory operations.  Enabling this also
2385##     disables the library's free space manager code.
2386##
2387AC_MSG_CHECKING([whether a memory checking tool will be used])
2388AC_ARG_ENABLE([using-memchecker],
2389              [AS_HELP_STRING([--enable-using-memchecker],
2390                              [Enable this option if a memory allocation and/or
2391                              bounds checking tool will be used on the HDF5
2392                              library.  Enabling this causes the library to be
2393                              more picky about its memory operations and also
2394                              disables the library's free space manager code.
2395                              This option is orthogonal to the
2396                              --enable-memory-alloc-sanity-check option.
2397                              [default=no]
2398                              ])],
2399              [USINGMEMCHECKER=$enableval])
2400
2401## Allow this variable to be substituted in
2402## other files (src/libhdf5.settings.in, etc.)
2403AC_SUBST([USINGMEMCHECKER])
2404
2405## Set the default level.
2406if test "X-$USINGMEMCHECKER" = X- ; then
2407  USINGMEMCHECKER=no
2408fi
2409
2410case "X-$USINGMEMCHECKER" in
2411  X-yes)
2412      AC_DEFINE([USING_MEMCHECKER], [1],
2413                [Define if a memory checking tool will be used on the library,
2414                to cause library to be very picky about memory operations and
2415                also disable the internal free list manager code.])
2416      AC_MSG_RESULT([yes])
2417    ;;
2418  X-no)
2419      AC_MSG_RESULT([no])
2420    ;;
2421  *)
2422      AC_MSG_ERROR([Unrecognized value: $USINGMEMCHECKER])
2423    ;;
2424esac
2425
2426## ----------------------------------------------------------------------
2427## Check if they would like to enable the internal memory allocation sanity
2428##     checking code.
2429##
2430AC_MSG_CHECKING([whether internal memory allocation sanity checking is used])
2431AC_ARG_ENABLE([memory-alloc-sanity-check],
2432              [AS_HELP_STRING([--enable-memory-alloc-sanity-check],
2433                              [Enable this option to turn on internal memory
2434                              allocation sanity checking.  This could cause
2435                              more memory use and somewhat slower allocation.
2436                              This option is orthogonal to the
2437                              --enable-using-memchecker option.
2438                               [default=yes if debug build, otherwise no]
2439                              ])],
2440              [MEMORYALLOCSANITYCHECK=$enableval])
2441
2442## Allow this variable to be substituted in
2443## other files (src/libhdf5.settings.in, etc.)
2444AC_SUBST([MEMORYALLOCSANITYCHECK])
2445
2446## Set default
2447if test "X-$MEMORYALLOCSANITYCHECK" = X- ; then
2448  if test "X-$BUILD_MODE" = "X-debug" ; then
2449    MEMORYALLOCSANITYCHECK=yes
2450  else
2451    MEMORYALLOCSANITYCHECK=no
2452  fi
2453fi
2454
2455case "X-$MEMORYALLOCSANITYCHECK" in
2456  X-yes)
2457      AC_DEFINE([MEMORY_ALLOC_SANITY_CHECK], [1],
2458                [Define to enable internal memory allocation sanity checking.])
2459      AC_MSG_RESULT([yes])
2460    ;;
2461  X-no)
2462      AC_MSG_RESULT([no])
2463    ;;
2464  *)
2465      AC_MSG_ERROR([Unrecognized value: $MEMORYALLOCSANITYCHECK])
2466    ;;
2467esac
2468
2469## Checkpoint the cache
2470AC_CACHE_SAVE
2471
2472## What header files and libraries do we have to look for for parallel
2473## support?  For the most part, search paths are already specified with
2474## CPPFLAGS and LDFLAGS or are known to the compiler.
2475##
2476AC_ARG_ENABLE([parallel],
2477              [AS_HELP_STRING([--enable-parallel],
2478                              [Search for MPI-IO and MPI support files])])
2479
2480## The --enable-parallel flag is not compatible with --enable-cxx.
2481## If the user tried to specify both flags, throw an error, unless
2482## they also provided the --enable-unsupported flag.
2483if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
2484  if test "X${HDF_CXX}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then
2485    AC_MSG_ERROR([--enable-cxx and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error.])
2486  fi
2487fi
2488
2489## The --enable-parallel flag is not compatible with --enable-java.
2490## If the user tried to specify both flags, throw an error, unless
2491## they also provided the --enable-unsupported flag.
2492if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
2493  if test "X${HDF_JAVA}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then
2494    AC_MSG_ERROR([--enable-java and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error.])
2495  fi
2496fi
2497
2498## --enable-parallel is also incompatible with --enable-threadsafe, unless
2499## --enable-unsupported has been specified on the configure line.
2500if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
2501  if test "X${THREADSAFE}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then
2502    AC_MSG_ERROR([--enable-threadsafe and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error.])
2503  fi
2504fi
2505
2506AC_MSG_CHECKING([for parallel support files])
2507case "X-$enable_parallel" in
2508  X-|X-no|X-none)
2509    ## We are not compiling for parallel.
2510    AC_MSG_RESULT([skipped])
2511    ;;
2512
2513  X-yes)
2514    ## We want to compile a parallel library with a compiler that
2515    ## may already know how to link with MPI and MPI-IO.
2516    AC_MSG_RESULT([provided by compiler])
2517    PARALLEL=yes
2518
2519    ## Try link a simple MPI program.
2520    AC_MSG_CHECKING([whether a simple MPI-IO C program can be linked])
2521    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>]],
2522                   [[ MPI_Init(0, (void *)0);
2523            MPI_File_open(0, (void *)0, 0, 0, (void *)0);]])],
2524        [AC_MSG_RESULT([yes])],
2525            [AC_MSG_RESULT([no])
2526            AC_MSG_ERROR([unable to link a simple MPI-IO C program])])
2527
2528    if test "X$HDF_FORTRAN" = "Xyes"; then
2529      PAC_PROG_FC_MPI_CHECK
2530    fi
2531
2532    ## Set RUNPARALLEL to mpiexec if not set yet.
2533    if test "X$PARALLEL" = "Xyes" -a -z "$RUNPARALLEL"; then
2534      RUNPARALLEL="mpiexec -n \$\${NPROCS:=6}"
2535    fi
2536    ;;
2537
2538  *)
2539    AC_MSG_RESULT([error])
2540    AC_MSG_ERROR([\'$enable_parallel\' is not a valid parallel search type])
2541    ;;
2542esac
2543
2544## ----------------------------------------------------------------------
2545## Print some other parallel information and do some sanity checks.
2546## Needs to be done outside of the PARALLEL block since the serial
2547## build also needs to have values defined.
2548##
2549AC_SUBST([ADD_PARALLEL_FILES]) ADD_PARALLEL_FILES="no"
2550AC_SUBST([MPE]) MPE=no
2551AC_SUBST([INSTRUMENT_LIBRARY]) INSTRUMENT_LIBRARY=no
2552AC_SUBST([PARALLEL_FILTERED_WRITES])
2553AC_SUBST([LARGE_PARALLEL_IO])
2554
2555if test -n "$PARALLEL"; then
2556  if test "X$HDF5_TESTS" = "Xyes"; then
2557    ## The 'testpar' directory should participate in the build
2558    TESTPARALLEL=testpar
2559  fi
2560
2561  ## We are building a parallel library
2562  AC_DEFINE([HAVE_PARALLEL], [1], [Define if we have parallel support])
2563
2564  ## Display what we found about running programs
2565  AC_MSG_CHECKING([prefix for running on one processor])
2566  AC_MSG_RESULT([$RUNSERIAL])
2567  AC_MSG_CHECKING([prefix for running in parallel])
2568  AC_MSG_RESULT([$RUNPARALLEL])
2569
2570  ## There *must* be some way to run in parallel even if it's just the
2571  ## word `none'.
2572  if test -z "$RUNPARALLEL"; then
2573    AC_MSG_ERROR([no way to run a parallel program])
2574  fi
2575
2576  ## If RUNSERIAL or RUNPARALLEL is the word `none' then replace it with
2577  ## the empty string. This means that no launch commands were requested,
2578  ## so we will not use any launch commands.
2579  if test "X$RUNSERIAL" = "Xnone"; then
2580    RUNSERIAL=""
2581  fi
2582  if test "X$RUNPARALLEL" = "Xnone"; then
2583    RUNPARALLEL=""
2584  fi
2585
2586  if test "X$HDF_FORTRAN" = "Xyes"; then
2587    ADD_PARALLEL_FILES="yes"
2588    AC_MSG_CHECKING([for MPI_Comm_c2f and MPI_Comm_f2c functions])
2589
2590    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2591    #include <mpi.h>
2592    ]],
2593      [[MPI_Comm c_comm; MPI_Comm_c2f(c_comm)]])],
2594      [AC_DEFINE([HAVE_MPI_MULTI_LANG_Comm], [1],
2595                 [Define if MPI_Comm_c2f and MPI_Comm_f2c exist])
2596                 AC_MSG_RESULT([yes])],
2597                 [AC_MSG_RESULT([no])]
2598    )
2599
2600    AC_MSG_CHECKING([for MPI_Info_c2f and MPI_Info_f2c functions])
2601    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>]],
2602      [[MPI_Info c_info; MPI_Info_c2f(c_info)]])],
2603      [AC_DEFINE([HAVE_MPI_MULTI_LANG_Info], [1],
2604                [Define if MPI_Info_c2f and MPI_Info_f2c exist])
2605                AC_MSG_RESULT([yes])],
2606                [AC_MSG_RESULT([no])]
2607    )
2608  fi
2609
2610  ## ----------------------------------------------------------------------
2611  ## Enable instrumenting of the library's internal operations
2612  ## in parallel builds.
2613  ##
2614
2615  ## Set default
2616  if test "X-$BUILD_MODE" = "X-debug" ; then
2617    INSTRUMENT_LIBRARY=yes
2618  else
2619    INSTRUMENT_LIBRARY=no
2620  fi
2621
2622  AC_MSG_CHECKING([for instrumented library]);
2623  AC_ARG_ENABLE([instrument],
2624                [AS_HELP_STRING([--enable-instrument],
2625                                [Enable library instrumentation of optimization
2626                                  tracing (only used with parallel builds).
2627                                  [default=yes if a parallel debug build, otherwise no]
2628                                ])],
2629                [INSTRUMENT_LIBRARY=$enableval])
2630
2631  ## Allow this variable to be substituted in
2632  ## other files (src/libhdf5.settings.in, etc.)
2633  AC_SUBST([INSTRUMENT_LIBRARY])
2634
2635  case "X-$INSTRUMENT_LIBRARY" in
2636    X-yes)
2637      AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1],
2638                [Define if parallel library will contain instrumentation to detect correct optimization operation])
2639      AC_MSG_RESULT([yes])
2640      ;;
2641    X-no)
2642      AC_MSG_RESULT([no])
2643      ;;
2644    *)
2645      AC_MSG_ERROR([Unrecognized value: $INSTRUMENT_LIBRARY])
2646      ;;
2647  esac
2648
2649  ## --------------------------------------------------------------------
2650  ## Do we want MPE instrumentation feature on?
2651  ##
2652  ## This must be done after enable-parallel is checked since it depends
2653  ## on a mpich compiler.
2654  ##
2655  MPE=yes
2656  AC_ARG_WITH([mpe],
2657              [AS_HELP_STRING([--with-mpe=DIR],
2658                              [Use MPE instrumentation [default=no]])],,
2659              [withval=no])
2660
2661  case "X-$withval" in
2662    X-|X-no|X-none)
2663      AC_MSG_CHECKING([for MPE])
2664      AC_MSG_RESULT([suppressed])
2665      unset MPE
2666      ;;
2667    X-yes)
2668      AC_CHECK_HEADERS([mpe.h],, [unset MPE])
2669      AC_CHECK_LIB([mpe], [MPE_Init_log],, [unset MPE])
2670      ;;
2671    *)
2672      case "$withval" in
2673        *,*)
2674          mpe_inc="`echo $withval | cut -f1 -d,`"
2675          mpe_lib="`echo $withval | cut -f2 -d, -s`"
2676          ;;
2677        *)
2678          if test -n "$withval"; then
2679            mpe_inc="$withval/include"
2680            mpe_lib="$withval/lib"
2681          fi
2682          ;;
2683      esac
2684
2685      if test -n "$mpe_inc"; then
2686        saved_CPPFLAGS="$CPPFLAGS"
2687        saved_AM_CPPFLAGS="$AM_CPPFLAGS"
2688        CPPFLAGS="$CPPFLAGS -I$mpe_inc"
2689        AM_CPPFLAGS="$AM_CPPFLAGS -I$mpe_inc"
2690        AC_CHECK_HEADERS([mpe.h],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset MPE])
2691      else
2692        AC_CHECK_HEADERS([mpe.h],, [unset MPE])
2693      fi
2694
2695      if test -n "$mpe_lib"; then
2696        saved_LDFLAGS="$LDFLAGS"
2697        saved_AM_LDFLAGS="$AM_LDFLAGS"
2698        LDFLAGS="$LDFLAGS -L$mpe_lib"
2699        AM_LDFLAGS="$AM_LDFLAGS -L$mpe_lib"
2700        AC_CHECK_LIB([mpe], [MPE_Init_log],,
2701                     [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset MPE])
2702      else
2703        AC_CHECK_LIB([mpe], [MPE_Init_log],, [unset MPE])
2704      fi
2705      ;;
2706  esac
2707
2708  if test "X-$MPE" = "X-yes"; then
2709    AC_DEFINE([HAVE_MPE], [1], [Define if we have MPE support])
2710  fi
2711
2712  ## ----------------------------------------------------------------------
2713  ## Check for the MPI-3 functions necessary for the Parallel Compression
2714  ## feature. If these are not present, issue a warning that Parallel
2715  ## Compression will be disabled.
2716  ##
2717  AC_MSG_CHECKING([for MPI_Mprobe and MPI_Imrecv functions])
2718
2719  AC_LINK_IFELSE(
2720      [AC_LANG_PROGRAM(
2721          [[
2722              #include <mpi.h>
2723          ]],
2724          [[
2725              MPI_Message message;
2726              MPI_Init(0, (void *) 0);
2727              MPI_Mprobe(0, 0, 0, &message, (void *) 0);
2728              MPI_Imrecv((void *) 0, 0, 0, (void *) 0, (void *) 0);
2729          ]]
2730      )],
2731      [AC_MSG_RESULT([yes])
2732       PARALLEL_FILTERED_WRITES=yes],
2733      [AC_MSG_RESULT([no])
2734       AC_MSG_WARN([A simple MPI program using the MPI_Mprobe and MPI_Imrecv functions could not be compiled and linked.
2735                    Parallel writes of filtered data will be disabled.])
2736       PARALLEL_FILTERED_WRITES=no]
2737  )
2738
2739  ## ----------------------------------------------------------------------
2740  ## Check for the MPI-3 functions necessary for the big I/O feature.
2741  ## If these are not present, issue a warning that the big I/O feature
2742  ## will be disabled.
2743  ##
2744  AC_MSG_CHECKING([for MPI_Get_elements_x and MPI_Type_size_x functions])
2745
2746  AC_LINK_IFELSE(
2747      [AC_LANG_PROGRAM(
2748          [[
2749              #include <mpi.h>
2750          ]],
2751          [[
2752              MPI_Count count;
2753              MPI_Init(0, (void *) 0);
2754              MPI_Get_elements_x(0, 0, &count);
2755              MPI_Type_size_x(0, &count);
2756          ]]
2757      )],
2758      [AC_MSG_RESULT([yes])
2759       LARGE_PARALLEL_IO=yes],
2760      [AC_MSG_RESULT([no])
2761       AC_MSG_WARN([A simple MPI program using the MPI_Get_elements_x and MPI_Type_size_x functions could not be compiled and linked.
2762                    Reading/Writing >2GB of data in a single parallel I/O operation will be disabled.])
2763       LARGE_PARALLEL_IO=no]
2764  )
2765
2766fi
2767
2768## ----------------------------------------------------------------------
2769## Check if Direct I/O driver is enabled by --enable-direct-vfd
2770##
2771AC_SUBST([DIRECT_VFD])
2772
2773## Default is no direct VFD
2774DIRECT_VFD=no
2775
2776AC_CACHE_VAL([hdf5_cv_direct_io],
2777    AC_CHECK_DECL([O_DIRECT], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no], [[#include <fcntl.h>]]))
2778AC_CACHE_VAL([hdf5_cv_posix_memalign],
2779    AC_CHECK_FUNC([posix_memalign], [hdf5_cv_posix_memalign=yes], [hdf5_cv_posix_memalign=no]))
2780
2781AC_MSG_CHECKING([if the direct I/O virtual file driver (VFD) is enabled])
2782
2783AC_ARG_ENABLE([direct-vfd],
2784              [AS_HELP_STRING([--enable-direct-vfd],
2785                              [Build the direct I/O virtual file driver (VFD).
2786                               This is based on the POSIX (sec2) VFD and
2787                               requires the open() call to take the O_DIRECT
2788                               flag. [default=no]])],
2789              [DIRECT_VFD=$enableval], [DIRECT_VFD=no])
2790
2791if test "X$DIRECT_VFD" = "Xyes"; then
2792    if test ${hdf5_cv_direct_io} = "yes" && test ${hdf5_cv_posix_memalign} = "yes" ; then
2793        AC_MSG_RESULT([yes])
2794        AC_DEFINE([HAVE_DIRECT], [1],
2795                [Define if the direct I/O virtual file driver (VFD) should be compiled])
2796    else
2797        AC_MSG_RESULT([no])
2798        DIRECT_VFD=no
2799        AC_MSG_ERROR([The direct VFD was requested but cannot be built. This is either
2800                     due to O_DIRECT not being found in fcntl.h or a lack of
2801                     posix_memalign() on your system. Please re-configure without
2802                     specifying --enable-direct-vfd.])
2803    fi
2804else
2805    AC_MSG_RESULT([no])
2806fi
2807
2808## Direct VFD files are not built if not required.
2809AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"])
2810
2811## ----------------------------------------------------------------------
2812## Check if Read-Only S3 virtual file driver is enabled by --enable-ros3-vfd
2813##
2814AC_SUBST([ROS3_VFD])
2815
2816## Default is no Read-Only S3 VFD
2817ROS3_VFD=no
2818
2819AC_ARG_ENABLE([ros3-vfd],
2820              [AS_HELP_STRING([--enable-ros3-vfd],
2821                              [Build the Read-Only S3 virtual file driver (VFD).
2822                               [default=no]])],
2823              [ROS3_VFD=$enableval], [ROS3_VFD=no])
2824
2825if test "X$ROS3_VFD" = "Xyes"; then
2826    AC_CHECK_HEADERS([curl/curl.h],, [unset ROS3_VFD])
2827    AC_CHECK_HEADERS([openssl/evp.h],, [unset ROS3_VFD])
2828    AC_CHECK_HEADERS([openssl/hmac.h],, [unset ROS3_VFD])
2829    AC_CHECK_HEADERS([openssl/sha.h],, [unset ROS3_VFD])
2830    if test "X$ROS3_VFD" = "Xyes"; then
2831        AC_CHECK_LIB([curl], [curl_global_init],, [unset ROS3_VFD])
2832        AC_CHECK_LIB([crypto], [EVP_sha256],, [unset ROS3_VFD])
2833    fi
2834
2835    AC_MSG_CHECKING([if the Read-Only S3 virtual file driver (VFD) is enabled])
2836    if test "X$ROS3_VFD" = "Xyes"; then
2837        AC_DEFINE([HAVE_ROS3_VFD], [1],
2838                [Define whether the Read-Only S3 virtual file driver (VFD) should be compiled])
2839        AC_MSG_RESULT([yes])
2840    else
2841        AC_MSG_RESULT([no])
2842        ROS3_VFD=no
2843        AC_MSG_ERROR([The Read-Only S3 VFD was requested but cannot be built.
2844                      Please check that openssl and cURL are available on your
2845                      system, and/or re-configure without option
2846                      --enable-ros3-vfd.])
2847    fi
2848else
2849    AC_MSG_CHECKING([if the Read-Only S3 virtual file driver (VFD) is enabled])
2850    AC_MSG_RESULT([no])
2851    ROS3_VFD=no
2852
2853fi
2854
2855## Read-only S3 files are not built if not required.
2856AM_CONDITIONAL([ROS3_VFD_CONDITIONAL], [test "X$ROS3_VFD" = "Xyes"])
2857
2858
2859## ----------------------------------------------------------------------
2860## Is libhdfs (Hadoop Distributed File System) present?
2861## It might be specified with the `--with-libhdfs' command-line switch.
2862## If found, enables the HDFS VFD.
2863##
2864AC_SUBST([HAVE_LIBHDFS])
2865AC_ARG_WITH([libhdfs],
2866            [AS_HELP_STRING([--with-libhdfs=DIR],
2867                            [Provide libhdfs library to enable HDFS virtual file driver (VFD) [default=no]])],,
2868            [withval=no])
2869
2870case $withval in
2871  no)
2872    HAVE_LIBHDFS="no"
2873    AC_MSG_CHECKING([for libhdfs])
2874    AC_MSG_RESULT([suppressed])
2875    ;;
2876  *)
2877    HAVE_LIBHDFS="yes"
2878    case "$withval" in
2879      *,*)
2880        libhdfs_inc="`echo $withval |cut -f1 -d,`"
2881        libhdfs_lib="`echo $withval |cut -f2 -d, -s`"
2882        ;;
2883      yes)
2884        libhdfs_inc="$HADOOP_HOME/include"
2885        libhdfs_lib="$HADOOP_HOME/lib"
2886        ;;
2887      *)
2888        if test -n "$withval"; then
2889          libhdfs_inc="$withval/include"
2890          libhdfs_lib="$withval/lib"
2891        fi
2892        ;;
2893    esac
2894
2895    if test -n "$libhdfs_inc"; then
2896      CPPFLAGS="$CPPFLAGS -I$libhdfs_inc"
2897      AM_CPPFLAGS="$AM_CPPFLAGS -I$libhdfs_inc"
2898    fi
2899    AC_CHECK_HEADERS([hdfs.h],,
2900                     [unset HAVE_LIBHDFS])
2901
2902    if test "x$HAVE_LIBHDFS" = "xyes"; then
2903      dnl Check for '-ljvm' needed by libhdfs
2904      JNI_LDFLAGS=""
2905      if test $JAVA_HOME != ""
2906      then
2907        JNI_LDFLAGS="-L$JAVA_HOME/jre/lib/$OS_ARCH -L$JAVA_HOME/jre/lib/$OS_ARCH/server"
2908      fi
2909      ldflags_bak=$LDFLAGS
2910      LDFLAGS="$LDFLAGS $JNI_LDFLAGS"
2911      AC_CHECK_LIB([jvm], [JNI_GetCreatedJavaVMs])
2912      LDFLAGS=$ldflags_bak
2913      AC_SUBST([JNI_LDFLAGS])
2914      if test -n "$libhdfs_lib"; then
2915        ## Hadoop distribution hides libraries down one level in 'lib/native'
2916        libhdfs_lib="$libhdfs_lib/native"
2917        LDFLAGS="$LDFLAGS -L$libhdfs_lib $JNI_LDFLAGS"
2918        AM_LDFLAGS="$AM_LDFLAGS -L$libhdfs_lib $JNI_LDFLAGS"
2919      fi
2920      AC_CHECK_LIB([hdfs], [hdfsConnect],,
2921                   [unset HAVE_LIBHDFS])
2922    fi
2923
2924    if test -z "$HAVE_LIBHDFS"; then
2925      AC_MSG_ERROR([Set to use libhdfs library, but could not find or use
2926                    libhdfs. Please verify that the path to HADOOP_HOME is
2927                    valid, and/or reconfigure without --with-libhdfs.])
2928    fi
2929    ;;
2930esac
2931
2932if test "x$HAVE_LIBHDFS" = "xyes"; then
2933  AC_DEFINE([HAVE_LIBHDFS], [1],
2934            [Proceed to build with libhdfs])
2935fi
2936
2937## Checkpoint the cache
2938AC_CACHE_SAVE
2939
2940## ----------------------------------------------------------------------
2941## Enable custom plugin default path for library.  It requires SHARED support.
2942##
2943AC_MSG_CHECKING([for custom plugin default path definition])
2944AC_ARG_WITH([default-plugindir],
2945            [AS_HELP_STRING([--with-default-plugindir=location],
2946                            [Specify default location for plugins
2947                            [default="/usr/local/hdf5/lib/plugin"]])],,
2948            withval="/usr/local/hdf5/lib/plugin")
2949
2950if test "X$withval" = "X"; then
2951    AC_MSG_RESULT([default])
2952    default_plugindir="/usr/local/hdf5/lib/plugin"
2953else
2954    AC_MSG_RESULT([$withval])
2955    default_plugindir=$withval
2956fi
2957
2958AC_DEFINE_UNQUOTED([DEFAULT_PLUGINDIR], ["$default_plugindir"],
2959            [Define the default plugins path to compile])
2960
2961## ----------------------------------------------------------------------
2962## Decide whether the presence of user's exception handling functions is
2963## checked and data conversion exceptions are returned.  This is mainly
2964## for the speed optimization of hard conversions.  Soft conversions can
2965## actually benefit little.
2966##
2967AC_MSG_CHECKING([whether exception handling functions is checked during data conversions])
2968AC_ARG_ENABLE([dconv-exception],
2969              [AS_HELP_STRING([--enable-dconv-exception],
2970                              [if exception handling functions is checked during
2971                              data conversions [default=yes]])],
2972              [DCONV_EXCEPTION=$enableval], [DCONV_EXCEPTION=yes])
2973
2974if test "$DCONV_EXCEPTION" = "yes"; then
2975  AC_MSG_RESULT([yes])
2976  AC_DEFINE([WANT_DCONV_EXCEPTION], [1],
2977            [Check exception handling functions during data conversions])
2978else
2979  AC_MSG_RESULT([no])
2980fi
2981
2982## ----------------------------------------------------------------------
2983## Decide whether the data accuracy has higher priority during data
2984## conversions.  If not, some hard conversions will still be prefered even
2985## though the data may be wrong (for example, some compilers don't
2986## support denormalized floating values) to maximize speed.
2987##
2988AC_MSG_CHECKING([whether data accuracy is guaranteed during data conversions])
2989AC_ARG_ENABLE([dconv-accuracy],
2990              [AS_HELP_STRING([--enable-dconv-accuracy],
2991                              [if data accuracy is guaranteed during
2992                              data conversions [default=yes]])],
2993              [DATA_ACCURACY=$enableval], [DATA_ACCURACY=yes])
2994
2995if test "$DATA_ACCURACY" = "yes"; then
2996  AC_MSG_RESULT([yes])
2997  AC_DEFINE([WANT_DATA_ACCURACY], [1],
2998            [Data accuracy is prefered to speed during data conversions])
2999else
3000  AC_MSG_RESULT([no])
3001fi
3002
3003## ----------------------------------------------------------------------
3004## Set the flag to indicate that the machine has window style pathname,
3005## that is, "drive-letter:\" (e.g. "C:") or "drive-letter:/" (e.g. "C:/").
3006## (This flag should be _unset_ for all machines, except for Windows, where
3007## it's set in the custom Windows H5pubconf.h file)
3008##
3009AC_MSG_CHECKING([if the machine has window style path name])
3010
3011case "`uname`" in
3012  MINGW*)
3013    AC_DEFINE([HAVE_WINDOW_PATH], [1],
3014              [Define if your system has window style path name.])
3015    AC_MSG_RESULT([yes])
3016    ;;
3017  *)
3018    AC_MSG_RESULT([no])
3019    ;;
3020esac
3021
3022## ----------------------------------------------------------------------
3023## Set the flag to indicate that the machine is using a special algorithm to convert
3024## 'long double' to '(unsigned) long' values.  (This flag should only be set for
3025## the IBM Power6 Linux.  When the bit sequence of long double is
3026## 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long
3027## is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282.
3028## The machine's conversion gets the correct value.  We define the macro and disable
3029## this kind of test until we figure out what algorithm they use.
3030##
3031AC_MSG_CHECKING([if using special algorithm to convert long double to (unsigned) long values])
3032
3033## NOTE: Place all configure test programs into cmake's source file, then use a preprocessor directive
3034## to select the proper test program. This is done by echoing the #define and cat'ing the cmake
3035## source file. (HDFFV-9467)
3036
3037TEST_SRC="`(echo \"#define H5_LDOUBLE_TO_LONG_SPECIAL_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
3038
3039if test ${ac_cv_sizeof_long_double} = 0; then
3040   hdf5_cv_ldouble_to_long_special=${hdf5_cv_ldouble_to_long_special=no}
3041else
3042   AC_CACHE_VAL([hdf5_cv_ldouble_to_long_special],
3043        [AC_RUN_IFELSE(
3044            [AC_LANG_SOURCE([$TEST_SRC])]
3045    , [hdf5_cv_ldouble_to_long_special=yes], [hdf5_cv_ldouble_to_long_special=no],)])
3046fi
3047
3048if test ${hdf5_cv_ldouble_to_long_special} = "yes"; then
3049  AC_DEFINE([LDOUBLE_TO_LONG_SPECIAL], [1],
3050            [Define if your system converts long double to (unsigned) long values with special algorithm.])
3051  AC_MSG_RESULT([yes])
3052else
3053  AC_MSG_RESULT([no])
3054fi
3055
3056## ----------------------------------------------------------------------
3057## Set the flag to indicate that the machine is using a special algorithm
3058## to convert some values of '(unsigned) long' to 'long double' values.
3059## (This flag should be off for all machines, except for IBM Power6 Linux,
3060## when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff...,
3061## ..., 7fffff..., the compiler uses a unknown algorithm.  We define a
3062## macro and skip the test for now until we know about the algorithm.
3063##
3064AC_MSG_CHECKING([if using special algorithm to convert (unsigned) long to long double values])
3065
3066TEST_SRC="`(echo \"#define H5_LONG_TO_LDOUBLE_SPECIAL_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
3067
3068if test ${ac_cv_sizeof_long_double} = 0; then
3069   hdf5_cv_long_to_ldouble_special=${hdf5_cv_long_to_ldouble_special=no}
3070else
3071   AC_CACHE_VAL([hdf5_cv_long_to_ldouble_special],
3072        [AC_RUN_IFELSE(
3073            [AC_LANG_SOURCE([$TEST_SRC])]
3074    , [hdf5_cv_long_to_ldouble_special=yes], [hdf5_cv_long_to_ldouble_special=no],)])
3075fi
3076
3077if test ${hdf5_cv_long_to_ldouble_special} = "yes"; then
3078  AC_DEFINE([LONG_TO_LDOUBLE_SPECIAL], [1],
3079            [Define if your system can convert (unsigned) long to long double values with special algorithm.])
3080  AC_MSG_RESULT([yes])
3081else
3082  AC_MSG_RESULT([no])
3083fi
3084
3085## ----------------------------------------------------------------------
3086## Set the flag to indicate that the machine can accurately convert
3087## 'long double' to '(unsigned) long long' values.  (This flag should
3088## be set for all machines, except for Mac OS 10.4, SGI IRIX64 6.5 and
3089## Powerpc Linux using XL compilers.
3090## When the bit sequence of long double is 0x4351ccf385ebc8a0bfcc2a3c...,
3091## the values of (unsigned)long long start to go wrong on these
3092## two machines.  Adjusting it higher to 0x4351ccf385ebc8a0dfcc... or
3093## 0x4351ccf385ebc8a0ffcc... will make the converted values wildly wrong.
3094## This test detects this wrong behavior and disable the test.
3095##
3096AC_MSG_CHECKING([if correctly converting long double to (unsigned) long long values])
3097
3098TEST_SRC="`(echo \"#define H5_LDOUBLE_TO_LLONG_ACCURATE_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
3099
3100if test ${ac_cv_sizeof_long_double} = 0; then
3101   hdf5_cv_ldouble_to_llong_accurate=${hdf5_cv_ldouble_to_llong_accurate=no}
3102else
3103   AC_CACHE_VAL([hdf5_cv_ldouble_to_llong_accurate],
3104        [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],
3105        [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],[])])
3106fi
3107
3108if test ${hdf5_cv_ldouble_to_llong_accurate} = "yes"; then
3109  AC_DEFINE([LDOUBLE_TO_LLONG_ACCURATE], [1],
3110            [Define if your system can convert long double to (unsigned) long long values correctly.])
3111  AC_MSG_RESULT([yes])
3112else
3113  AC_MSG_RESULT([no])
3114fi
3115
3116
3117## ----------------------------------------------------------------------
3118## Set the flag to indicate that the machine can accurately convert
3119## '(unsigned) long long' to 'long double' values.  (This flag should be
3120## set for all machines, except for Mac OS 10.4 and Powerpc Linux using
3121## XL compilers.
3122## When the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff...,
3123## ..., 7fffff..., the converted values are twice as big as they should be.
3124##
3125AC_MSG_CHECKING([if correctly converting (unsigned) long long to long double values])
3126
3127TEST_SRC="`(echo \"#define H5_LLONG_TO_LDOUBLE_CORRECT_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
3128
3129if test ${ac_cv_sizeof_long_double} = 0; then
3130   hdf5_cv_llong_to_ldouble_correct=${hdf5_cv_llong_to_ldouble_correct=no}
3131else
3132   AC_CACHE_VAL([hdf5_cv_llong_to_ldouble_correct],
3133        [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],
3134        [hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],[])])
3135fi
3136
3137if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then
3138  AC_DEFINE([LLONG_TO_LDOUBLE_CORRECT], [1],
3139            [Define if your system can convert (unsigned) long long to long double values correctly.])
3140  AC_MSG_RESULT([yes])
3141else
3142  AC_MSG_RESULT([no])
3143fi
3144
3145## ----------------------------------------------------------------------
3146## Set the flag to indicate that the machine is IBM ppc64le and cannot
3147## accurately convert some long double values.
3148##
3149AC_MSG_CHECKING([if the system is IBM ppc64le and cannot correctly convert some long double values])
3150
3151TEST_SRC="`(echo \"#define H5_DISABLE_SOME_LDOUBLE_CONV_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
3152
3153if test ${ac_cv_sizeof_long_double} = 0; then
3154   hdf5_cv_disable_some_ldouble_conv=${hdf5_cv_disable_some_ldouble_conv=no}
3155else
3156   AC_CACHE_VAL([hdf5_cv_disable_some_ldouble_conv],
3157        [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],
3158        [hdf5_cv_disable_some_ldouble_conv=yes], [hdf5_cv_disable_some_ldouble_conv=no],[])])
3159fi
3160
3161if test ${hdf5_cv_disable_some_ldouble_conv} = "yes"; then
3162  AC_DEFINE([DISABLE_SOME_LDOUBLE_CONV], [1],
3163            [Define if your system is IBM ppc64le and cannot convert some long double values correctly.])
3164  AC_MSG_RESULT([yes])
3165else
3166  AC_MSG_RESULT([no])
3167fi
3168
3169## ----------------------------------------------------------------------
3170## Set some variables for general configuration information to be saved
3171## and installed with the libraries (used to generate libhdf5.settings).
3172##
3173
3174## HDF5 version from the first line of the README.txt file.
3175H5_VERSION="`cut -d' ' -f3 $srcdir/README.txt | head -1`"
3176AC_SUBST([H5_VERSION])
3177
3178## Configuration date
3179AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date`"
3180
3181## User doing the configuration
3182AC_SUBST([CONFIG_USER]) CONFIG_USER="`whoami`@`hostname`"
3183if test -n "$ORGANIZATION"; then
3184  CONFIG_USER="$CONFIG_USER at $ORGANIZATION"
3185fi
3186
3187## Configuration mode (production, debug, etc.) saved above.
3188AC_SUBST([CONFIG_MODE])
3189
3190## Byte sex from the AC_C_BIGENDIAN macro.
3191AC_SUBST([BYTESEX])
3192if test "X$ac_cv_c_bigendian" = "Xyes"; then
3193  BYTESEX="big-endian"
3194else
3195  BYTESEX="little-endian"
3196fi
3197
3198
3199if test "X$ac_cv_c_bigendian" = "Xyes"; then
3200  WORDS_BIGENDIAN="yes"
3201else
3202  WORDS_BIGENDIAN="no"
3203fi
3204AC_SUBST([WORDS_BIGENDIAN])
3205
3206## Parallel support? (set above except empty if none)
3207PARALLEL=${PARALLEL:-no}
3208
3209## Parallel writes to filtered datasets support?
3210PARALLEL_FILTERED_WRITES=${PARALLEL_FILTERED_WRITES:-no}
3211
3212## >2GB writes in parallel support?
3213LARGE_PARALLEL_IO=${LARGE_PARALLEL_IO:-no}
3214
3215## Compiler with version information. This consists of the full path
3216## name of the compiler and the reported version number.
3217AC_SUBST([CC_VERSION])
3218## Strip anything that looks like a flag off of $CC
3219CC_NOFLAGS=`echo $CC | sed 's/ -.*//'`
3220
3221if `echo $CC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
3222  CC_VERSION="$CC"
3223else
3224  CC_VERSION="$CC";
3225  for x in `echo $PATH | sed -e 's/:/ /g'`; do
3226    if test -x $x/$CC_NOFLAGS; then
3227      CC_VERSION="$x/$CC"
3228      break
3229    fi
3230  done
3231fi
3232if test -n "$cc_version_info"; then
3233  CC_VERSION="$CC_VERSION ( $cc_version_info)"
3234fi
3235
3236AC_SUBST([FC_VERSION])
3237## Strip anything that looks like a flag off of $FC
3238FC_NOFLAGS=`echo $FC | sed 's/ -.*//'`
3239
3240if `echo $FC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
3241  FC_VERSION="$FC"
3242else
3243  FC_VERSION="$FC";
3244  for x in `echo $PATH | sed -e 's/:/ /g'`; do
3245    if test -x $x/$FC_NOFLAGS; then
3246      FC_VERSION="$x/$FC"
3247      break
3248    fi
3249  done
3250fi
3251if test -n "$fc_version_info"; then
3252  FC_VERSION="$FC_VERSION ( $fc_version_info)"
3253fi
3254
3255AC_SUBST([CXX_VERSION])
3256## Strip anything that looks like a flag off of $CXX
3257CXX_NOFLAGS=`echo $CXX | sed 's/ -.*//'`
3258
3259if `echo $CXX_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
3260  CXX_VERSION="$CXX"
3261else
3262  CXX_VERSION="$CXX";
3263  for x in `echo $PATH | sed -e 's/:/ /g'`; do
3264    if test -x $x/$CXX_NOFLAGS; then
3265      CXX_VERSION="$x/$CXX"
3266      break
3267    fi
3268  done
3269fi
3270if test -n "$cxx_version_info"; then
3271  CXX_VERSION="$CXX_VERSION ( $cxx_version_info)"
3272fi
3273
3274AC_SUBST([JAVA_VERSION])
3275## Strip anything that looks like a flag off of $JAVA
3276JAVA_NOFLAGS=`echo $JAVA | sed 's/ -.*//'`
3277
3278if `echo $JAVA_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
3279  JAVA_VERSION="$JAVA"
3280else
3281  JAVA_VERSION="$JAVA";
3282  for x in `echo $PATH | sed -e 's/:/ /g'`; do
3283    if test -x $x/$JAVA_NOFLAGS; then
3284      JAVA_VERSION="$x/$JAVA"
3285      break
3286    fi
3287  done
3288fi
3289java_version_info=`$JAVA -version 2>&1 |\
3290  grep 'version' | sed -e 's/version "//' | sed -e 's/"//'`
3291if test -n "$java_version_info"; then
3292  JAVA_VERSION="$JAVA_VERSION ($java_version_info)"
3293fi
3294
3295## ----------------------------------------------------------------------
3296## Where is the root of the source tree. Give an absolute address so
3297## we can find it no matter which directory of the distribution is our
3298## current directory. The built-in pwd fails on some systems, but the
3299## /bin/pwd version works OK.
3300##
3301if test -x /bin/pwd; then
3302  pwd=/bin/pwd
3303else
3304  pwd=pwd
3305fi
3306AC_SUBST([ROOT]) ROOT="`$pwd`"
3307
3308## ----------------------------------------------------------------------
3309## Some programs shouldn't be built by default (e.g., programs to generate
3310## data files used by tests, some optional tests).
3311## Check if they want such programs built anyway.
3312##
3313AC_MSG_CHECKING([additional programs should be built])
3314AC_ARG_ENABLE([build-all],
3315     [AS_HELP_STRING([--enable-build-all],
3316                     [Build helper programs that only developers should need [default=no]])],
3317     [BUILD_ALL=$enableval],
3318     [BUILD_ALL=no])
3319
3320if test "X$BUILD_ALL" = "Xyes"; then
3321 echo "yes"
3322else
3323 echo "no"
3324fi
3325AM_CONDITIONAL([BUILD_ALL_CONDITIONAL], [test "X$BUILD_ALL" = "Xyes"])
3326
3327## ----------------------------------------------------------------------
3328## Enable deprecated public API symbols
3329##
3330
3331## Enabled unless the build mode is clean.
3332if test "X-$BUILD_MODE" = "X-clean" ; then
3333  DEPREC_SYMBOLS=no
3334else
3335  DEPREC_SYMBOLS=yes
3336fi
3337
3338AC_SUBST([DEPRECATED_SYMBOLS])
3339AC_MSG_CHECKING([if deprecated public symbols are available]);
3340AC_ARG_ENABLE([deprecated-symbols],
3341              [AS_HELP_STRING([--enable-deprecated-symbols],
3342                     [Enable deprecated public API symbols.
3343                     [default=yes (unless build mode = clean)]
3344                     ])],
3345              [DEPREC_SYMBOLS=$enableval])
3346
3347case "X-$DEPREC_SYMBOLS" in
3348  X-yes)
3349    AC_MSG_RESULT([yes])
3350    DEPRECATED_SYMBOLS=yes
3351    ;;
3352  X-no|*)
3353    AC_MSG_RESULT([no])
3354    DEPRECATED_SYMBOLS=no
3355    AC_DEFINE([NO_DEPRECATED_SYMBOLS], [1],
3356              [Define if deprecated public API symbols are disabled])
3357    ;;
3358esac
3359
3360## --------------------------------------------------------------------------
3361## Which version of the public APIs should the 'base' versioned symbols use?
3362##
3363
3364AC_SUBST([DEFAULT_API_VERSION])
3365AC_MSG_CHECKING([which version of public symbols to use by default])
3366AC_ARG_WITH([default-api-version],
3367            [AS_HELP_STRING([--with-default-api-version=(v16|v18|v110)],
3368                            [Specify default release version of public symbols
3369                             [default=v110]])],,
3370            [withval=v110])
3371
3372if test "X$withval" = "Xv16"; then
3373    AC_MSG_RESULT([v16])
3374    DEFAULT_API_VERSION=v16
3375    AC_DEFINE([USE_16_API_DEFAULT], [1],
3376              [Define using v1.6 public API symbols by default])
3377elif test "X$withval" = "Xv18"; then
3378    AC_MSG_RESULT([v18])
3379    DEFAULT_API_VERSION=v18
3380    AC_DEFINE([USE_18_API_DEFAULT], [1],
3381              [Define using v1.8 public API symbols by default])
3382elif test "X$withval" = "Xv110"; then
3383    AC_MSG_RESULT([v110])
3384    DEFAULT_API_VERSION=v110
3385    AC_DEFINE([USE_110_API_DEFAULT], [1],
3386              [Define using v1.10 public API symbols by default])
3387else
3388    AC_MSG_ERROR([invalid version of public symbols given])
3389fi
3390
3391## It's an error to try to disable deprecated public API symbols while
3392## choosing an older version of the public API as the default. However,
3393## if the user insists on doing this via the --enable-unsupported configure
3394## flag, we'll let them.
3395if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then
3396  if test "X${DEFAULT_API_VERSION}" != "Xv110" -a "X${DEPRECATED_SYMBOLS}" = "Xno" ; then
3397    AC_MSG_ERROR([Removing old public API symbols not allowed when using them as default public API symbols. Use --enable-unsupported to override this error.])
3398  fi
3399fi
3400
3401## ----------------------------------------------------------------------
3402## Enable strict file format checks
3403##
3404AC_SUBST([STRICT_FORMAT_CHECKS])
3405AC_MSG_CHECKING([whether to perform strict file format checks]);
3406AC_ARG_ENABLE([strict-format-checks],
3407              [AS_HELP_STRING([--enable-strict-format-checks],
3408                     [Enable strict file format checks.
3409                      [default=yes if debug build, otherwise no]
3410                     ])],
3411             [STRICT_FORMAT_CHECKS=$enableval])
3412
3413## Set the default level. This depends on the compiler mode.
3414if test "X-$STRICT_FORMAT_CHECKS" = X- ; then
3415  if test "X-$BUILD_MODE" = "X-debug" ; then
3416    STRICT_FORMAT_CHECKS=yes
3417  else
3418    STRICT_FORMAT_CHECKS=no
3419  fi
3420fi
3421
3422case "X-$STRICT_FORMAT_CHECKS" in
3423  X-yes)
3424    AC_MSG_RESULT([yes])
3425    AC_DEFINE([STRICT_FORMAT_CHECKS], [1],
3426              [Define if strict file format checks are enabled])
3427    ;;
3428  X-no)
3429    AC_MSG_RESULT([no])
3430    ;;
3431  *)
3432    AC_MSG_ERROR([Unrecognized value: $STRICT_FORMAT_CHECKS])
3433    ;;
3434esac
3435
3436
3437## ----------------------------------------------------------------------
3438## Enable use of pread/pwrite instead of read/write in certain VFDs.
3439##
3440AC_SUBST([PREADWRITE])
3441
3442## Check these first to avoid interspersed output in the AC_ARG_ENABLE line
3443## below. (Probably overkill to check for both, but we'll be extra careful)
3444PREADWRITE_HAVE_BOTH=yes
3445AC_CHECK_FUNC([pread], [], [PREADWRITE_HAVE_BOTH=no])
3446AC_CHECK_FUNC([pwrite], [], [PREADWRITE_HAVE_BOTH=no])
3447
3448AC_MSG_CHECKING([whether to use pread/pwrite instead of read/write in certain VFDs])
3449AC_ARG_ENABLE([preadwrite],
3450              [AS_HELP_STRING([--enable-preadwrite],
3451                              [Enable using pread/pwrite instead of read/write in sec2/log/core VFDs.
3452                              [default=yes if pread/pwrite are present]])],
3453              [PREADWRITE=$enableval])
3454
3455## Set the default level.
3456if test "X-$PREADWRITE" = X- ; then
3457  PREADWRITE=yes
3458fi
3459
3460case "X-$PREADWRITE" in
3461  X-yes)
3462      if test "X-$PREADWRITE_HAVE_BOTH" = "X-yes"; then
3463        AC_DEFINE([HAVE_PREADWRITE], [1], [Define if both pread and pwrite exist.])
3464        AC_MSG_RESULT([yes])
3465      else
3466        AC_MSG_RESULT([no])
3467      fi
3468    ;;
3469  X-no)
3470      AC_MSG_RESULT([no])
3471    ;;
3472  *)
3473      AC_MSG_ERROR([Unrecognized value: $PREADWRITE])
3474    ;;
3475esac
3476
3477
3478## ----------------------------------------------------------------------
3479## Enable embedded library information
3480##
3481AC_MSG_CHECKING([whether to have library information embedded in the executables])
3482AC_ARG_ENABLE([embedded-libinfo],
3483    [AS_HELP_STRING([--enable-embedded-libinfo],
3484    [Enable embedded library information [default=yes]])],
3485    [enable_embedded_libinfo=$enableval],
3486    [enable_embedded_libinfo=yes])
3487
3488   if test "${enable_embedded_libinfo}" = "yes"; then
3489      AC_MSG_RESULT([yes])
3490      AC_DEFINE([HAVE_EMBEDDED_LIBINFO], [1],
3491                [Define if library information should be embedded in the executables])
3492   else
3493      AC_MSG_RESULT([no])
3494    fi
3495
3496
3497## ----------------------------------------------------------------------
3498## Check if pointer alignments are enforced
3499##
3500AC_MSG_CHECKING([if alignment restrictions are strictly enforced])
3501
3502TEST_SRC="`(echo \"#define H5_NO_ALIGNMENT_RESTRICTIONS_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
3503
3504AC_RUN_IFELSE([
3505    AC_LANG_SOURCE([$TEST_SRC])
3506    ], [
3507    AC_DEFINE([NO_ALIGNMENT_RESTRICTIONS], [1], [Define if we can violate pointer alignment restrictions])
3508    AC_MSG_RESULT([no])
3509    ], [
3510    AC_MSG_RESULT([yes])
3511    ], [
3512    AC_MSG_RESULT([unknown, assuming yes])
3513    ])
3514
3515
3516## ----------------------------------------------------------------------
3517## Restore user's CFLAGS.
3518CFLAGS="$saved_user_CFLAGS"
3519FCFLAGS="$saved_user_FCFLAGS"
3520CXXFLAGS="$saved_user_CXXFLAGS"
3521CPPFLAGS="$saved_user_CPPFLAGS"
3522JAVACFLAGS="$saved_user_JAVACFLAGS"
3523JAVAFLAGS="$saved_user_JAVAFLAGS"
3524LDFLAGS="$saved_user_LDFLAGS"
3525
3526
3527## ----------------------------------------------------------------------
3528## Create automake conditionals to tell automake makefiles which directories
3529## need to be compiled
3530
3531AM_CONDITIONAL([BUILD_CXX_CONDITIONAL], [test "X$HDF_CXX" = "Xyes"])
3532AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test "X$PARALLEL" = "Xyes"])
3533AM_CONDITIONAL([BUILD_FORTRAN_CONDITIONAL], [test "X$HDF_FORTRAN" = "Xyes"])
3534AM_CONDITIONAL([BUILD_JAVA_CONDITIONAL], [test "X$HDF_JAVA" = "Xyes"])
3535AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"])
3536AM_CONDITIONAL([BUILD_TESTS_CONDITIONAL], [test "X$HDF5_TESTS" = "Xyes"])
3537AM_CONDITIONAL([BUILD_TESTS_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"])
3538AM_CONDITIONAL([BUILD_TOOLS_CONDITIONAL], [test "X$HDF5_TOOLS" = "Xyes"])
3539
3540## ----------------------------------------------------------------------
3541## Build the Makefiles.
3542##
3543
3544## The directory search list
3545AC_SUBST([SEARCH]) SEARCH='$(srcdir) $(top_builddir)/src $(top_srcdir)/src'
3546export SEARCH
3547
3548## Some cleanup stuff
3549rm -f conftest conftest.o conftest.c dummy.o *.mod
3550
3551## Build config.status, touch the stamp files, and build all the Makefiles.
3552## The order is such that the first `make' does not need to update any
3553## configuration information. See config/commence.in for the order in which
3554## things need to be done.
3555
3556## First the stamp1 file for H5config.h.in
3557mkdir ./config >/dev/null 2>&1
3558touch ./config/stamp1
3559
3560## Then the config.status file (but not makefiles)
3561saved_no_create=$no_create
3562no_create=yes
3563
3564PARALLEL_MAKE=""
3565FORTRAN_PARALLEL_MAKE=""
3566
3567if test -n "$TESTPARALLEL"; then
3568  PARALLEL_MAKE="$TESTPARALLEL/Makefile"
3569
3570  if test "X$HDF_FORTRAN" = "Xyes"; then
3571    FORTRAN_PARALLEL_MAKE=fortran/$TESTPARALLEL/Makefile
3572  fi
3573fi
3574LT_OUTPUT
3575no_create=$saved_no_create
3576
3577## Then the stamp2 file for H5config.h
3578touch ./config/stamp2
3579
3580## Finally the makefiles
3581test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
3582
3583## Are we compiling static libraries, shared libraries, or both?  This
3584## is only used for the libhdf5.settings file. We can't just look at
3585## $enable_static and $enable_shared because if they're yes the ltconfig
3586## might have decided that one or the other is simply not possible.
3587## Therefore we have to ask the generated `libtool' shell script
3588## which 'features' it has enabled.
3589if (./libtool --features | grep '^enable shared libraries' > /dev/null); then
3590  enable_shared=yes
3591else
3592  enable_shared=no
3593fi
3594
3595if (./libtool --features | grep '^enable static libraries' > /dev/null); then
3596  enable_static=yes
3597else
3598  enable_static=no
3599fi
3600
3601## Expose things for *.in markup
3602AC_SUBST([STATIC_SHARED])
3603AC_SUBST([enable_shared])
3604AC_SUBST([enable_static])
3605
3606if test "X$enable_static" = "Xyes" && test "X$enable_shared" = "Xyes"; then
3607  STATIC_SHARED="static, shared"
3608elif test "X$enable_static" = "Xyes"; then
3609  STATIC_SHARED="static"
3610elif test "X$enable_shared" = "Xyes"; then
3611  STATIC_SHARED="shared"
3612else
3613  STATIC_SHARED="none"
3614fi
3615
3616if test "X$HDF_FORTRAN" = "Xyes"; then
3617
3618  ### libtool does not pass the correct argument linking (-Wl,-Wl,,) for the NAG Fortran compiler
3619  ### on Linux (other OSs have not been tested).
3620  ### Therefore, detect if we are using the NAG Fortran compiler, and replace the wl="-Wl," for Fortran to
3621  ### wl="-Wl,-Wl,," in the libtool file. (HDFFV-10037)
3622  case "`uname`" in
3623    Linux*)
3624
3625    fortran_linux_linker_option="-Wl,"
3626    if test "X$FC_BASENAME" = "Xnagfor"; then
3627       fortran_linux_linker_option="-Wl,-Wl,,"
3628    fi
3629
3630    ## Set the correct linker option for use in h5fc.in markup
3631    AC_SUBST([fortran_linux_linker_option])
3632    ;;
3633  esac
3634
3635fi
3636
3637## ----------------------------------------------------------------------
3638## Set a macro if shared library is enabled.
3639##
3640AM_CONDITIONAL([HAVE_SHARED_CONDITIONAL], [test "X$enable_shared" = "Xyes"])
3641
3642AC_CONFIG_FILES([src/libhdf5.settings
3643                 Makefile
3644                 src/Makefile
3645                 test/Makefile
3646                 test/H5srcdir_str.h
3647                 test/testabort_fail.sh
3648                 test/testcheck_version.sh
3649                 test/testerror.sh
3650                 test/testexternal_env.sh
3651                 test/testflushrefresh.sh
3652                 test/testlibinfo.sh
3653                 test/testlinks_env.sh
3654                 test/testswmr.sh
3655                 test/testvds_env.sh
3656                 test/testvdsswmr.sh
3657                 test/test_filter_plugin.sh
3658                 test/test_usecases.sh
3659                 testpar/Makefile
3660                 testpar/testpflush.sh
3661                 tools/Makefile
3662                 tools/lib/Makefile
3663                 tools/libtest/Makefile
3664                 tools/src/Makefile
3665                 tools/src/h5dump/Makefile
3666                 tools/src/h5import/Makefile
3667                 tools/src/h5diff/Makefile
3668                 tools/src/h5jam/Makefile
3669                 tools/src/h5repack/Makefile
3670                 tools/src/h5ls/Makefile
3671                 tools/src/h5copy/Makefile
3672                 tools/src/misc/Makefile
3673                 tools/src/h5stat/Makefile
3674                 tools/test/Makefile
3675                 tools/test/h5dump/Makefile
3676                 tools/test/h5dump/h5dump_plugin.sh
3677                 tools/test/h5dump/testh5dump.sh
3678                 tools/test/h5dump/testh5dumppbits.sh
3679                 tools/test/h5dump/testh5dumpvds.sh
3680                 tools/test/h5dump/testh5dumpxml.sh
3681                 tools/test/h5ls/Makefile
3682                 tools/test/h5ls/h5ls_plugin.sh
3683                 tools/test/h5ls/testh5ls.sh
3684                 tools/test/h5ls/testh5lsvds.sh
3685                 tools/test/h5import/Makefile
3686                 tools/test/h5import/h5importtestutil.sh
3687                 tools/test/h5diff/Makefile
3688                 tools/test/h5diff/h5diff_plugin.sh
3689                 tools/test/h5diff/testh5diff.sh
3690                 tools/test/h5diff/testph5diff.sh
3691                 tools/src/h5format_convert/Makefile
3692                 tools/test/h5format_convert/Makefile
3693                 tools/test/h5format_convert/testh5fc.sh
3694                 tools/test/h5jam/Makefile
3695                 tools/test/h5jam/testh5jam.sh
3696                 tools/test/h5repack/Makefile
3697                 tools/test/h5repack/h5repack.sh
3698                 tools/test/h5repack/h5repack_plugin.sh
3699                 tools/test/h5copy/Makefile
3700                 tools/test/h5copy/testh5copy.sh
3701                 tools/test/misc/Makefile
3702                 tools/test/misc/testh5clear.sh
3703                 tools/test/misc/testh5mkgrp.sh
3704                 tools/test/misc/testh5repart.sh
3705                 tools/test/misc/vds/Makefile
3706                 tools/test/h5stat/Makefile
3707                 tools/test/h5stat/testh5stat.sh
3708                 tools/test/perform/Makefile
3709                 examples/Makefile
3710                 examples/run-c-ex.sh
3711                 examples/testh5cc.sh
3712                 bin/h5cc
3713                 bin/Makefile
3714                 c++/Makefile
3715                 c++/src/Makefile
3716                 c++/src/h5c++
3717                 c++/test/Makefile
3718                 c++/test/H5srcdir_str.h
3719                 c++/examples/Makefile
3720                 c++/examples/run-c++-ex.sh
3721                 c++/examples/testh5c++.sh
3722                 fortran/Makefile
3723                 fortran/src/h5fc
3724                 fortran/src/Makefile
3725                 fortran/src/H5fort_type_defines.h
3726                 fortran/test/Makefile
3727                 fortran/testpar/Makefile
3728                 fortran/examples/Makefile
3729                 fortran/examples/run-fortran-ex.sh
3730                 fortran/examples/testh5fc.sh
3731                 java/Makefile
3732                 java/src/Makefile
3733                 java/src/jni/Makefile
3734                 java/test/Makefile
3735                 java/test/junit.sh
3736                 java/examples/Makefile
3737                 java/examples/intro/Makefile
3738                 java/examples/intro/JavaIntroExample.sh
3739                 java/examples/datasets/Makefile
3740                 java/examples/datasets/JavaDatasetExample.sh
3741                 java/examples/datatypes/Makefile
3742                 java/examples/datatypes/JavaDatatypeExample.sh
3743                 java/examples/groups/Makefile
3744                 java/examples/groups/JavaGroupExample.sh
3745                 hl/Makefile
3746                 hl/src/Makefile
3747                 hl/test/Makefile
3748                 hl/test/H5srcdir_str.h
3749                 hl/tools/Makefile
3750                 hl/tools/gif2h5/Makefile
3751                 hl/tools/gif2h5/h52giftest.sh
3752                 hl/tools/h5watch/Makefile
3753                 hl/tools/h5watch/testh5watch.sh
3754                 hl/examples/Makefile
3755                 hl/examples/run-hlc-ex.sh
3756                 hl/c++/Makefile
3757                 hl/c++/src/Makefile
3758                 hl/c++/test/Makefile
3759                 hl/c++/examples/Makefile
3760                 hl/c++/examples/run-hlc++-ex.sh
3761                 hl/fortran/Makefile
3762                 hl/fortran/src/Makefile
3763                 hl/fortran/test/Makefile
3764                 hl/fortran/examples/Makefile
3765                 hl/fortran/examples/run-hlfortran-ex.sh])
3766
3767AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes;
3768                $MKDIR_P java/test/.classes;
3769                $MKDIR_P java/examples/intro/.classes;
3770                $MKDIR_P java/examples/datasets/.classes;
3771                $MKDIR_P java/examples/datatypes/.classes;
3772                $MKDIR_P java/examples/groups/.classes])
3773
3774AC_OUTPUT
3775
3776chmod 755 bin/h5cc
3777if test "X$HDF_CXX" = "Xyes"; then
3778  chmod 755 c++/src/h5c++
3779fi
3780
3781
3782if test "X$HDF_FORTRAN" = "Xyes"; then
3783  chmod 755 fortran/src/h5fc
3784  ## libtool does not pass the correct argument linker (wl=) for the Intel Fortran compiler
3785  ## on OS X, which is needed when building shared libraries on OS X.  This script
3786  ## replaces the 3rd occurrence, which is for Fortran, of wl="" with wl="-Wl," (HDFFV-2772)
3787  case "`uname`" in
3788    Darwin*)
3789      cat libtool | awk '/wl=\"/{c++;if(c==3){sub("wl=\"\"","wl=\"-Wl,\"");c=0}}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool
3790      ;;
3791  esac
3792
3793  ### libtool does not pass the correct argument linking (-Wl,-Wl,,) for the NAG Fortran compiler
3794  ### on Linux (other OSs have not been tested).
3795  ### Therefore, detect if we are using the NAG Fortran compiler, and replace the wl="-Wl," for Fortran to
3796  ### wl="-Wl,-Wl,," in the libtool file. (HDFFV-10037)
3797  case "`uname`" in
3798    Linux*)
3799      if test "X$FC_BASENAME" = "Xnagfor"; then
3800         cat libtool | awk '/BEGIN LIBTOOL TAG CONFIG: FC/{flag=1}flag&&/wl=/{$NF="wl=\"-Wl,-Wl,,\"";flag=0}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool
3801      fi
3802      ;;
3803  esac
3804fi
3805
3806## HDF5 configure code created by autotools with gcc 4.9.2 is adding problematic
3807## linker flags:  -l with no library name; -l <libname>, specifically gfortran or m.
3808## This sed script corrects "-l <libname>" first and then "-l " with no library name.
3809## If the order is not preserved, all instances of "-l " will be removed.
3810sed -e '/^postdeps/ s/-l \([a-zA-Z]\)/-l\1/g' -e '/^postdeps/ s/-l //g' -i libtool
3811
3812## show the configure settings
3813cat src/libhdf5.settings
3814