From 43f4288c836a80e92ba8adc2cd88e4a2c3432b27 Mon Sep 17 00:00:00 2001
From: "andreas.lagg" <lagg@mps.mpg.de>
Date: Fri, 4 Dec 2020 14:35:37 +0100
Subject: [PATCH] version check for gfortran>=10 in configure.ac

---
 configure.ac        | 11 ++++++++---
 scripts/compile_mps | 12 +++++++-----
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index cf5d68a..ba330b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,10 +135,15 @@ case $FC in
     PPFLAGS=$PPFLAGS" "$PP"GNU"
     FCFLAGS=" "
     AR="ar"
-    if $debug ;then
-      OPTFLAGS="-O3 -O4 -O5 -ffast-math -fallow-argument-mismatch "
+     if $debug ;then
+      OPTFLAGS="-O3 -O4 -O5 -ffast-math "
     else
-      OPTFLAGS="-O2 -g3 -fallow-argument-mismatch "
+      OPTFLAGS="-O2 -g3 "
+    fi
+    gfortranversion=$(gfortran -dumpversion)
+    gfortran10=$(echo "${gfortranversion%%.*}")
+    if test $gfortran10 -ge 10 ;then
+      OPTFLAGS=$OPTFLAGS" -fallow-argument-mismatch "
     fi
     EXEADD=".gfortran"$EXEADD
     DISLINSUB="gf"
diff --git a/scripts/compile_mps b/scripts/compile_mps
index 148a16c..3aec5fa 100755
--- a/scripts/compile_mps
+++ b/scripts/compile_mps
@@ -11,10 +11,6 @@ cfitsio=/opt/local/cfitsio/cfitsio-3.350
 dislin=/opt/local/dislin
 motif=/usr/lib64
 
-#create ifort MPI version
-./configure --with-mpi --with-cfitsio=$cfitsio
-make clean all install
-
 #create ifort version with X11
 ./configure FC=ifort --with-dislin=$dislin --with-cfitsio=$cfitsio --with-openmotif=$motif
 make clean all install
@@ -30,5 +26,11 @@ make clean all install
 #create gfortran MPI version
 module unload intel openmpi_intel
 module load openmpi_gcc
-./configure --with-mpi --with-cfitsio=$cfitsio
+./configure FC=gfortran --with-mpi --with-cfitsio=$cfitsio
+make clean all install
+
+#create ifort MPI version
+module unload openmpi_gcc
+module load intel openmpi_intel
+./configure FC=ifort --with-mpi --with-cfitsio=$cfitsio
 make clean all install
-- 
GitLab