From 419d99e4244f076a94b4fd9d9d65569cf3ef044c Mon Sep 17 00:00:00 2001
From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Date: Fri, 17 Jan 2025 15:15:57 +0100
Subject: [PATCH 1/4] Add script to regenerate the configure

---
 autogen.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
 create mode 100755 autogen.sh

diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..5fc49b6
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+script_dir=`echo "$0" | sed 's@[^/]*$@@'`
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+cd "$script_dir"
+
+exec autoreconf -fvi
-- 
GitLab


From fe47afddc503be844635f90ced931ce8f37119e5 Mon Sep 17 00:00:00 2001
From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Date: Fri, 17 Jan 2025 15:16:39 +0100
Subject: [PATCH 2/4] Regenerate the configure script

---
 configure | 49 ++++---------------------------------------------
 1 file changed, 4 insertions(+), 45 deletions(-)

diff --git a/configure b/configure
index c29bb96..018243a 100755
--- a/configure
+++ b/configure
@@ -1352,9 +1352,6 @@ Optional Features:
                           [default=yes]
   --enable-mpi            enable MPI (parallelization) support [default=yes]
   --enable-resolution     build the model for the specific domain resolution.
-                          Note that since HD V.5.2.2, domain info is read from the HD parameter file
-                          so that the domain include file is obsolete. Executables are only different
-                          for 0.5 degree and 5 Min. spatial resolution, but not for different regional domains.
                           The value of the argument must be one of the
                           following [default=05deg]:
                             0|05deg     0.5 degree global domain
@@ -2043,10 +2040,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-##if test "`cd $srcdir && pwd`" != "`pwd`" 
-##then :
-##  as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
-##fi
+
+
 
 ac_ext=${ac_fc_srcext-f}
 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
@@ -3720,7 +3715,7 @@ case $enable_resolution in #(
   euro5min) :
     EXEC_FILE_NAME='hd_5min.exe' ;; #(
   aus5min) :
-    EXEC_FILE_NAME='hd_aus.exe' ;; #(
+    EXEC_FILE_NAME='hd_5min.exe' ;; #(
   *) :
     as_fn_error $? "unexpected value for the domain resolution '$enable_resolution'; this is a bug in the configure script" "$LINENO" 5 ;;
 esac
@@ -5060,7 +5055,6 @@ esac
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # Files that config.status was made for.
 config_files="$ac_config_files"
-config_links="$ac_config_links"
 config_commands="$ac_config_commands"
 
 _ACEOF
@@ -5086,9 +5080,6 @@ Usage: $0 [OPTION]... [TAG]...
 Configuration files:
 $config_files
 
-Configuration links:
-$config_links
-
 Configuration commands:
 $config_commands
 
@@ -5226,7 +5217,6 @@ done
 # bizarre bug on SunOS 4.1.3.
 if $ac_need_defaults; then
   test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
-  test ${CONFIG_LINKS+y} || CONFIG_LINKS=$config_links
   test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands
 fi
 
@@ -5416,7 +5406,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 fi # test -n "$CONFIG_FILES"
 
 
-eval set X "  :F $CONFIG_FILES    :L $CONFIG_LINKS  :C $CONFIG_COMMANDS"
+eval set X "  :F $CONFIG_FILES      :C $CONFIG_COMMANDS"
 shift
 for ac_tag
 do
@@ -5636,38 +5626,7 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
 
-  :L)
-  #
-  # CONFIG_LINK
-  #
-
-  if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then
-    :
-  else
-    # Prefer the file from the source tree if names are identical.
-    if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then
-      ac_source=$srcdir/$ac_source
-    fi
-
-    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5
-printf "%s\n" "$as_me: linking $ac_source to $ac_file" >&6;}
-
-    if test ! -r "$ac_source"; then
-      as_fn_error $? "$ac_source: file not found" "$LINENO" 5
-    fi
-    rm -f "$ac_file"
 
-    # Try a relative symlink, then a hard link, then a copy.
-    case $ac_source in
-    [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;;
-	*) ac_rel_source=$ac_top_build_prefix$ac_source ;;
-    esac
-    ln -s "$ac_rel_source" "$ac_file" 2>/dev/null ||
-      ln "$ac_source" "$ac_file" 2>/dev/null ||
-      cp -p "$ac_source" "$ac_file" ||
-      as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5
-  fi
- ;;
   :C)  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
 printf "%s\n" "$as_me: executing $ac_file commands" >&6;}
  ;;
