1dnl This file is part of MED. 2dnl 3dnl COPYRIGHT (C) 1999 - 2019 EDF R&D, CEA/DEN 4dnl MED is free software: you can redistribute it and/or modify 5dnl it under the terms of the GNU Lesser General Public License as published by 6dnl the Free Software Foundation, either version 3 of the License, or 7dnl (at your option) any later version. 8dnl 9dnl MED is distributed in the hope that it will be useful, 10dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12dnl GNU Lesser General Public License for more details. 13dnl 14dnl You should have received a copy of the GNU Lesser General Public License 15dnl along with MED. If not, see <http://www.gnu.org/licenses/>. 16dnl 17 18AC_DEFUN([MED_CHECK_TYPEOF_HIDT], [ 19AC_REQUIRE([MED_CHECK_HDF5]) 20 21## Guess where as hid_t type is provided by --with-hid_t option 22## or auto-detection must be used 23 24AC_ARG_WITH([hid_t], 25 AC_HELP_STRING([--with-hid_t=<C type>], 26 [Use <C type int or long> for hid_t (autodetect by default)]), 27 [], 28 [withval=no]) 29 30#Si l'interface fortran n'est pas générée ne lance pas les tests avec compilation 31#La taille du hid_t est déduite de la version d'HDF. 32#A partir d'HDF 1.10 hid_t est 64 bits 33test x"$withval" = xno && test x"$enable_fortran" && ( test "0${HDF5_VERSION}" -gt "10899" && withval=long || withval=int ) 34 35dnl Si aucune directive n est donnée, on vérifie la taille du hid_t induit de la version HDF utilisée 36dnl et on vérifie la cohérence avec la taille réelle de l entier Fortran. 37dnl Pour la cross-compilation, il ne faut pas lancer un test de compilation 38dnl -> l utilisateur spécifie le type à utiliser : int ou long 39if test x"$withval" = xno 40then 41 ## Guess the fortran int size 42 CPPFLAGS_save="$CPPFLAGS" 43 CPPFLAGS="-I$hdf5include $CPPFLAGS " 44 AC_CHECK_SIZEOF(hid_t,[],[#include <H5Ipublic.h>]) 45 CPPFLAGS="$CPPFLAGS_save" 46 if test "x$ac_cv_sizeof_hid_t" = "x8" ; then 47 test "0${HDF5_VERSION}" -lt "11000" && AC_MSG_ERROR([Size of the hid_t HDF5 type should not be eight bytes for HDF5 version < 1.10]) 48 AC_DEFINE(HAVE_F77HIDT64,[], 49 [The size of a Fortran integer for hid_t C type, as computed by sizeof.]) 50 AC_CHECK_SIZEOF_FORTRAN(integer*8) 51 test "x$ac_cv_sizeof_fortran_integerp8" = "x8" || AC_MSG_ERROR([Size of integer*8 F type is expected to be eight bytes]) 52 HIDT_I8_OR_I4="integer*8" 53 elif test "x$ac_cv_sizeof_hid_t" = "x4" ; then 54 test "0${HDF5_VERSION}" -ge "11000" && AC_MSG_ERROR([Size of the hid_t HDF5 type should not be four bytes for HDF5 version >= 1.10]) 55 AC_CHECK_SIZEOF_FORTRAN(integer*4) 56 test "x$ac_cv_sizeof_fortran_integerp4" = "x4" || AC_MSG_ERROR([Size of integer*4 F type is expected to be four bytes]) 57 HIDT_I8_OR_I4="integer*4" 58 else 59 AC_MSG_ERROR([Size of hid_t HDF5 type is neither four nor eight bytes]) 60 fi 61 62else 63 if test "x$withval" = "xlong" ; then 64 test "0${HDF5_VERSION}" -lt "11000" && AC_MSG_ERROR([Size of the hid_t HDF5 type should not be eight bytes for HDF5 version < 1.10]) 65 AC_DEFINE(HAVE_F77HIDT64,[], 66 [The size of a Fortran integer for hid_t C type, as computed by sizeof.]) 67 AC_MSG_WARN([Be careful that --with-hid_t=long implies using HDF 1.10.z]) 68 elif test ! "x$withval" = "xint" ; then 69 AC_MSG_ERROR([--with-hid_t must be equal to int or long !]) 70 fi 71 test ! "x$withval" = "xint" && test "0${HDF5_VERSION}" -ge "11000" && AC_MSG_ERROR([Size of the hid_t HDF5 type should not be four bytes for HDF5 version >= 1.10]) 72 73 HID_LONG_OR_INT="$withval" 74 AC_MSG_NOTICE([Using type $withval for hid_t]) 75fi 76 77AC_SUBST(HIDT_I8_OR_I4) 78 79]) 80