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] 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