-- 
GitLab


From 21fb09ca8feae8b902554206abc247e0d386c8d3 Mon Sep 17 00:00:00 2001
From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Date: Fri, 17 Jan 2025 15:20:51 +0100
Subject: [PATCH 3/4] Remove obsolete values of the --enable-resolution

---
 configure    | 19 ++-----------------
 configure.ac | 15 +++------------
 2 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/configure b/configure
index 018243a..84d32e2 100755
--- a/configure
+++ b/configure
@@ -1356,8 +1356,6 @@ Optional Features:
                           following [default=05deg]:
                             0|05deg     0.5 degree global domain
                             1|5min      5min global domain
-                            2|euro5min  5min European domain
-                            3|aus5min   5min Australian domain
   --enable-coupling       enable coupling using the specific backend
                           [default=no]:
                             yes|yac  use YAC coupler
@@ -3694,10 +3692,6 @@ then :
     enable_resolution=05deg ;; #(
   1|5min) :
     enable_resolution=5min ;; #(
-  2|euro5min) :
-    enable_resolution=euro5min ;; #(
-  3|aus5min) :
-    enable_resolution=aus5min ;; #(
   *) :
     as_fn_error $? "unexpected value for the argument --enable-resolution='$enableval'; see the help message for the valid values of the argument" "$LINENO" 5 ;;
 esac
@@ -3711,20 +3705,11 @@ case $enable_resolution in #(
   05deg) :
     EXEC_FILE_NAME='hd_05.exe' ;; #(
   5min) :
-    EXEC_FILE_NAME='hd_5min.exe' ;; #(
-  euro5min) :
-    EXEC_FILE_NAME='hd_5min.exe' ;; #(
-  aus5min) :
-    EXEC_FILE_NAME='hd_5min.exe' ;; #(
+    EXEC_FILE_NAME='hd_5min.exe'
+   as_fn_append FCFLAGS " ${FC_PP_DEF}HD_5MIN" ;; #(
   *) :
     as_fn_error $? "unexpected value for the domain resolution '$enable_resolution'; this is a bug in the configure script" "$LINENO" 5 ;;
 esac
-case $enable_resolution in #(
-  *5min) :
-    as_fn_append FCFLAGS " ${FC_PP_DEF}HD_5MIN" ;; #(
-  *) :
-     ;;
-esac
 
 eval "set dummy $acx_lib_search_flags; shift"
 
diff --git a/configure.ac b/configure.ac
index b2f29a1..f68a767 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,14 +101,10 @@ AC_ARG_ENABLE([resolution],
                           The value of the argument must be one of the
                           following @<:@default=05deg@:>@:
                             0|05deg     0.5 degree global domain
-                            1|5min      5min global domain
-                            2|euro5min  5min European domain
-                            3|aus5min   5min Australian domain],
+                            1|5min      5min global domain],
 [AS_CASE([$enableval],
    [0|05deg], [enable_resolution=05deg],
    [1|5min], [enable_resolution=5min],
-   [2|euro5min], [enable_resolution=euro5min],
-   [3|aus5min], [enable_resolution=aus5min],
    [AC_MSG_ERROR([unexpected value for the argument dnl
 --enable-resolution='$enableval'; see the help message for the valid values dnl
 of the argument])])],
@@ -119,15 +115,10 @@ AS_CASE([$enable_resolution],
   [05deg],
   [EXEC_FILE_NAME='hd_05.exe'],
   [5min],
-  [EXEC_FILE_NAME='hd_5min.exe'],
-  [euro5min],
-  [EXEC_FILE_NAME='hd_5min.exe'],
-  [aus5min],
-  [EXEC_FILE_NAME='hd_5min.exe'],
+  [EXEC_FILE_NAME='hd_5min.exe'
+   AS_VAR_APPEND([FCFLAGS], [" ${FC_PP_DEF}HD_5MIN"])],
   [AC_MSG_ERROR([unexpected value for the domain resolution dnl
 '$enable_resolution'; this is a bug in the configure script])])
-AS_CASE([$enable_resolution],
-  [*5min], [AS_VAR_APPEND([FCFLAGS], [" ${FC_PP_DEF}HD_5MIN"])])
 
 eval "set dummy $acx_lib_search_flags; shift"
 ACX_LANG_PACKAGE_INIT([NetCDF], ["$FC_INC_FLAG" "$FC_MOD_IN"], ["$@"])
-- 
GitLab


From f5b117965d1ba9a7240075bdccf678fd3e571a0a Mon Sep 17 00:00:00 2001
From: Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de>
Date: Fri, 17 Jan 2025 15:31:16 +0100
Subject: [PATCH 4/4] Switch to the new YAC module

---
 code/src/mo_coupling.f90    |  2 +-
 code/src/mo_coupling_hd.f90 |  2 +-
 configure                   | 44 ++++++++++++++++++-------------------
 configure.ac                |  8 +++----
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/code/src/mo_coupling.f90 b/code/src/mo_coupling.f90
index c0338bc..d669272 100644
--- a/code/src/mo_coupling.f90
+++ b/code/src/mo_coupling.f90
@@ -37,7 +37,7 @@ MODULE mo_coupling
 #endif
 
 #ifdef COUP_YAC
-  USE mo_yac_finterface
+  USE yac
   USE mpi
 #endif
 
diff --git a/code/src/mo_coupling_hd.f90 b/code/src/mo_coupling_hd.f90
index 35a0f14..c9fc7a9 100644
--- a/code/src/mo_coupling_hd.f90
+++ b/code/src/mo_coupling_hd.f90
@@ -38,7 +38,7 @@ MODULE mo_coupling_hd
 
   
 #ifdef COUP_YAC
-  USE mo_yac_finterface
+  USE yac
   USE mpi
   USE mo_coupling, ONLY: runoff_s, runoff_dr, fdir_hd, get_grid_dimensions, &
                          lcoupling_atm, lcoupling_oce, icpl_mask_tohd
diff --git a/configure b/configure
index 84d32e2..7bcf441 100755
--- a/configure
+++ b/configure
@@ -3976,31 +3976,31 @@ esac
 fi
 
 
-   as_fn_append DEPGEN_EXTERNAL_MODS ',mo_yac_finterface'
+   as_fn_append DEPGEN_EXTERNAL_MODS ',yac'
    YAC_FCFLAGS=${YAC_FCFLAGS-$acx_fc_YAC_inc_search_args}
    FCFLAGS="$YAC_FCFLAGS $FCFLAGS"
-         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran module MO_YAC_FINTERFACE" >&5
-printf %s "checking for Fortran module MO_YAC_FINTERFACE... " >&6; }
-if test ${acx_cv_fc_module_MO_YAC_FINTERFACE+y}
+         { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran module YAC" >&5
+printf %s "checking for Fortran module YAC... " >&6; }
+if test ${acx_cv_fc_module_YAC+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
   cat > conftest.$ac_ext <<_ACEOF
       program main
-      use MO_YAC_FINTERFACE
+      use YAC
       end
 _ACEOF
 if ac_fn_fc_try_compile "$LINENO"
 then :
-  acx_cv_fc_module_MO_YAC_FINTERFACE=yes
+  acx_cv_fc_module_YAC=yes
 else $as_nop
-  acx_cv_fc_module_MO_YAC_FINTERFACE=no
+  acx_cv_fc_module_YAC=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acx_cv_fc_module_MO_YAC_FINTERFACE" >&5
-printf "%s\n" "$acx_cv_fc_module_MO_YAC_FINTERFACE" >&6; }
-   if test "x$acx_cv_fc_module_MO_YAC_FINTERFACE" = xyes
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $acx_cv_fc_module_YAC" >&5
+printf "%s\n" "$acx_cv_fc_module_YAC" >&6; }
+   if test "x$acx_cv_fc_module_YAC" = xyes
 then :
         acx_pkg_YAC_FCLIBS=
       if test ${YAC_FCLIBS+y}
