From 68a4ee9cd4f7e4194cfa054aa254246dd63203c0 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Fri, 24 Jul 2020 10:57:27 +0200 Subject: [PATCH] Make some Fortran features mandatory. --- configure | 112 ++++++++++++++++++++++++++------------------------- configure.ac | 18 +++++---- 2 files changed, 69 insertions(+), 61 deletions(-) diff --git a/configure b/configure index 151ec7dd..e62eb0e1 100755 --- a/configure +++ b/configure @@ -6744,10 +6744,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -# -# Optional features -# - { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran VOLATILE" >&5 $as_echo_n "checking support for Fortran VOLATILE... " >&6; } ac_ext=${ac_fc_srcext-f} @@ -6767,12 +6763,13 @@ _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - FDEFINES="$psblas_cv_define_prepend-DHAVE_VOLATILE $FDEFINES" + : else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 + as_fn_error $? "Sorry, cannot build PSBLAS without support for VOLATILE" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -6784,31 +6781,36 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking test GENERIC interfaces" >&5 -$as_echo_n "checking test GENERIC interfaces... " >&6; } -ac_ext=${ac_fc_srcext-f} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran FINAL" >&5 +$as_echo_n "checking support for Fortran FINAL... " >&6; } + ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_exeext='' - ac_ext='F90' + ac_ext='f90' ac_fc=${MPIFC-$FC}; cat > conftest.$ac_ext <<_ACEOF -module conftest - - interface foo - subroutine i_sub_foo(v) - integer, intent(inout) :: v(:) - end subroutine i_sub_foo - end interface foo - - interface bar - procedure i_sub_foo - end interface bar +module conftest_mod + type foo + integer :: i + contains + final :: destroy_foo + end type foo -end module conftest + private destroy_foo +contains + subroutine destroy_foo(a) + type(foo) :: a + ! Just a test + end subroutine destroy_foo +end module conftest_mod +program conftest + use conftest_mod + type(foo) :: foovar +end program conftest _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -6819,7 +6821,7 @@ else $as_echo "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - FDEFINES="$psblas_cv_define_prepend-DHAVE_BUGGY_GENERICS $FDEFINES" + as_fn_error $? "Sorry, cannot build PSBLAS without support for FINAL" "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -6831,35 +6833,48 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran FLUSH statement" >&5 -$as_echo_n "checking support for Fortran FLUSH statement... " >&6; } - ac_ext=${ac_fc_srcext-f} + +# +# Optional features +# + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking test GENERIC interfaces" >&5 +$as_echo_n "checking test GENERIC interfaces... " >&6; } +ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_exeext='' - ac_ext='f90' + ac_ext='F90' ac_fc=${MPIFC-$FC}; cat > conftest.$ac_ext <<_ACEOF -program conftest - integer :: iunit=10 - open(10) - write(10,*) 'Test ' - flush(10) - close(10) -end program conftest +module conftest + + interface foo + subroutine i_sub_foo(v) + integer, intent(inout) :: v(:) + end subroutine i_sub_foo + end interface foo + + interface bar + procedure i_sub_foo + end interface bar + +end module conftest _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - FDEFINES="$psblas_cv_define_prepend-DHAVE_FLUSH_STMT $FDEFINES" + : else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 + FDEFINES="$psblas_cv_define_prepend-DHAVE_BUGGY_GENERICS $FDEFINES" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -6871,9 +6886,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran FINAL" >&5 -$as_echo_n "checking support for Fortran FINAL... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran FLUSH statement" >&5 +$as_echo_n "checking support for Fortran FLUSH statement... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -6884,29 +6898,18 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu ac_fc=${MPIFC-$FC}; cat > conftest.$ac_ext <<_ACEOF -module conftest_mod - type foo - integer :: i - contains - final :: destroy_foo - end type foo - - private destroy_foo -contains - subroutine destroy_foo(a) - type(foo) :: a - ! Just a test - end subroutine destroy_foo -end module conftest_mod program conftest - use conftest_mod - type(foo) :: foovar + integer :: iunit=10 + open(10) + write(10,*) 'Test ' + flush(10) + close(10) end program conftest _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - FDEFINES="$psblas_cv_define_prepend-DHAVE_FINAL $FDEFINES" + FDEFINES="$psblas_cv_define_prepend-DHAVE_FLUSH_STMT $FDEFINES" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -6923,6 +6926,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + { $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran SAME_TYPE_AS" >&5 $as_echo_n "checking support for Fortran SAME_TYPE_AS... " >&6; } ac_ext=${ac_fc_srcext-f} diff --git a/configure.ac b/configure.ac index 5fbf3480..f67b4604 100755 --- a/configure.ac +++ b/configure.ac @@ -573,13 +573,21 @@ PAC_FORTRAN_TEST_ISO_FORTRAN_ENV( Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8.])] ) +PAC_FORTRAN_TEST_VOLATILE( + [], + [AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for VOLATILE])] +) + +PAC_FORTRAN_TEST_FINAL( + [], + [AC_MSG_ERROR([Sorry, cannot build PSBLAS without support for FINAL])] +) + + # # Optional features # -PAC_FORTRAN_TEST_VOLATILE( - [FDEFINES="$psblas_cv_define_prepend-DHAVE_VOLATILE $FDEFINES"], -) PAC_FORTRAN_TEST_GENERICS( [], @@ -591,10 +599,6 @@ PAC_FORTRAN_TEST_FLUSH( ) -PAC_FORTRAN_TEST_FINAL( - [FDEFINES="$psblas_cv_define_prepend-DHAVE_FINAL $FDEFINES"], -) - PAC_FORTRAN_TEST_SAME_TYPE( [FDEFINES="$psblas_cv_define_prepend-DHAVE_SAME_TYPE_AS $FDEFINES"], )