mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-24 16:04:40 +08:00
Infrastructure for generating a meta header file dynamically at configure time.
This commit is contained in:
parent
e5152eb990
commit
ef0b2a3f77
@ -396,15 +396,14 @@ ENDMACRO()
|
||||
# If a variable is set, it 'yes' is returned. Otherwise, 'no' is
|
||||
# returned.
|
||||
#
|
||||
# Also creates a version of the ret_val appended with 'BOOL',
|
||||
# Also creates a version of the ret_val prepended with 'NC',
|
||||
# when feature is true, which is used to generate netcdf_meta.h.
|
||||
FUNCTION(is_enabled feature ret_val)
|
||||
IF(${feature})
|
||||
SET(${ret_val} "yes" PARENT_SCOPE)
|
||||
SET("${ret_val}_BOOL" 1 PARENT_SCOPE)
|
||||
SET("NC_${ret_val}" 1 PARENT_SCOPE)
|
||||
ELSE()
|
||||
SET(${ret_val} "no" PARENT_SCOPE)
|
||||
SET("${ret_val}_BOOL" 0 PARENT_SCOPE)
|
||||
ENDIF(${feature})
|
||||
ENDFUNCTION()
|
||||
|
||||
@ -412,15 +411,14 @@ ENDFUNCTION()
|
||||
# If a variable is set, it 'yes' is returned. Otherwise, 'no' is
|
||||
# returned.
|
||||
#
|
||||
# Also creates a version of the ret_val appended with 'BOOL',
|
||||
# Also creates a version of the ret_val prepended with 'NC',
|
||||
# when feature is true, which is used to generate netcdf_meta.h.
|
||||
FUNCTION(is_disabled feature ret_val)
|
||||
IF(${feature})
|
||||
SET(${ret_val} "no" PARENT_SCOPE)
|
||||
SET("${ret_val}_BOOL" 0 PARENT_SCOPE)
|
||||
ELSE()
|
||||
SET(${ret_val} "yes" PARENT_SCOPE)
|
||||
SET("${ret_val}_BOOL" 1 PARENT_SCOPE)
|
||||
SET("NC_${ret_val}" 1 PARENT_SCOPE)
|
||||
ENDIF(${feature})
|
||||
ENDFUNCTION()
|
||||
|
||||
@ -500,10 +498,7 @@ ENDIF()
|
||||
OPTION (ENABLE_V2_API "Build netCDF Version 2." ON)
|
||||
SET(BUILD_V2 ${ENABLE_V2_API})
|
||||
IF(NOT ENABLE_V2_API)
|
||||
SET(NO_NETCDF_2 1)
|
||||
SET(USE_NETCDF_2 0)
|
||||
ELSE()
|
||||
SET(USE_NETCDF_2 1)
|
||||
SET(NO_NETCDF_2 ON)
|
||||
ENDIF()
|
||||
|
||||
# Option to build utilities
|
||||
@ -611,7 +606,7 @@ SET(NCIO_MINBLOCKSIZE 256 CACHE STRING "Minimum I/O Blocksize for netCDF classic
|
||||
# Build netCDF4
|
||||
OPTION(ENABLE_NETCDF_4 "Enable netCDF-4" ON)
|
||||
IF(ENABLE_NETCDF_4)
|
||||
SET(USE_NETCDF4 1 CACHE BOOL "")
|
||||
SET(USE_NETCDF4 ON CACHE BOOL "")
|
||||
SET(ENABLE_NETCDF_4 ON CACHE BOOL "")
|
||||
SET(ENABLE_NETCDF4 ON CACHE BOOL "")
|
||||
ENDIF()
|
||||
@ -628,7 +623,7 @@ OPTION(USE_HDF5 "Use HDF5." ${ENABLE_NETCDF_4})
|
||||
|
||||
IF(USE_HDF5 OR ENABLE_NETCDF_4)
|
||||
SET(USE_HDF5 ON)
|
||||
SET(USE_NETCDF4 1)
|
||||
SET(USE_NETCDF4 ON)
|
||||
# Accomodate developers who have hdf5 libraries and
|
||||
# headers on their system, but do not have a the hdf
|
||||
# .cmake files. If this is the case, they should
|
||||
@ -1419,7 +1414,7 @@ INSTALL(FILES "${netCDF_BINARY_DIR}/libnetcdf.settings"
|
||||
# Create 'netcdf_meta.h' include file.
|
||||
#####
|
||||
configure_file(
|
||||
${netCDF_SOURCE_DIR}/include/netcdf_meta.h.in
|
||||
${netCDF_SOURCE_DIR}/include/netcdf_meta.h.cmake.in
|
||||
${netCDF_BINARY_DIR}/include/netcdf_meta.h @ONLY)
|
||||
|
||||
|
||||
|
29
configure.ac
29
configure.ac
@ -1035,9 +1035,11 @@ AH_BOTTOM([#include "ncconfigure.h"])
|
||||
# debugging purposes.
|
||||
# cp confdefs.h my_config.h
|
||||
|
||||
#####
|
||||
# Create output variables from various
|
||||
# shell variables, for use in generating
|
||||
# libnetcdf.settings.
|
||||
#####
|
||||
AC_SUBST([enable_shared])
|
||||
AC_SUBST([enable_static])
|
||||
AC_SUBST([CFLAGS])
|
||||
@ -1047,18 +1049,35 @@ AC_SUBST([AM_CFLAGS])
|
||||
AC_SUBST([AM_CPPFLAGS])
|
||||
AC_SUBST([AM_LDFLAGS])
|
||||
|
||||
AC_SUBST(USE_NETCDF_2,[1])
|
||||
AC_SUBST(USE_NETCDF4)
|
||||
AC_SUBST(USE_HDF4)
|
||||
#####
|
||||
# Define values used in include/netcdf_meta.h
|
||||
#####
|
||||
AC_DEFINE_UNQUOTED(NC_VERSION, "${PACKAGE_VERSION}", "")
|
||||
AC_DEFINE_UNQUOTED(NC_HAS_NC2, ${USE_NETCDF_2}, "")
|
||||
AC_DEFINE_UNQUOTED(NC_HAS_NC4, ${USE_NETCDF4}, "")
|
||||
AC_DEFINE_UNQUOTED(NC_HAS_HDF4, ${USE_HDF4}, "")
|
||||
|
||||
AC_SUBST(NC_HAS_DAP,[$enable_dap])
|
||||
AC_SUBST(NC_HAS_HDF4,[$enable_hdf4])
|
||||
AC_SUBST(NC_HAS_PNETCDF,[$enable_pnetcdf])
|
||||
AC_SUBST(NC_HAS_HDF5,[$enable_netcdf_4])
|
||||
AC_SUBST(NC_HAS_SZLIB,[$nc_has_szlib])
|
||||
AC_SUBST(NC_HAS_PARALLEL,[$enable_parallel])
|
||||
AC_SUBST(NC_HAS_DISKLESS,[$enable_diskless])
|
||||
AC_SUBST(NC_HAS_MMAP,[$enable_mmap])
|
||||
AC_SUBST(NC_HAS_JNA,[$enable_jna])
|
||||
|
||||
|
||||
|
||||
AC_CONFIG_HEADERS([include/netcdf_meta.h])
|
||||
|
||||
AC_MSG_NOTICE([generating header files and makefiles])
|
||||
AC_CONFIG_FILES([Makefile
|
||||
nc-config
|
||||
netcdf.pc
|
||||
libnetcdf.settings
|
||||
include/netcdf_meta.h
|
||||
include/Makefile
|
||||
h5_test/Makefile
|
||||
h5_test/Makefile
|
||||
docs/Makefile
|
||||
docs/images/Makefile
|
||||
libsrc/Makefile
|
||||
|
@ -8,12 +8,12 @@
|
||||
#ifndef NETCDF_META_H
|
||||
#define NETCDF_META_H
|
||||
|
||||
#define NC_VERSION @PACKAGE_VERSION@
|
||||
#undef NC_VERSION
|
||||
|
||||
test @PACKAGE_VERSION@
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
#define NC_HAS_NC2 @HAS_NC2@
|
||||
#define NC_HAS_NC4 @HAS_HDF5@
|
||||
#define NC_HAS_HDF4 @USE_HDF4@
|
||||
#undef NC_HAS_NC2 0
|
||||
#undef NC_HAS_NC4
|
||||
#undef NC_HAS_HDF4
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user