📄 hdf5.m4
字号:
dnl ######################################################################dnldnl File: hdf5.m4dnldnl Purpose: Determine the locations of hdf5 includes and librariesdnldnl Version: $Id: hdf5.m4,v 1.41 2005/08/09 16:48:24 rmtrines Exp $dnldnl Tech-X configure systemdnldnl This m4 file defines:dnl HAVE_HDF5dnl HDF5_INCDIRdnl HDF5_INCdnl HDF5_LIBDIRdnl HDF5_LIBdnl HDF5_LIBDIRdnl SZ_LIBdnldnl 2005-02-30 - SEKdnl Added hdf5 enable option for codes that do not require hdf5dnl ######################################################################dnl ######################################################################dnldnl Allow the user to specify an overall hdf5 directory. If specified,dnl we look for include and lib under this.dnldnl ######################################################################AC_ARG_ENABLE(hdf5,[ --enable-hdf5 Use HDF5], [case "${enableval}" in yes | no) ac_cv_have_hdf5="${enableval}" ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-HDF5) ;; esac], [ac_cv_have_hdf5=yes])AC_ARG_WITH(hdf5-dir,[ --with-hdf5-dir=<location of hdf5 installation> ],HDF5_DIR="$withval",HDF5_DIR="")if test -n "$MUST_HAVE_H5DIFF"; then if test $ac_cv_have_hdf5 = no; then AC_MSG_WARN(This project must have HDF5, so you cannot switch it off. Turning HDF5 back on.) ac_cv_have_hdf5=yes fifidnl ######################################################################dnldnl Find hdf5 includes - looking in include location if present,dnl otherwise in dir/include if present, otherwise in default locations,dnl first parallel, then serial.dnldnl ######################################################################if test $ac_cv_have_hdf5 = yes; then AC_ARG_WITH(hdf5-incdir,[ --with-hdf5-incdir=<location of hdf5 includes> ], HDF5_INCDIR="$withval",HDF5_INCDIR="") if test -n "$HDF5_INCDIR"; then HDF5_INCPATH=$HDF5_INCDIR elif test -n "$HDF5_DIR"; then HDF5_INCPATH=$HDF5_DIR/include elif test "$MPI" = yes; then HDF5_INCPATH=/usr:$HOME/hdf5mpi/include:/usr/local/hdf5mpi/include:/loc/hdf5mpi/include:$HOME/hdf5/include:/usr/local/hdf5/include:/loc/hdf5/include:/usr/common/usg/hdf5/default/parallel/include:/usr/local/include else HDF5_INCPATH=/usr:$HOME/hdf5/include:/usr/local/hdf5/include:/loc/hdf5/include:$HOME/hdf5mpi/include:/usr/local/hdf5mpi/include:/loc/hdf5mpi/include:/usr/common/usg/hdf5/default/serial/include fi AC_PATH_PROGS(HDF5_H, hdf5.h, "", $HDF5_INCPATH) if test -z "$HDF5_H"; then AC_MSG_WARN(hdf5.h not found in $HDF5_INCPATH. Set with --with-hdf5-incdir=) HDF5_INC=" " ac_cv_have_hdf5=no else HDF5_INCDIR=`dirname $HDF5_H` AC_SUBST(HDF5_INCDIR) HDF5_INC=-I$HDF5_INCDIR AC_SUBST(HDF5_INC) HDF5_DIR=`dirname $HDF5_INCDIR` ac_cv_have_hdf5=yes fifidnl ######################################################################dnldnl See if built paralleldnldnl ######################################################################if test $ac_cv_have_hdf5 = yes; then if test -f $HDF5_INCDIR/H5config.h; then hdf5par=`grep "HAVE_PARALLEL 1" $HDF5_INCDIR/H5config.h` elif test -f $HDF5_INCDIR/H5pubconf.h; then hdf5par=`grep "HAVE_PARALLEL 1" $HDF5_INCDIR/H5pubconf.h` fifidnl ######################################################################dnldnl Find hdf5 librariesdnldnl ######################################################################AC_ARG_WITH(hdf5-libdir,[ --with-hdf5-libdir=<location of hdf5 library> ],HDF5_LIBDIR="$withval",HDF5_LIBDIR="")if test $ac_cv_have_hdf5 = yes; then if test -n "$HDF5_LIBDIR"; then HDF5_LIBPATH=$HDF5_LIBDIR else HDF5_LIBPATH=$HDF5_DIR/lib fi # echo HDF5_LIBPATH=$HDF5_LIBPATH # echo HDF5_LIBDIR=$HDF5_LIBDIR AC_PATH_PROGS(LIBHDF5_A, libhdf5.a,"", $HDF5_LIBPATH) if test -z "$LIBHDF5_A"; then AC_MSG_WARN(libhdf5.a not found. Set with --with-hdf5-libdir=) ac_cv_have_hdf5=no HDF5_LIB=" " else HDF5_LIBDIR=`dirname $LIBHDF5_A` AC_SUBST(HDF5_LIBDIR)dnl HDF5_LIB="-L$HDF5_LIBDIR '$(RPATH_FLAG)'$HDF5_LIBDIR -lhdf5" HDF5_LIB="-L$HDF5_LIBDIR -lhdf5" fi AC_SUBST(HDF5_LIB) AC_SUBST(HDF5_LIBDIR)fidnl ######################################################################dnldnl Find the hdf5 compression librarydnldnl ######################################################################if test -f $HDF5_LIBDIR/libsz.a -o -f $HDF5_LIBDIR/libsz.so; then SZ_LIB=-lszfiAC_SUBST(SZ_LIB)dnl ######################################################################dnldnl Define for whether hdf5 founddnldnl ######################################################################if test $ac_cv_have_hdf5 = yes; then AC_DEFINE([HAVE_HDF5], [], [tells if the HDF5 library is present])fidnl ######################################################################dnldnl Determine version - as H5Sselect_hyperslab interface changeddnldnl ######################################################################if test $ac_cv_have_hdf5 = yes; then H5_VERS_MAJOR=`grep '#define H5_VERS_MAJOR' $HDF5_INCDIR/H5public.h | sed 's/^.*H5_VERS_MAJOR//' | sed 's/\/.*$//' | tr -d [:space:]` H5_VERS_MINOR=`grep '#define H5_VERS_MINOR' $HDF5_INCDIR/H5public.h | sed 's/^.*H5_VERS_MINOR//' | sed 's/\/.*$//' | tr -d [:space:]` H5_VERS_RELEASE=`grep '#define H5_VERS_RELEASE' $HDF5_INCDIR/H5public.h | sed 's/^.*H5_VERS_RELEASE//' | sed 's/\/.*$//' | tr -d [:space:]` unset new_H5Sselect_hyperslab_ifc if test $H5_VERS_MAJOR -gt 1; then new_H5Sselect_hyperslab_ifc=true elif test $H5_VERS_MAJOR = 1; then if test $H5_VERS_MINOR -gt 6; then new_H5Sselect_hyperslab_ifc=true elif test $H5_VERS_MINOR = 6; then if test $H5_VERS_RELEASE -ge 4; then new_H5Sselect_hyperslab_ifc=true fi fi fi if test -n "$new_H5Sselect_hyperslab_ifc"; then AC_DEFINE([NEW_H5S_SELECT_HYPERSLAB_IFC], [], [whether the new H5Sselect_hyperslab interface is in use]) fifidnl ######################################################################dnl h5diffdnl dnl ######################################################################if test $ac_cv_have_hdf5 = yes; then HDF5_BINPATH=`dirname $HDF5_LIBDIR`/bin AC_PATH_PROGS(H5DIFF, h5diff, "", $HDF5_BINPATH) if test -z "$H5DIFF"; then if test -n "$MUST_HAVE_H5DIFF"; then AC_MSG_ERROR(h5diff not found in HDF5 tree. Must reinstall HDF5.) fi else AC_SUBST(H5DIFF) if test -z "$new_H5Sselect_hyperslab_ifc"; then if test -n "$MUST_HAVE_H5DIFF"; then AC_MSG_ERROR(HDF5 must be at version 1.6.4 for regression tests to work.) fi else echo h5diff of version 1.6.4 or greater found. fi fielse if test -n "$MUST_HAVE_H5DIFF"; then AC_MSG_ERROR(HDF5 not properly installed, but this project needs it. Must reinstall HDF5.) fifidnl ######################################################################dnl Fortran support. dnl Problem is that hdf5 f90 wrappers need to be compiled with same dnl compiler as code compiler. Perform check using hdf5 settings filednl Note to use this functionality, one needs to set in configure.in:dnl ac_use_fortran_hdf5=true # Perform fortan hdf5 testsdnl ######################################################################if test "$FC_BASE" != none && test -n "$FC_BASE" && test $ac_use_fortran_hdf5 = true; then dnl test to make sure hdf5_fortran exists if test -f $HDF5_LIBDIR/libhdf5_fortran.a; then dnl test to make sure hdf5_fortran exists hdf5_f90_full=`grep 'Fortran Compiler' $HDF5_LIBDIR/libhdf5_fortran.settings | cut -f2 -d:` hdf5_f90=`basename $hdf5_f90_full` if test "$FC_BASE" = $hdf5_f90; then dnl This is to handle the Absoft weirdness HDF5_INCLUDES="$FC_INCLUDE_FLAG$HDF5_LIBDIR" HDF5_LIB="-L$HDF5_LIBDIR -lhdf5_fortran -lhdf5" AC_SUBST(HDF5_LIB) AC_SUBST(HDF5_INCLUDES) else AC_MSG_WARN(Fortran compiler used to compile hdf5 bindings -- $hdf5_f90 not the same as your fortran compiler -- $FC. Turning off hdf5.) ac_cv_have_hdf5=no HDF5_DIR="" HDF5_LIB="" HDF5_LIBDIR="" HDF5_INC="" HDF5_INCDIR="" fi else AC_MSG_WARN(hdf5_fortran.a not found in $HDF5_LIBDIR. Turning off HDF5) ac_cv_have_hdf5=no HDF5_DIR="" HDF5_LIB="" HDF5_LIBDIR="" HDF5_INC="" HDF5_INCDIR="" fifi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -