Skip to content
Snippets Groups Projects
Commit 3b938bf7 authored by Sergey Kosukhin's avatar Sergey Kosukhin
Browse files

Avoid SIGPIPE when requesting the compilers for their versions at configure-time.

Both 'head -n 1' and 'sed 1q' exit after printing the first line, which closes
the pipe and kills the compiler's process leaving it no chance to clean any
temporary files it might have created (e.g. Intel compiler creates 'a.out' when
it is called with additional flags like -I, -L, etc., which is the case when
$CC/$FC is an MPI wrapper.
parent ed0fd4f3
No related branches found
No related tags found
2 merge requests!34Version 2.2.0,!13Consolidation with CDI-PIO (develop)
......@@ -256,15 +256,7 @@ AS_CASE([$CC],
[clang*], [COMP_VERSION=`$CC --version | head -n 1`],
[sxc*], [COMP_VERSION=`$CC -V 2>&1 | tail -n 1`],
[xlc*], [COMP_VERSION=`$CC -qversion 2>&1 | head -n 1`],
[dnl
dnl 'head -n 1' exits after printing the first line, which closes the pipe and
dnl kills the compiler's process leaving it no chance to clean any temporary
dnl files it might have created (e.g. Intel compiler creates 'a.out' when it is
dnl called with additional flags like -I, -L, etc., which is the case when $CC
dnl is an MPI wrapper). Therefore, we have to run the processes one after
dnl another:
COMP_VERSION=`$CC -V 2>&1`
COMP_VERSION=`echo "$COMP_VERSION" | head -n 1`])
[COMP_VERSION=`$CC -V 2>&1 | sed -n 1p`])
test -z "$COMP_VERSION" && COMP_VERSION=unknown
AC_DEFINE_UNQUOTED([COMP_VERSION], ["$COMP_VERSION"], [Compiler version])
dnl
......
......@@ -44,7 +44,7 @@ AC_DEFUN([ACX_XLF_QEXTNAME_ADD_APPENDUS],
[AS_CASE([$host],
[*-ibm-aix*|powerpc64-*-linux-*|powerpc-*-linux-*],
[AC_MSG_CHECKING([if -Dappendus needs to be added to CPPFLAGS for cfortran.h])
AS_IF([$CC -qversion 2>&1 | sed 5q | grep '^IBM XL C' >/dev/null],
AS_IF([$CC -qversion 2>&1 | sed -n 1,5p | grep '^IBM XL C' >/dev/null],
[acx_temp_qextname_f77flags=`echo "$FFLAGS" | sed -n '/-qextname/{ s/^\(.* \)*-qextname\( .*\)*$/-qextname/;p;}'`
acx_temp_qextname_fcflags=`echo "$FCFLAGS" | sed -n '/-qextname/{ s/^\(.* \)*-qextname\( .*\)*$/-qextname/;p;}'`
dnl pretend the same option as for FC was used if F77 isn't used at all
......@@ -80,7 +80,7 @@ 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`
[acx_temp=`$acx_FC -V 2>&1 | sed -n 1,5p`
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],
......@@ -89,7 +89,7 @@ AC_DEFUN([_ACX_FIND_CFORTRAN_DEF],
[AS_VAR_SET([acx_cf_flag],[-DgFortran])],
[echo "$acx_temp" | grep '^Cray Fortran' >/dev/null],
[AS_VAR_SET([acx_cf_flag],[-DgFortran])],
[acx_temp=`$acx_FC --version 2>&1 | sed 5q` \
[acx_temp=`$acx_FC --version 2>&1 | sed -n 1,5p` \
&& echo $acx_temp | grep '^GNU Fortran' >/dev/null],
[AS_IF([echo $acx_temp | grep g77 >/dev/null],
[AS_VAR_SET([acx_cf_flag],[-Dg77Fortran])],
......@@ -100,10 +100,10 @@ dnl check if compiling with f2c bindings or with default bindings
[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],
[$acx_FC -v 2>&1 | sed -n 1,5p | grep '^f2c' >/dev/null],
[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_IF([$acx_FC -qversion 2>&1 | sed -n 1,5p | grep '^IBM XL Fortran' >/dev/null],
[AS_VAR_SET([acx_cf_flag],[-DIBMR2Fortran])])],
[*-ibm-aix*],
[dnl xlc set _IBMR2 so nothing needs to be done
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment