config/pac.m4
 configure.ac
 configure

Added checks for Fortran 2003 features support.
psblas3-type-indexed
Salvatore Filippone 15 years ago
parent 8db3e4753d
commit c1552ff9f2

@ -335,7 +335,7 @@ ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext
dnl Warning : square brackets are EVIL!
[cat > conftest.$ac_ext <<EOF
program test
use psb_base_mod
use psb_sparse_mod
end program test
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
@ -441,6 +441,7 @@ ifelse([$2], , , [
fi
cd ..
rm -fr tmpdir_$i])
dnl @synopsis PAC_FORTRAN_TEST_VOLATILE( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will try to compile and link a program checking the VOLATILE Fortran support.
@ -487,6 +488,191 @@ fi
cd ..
rm -fr tmpdir_$i])
dnl @synopsis PAC_FORTRAN_TEST_EXTENDS( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will try to compile and link a program checking the EXTENDS 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 Salvatore Filippone <salvatore.filippone@uniroma2.it>
AC_DEFUN(PAC_FORTRAN_TEST_EXTENDS,
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 EXTENDS])
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 <<EOF
program conftest
type foo
integer :: i
end type foo
type, extends(foo) :: bar
integer j
end type bar
type(bar) :: barvar
end program conftest
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
AC_MSG_RESULT([yes])
ifelse([$1], , :, [
$1])
else
AC_MSG_RESULT([no])
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$2], , , [
$2
])dnl
fi
cd ..
rm -fr tmpdir_$i])
dnl @synopsis PAC_FORTRAN_TEST_CLASS_TBP( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will try to compile and link a program checking the TBP 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 Salvatore Filippone <salvatore.filippone@uniroma2.it>
AC_DEFUN(PAC_FORTRAN_TEST_CLASS_TBP,
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 CLASS TBP])
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 <<EOF
module foo_mod
type foo
integer :: i
contains
procedure, pass(a) :: doit
procedure, pass(a) :: getit
end type foo
private doit,getit
contains
subroutine doit(a)
class(foo) :: a
a%i = 1
write(*,*) 'FOO%DOIT base version'
end subroutine doit
function getit(a) result(res)
class(foo) :: a
integer :: res
res = a%i
end function getit
end module foo_mod
program conftest
use foo_mod
type(foo) :: foovar
end program conftest
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
AC_MSG_RESULT([yes])
ifelse([$1], , :, [
$1])
else
AC_MSG_RESULT([no])
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$2], , , [
$2
])dnl
fi
cd ..
rm -fr tmpdir_$i])
dnl @synopsis PAC_FORTRAN_TEST_FINAL( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will try to compile and link a program checking the FINAL 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 Salvatore Filippone <salvatore.filippone@uniroma2.it>
AC_DEFUN(PAC_FORTRAN_TEST_FINAL,
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 FINAL])
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 <<EOF
module foo_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 foo_mod
program conftest
use foo_mod
type(foo) :: foovar
end program conftest
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
AC_MSG_RESULT([yes])
ifelse([$1], , :, [
$1])
else
AC_MSG_RESULT([no])
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$2], , , [
$2
])dnl
fi
cd ..
rm -fr tmpdir_$i])
dnl @synopsis PAC_CHECK_BLACS
dnl
dnl Will try to find the BLACS

348
configure vendored