@@ -4146,19 +4146,19 @@ fi
          yac_LIBS=
 
 pkg_failed=no
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for yac" >&5
-printf %s "checking for yac... " >&6; }
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for yac-mci" >&5
+printf %s "checking for yac-mci... " >&6; }
 
 if test -n "$yac_CFLAGS"; then
     pkg_cv_yac_CFLAGS="$yac_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yac\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "yac") 2>&5
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yac-mci\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "yac-mci") 2>&5
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_yac_CFLAGS=`$PKG_CONFIG --cflags "yac" 2>/dev/null`
+  pkg_cv_yac_CFLAGS=`$PKG_CONFIG --cflags "yac-mci" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -4170,12 +4170,12 @@ if test -n "$yac_LIBS"; then
     pkg_cv_yac_LIBS="$yac_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yac\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "yac") 2>&5
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"yac-mci\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "yac-mci") 2>&5
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_yac_LIBS=`$PKG_CONFIG --libs "yac" 2>/dev/null`
+  pkg_cv_yac_LIBS=`$PKG_CONFIG --libs "yac-mci" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -4196,9 +4196,9 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        yac_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "yac" 2>&1`
+	        yac_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "yac-mci" 2>&1`
         else
-	        yac_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "yac" 2>&1`
+	        yac_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "yac-mci" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$yac_PKG_ERRORS" >&5
@@ -4251,7 +4251,7 @@ then :
 else $as_nop
   cat > conftest.$ac_ext <<_ACEOF
       program main
-      use MO_YAC_FINTERFACE, ONLY: yac_fget_version
+      use YAC, ONLY: yac_fget_version
       implicit none
       print *, 'YAC Version: ' // TRIM(yac_fget_version())
       end
@@ -4305,7 +4305,7 @@ fi
 else $as_nop
   { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "Fortran module 'MO_YAC_FINTERFACE' is not available
+as_fn_error $? "Fortran module 'YAC' is not available
 See \`config.log' for more details" "$LINENO" 5; }
 fi
 
diff --git a/configure.ac b/configure.ac
index f68a767..946c269 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,10 +149,10 @@ of the argument])])],
 AS_CASE([$enable_coupling],
   [yac],
   [ACX_LANG_PACKAGE_INIT([YAC], ["$FC_MOD_IN"], [-L])
-   AS_VAR_APPEND([DEPGEN_EXTERNAL_MODS], [',mo_yac_finterface'])
+   AS_VAR_APPEND([DEPGEN_EXTERNAL_MODS], [',yac'])
    YAC_FCFLAGS=${YAC_FCFLAGS-$acx_fc_YAC_inc_search_args}
    FCFLAGS="$YAC_FCFLAGS $FCFLAGS"
-   ACX_FC_MODULE_CHECK([MO_YAC_FINTERFACE],
+   ACX_FC_MODULE_CHECK([YAC],
      [dnl
 dnl If YAC_FCLIBS is not set, try getting linker flags from yac.pc. The problem
 dnl is that the flags returned by pkg-config are meant for the C compiler and
@@ -175,7 +175,7 @@ dnl have names YAC_FCFAGS and YAC_FCLIBS, respectively. The value of the first
 dnl one is already known and the second one we want to get:
          yac_CFLAGS=$YAC_FCFAGS
          yac_LIBS=
-         PKG_CHECK_MODULES([yac], [yac],
+         PKG_CHECK_MODULES([yac], [yac-mci],
            [acx_pkg_YAC_FCLIBS=$yac_LIBS
             AS_VAR_IF([enable_rpaths], [yes],
               [ASX_EXTRACT_ARGS([acx_L_args], ["$acx_pkg_YAC_FCLIBS"],
@@ -189,7 +189,7 @@ dnl one is already known and the second one we want to get:
         ["$acx_pkg_YAC_FCLIBS"],
         [YAC_FCFLAGS=$acx_cv_fc_lib_func_YAC_FGET_VERSION
          LIBS="$YAC_FCFLAGS $LIBS"], [],
-        [AC_LANG_PROGRAM([],[[      use MO_YAC_FINTERFACE, ONLY: yac_fget_version
+        [AC_LANG_PROGRAM([],[[      use YAC, ONLY: yac_fget_version
       implicit none
       print *, 'YAC Version: ' // TRIM(yac_fget_version())]])])])
    AS_VAR_APPEND([FCFLAGS], [" ${FC_PP_DEF}COUP_YAC"])],
-- 
GitLab