diff --git a/base/modules/psb_error_impl.F90 b/base/modules/psb_error_impl.F90 index 1529b1a1..4f550be8 100644 --- a/base/modules/psb_error_impl.F90 +++ b/base/modules/psb_error_impl.F90 @@ -39,6 +39,10 @@ subroutine psb_serror() end do end if end if +#if defined(HAVE_FLUSH_STMT) + flush(0) +#endif + end subroutine psb_serror @@ -72,9 +76,6 @@ subroutine psb_perror(ictxt) call psb_errmsg(err_c, r_name, i_e_d, a_e_d,iam) ! write(0,'(50("="))') end do -#if defined(HAVE_FLUSH_SUB) - call flush(0) -#endif #if defined(HAVE_FLUSH_STMT) flush(0) #endif @@ -90,9 +91,6 @@ subroutine psb_perror(ictxt) do while (psb_get_numerr() > 0) call psb_errpop(err_c, r_name, i_e_d, a_e_d) end do -#if defined(HAVE_FLUSH_SUB) - call flush(0) -#endif #if defined(HAVE_FLUSH_STMT) flush(0) #endif diff --git a/config/pac.m4 b/config/pac.m4 index 206e75a7..752c5a05 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -1264,3 +1264,53 @@ else $2 fi ])dnl PAC_LAPACK + +dnl @synopsis PAC_FORTRAN_TEST_FLUSH( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +dnl Will try to compile and link a program checking the FLUSH Fortran support. +dnl +dnl Will use MPIFC, otherwise '$FC'. +dnl +dnl If the test passes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND. +dnl Note : This file will be likely to induce the compiler to create a module file +dnl (for a module called conftest). +dnl Depending on the compiler flags, this could cause a conftest.mod file to appear +dnl in the present directory, or in another, or with another name. So be warned! +dnl +dnl @author Michele Martone +dnl @author Salvatore Filippone +AC_DEFUN(PAC_FORTRAN_TEST_FLUSH, +ac_exeext='' +ac_ext='f90' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +dnl Warning : square brackets are EVIL! +[AC_MSG_CHECKING([support for Fortran FLUSH statement]) +i=0 +while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do + i=`expr $i + 1` +done +mkdir tmpdir_$i +cd tmpdir_$i +cat > conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$2], , , [ + $2 +])dnl +fi +cd .. +rm -fr tmpdir_$i]) diff --git a/configure b/configure index bad37952..74abad84 100755 --- a/configure +++ b/configure @@ -7427,9 +7427,9 @@ $as_echo "no" >&6; } cat conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: Sorry, cannot build PSBLAS without support for TR15581. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5." >&5 + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6." >&5 $as_echo "$as_me: error: Sorry, cannot build PSBLAS without support for TR15581. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5." >&2;} + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6." >&2;} { (exit 1); exit 1; }; } fi @@ -7473,9 +7473,9 @@ $as_echo "no" >&6; } cat conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: Sorry, cannot build PSBLAS without support for EXTENDS. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5." >&5 + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6." >&5 $as_echo "$as_me: error: Sorry, cannot build PSBLAS without support for EXTENDS. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5." >&2;} + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6." >&2;} { (exit 1); exit 1; }; } fi @@ -7538,9 +7538,9 @@ $as_echo "no" >&6; } cat conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: Sorry, cannot build PSBLAS without support for CLASS and type bound procedures. - Please get a Fortran compiler that supports them, e.g. GNU Fortran 4.5." >&5 + Please get a Fortran compiler that supports them, e.g. GNU Fortran 4.6." >&5 $as_echo "$as_me: error: Sorry, cannot build PSBLAS without support for CLASS and type bound procedures. - Please get a Fortran compiler that supports them, e.g. GNU Fortran 4.5." >&2;} + Please get a Fortran compiler that supports them, e.g. GNU Fortran 4.6." >&2;} { (exit 1); exit 1; }; } fi @@ -7575,10 +7575,10 @@ $as_echo "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - { { $as_echo "$as_me:$LINENO: error: Sorry, cannot build PSBLAS without support for EXTENDS. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5." >&5 -$as_echo "$as_me: error: Sorry, cannot build PSBLAS without support for EXTENDS. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5." >&2;} + { { $as_echo "$as_me:$LINENO: error: Sorry, cannot build PSBLAS without support for MOVE_ALLOC. + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6." >&5 +$as_echo "$as_me: error: Sorry, cannot build PSBLAS without support for MOVE_ALLOC. + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6." >&2;} { (exit 1); exit 1; }; } fi @@ -7622,6 +7622,44 @@ fi cd .. rm -fr tmpdir_$i +ac_exeext='' +ac_ext='f90' +ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +{ $as_echo "$as_me:$LINENO: checking support for Fortran FLUSH statement" >&5 +$as_echo_n "checking support for Fortran FLUSH statement... " >&6; } +i=0 +while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do + i=`expr $i + 1` +done +mkdir tmpdir_$i +cd tmpdir_$i +cat > conftest.$ac_ext <&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + + FDEFINES="$psblas_cv_define_prepend-DHAVE_FLUSH_STMT $FDEFINES" +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +cd .. +rm -fr tmpdir_$i + ac_exeext='' ac_ext='f90' ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' diff --git a/configure.ac b/configure.ac index 7370ba53..61760cb1 100755 --- a/configure.ac +++ b/configure.ac @@ -508,24 +508,24 @@ fi PAC_FORTRAN_TEST_TR15581( [], [AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for TR15581. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5.])] + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6.])] ) PAC_FORTRAN_TEST_EXTENDS( [], [AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for EXTENDS. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5.])] + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6.])] ) PAC_FORTRAN_TEST_CLASS_TBP( [], [AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for CLASS and type bound procedures. - Please get a Fortran compiler that supports them, e.g. GNU Fortran 4.5.])] + Please get a Fortran compiler that supports them, e.g. GNU Fortran 4.6.])] ) PAC_FORTRAN_HAVE_MOVE_ALLOC( [FDEFINES="$psblas_cv_define_prepend-DHAVE_MOVE_ALLOC $FDEFINES"], - [AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for EXTENDS. - Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.5.])] + [AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for MOVE_ALLOC. + Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.6.])] ) # @@ -536,6 +536,10 @@ PAC_FORTRAN_TEST_VOLATILE( [FDEFINES="$psblas_cv_define_prepend-DHAVE_VOLATILE $FDEFINES"], ) +PAC_FORTRAN_TEST_FLUSH( + [FDEFINES="$psblas_cv_define_prepend-DHAVE_FLUSH_STMT $FDEFINES"], +) + PAC_FORTRAN_TEST_FINAL( [FDEFINES="$psblas_cv_define_prepend-DHAVE_FINAL $FDEFINES"], )