@ -5604,95 +5604,6 @@ else
fi
rm -f conftest*
#
# Test for TR 15581, aka allocatables extensions.
#
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 allocatables TR15581" >&5
$as_echo_n "checking support for Fortran allocatables TR15581... " >&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 <<EOF
module conftest
type outer
integer, allocatable :: v(:)
end type outer
interface foo
module procedure foov, food
end interface
contains
subroutine foov(a,b)
implicit none
integer, allocatable, intent(inout) :: a(:)
integer, allocatable, intent(out) :: b(:)
allocate(b(size(a)))
end subroutine foov
subroutine food(a,b)
implicit none
type(outer), intent(inout) :: a
type(outer), intent(out) :: b
allocate(b%v(size(a%v)))
end subroutine food
end module conftest
program testtr15581
use conftest
type(outer) :: da, db
integer, allocatable :: a(:), b(:)
allocate(a(10),da%v(10))
a = (/ (i,i=1,10) /)
da%v = (/ (i,i=1,10) /)
call foo(a,b)
call foo(da,db)
write(*,*) b
write(*,*) db%v
end program testtr15581
EOF
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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; }
:
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
echo "configure: failed program was:" >&5
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.3." >&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.3." >&2;}
{ (exit 1); exit 1; }; }
fi
cd ..
rm -fr tmpdir_$i
if test x"$psblas_cv_fc" == "x" ; then
if eval "$MPIFC -qversion 2>&1 | grep XL 2>/dev/null" ; then
psblas_cv_fc="xlf"
@ -7461,7 +7372,215 @@ fi
rm -f conftest*
fi
# Custom test : do we have move_alloc ?
#
# Tests for support of various Fortran features; some of them are critical,
# some optional
#
#
# Critical features
#
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 allocatables TR15581" >&5
$as_echo_n "checking support for Fortran allocatables TR15581... " >&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 <<EOF
module conftest
type outer
integer, allocatable :: v(:)
end type outer
interface foo
module procedure foov, food
end interface
contains
subroutine foov(a,b)
implicit none
integer, allocatable, intent(inout) :: a(:)
integer, allocatable, intent(out) :: b(:)
allocate(b(size(a)))
end subroutine foov
subroutine food(a,b)
implicit none
type(outer), intent(inout) :: a
type(outer), intent(out) :: b
allocate(b%v(size(a%v)))
end subroutine food
end module conftest
program testtr15581
use conftest
type(outer) :: da, db
integer, allocatable :: a(:), b(:)
allocate(a(10),da%v(10))
a = (/ (i,i=1,10) /)
da%v = (/ (i,i=1,10) /)
call foo(a,b)
call foo(da,db)
write(*,*) b
write(*,*) db%v
end program testtr15581
EOF
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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; }
:
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
echo "configure: failed program was:" >&5
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
$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;}
{ (exit 1); exit 1; }; }
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 EXTENDS" >&5
$as_echo_n "checking support for Fortran EXTENDS... " >&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 <<EOF
program conftest
type foo
integer :: i
end type foo
type, extends(foo) :: bar
integer j
end type bar
type(bar) :: barvar
end program conftest
EOF
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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; }
:
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
echo "configure: failed program was:" >&5
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
$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;}
{ (exit 1); exit 1; }; }
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 CLASS TBP" >&5
$as_echo_n "checking support for Fortran CLASS TBP... " >&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 <<EOF
module foo_mod
type foo
integer :: i
contains
procedure, pass(a) :: doit
procedure, pass(a) :: getit
end type foo
private doit,getit
contains
subroutine doit(a)
class(foo) :: a
a%i = 1
write(*,*) 'FOO%DOIT base version'
end subroutine doit
function getit(a) result(res)
class(foo) :: a
integer :: res
res = a%i
end function getit
end module foo_mod
program conftest
use foo_mod
type(foo) :: foovar
end program conftest
EOF
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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; }
:
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
echo "configure: failed program was:" >&5
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
$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;}
{ (exit 1); exit 1; }; }
fi
cd ..
rm -fr tmpdir_$i
#
# Optional features
#
ac_exeext=''
ac_ext='f'
ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
@ -7527,6 +7646,55 @@ 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 FINAL" >&5
$as_echo_n "checking support for Fortran FINAL... " >&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 <<EOF
module foo_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 foo_mod
program conftest
use foo_mod
type(foo) :: foovar
end program conftest
EOF
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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_FINAL $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
###############################################################################
# Additional pathname stuff (yes, it is redundant and confusing...)
###############################################################################

@ -212,15 +212,6 @@ PAC_CHECK_HAVE_GFORTRAN(
[]
)
#
# Test for TR 15581, aka allocatables extensions.
#
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.3.])]
)
if test x"$psblas_cv_fc" == "x" ; then
if eval "$MPIFC -qversion 2>&1 | grep XL 2>/dev/null" ; then
psblas_cv_fc="xlf"
@ -532,7 +523,36 @@ else
)
fi
# Custom test : do we have move_alloc ?
#
# Tests for support of various Fortran features; some of them are critical,
# some optional
#
#
# Critical features
#
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.])]
)
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.])]
)
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.])]
)
#
# Optional features
#
PAC_FORTRAN_HAVE_MOVE_ALLOC(
[FDEFINES="$psblas_cv_define_prepend-DHAVE_MOVE_ALLOC $FDEFINES"],
@ -542,6 +562,10 @@ PAC_FORTRAN_TEST_VOLATILE(
[FDEFINES="$psblas_cv_define_prepend-DHAVE_VOLATILE $FDEFINES"],
)
PAC_FORTRAN_TEST_FINAL(
[FDEFINES="$psblas_cv_define_prepend-DHAVE_FINAL $FDEFINES"],
)
###############################################################################
# Additional pathname stuff (yes, it is redundant and confusing...)
###############################################################################

Loading…
Cancel
Save