From ccf22c86482166a86251f398e961537e73f59c0f Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 3 Feb 2022 15:25:45 +0000 Subject: [PATCH] CMake: support for system functions fsync/fdatasync --- CMakeLists.txt | 30 ++++++++++++++++-------------- eccodes_config.h.in | 3 +++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c17fb1e8..5200bd5ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,22 +26,24 @@ project( eccodes VERSION 2.25.0 LANGUAGES C ) ############################################################################### # system checks needed for eccodes_config.h and some options like MEMFS -check_type_size( int ECCODES_SIZEOF_INT ) -check_type_size( long ECCODES_SIZEOF_LONG ) -check_type_size( size_t ECCODES_SIZEOF_SIZE_T ) +check_type_size( int ECCODES_SIZEOF_INT ) +check_type_size( long ECCODES_SIZEOF_LONG ) +check_type_size( size_t ECCODES_SIZEOF_SIZE_T ) -check_include_files( assert.h ECCODES_HAVE_ASSERT_H ) -check_include_files( string.h ECCODES_HAVE_STRING_H ) -check_include_files( sys/types.h ECCODES_HAVE_SYS_TYPES_H ) -check_include_files( sys/stat.h ECCODES_HAVE_SYS_STAT_H ) -check_include_files( fcntl.h ECCODES_HAVE_FCNTL_H ) -check_include_files( unistd.h ECCODES_HAVE_UNISTD_H ) +check_include_files( assert.h ECCODES_HAVE_ASSERT_H ) +check_include_files( string.h ECCODES_HAVE_STRING_H ) +check_include_files( sys/types.h ECCODES_HAVE_SYS_TYPES_H ) +check_include_files( sys/stat.h ECCODES_HAVE_SYS_STAT_H ) +check_include_files( fcntl.h ECCODES_HAVE_FCNTL_H ) +check_include_files( unistd.h ECCODES_HAVE_UNISTD_H ) -check_symbol_exists( fseeko "stdio.h" ECCODES_HAVE_FSEEKO ) -check_symbol_exists( posix_memalign "stdlib.h" ECCODES_HAVE_POSIX_MEMALIGN ) -check_symbol_exists( fmemopen "stdio.h" ECCODES_HAVE_FMEMOPEN ) -check_symbol_exists( funopen "stdio.h" ECCODES_HAVE_FUNOPEN ) -check_symbol_exists( realpath "stdlib.h" ECCODES_HAVE_REALPATH ) +check_symbol_exists( fseeko "stdio.h" ECCODES_HAVE_FSEEKO ) +check_symbol_exists( posix_memalign "stdlib.h" ECCODES_HAVE_POSIX_MEMALIGN ) +check_symbol_exists( fmemopen "stdio.h" ECCODES_HAVE_FMEMOPEN ) +check_symbol_exists( funopen "stdio.h" ECCODES_HAVE_FUNOPEN ) +check_symbol_exists( realpath "stdlib.h" ECCODES_HAVE_REALPATH ) +check_symbol_exists( fsync "unistd.h" ECCODES_HAVE_FSYNC) +check_symbol_exists( fdatasync "unistd.h" ECCODES_HAVE_FDATASYNC) check_c_source_compiles( " typedef int foo_t; diff --git a/eccodes_config.h.in b/eccodes_config.h.in index 9d5d35edd..3341c4682 100644 --- a/eccodes_config.h.in +++ b/eccodes_config.h.in @@ -51,6 +51,9 @@ #cmakedefine ECCODES_HAVE_FMEMOPEN #cmakedefine ECCODES_HAVE_FUNOPEN #cmakedefine ECCODES_HAVE_REALPATH +#cmakedefine ECCODES_HAVE_FSYNC +#cmakedefine ECCODES_HAVE_FDATASYNC +#cmakedefine ECCODES_ON_LINUX_32BIT #if defined(EC_HAVE_ASSERT_H) || defined(ECCODES_HAVE_ASSERT_H) #define HAVE_ASSERT_H 1