Commit 42b75855 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Replace grep with case.

* This saves on external commands in configure phase.
* Also, using sed -n 1,5p instead of sed 5q prevents ifort from dying on SIGPIPE.
parent f013bea3
......@@ -80,28 +80,26 @@ AC_DEFUN([_ACX_FIND_CFORTRAN_DEF],
AS_VAR_PUSHDEF([acx_FCFLAGS],[AC_LANG_CASE([Fortran],[FCFLAGS],[Fortran 77],[FFLAGS])])dnl
AS_CASE([$host],
[x86_64-*-linux-*|i*86-*-linux-*|*-apple-darwin*|ia64-*-linux-*|x86_64-*-freebsd*|i*86-*-freebsd*],
[acx_temp=`$acx_FC -V 2>&1 | sed 5q`
AS_IF([echo "$acx_temp" | grep '^Copyright.*\(The Portland Group\|NVIDIA CORPORATION\)' >/dev/null],
[AS_VAR_SET([acx_cf_flag],[-DgFortran])],
[echo "$acx_temp" | grep '^NAG Fortran Compiler Release' >/dev/null],
[AS_CASE([`$acx_FC -V 2>&1 | sed -n 1,5p`],
[*NAG\ Fortran\ Compiler\ Release*],
[AS_VAR_SET([acx_cf_flag],[-DNAGf90Fortran])],
[echo "$acx_temp" | grep '^Intel(R) Fortran.*Compiler' >/dev/null],
[AS_VAR_SET([acx_cf_flag],[-DgFortran])],
[echo "$acx_temp" | grep '^Cray Fortran' >/dev/null],
[*Copyright*The\ Portland\ Group*|*Copyright*NVIDIA\ CORPORATION*|*Intel\(R\)\ Fortran*Compiler*|*Cray\ Fortran*],
[AS_VAR_SET([acx_cf_flag],[-DgFortran])],
[acx_temp=`$acx_FC --version 2>&1 | sed 5q` \
&& echo $acx_temp | grep '^GNU Fortran' >/dev/null],
[AS_IF([echo $acx_temp | grep g77 >/dev/null],
[AS_CASE([`$acx_FC --version 2>&1 | sed -n 1,5p`],
[*G95*],
[AS_VAR_SET([acx_cf_flag],[-DNAGf90Fortran])],
[*GNU\ Fortran*g77*],
[AS_VAR_SET([acx_cf_flag],[-Dg77Fortran])],
[*GNU\ Fortran*],
[dnl assume gfortran
dnl check if compiling with f2c bindings or with default bindings
AS_IF([echo "$acx_FCFLAGS" | grep '^\(.* \)*-ff2c\( .*\)*$' >/dev/null],
AS_CASE([" $acx_FCFLAGS "],
[*\ -ff2c\ *],
[AS_VAR_SET([acx_cf_flag],[-Df2cFortran])],
[AS_VAR_SET([acx_cf_flag],[-DgFortran])])])],
[echo $acx_temp | grep '^G95' >/dev/null],
[AS_VAR_SET([acx_cf_flag],[-DNAGf90Fortran])],
[$acx_FC -v 2>&1 | sed 5q | grep '^f2c' >/dev/null],
[AS_VAR_SET([acx_cf_flag],[-Df2cFortran])])],
[AS_VAR_SET([acx_cf_flag],[-DgFortran])])],
[AS_CASE([`$acx_FC -v 2>&1 | sed -n 1,5p`],
[*f2c*],
[AS_VAR_SET([acx_cf_flag],[-Df2cFortran])])])])],
[powerpc64-*-linux-*|powerpc-*-linux-*],
[AS_IF([$acx_FC -qversion 2>&1 | sed 5q | grep '^IBM XL Fortran' >/dev/null],
[AS_VAR_SET([acx_cf_flag],[-DIBMR2Fortran])])],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment