From 47cc55340dd318a62a568440777a9b412367f468 Mon Sep 17 00:00:00 2001 From: rem1776 Date: Fri, 26 Jul 2024 11:01:13 -0400 Subject: [PATCH] use variable for module extension and add in previously unused m4 --- configure.ac | 3 +++ m4/gx_fortran_options.m4 | 14 ++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 9cca9055a..b1832341c 100644 --- a/configure.ac +++ b/configure.ac @@ -278,6 +278,9 @@ rm -f test.nc # Check if we need a flag to not capitalize module output (needed with cray compiler) GX_FC_MOD_CASE_FLAG([FCFLAGS="$FCFLAGS $FC_MOD_CASE_FLAG"]) +# Check if new unit is supported +GX_FC_08_OPEN_NEWUNIT([], [AC_MSG_ERROR([Compiler support for use of newunit argument is required to build FMS])]) + # Check if Fortran compiler has the Class, Character array assign bug GX_FC_CLASS_CHAR_ARRAY_BUG_CHECK() diff --git a/m4/gx_fortran_options.m4 b/m4/gx_fortran_options.m4 index f43aae9d6..04980c1b6 100644 --- a/m4/gx_fortran_options.m4 +++ b/m4/gx_fortran_options.m4 @@ -430,16 +430,16 @@ end module foo]], AC_MSG_ERROR(["Failed to compile test module with -c"])) # if output .mod file is capitalized, add the flag and check that it works -if test -f "FOO.mod"; then +if test -f "FOO.${FC_MODEXT}"; then FCFLAGS="$gx_mod_case_flag_FCFLAGS_save -c -ef" AC_COMPILE_IFELSE([[module foo end module mod]], []) - if test -f "foo.mod"; then + if test -f "foo.${FC_MODEXT}"; then gx_cv_fc_mod_case_flag="-ef" fi else - gx_cv_fc_mod_case_flag= + gx_cv_fc_mod_case_flag=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext @@ -448,14 +448,12 @@ FCFLAGS=$gx_mod_case_flag_FCFLAGS_save if test "x$gx_cv_fc_mod_case_flag" = "xunknown"; then m4_default([$2], - [AC_MSG_ERROR([No working flag found to disable .mod filename capitalization])]) -elif test "x$gx_cv_fc_mod_case_flag" != "x"; then - AC_DEFINE([NEEDS_MOD_OUTPUT_CASE_FLAG], 1, - [Define to 1 if your Fortran compiler requires a flag to match case of module names]) + [AC_MSG_ERROR([No working flag found to disable module filename capitalization])]) +elif test "x$gx_cv_fc_mod_case_flag" != "xno"; then FC_MOD_CASE_FLAG=$gx_cv_fc_mod_case_flag + AC_SUBST([FC_MOD_CASE_FLAG]) $1 fi AC_LANG_POP([Fortran]) -AC_SUBST([FC_MOD_CASE_FLAG]) ])