diff --git a/CMAKE_INSTRUCTIONS.md b/CMAKE_INSTRUCTIONS.md index 7f4858c30..6eb014012 100644 --- a/CMAKE_INSTRUCTIONS.md +++ b/CMAKE_INSTRUCTIONS.md @@ -66,6 +66,7 @@ The following build options are available: -DCONSTANTS "Build with constants parameter definitions" DEFAULT:GFDL OPTIONS:GFS|GEOS|GFDL -DINTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" DEFAULT: ON -DENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" DEFAULT: ON +-DPORTABLE_KINDS "Enable compiler definition -DPORTABLE_KINDS" DEFAULT:OFF -DGFS_PHYS "Enable compiler definition -DGFS_PHYS" DEFAULT:OFF -DLARGEFILE "Enable compiler definition -Duse_LARGEFILE" DEFAULT:OFF -DWITH_YAML "Enable compiler definition -Duse_yaml" DEFAULT:OFF diff --git a/CMakeLists.txt b/CMakeLists.txt index aa2b9c015..5082a98e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,6 +61,7 @@ option(SHARED_LIBS "Build shared/dynamic libraries" OFF) # Options for compiler definitions option(INTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" ON) option(ENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" ON) +option(PORTABLE_KINDS "Enable compiler definition -DPORTABLE_KINDS" OFF) option(GFS_PHYS "Enable compiler definition -DGFS_PHYS" OFF) option(LARGEFILE "Enable compiler definition -Duse_LARGEFILE" OFF) option(WITH_YAML "Enable compiler definition -Duse_yaml" OFF) @@ -267,6 +268,10 @@ if(ENABLE_QUAD_PRECISION) list(APPEND fms_defs ENABLE_QUAD_PRECISION) endif() +if(PORTABLE_KINDS) + list(APPEND fms_defs PORTABLE_KINDS) +endif() + if(LARGEFILE) list(APPEND fms_defs use_LARGEFILE) endif() diff --git a/configure.ac b/configure.ac index 057905253..190a0e51b 100644 --- a/configure.ac +++ b/configure.ac @@ -112,6 +112,13 @@ AS_IF([test ${enable_r8_default:-yes} = yes], [enable_r8_default=yes], [enable_r8_default=no]) +AC_ARG_ENABLE([portable-kinds], + [AS_HELP_STRING([--enable-portable-kinds], + [Enables compilation with -DPORTABLE_KINDS with iso_c_binding KIND type parameters])]) +AS_IF([test ${enable_portable_kinds:-no} = yes], + [enable_portable_kinds=yes], + [enable_portable_kinds=no]) + # user enabled testing with input files AC_MSG_CHECKING([whether to enable tests with input files]) AC_ARG_ENABLE([test-input], @@ -342,6 +349,11 @@ if test $enable_setting_flags = yes; then AC_DEFINE([no_8byte_integers], [1], [Set to disable 8 byte integer Fortran routines]) fi + # Builds with C data types + if test $enable_portable_kinds = yes; then + AC_DEFINE([PORTABLE_KINDS], [1], [Set to define KIND parameters to iso_c_binding KIND parameters]) + fi + # Add Cray Pointer support flag if test ! -z "$FC_CRAY_POINTER_FLAG"; then FCFLAGS="$FCFLAGS $FC_CRAY_POINTER_FLAG"