Next: , Previous: , Up: The Macros  


ax_lib_hdf5

Synopsis

AX_LIB_HDF5([serial/parallel])

Description

This macro provides tests of the availability of HDF5 library.

The optional macro argument should be either ’serial’ or ’parallel’. The former only looks for serial HDF5 installations via h5cc. The latter only looks for parallel HDF5 installations via h5pcc. If the optional argument is omitted, serial installations will be preferred over parallel ones.

The macro adds a –with-hdf5 option accepting one of three values:

  no   - do not check for the HDF5 library.
  yes  - do check for HDF5 library in standard locations.
  path - complete path to the HDF5 helper script h5cc or h5pcc.

If HDF5 is successfully found, this macro calls

  AC_SUBST(HDF5_VERSION)
  AC_SUBST(HDF5_CC)
  AC_SUBST(HDF5_CFLAGS)
  AC_SUBST(HDF5_CPPFLAGS)
  AC_SUBST(HDF5_LDFLAGS)
  AC_SUBST(HDF5_LIBS)
  AC_SUBST(HDF5_FC)
  AC_SUBST(HDF5_FFLAGS)
  AC_SUBST(HDF5_FLIBS)
  AC_DEFINE(HAVE_HDF5)

and sets with_hdf5="yes". Additionally, the macro sets with_hdf5_fortran="yes" if a matching Fortran wrapper script is found. Note that Autconf’s Fortran support is not used to perform this check. H5CC and H5FC will contain the appropriate serial or parallel HDF5 wrapper script locations.

If HDF5 is disabled or not found, this macros sets with_hdf5="no" and with_hdf5_fortran="no".

Your configuration script can test $with_hdf to take any further actions. HDF5_{C,CPP,LD}FLAGS may be used when building with C or C++. HDF5_F{FLAGS,LIBS} should be used when building Fortran applications.

To use the macro, one would code one of the following in "configure.ac" before AC_OUTPUT:

  1) dnl Check for HDF5 support
     AX_LIB_HDF5()
  2) dnl Check for serial HDF5 support
     AX_LIB_HDF5([serial])
  3) dnl Check for parallel HDF5 support
     AX_LIB_HDF5([parallel])

One could test $with_hdf5 for the outcome or display it as follows

  echo "HDF5 support:  $with_hdf5"

You could also for example, override the default CC in "configure.ac" to enforce compilation with the compiler that HDF5 uses:

  AX_LIB_HDF5([parallel])
  if test "$with_hdf5" = "yes"; then
          CC="$HDF5_CC"
  else
          AC_MSG_ERROR([Unable to find HDF5, we need parallel HDF5.])
  fi

Source Code

Download the latest version of ax_lib_hdf5.m4 or browse the macro’s revision history.

License

Copyright © 2009 Timothy Brown tbrown@freeshell.org
Copyright © 2010 Rhys Ulerich rhys.ulerich@gmail.com

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.


Next: , Previous: , Up: The Macros