From 24b11709aff9e88de172342faed165ec08985e42 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Mar 2017 12:58:49 -0500 Subject: Update cmake pubconf to match autotools and add strtoll checks --- config/cmake/H5pubconf.h.in | 95 +++++++++++++++++++++++------- config/cmake_ext_mod/ConfigureChecks.cmake | 16 +++-- configure.ac | 1 + src/H5private.h | 8 ++- src/H5system.c | 33 ++++++----- src/H5win32defs.h | 16 ++++- 6 files changed, 124 insertions(+), 45 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 5dad4f3..55de8f8 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -41,17 +41,41 @@ /* As FC_FUNC, but for C identifiers containing underscores. */ #define @H5_FC_FUNC_@ -/* Define Fortran Maximum Real Decimal Precision */ -#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ - -/* Define C Maximum Real Decimal Precision */ -#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ +/* Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE */ +#cmakedefine H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ /* Define if we have Fortran C_LONG_DOUBLE */ #cmakedefine H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ -/* Determine if __float128 is available */ -#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ +/* Define if we have Fortran intrinsic C_SIZEOF */ +#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ + +/* Define if we have Fortran intrinsic SIZEOF */ +#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ + +/* Define if we have Fortran intrinsic STORAGE_SIZE */ +#cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ + +/* Determine the size of C long double */ +#cmakedefine H5_FORTRAN_SIZEOF_LONG_DOUBLE @H5_FORTRAN_SIZEOF_LONG_DOUBLE@ + +/* Define Fortran compiler ID */ +#cmakedefine H5_Fortran_COMPILER_ID @H5_Fortran_COMPILER_ID@ + +/* Define valid Fortran INTEGER KINDs */ +#cmakedefine H5_H5CONFIG_F_IKIND @H5_HH5_H5CONFIG_F_NUM_RKIND5CONFIG_F_IKIND@ + +/* Define number of valid Fortran INTEGER KINDs */ +#cmakedefine H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@ + +/* Define number of valid Fortran REAL KINDs */ +#cmakedefine H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@ + +/* Define valid Fortran REAL KINDs */ +#cmakedefine H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@ + +/* Define valid Fortran REAL KINDs Sizeof */ +#cmakedefine H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@ /* Define to 1 if you have the `alarm' function. */ #cmakedefine H5_HAVE_ALARM @H5_HAVE_ALARM@ @@ -81,7 +105,7 @@ /* Define to 1 if you have the `difftime' function. */ #cmakedefine H5_HAVE_DIFFTIME @H5_HAVE_DIFFTIME@ -/* Define if the direct I/O virtual file driver should be compiled */ +/* Define if the direct I/O virtual file driver (VFD) should be compiled */ #cmakedefine H5_HAVE_DIRECT @H5_HAVE_DIRECT@ /* Define to 1 if you have the header file. */ @@ -108,6 +132,9 @@ /* Define if support for szip filter is enabled */ #cmakedefine H5_HAVE_FILTER_SZIP @H5_HAVE_FILTER_SZIP@ +/* Determine if __float128 is available */ +#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ + /* Define to 1 if you have the `flock' function. */ #cmakedefine H5_HAVE_FLOCK @H5_HAVE_FLOCK@ @@ -162,7 +189,7 @@ /* Define if the compiler understands inline */ #cmakedefine H5_HAVE_INLINE @H5_HAVE_INLINE@ -/* Define if library will contain instrumentation to detect correct +/* Define if parallel library will contain instrumentation to detect correct optimization operation */ #cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@ @@ -244,8 +271,8 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_PTHREAD_H @H5_HAVE_PTHREAD_H@ -/* Define to 1 if you have the 'InitOnceExecuteOnce' function. */ -#cmakedefine H5_HAVE_WIN_THREADS @H5_HAVE_WIN_THREADS@ +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_QUADMATH_H @H5_HAVE_QUADMATH_H@ /* Define to 1 if you have the `random' function. */ #cmakedefine H5_HAVE_RANDOM @H5_HAVE_RANDOM@ @@ -254,10 +281,10 @@ #cmakedefine H5_HAVE_RAND_R @H5_HAVE_RAND_R@ /* Define to 1 if you have the `round' function. */ -#cmakedefine H5_HAVE_ROUNDF @H5_HAVE_ROUNDF@ +#cmakedefine H5_HAVE_ROUND @H5_HAVE_ROUND@ /* Define to 1 if you have the `roundf' function. */ -#cmakedefine H5_HAVE_ROUND @H5_HAVE_ROUND@ +#cmakedefine H5_HAVE_ROUNDF @H5_HAVE_ROUNDF@ /* Define to 1 if you have the `setjmp' function. */ #cmakedefine H5_HAVE_SETJMP @H5_HAVE_SETJMP@ @@ -292,6 +319,9 @@ /* Define if `struct stat' has the `st_blocks' field */ #cmakedefine H5_HAVE_STAT_ST_BLOCKS @H5_HAVE_STAT_ST_BLOCKS@ +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_STDBOOL_H @H5_HAVE_STDBOOL_H@ + /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_STDDEF_H @H5_HAVE_STDDEF_H@ @@ -307,6 +337,12 @@ /* Define to 1 if you have the `strdup' function. */ #cmakedefine H5_HAVE_STRDUP @H5_HAVE_STRDUP@ +/* Define to 1 if you have the `strtoll' function. */ +#cmakedefine H5_HAVE_STRTOLL @H5_HAVE_STRTOLL@ + +/* Define to 1 if you have the `strtoull' function. */ +#cmakedefine H5_HAVE_STRTOULL @H5_HAVE_STRTOULL@ + /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_STRINGS_H @H5_HAVE_STRINGS_H@ @@ -325,6 +361,9 @@ /* Define to 1 if you have the `system' function. */ #cmakedefine H5_HAVE_SYSTEM @H5_HAVE_SYSTEM@ +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_SYS_FILE_H @H5_HAVE_SYS_FILE_H@ + /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_SYS_IOCTL_H @H5_HAVE_SYS_IOCTL_H@ @@ -379,6 +418,9 @@ /* Define to 1 if you have the `waitpid' function. */ #cmakedefine H5_HAVE_WAITPID @H5_HAVE_WAITPID@ +/* Define to 1 if you have the 'InitOnceExecuteOnce' function. */ +#cmakedefine H5_HAVE_WIN_THREADS @H5_HAVE_WIN_THREADS@ + /* Define if your system has window style path name. */ #cmakedefine H5_HAVE_WINDOW_PATH @H5_HAVE_WINDOW_PATH@ @@ -419,10 +461,12 @@ with special algorithm. */ #cmakedefine H5_LONG_TO_LDOUBLE_SPECIAL @H5_LONG_TO_LDOUBLE_SPECIAL@ -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ +/* Define to the sub-directory where libtool stores uninstalled libraries. */ #cmakedefine H5_LT_OBJDIR @H5_LT_OBJDIR@ +/* Define to enable internal memory allocation sanity checking. */ +/* #cmakedefine H5_MEMORY_ALLOC_SANITY_CHECK @H5_MEMORY_ALLOC_SANITY_CHECK@ ** Define in CMakeLists.txt */ + /* Define if the metadata trace file code is to be compiled in */ #cmakedefine H5_METADATA_TRACE_FILE @H5_METADATA_TRACE_FILE@ @@ -453,9 +497,18 @@ /* Define to the version of this package. */ #define H5_PACKAGE_VERSION "@HDF5_PACKAGE_VERSION_STRING@" +/* Determine the maximum decimal precision in C */ +#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ + +/* Define Fortran Maximum Real Decimal Precision */ +#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ + /* Width for printf() for type `long long' or `__int64', use `ll' */ #cmakedefine H5_PRINTF_LL_WIDTH @H5_PRINTF_LL_WIDTH@ +/* The size of `bool', as computed by sizeof. */ +#cmakedefine H5_SIZEOF_BOOL @H5_SIZEOF_BOOL@ + /* The size of `char', as computed by sizeof. */ #cmakedefine H5_SIZEOF_CHAR @H5_SIZEOF_CHAR@ @@ -589,14 +642,14 @@ /* The size of `unsigned', as computed by sizeof. */ #cmakedefine H5_SIZEOF_UNSIGNED @H5_SIZEOF_UNSIGNED@ -/* The size of `__int64', as computed by sizeof. */ -#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ +/* The size of `_Quad', as computed by sizeof. */ +#define H5_SIZEOF__QUAD @H5_SIZEOF__QUAD@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_STDBOOL_H @H5_HAVE_STDBOOL_H@ +/* The size of `__float128', as computed by sizeof. */ +#define H5_SIZEOF___FLOAT128 @H5_SIZEOF___FLOAT128@ -/* The size of `bool', as computed by sizeof. */ -#cmakedefine H5_SIZEOF_BOOL @H5_SIZEOF_BOOL@ +/* The size of `__int64', as computed by sizeof. */ +#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@ /* Define to 1 if you have the ANSI C header files. */ #cmakedefine H5_STDC_HEADERS @H5_STDC_HEADERS@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 2e99c94..a0ec8e3 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -198,18 +198,19 @@ endmacro () #----------------------------------------------------------------------------- # Check for the existence of certain header files #----------------------------------------------------------------------------- -CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" ${HDF_PREFIX}_HAVE_SYS_RESOURCE_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H) -CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/file.h" ${HDF_PREFIX}_HAVE_SYS_FILE_H) CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" ${HDF_PREFIX}_HAVE_SYS_IOCTL_H) -CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" ${HDF_PREFIX}_HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" ${HDF_PREFIX}_HAVE_SYS_RESOURCE_H) CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" ${HDF_PREFIX}_HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" ${HDF_PREFIX}_HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H) CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H) -CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) -CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H) CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) +CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H) +CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) +CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) # IF the c compiler found stdint, check the C++ as well. On some systems this # file will be found by C but not C++, only do this test IF the C++ compiler @@ -527,6 +528,8 @@ CHECK_FUNCTION_EXISTS (sigprocmask ${HDF_PREFIX}_HAVE_SIGPROCMASK) CHECK_FUNCTION_EXISTS (snprintf ${HDF_PREFIX}_HAVE_SNPRINTF) CHECK_FUNCTION_EXISTS (srandom ${HDF_PREFIX}_HAVE_SRANDOM) CHECK_FUNCTION_EXISTS (strdup ${HDF_PREFIX}_HAVE_STRDUP) +CHECK_FUNCTION_EXISTS (strtoll ${HDF_PREFIX}_HAVE_STRTOLL) +CHECK_FUNCTION_EXISTS (strtoull ${HDF_PREFIX}_HAVE_STRTOULL) CHECK_FUNCTION_EXISTS (symlink ${HDF_PREFIX}_HAVE_SYMLINK) CHECK_FUNCTION_EXISTS (system ${HDF_PREFIX}_HAVE_SYSTEM) @@ -585,6 +588,7 @@ macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) HAVE_UNISTD_H HAVE_SYS_TYPES_H HAVE_SYS_SOCKET_H + HAVE_SYS_FILE_H ) if ("${${HDF_PREFIX}_${def}}") set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") diff --git a/configure.ac b/configure.ac index 2af7988..3e918db 100644 --- a/configure.ac +++ b/configure.ac @@ -1851,6 +1851,7 @@ AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([snprintf srandom strdup symlink system]) +AC_CHECK_FUNCS([strtoll strtoull]) AC_CHECK_FUNCS([tmpfile asprintf vasprintf vsnprintf waitpid]) AC_CHECK_FUNCS([roundf lroundf llroundf round lround llround]) diff --git a/src/H5private.h b/src/H5private.h index 00de96c..61ecc5b 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1386,7 +1386,13 @@ typedef off_t h5_stat_size_t; #ifndef HDstrtol #define HDstrtol(S,R,N) strtol(S,R,N) #endif /* HDstrtol */ -H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); +#ifndef HDstrtoll + #ifdef H5_HAVE_STRTOLL + #define HDstrtoll(S,R,N) strtoll(S,R,N) + #else + H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); + #endif /* H5_HAVE_STRTOLL */ +#endif /* HDstrtoll */ #ifndef HDstrtoul #define HDstrtoul(S,R,N) strtoul(S,R,N) #endif /* HDstrtoul */ diff --git a/src/H5system.c b/src/H5system.c index ac323c0..1f92e19 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -32,10 +32,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -474,6 +474,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) * *------------------------------------------------------------------------- */ +#ifndef HDstrtoll int64_t HDstrtoll(const char *s, const char **rest, int base) { @@ -549,7 +550,7 @@ HDstrtoll(const char *s, const char **rest, int base) *rest = s; return acc; } /* end HDstrtoll() */ - +#endif /*------------------------------------------------------------------------- * Function: HDrand/HDsrand @@ -604,7 +605,7 @@ void HDsrand(unsigned int seed) #ifdef H5_HAVE_FCNTL int Pflock(int fd, int operation) { - + struct flock flk; /* Set the lock type */ @@ -649,18 +650,18 @@ Nflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) { /*------------------------------------------------------------------------- - * Function: H5_make_time + * Function: H5_make_time * - * Purpose: Portability routine to abstract converting a 'tm' struct into - * a time_t value. + * Purpose: Portability routine to abstract converting a 'tm' struct into + * a time_t value. * - * Note: This is a little problematic because mktime() operates on - * local times. We convert to local time and then figure out the - * adjustment based on the local time zone and daylight savings - * setting. + * Note: This is a little problematic because mktime() operates on + * local times. We convert to local time and then figure out the + * adjustment based on the local time zone and daylight savings + * setting. * - * Return: Success: The value of timezone - * Failure: -1 + * Return: Success: The value of timezone + * Failure: -1 * * Programmer: Quincey Koziol * November 18, 2015 @@ -1138,7 +1139,7 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) if(NULL == (*full_name = (char *)H5MM_strdup(path2))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end if */ + } /* end if */ else if(H5_CHECK_ABS_PATH(path2)) { /* On windows path2 is a path absolute name */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index b419f06..e005b51 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -23,6 +23,11 @@ * */ +/* + * _MSC_VER = 1900 VS2015 + * _MSC_VER = 1800 VS2013 + * _MSC_VER = 1700 VS2012 + */ #ifdef H5_HAVE_WIN32_API typedef struct _stati64 h5_stat_t; @@ -54,13 +59,22 @@ typedef __int64 h5_stat_size_t; #define HDsleep(S) Sleep(S*1000) #define HDstat(S,B) _stati64(S,B) #define HDstrcasecmp(A,B) _stricmp(A,B) -#define HDstrtoull(S,R,N) _strtoui64(S,R,N) #define HDstrdup(S) _strdup(S) #define HDtzset() _tzset() #define HDunlink(S) _unlink(S) #define HDwrite(F,M,Z) _write(F,M,Z) #ifdef H5_HAVE_VISUAL_STUDIO + +#if (_MSC_VER < 1800) + #ifndef H5_HAVE_STRTOLL + #define HDstrtoll(S,R,N) _strtoi64(S,R,N) + #endif /* H5_HAVE_STRTOLL */ + #ifndef H5_HAVE_STRTOULL + #define HDstrtoull(S,R,N) _strtoui64(S,R,N) + #endif /* H5_HAVE_STRTOULL */ +#endif /* MSC_VER < 1800 */ + /* * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO */ -- cgit v0.12