psblas2-dev:

Make.inc.in
 Makefile.am
 README
 config
 config/acx_blas.m4
 config/acx_mpi.m4
 config/ax_f90_module_extension.m4
 config/ax_f90_module_flag.m4
 config/pac.m4
 configure.ac
 configure
 missing

Merged back into trunk the configure machinery.
psblas3-type-indexed
Salvatore Filippone 17 years ago
parent 8dc4dff121
commit 620274da77

@ -0,0 +1,54 @@
# This is Make.inc file generated automatically by the PSBLAS configure script.
# It should be ready to use, included by Makefile.
# If it gives problems, consider editing it.
# These lines are quite portable.
.mod=@MODEXT@
.fh=.fh
.SUFFIXES: .f90 $(.mod) .F90 .F
# The following ones are the variables used by the PSBLAS make scripts.
F90=@F90@
FC=@FC@
CC=@CC@
#F77=@F77@
F90COPT=@F90COPT@
FCOPT=@FCOPT@
CCOPT=@CCOPT@
FMFLAG=@FMFLAG@
FIFLAG=@FIFLAG@
# These three should be always set!
MPF90=@MPF90@
MPF77=@MPF77@
MPCC=@MPCC@
F90LINK=$(MPF90)
FLINK=$(MPF77)
LIBS=@LIBS@
# BLAS, BLACS and METIS libraries.
BLAS=@BLAS_LIBS@
BLACS=@BLACS_LIBS@
METIS_LIB=@METIS_LIBS@
PSBFDEFINES=@FDEFINES@
PSBCDEFINES=@CDEFINES@
AR=@AR@
RANLIB=@RANLIB@
CFLAGS=@CFLAGS@
FFLAGS=@FFLAGS@
LIBDIR=@LIBDIR@
BASELIBNAME=@BASELIBNAME@
PRECLIBNAME=@PRECLIBNAME@
METHDLIBNAME=@METHDLIBNAME@
UTILLIBNAME=@UTILLIBNAME@
@PSBLASRULES@

@ -0,0 +1,24 @@
include Make.inc
library:
(cd base; make lib)
(cd prec; make lib )
(cd krylov; make lib)
(cd util; make lib )
@echo "====================================="
@echo "PSBLAS libraries Compilation Successful."
clean:
(cd base; make clean)
(cd prec; make clean )
(cd krylov; make clean)
(cd util; make clean)
cleanlib:
(cd lib; /bin/rm -f *.a *$(.mod) *$(.fh))
veryclean: cleanlib
(cd base; make veryclean)
(cd prec; make veryclean )
(cd krylov; make veryclean)
(cd util; make veryclean)

@ -81,9 +81,30 @@ prerequisites (see also SERIAL below):
This is optional: it is used in the util and test/fileread
directories if you define the HAVE_METIS directive.
To install, choose a Make.inc.XXX file in directory Make that fits
your compilers, modify the paths to libraries to match your
installation and copy it to Make.inc in the top directory.
We offer an experimental configure script: if everything works well,
it will generate a Make.inc file suitable for building the library.
The script is capable of recognizing the needed libraries with their
default names; if they are in unusual places consider adding the paths
with --with-lib, or explicitly specify the names in --with-blas and
friends.
Please note that a common way for the configure script to fail is to
specify inconsistent MPI vs. plain compilers, either directly or
indirectly via environment variables; e.g. specifying the Intel
compiler with FC=ifort and the default MPIFC=mpif90 which points to
GNU Fortran 4.1. The best way to avoid this situation is (in our
opinion) to use the environment modules package (see
http://modules.sourceforge.net/), and load the relevant variables with
(e.g.)
module load gnu42 mpich
This will delegate to the modules setup to make sure that the version
of mpich in use is the one compiled with the gnu42 compilers.
After the configure script has completed you can always tweak the
Make.inc file yourself.
As a backup alternative, you can choose a Make.inc.XXX file in
directory Make that fits your compilers, modify the paths to libraries
to match your installation and copy it to Make.inc in the top
directory.
Then run
make
to compile the library; go to the test directory and its
@ -107,6 +128,9 @@ The PSBLAS team.
Contact: Salvatore Filippone salvatore.filippone@uniroma2.it
Credits for version 2.2:
Michele Martone contributed the configure machinery.
Credits for version 2.0:
Salvatore Filippone
Alfredo Buttari

@ -0,0 +1,161 @@
dnl @synopsis ACX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl
dnl This macro looks for a library that implements the BLAS
dnl linear-algebra interface (see http://www.netlib.org/blas/). On
dnl success, it sets the BLAS_LIBS output variable to hold the
dnl requisite library linkages.
dnl
dnl To link with BLAS, you should link with:
dnl
dnl $BLAS_LIBS $LIBS $FLIBS
dnl
dnl in that order. FLIBS is the output variable of the
dnl AC_F77_LIBRARY_LDFLAGS macro (called if necessary by ACX_BLAS), and
dnl is sometimes necessary in order to link with F77 libraries. Users
dnl will also need to use AC_F77_DUMMY_MAIN (see the autoconf manual),
dnl for the same reason.
dnl
dnl Many libraries are searched for, from ATLAS to CXML to ESSL. The
dnl user may also use --with-blas=<lib> in order to use some specific
dnl BLAS library <lib>. In order to link successfully, however, be
dnl aware that you will probably need to use the same Fortran compiler
dnl (which can be set via the F77 env. var.) as was used to compile the
dnl BLAS library.
dnl
dnl ACTION-IF-FOUND is a list of shell commands to run if a BLAS
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
dnl default action will define HAVE_BLAS.
dnl
dnl This macro requires autoconf 2.50 or later.
dnl
dnl @category InstalledPackages
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
dnl @version 2001-12-13
dnl @license GPLWithACException
dnl modified by salvatore.filippone@uniroma2.it
dnl shifted check for ESSL as it was generating erroneous results on
dnl AIX SP5.
dnl
AC_DEFUN([ACX_BLAS], [
AC_PREREQ(2.50)
AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
acx_blas_ok=no
AC_ARG_WITH(blas,
[AC_HELP_STRING([--with-blas=<lib>], [use BLAS library <lib>])])
case $with_blas in
yes | "") ;;
no) acx_blas_ok=disable ;;
-* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;;
*) BLAS_LIBS="-l$with_blas" ;;
esac
# Get fortran linker names of BLAS functions to check for.
AC_F77_FUNC(sgemm)
AC_F77_FUNC(dgemm)
acx_blas_save_LIBS="$LIBS"
LIBS="$LIBS $FLIBS"
# First, check BLAS_LIBS environment variable
if test $acx_blas_ok = no; then
if test "x$BLAS_LIBS" != x; then
save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS])
AC_TRY_LINK_FUNC($sgemm, [acx_blas_ok=yes], [BLAS_LIBS=""])
AC_MSG_RESULT($acx_blas_ok)
LIBS="$save_LIBS"
fi
fi
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(atlas, ATL_xerbla,
[AC_CHECK_LIB(f77blas, $sgemm,
[AC_CHECK_LIB(cblas, cblas_dgemm,
[acx_blas_ok=yes
BLAS_LIBS="-lcblas -lf77blas -latlas"],
[], [-lf77blas -latlas])],
[], [-latlas])])
fi
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm,
[AC_CHECK_LIB(dgemm, $dgemm,
[AC_CHECK_LIB(sgemm, $sgemm,
[acx_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"],
[], [-lblas])],
[], [-lblas])])
fi
# BLAS in Alpha CXML library?
if test $acx_blas_ok = no; then
AC_CHECK_LIB(cxml, $sgemm, [acx_blas_ok=yes;BLAS_LIBS="-lcxml"])
fi
# BLAS in Alpha DXML library? (now called CXML, see above)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(dxml, $sgemm, [acx_blas_ok=yes;BLAS_LIBS="-ldxml"])
fi
# BLAS in Sun Performance library?
if test $acx_blas_ok = no; then
if test "x$GCC" != xyes; then # only works with Sun CC
AC_CHECK_LIB(sunmath, acosp,
[AC_CHECK_LIB(sunperf, $sgemm,
[BLAS_LIBS="-xlic_lib=sunperf -lsunmath"
acx_blas_ok=yes],[],[-lsunmath])])
fi
fi
# BLAS in SCSL library? (SGI/Cray Scientific Library)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(scs, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lscs"])
fi
# BLAS in SGIMATH library?
if test $acx_blas_ok = no; then
AC_CHECK_LIB(complib.sgimath, $sgemm,
[acx_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"])
fi
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
if test $acx_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm,
[AC_CHECK_LIB(essl, $sgemm,
[acx_blas_ok=yes; BLAS_LIBS="-lessl -lblas"],
[], [-lblas $FLIBS])])
fi
# BLAS linked to by default? (happens on some supercomputers)
if test $acx_blas_ok = no; then
save_LIBS="$LIBS"; LIBS="$LIBS"
AC_TRY_LINK_FUNC($sgemm, [acx_blas_ok=yes], [BLAS_LIBS=""])
dnl AC_CHECK_FUNC($sgemm, [acx_blas_ok=yes])
LIBS="$save_LIBS"
fi
# Generic BLAS library?
if test $acx_blas_ok = no; then
AC_CHECK_LIB(blas, $sgemm, [acx_blas_ok=yes; BLAS_LIBS="-lblas"])
fi
AC_SUBST(BLAS_LIBS)
LIBS="$acx_blas_save_LIBS"
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_blas_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])
:
else
acx_blas_ok=no
$2
fi
])dnl ACX_BLAS

@ -0,0 +1,146 @@
dnl @synopsis ACX_MPI([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl
dnl @summary figure out how to compile/link code with MPI
dnl
dnl This macro tries to find out how to compile programs that use MPI
dnl (Message Passing Interface), a standard API for parallel process
dnl communication (see http://www-unix.mcs.anl.gov/mpi/)
dnl
dnl On success, it sets the MPICC, MPICXX, or MPIF77 output variable to
dnl the name of the MPI compiler, depending upon the current language.
dnl (This may just be $CC/$CXX/$F77, but is more often something like
dnl mpicc/mpiCC/mpif77.) It also sets MPILIBS to any libraries that are
dnl needed for linking MPI (e.g. -lmpi, if a special
dnl MPICC/MPICXX/MPIF77 was not found).
dnl
dnl If you want to compile everything with MPI, you should set:
dnl
dnl CC="$MPICC" #OR# CXX="$MPICXX" #OR# F77="$MPIF77"
dnl LIBS="$MPILIBS $LIBS"
dnl
dnl NOTE: The above assumes that you will use $CC (or whatever) for
dnl linking as well as for compiling. (This is the default for automake
dnl and most Makefiles.)
dnl
dnl The user can force a particular library/compiler by setting the
dnl MPICC/MPICXX/MPIF77 and/or MPILIBS environment variables.
dnl
dnl ACTION-IF-FOUND is a list of shell commands to run if an MPI
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
dnl default action will define HAVE_MPI.
dnl
dnl @category InstalledPackages
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
dnl @author Julian Cummings <cummings@cacr.caltech.edu>
dnl @version 2006-10-13
dnl @license GPLWithACException
AC_DEFUN([ACX_MPI], [
AC_PREREQ(2.50) dnl for AC_LANG_CASE
AC_LANG_CASE([C], [
AC_REQUIRE([AC_PROG_CC])
AC_ARG_VAR(MPICC,[MPI C compiler command])
AC_CHECK_PROGS(MPICC, mpicc hcc mpxlc_r mpxlc mpcc cmpicc, $CC)
acx_mpi_save_CC="$CC"
CC="$MPICC"
AC_SUBST(MPICC)
],
[C++], [
AC_REQUIRE([AC_PROG_CXX])
AC_ARG_VAR(MPICXX,[MPI C++ compiler command])
AC_CHECK_PROGS(MPICXX, mpic++ mpicxx mpiCC hcp mpxlC_r mpxlC mpCC cmpic++, $CXX)
acx_mpi_save_CXX="$CXX"
CXX="$MPICXX"
AC_SUBST(MPICXX)
],
[Fortran 77], [
AC_REQUIRE([AC_PROG_F77])
AC_ARG_VAR(MPIF77,[MPI Fortran 77 compiler command])
AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf mpf77 mpif90 mpf90 mpxlf90 mpxlf95 mpxlf_r cmpifc cmpif90c, $F77)
acx_mpi_save_F77="$F77"
F77="$MPIF77"
AC_SUBST(MPIF77)
],
[Fortran], [
AC_REQUIRE([AC_PROG_FC])
AC_ARG_VAR(MPIFC,[MPI Fortran compiler command])
AC_CHECK_PROGS(MPIFC, mpif90 hf90 mpxlf90 mpxlf95 mpf90 cmpifc cmpif90c, $FC)
acx_mpi_save_FC="$FC"
FC="$MPIFC"
AC_SUBST(MPIFC)
])
if test x = x"$MPILIBS"; then
AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])],
[C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])],
[Fortran 77], [AC_MSG_CHECKING([for MPI_Init])
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" "
AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])],
[Fortran], [AC_MSG_CHECKING([for MPI_Init])
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" "
AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])])
fi
AC_LANG_CASE([Fortran 77], [
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"])
fi
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(fmpich, MPI_Init, [MPILIBS="-lfmpich"])
fi
],
[Fortran], [
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"])
fi
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(mpichf90, MPI_Init, [MPILIBS="-lmpichf90"])
fi
])
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"])
fi
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"])
fi
dnl We have to use AC_TRY_COMPILE and not AC_CHECK_HEADER because the
dnl latter uses $CPP, not $CC (which may be mpicc).
AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpi.h])
AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_MSG_RESULT(no)])
fi],
[C++], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpi.h])
AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_MSG_RESULT(no)])
fi],
[Fortran 77], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpif.h])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_MSG_RESULT(no)])
fi],
[Fortran], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpif.h])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_MSG_RESULT(no)])
fi])
AC_LANG_CASE([C], [CC="$acx_mpi_save_CC"],
[C++], [CXX="$acx_mpi_save_CXX"],
[Fortran 77], [F77="$acx_mpi_save_F77"],
[Fortran], [FC="$acx_mpi_save_FC"])
AC_SUBST(MPILIBS)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x = x"$MPILIBS"; then
$2
:
else
ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1])
:
fi
])dnl ACX_MPI

@ -0,0 +1,45 @@
dnl @synopsis AX_F90_MODULE_EXTENSION
dnl
dnl Find Fortran 90 modules file extension. The module extension is
dnl stored in the cached variable ax_f90_modext, or "unknown" if the
dnl extension cannot be found.
dnl
dnl @category Fortran
dnl @author Luc Maisonobe <luc@spaceroots.org>
dnl @version 2005-06-17
dnl @license AllPermissive
dnl modified Salvatore Filippone <salvatore.filippone@uniroma2.it>
dnl make it work even if ac_fc_ext="f"
AC_DEFUN([AX_F90_MODULE_EXTENSION],[
AC_CACHE_CHECK([fortran 90 modules extension],
ax_f90_modext,
[AC_LANG_PUSH(Fortran)
i=0
while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do
i=`expr $i + 1`
done
mkdir tmpdir_$i
cd tmpdir_$i
AC_COMPILE_IFELSE([
module conftest_module
contains
subroutine conftest_routine
write(*,'(a)') 'gotcha!'
end subroutine conftest_routine
end module conftest_module
],
[ax_f90_modext=`ls | sed -n 's,conftest_module\.,,p'`
if test x$ax_f90_modext = x ; then
dnl Some F90 compilers put module filename in uppercase letters
ax_f90_modext=`ls | sed -n 's,CONFTEST_MODULE\.,,p'`
if test x$ax_f90_modext = x ; then
ax_f90_modext=unknown
fi
fi
],
[ax_f90_modext=unknown])
cd ..
rm -fr tmpdir_$i
AC_LANG_POP(Fortran)
])])

@ -0,0 +1,57 @@
dnl @synopsis AX_F90_MODULE_FLAG
dnl
dnl @summary Find Fortran 90 modules inclusion flag.
dnl
dnl Find Fortran 90 modules inclusion flag. The module inclusion flag
dnl is stored in the cached variable ax_f90_modflag. An error is
dnl triggered if the flag cannot be found. Supported are the -I GNU
dnl compilers flag, the -M SUN compilers flag, and the -p Absoft Pro
dnl Fortran compiler flag.
dnl
dnl @category Fortran
dnl @author Luc Maisonobe <luc@spaceroots.org>
dnl @author Julian C. Cummings <cummings@cacr.caltech.edu>
dnl @version 2006-01-28
dnl @license AllPermissive
dnl modified Salvatore Filippone <salvatore.filippone@uniroma2.it>
dnl make it work even if ac_fc_ext="f"
AC_DEFUN([AX_F90_MODULE_FLAG],[
AC_CACHE_CHECK([fortran 90 modules inclusion flag],
ax_f90_modflag,
[AC_LANG_PUSH(Fortran)
i=0
while test \( -f tmpdir_$i \) -o \( -d tmpdir_$i \) ; do
i=`expr $i + 1`
done
mkdir tmpdir_$i
cd tmpdir_$i
AC_COMPILE_IFELSE([
module conftest_module
contains
subroutine conftest_routine
write(*,'(a)') 'gotcha!'
end subroutine conftest_routine
end module conftest_module
],[],[])
cd ..
ax_f90_modflag="not found"
for ax_flag in "-I " "-M" "-p"; do
if test "$ax_f90_modflag" = "not found" ; then
ax_save_FCFLAGS="$FCFLAGS"
FCFLAGS="$ax_save_FCFLAGS ${ax_flag}tmpdir_$i"
AC_COMPILE_IFELSE([
program conftest_program
use conftest_module
call conftest_routine
end program conftest_program
],[ax_f90_modflag="$ax_flag"],[])
FCFLAGS="$ax_save_FCFLAGS"
fi
done
rm -fr tmpdir_$i
if test "$ax_flag" = "not found" ; then
AC_MSG_ERROR([unable to find compiler flag for modules inclusion])
fi
AC_LANG_POP(Fortran)
])])

@ -0,0 +1,552 @@
dnl
dnl $Id$
dnl
dnl 20080206
dnl M4 macros for the PSBLAS library and useful for packages using PSBLAS.
dnl
dnl @synopsis PAC_CHECK_LIBS
dnl
dnl Tries to detect the presence of a specific function among various libraries, using AC_CHECK_LIB
dnl repeatedly on the specified libraries.
dnl
dnl Example use:
dnl
dnl PAC_CHECK_LIBS([atlas blas],
dnl [dgemm],
dnl [have_dgemm=yes],
dnl [have_dgemm=no])
dnl
dnl @author Michele Martone <michele.martone@uniroma2.it>
dnl
dnl 20080211 modified slighty from original.
AC_DEFUN([PAC_CHECK_LIBS],
[
pac_check_libs_ok=no
[for pac_check_libs_f in $2
do ]
[for pac_check_libs_l in $1
do ]
if test x"$pac_check_libs_ok" == xno ; then
AC_CHECK_LIB([$pac_check_libs_l],[$pac_check_libs_f], [pac_check_libs_ok=yes; pac_check_libs_LIBS="-l$pac_check_libs_l"],[],[$5])
fi
done
done
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
[ if test x"$pac_check_libs_ok" = xyes ; then
$3
else
pac_check_libs_ok=no
$4
fi
]
])dnl
dnl # How do we determine netlib blacs ? Here it is :
dnl AC_CHECK_LIB(blacsCinit_MPI-LINUX-0,BI_Asend,
dnl AC_CHECK_LIB(blacs_MPI-LINUX-0,BI_Asend,
dnl [acx_cv_blacs_ok=yes; BLACS_LIBS="-lblacsCinit_MPI-LINUX-0"])
dnl AC_F77_FUNC([BI_Asend])
dnl AC_CHECK_LIB(blacsCinit_MPI-LINUX-0,[$BI_Asend],
dnl [acx_cv_blacs_ok=yes; BLACS_LIBS="-lblacsCinit_MPI-LINUX-0"])
dnl AC_FC_FUNC([BI_Iam])
dnl AC_CHECK_LIB(blacsCinit_MPI-LINUX-0,[$BI_Asend],
dnl [acx_cv_blacs_ok=yes; BLACS_LIBS="-lblacsCinit_MPI-LINUX-0"])
dnl @synopsis PAC_FORTRAN_FUNC_MOVE_ALLOC( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will try to compile and link a program with move_alloc (a Fortran 2003 function).
dnl
dnl Will use MPIFC, otherwise '$FC'.
dnl
dnl If the test passes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND.
dnl
dnl @author Michele Martone <michele.martone@uniroma2.it>
dnl
AC_DEFUN([PAC_FORTRAN_HAVE_MOVE_ALLOC],
ac_exeext=''
ac_ext='f'
ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
dnl Warning : square brackets are EVIL!
[AC_MSG_CHECKING([for MOVE_ALLOC intrinsic])
cat > conftest.$ac_ext <<EOF
program test_move_alloc
integer, allocatable :: a(:), b(:)
allocate(a(3))
call move_alloc(a, b)
print *, allocated(a), allocated(b)
print *, b
end program test_move_alloc
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
AC_MSG_RESULT([yes])
ifelse([$1], , :, [rm -rf conftest*
$1])
else
AC_MSG_RESULT([no])
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$2], , , [ rm -rf conftest*
$2
])dnl
fi
rm -f conftest*])
dnl @synopsis PAC_CHECK_HAVE_GFORTRAN( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will check if MPIFC is $FC.
dnl The check will proceed by compiling a small Fortran program
dnl containing the __GNUC__ macro, which should be defined in the
dnl gfortran compiled programs.
dnl
dnl On pass, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND.
dnl
dnl @author Michele Martone <michele.martone@uniroma2.it>
dnl
AC_DEFUN(PAC_CHECK_HAVE_GFORTRAN,
ac_exeext=''
ac_ext='F'
ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
dnl Warning : square brackets are EVIL!
[
cat > conftest.$ac_ext <<EOF
program main
#ifdef __GNUC__
print *, "GCC!"
#else
this program will fail
#endif
end
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
ifelse([$1], , :, [rm -rf conftest*
$1])
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$2], , , [ rm -rf conftest*
$2
])dnl
fi
rm -f conftest*])
dnl @synopsis PAC_HAVE_MODERN_GCC( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will check if the GNU fortran version is suitable for PSBLAS.
dnl If yes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND.
dnl
dnl Note : Will use MPIFC; if unset, will use '$FC'.
dnl
dnl @author Michele Martone <michele.martone@uniroma2.it>
dnl
AC_DEFUN(PAC_HAVE_MODERN_GCC,
ac_exeext=''
ac_ext='F'
ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
dnl Warning : square brackets are EVIL!
[
cat > conftest.$ac_ext <<EOF
program main
#if ( __GNUC__ >= 4 && __GNUC_MINOR__ >= 2 ) || ( __GNUC__ > 4 )
print *, "ciao"
#else
this program will fail
#endif
end
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
ifelse([$1], , :, [rm -rf conftest*
$1])
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$2], , , [ rm -rf conftest*
$2
])dnl
fi
rm -f conftest*])
dnl @synopsis PAC_FORTRAN_CHECK_HAVE_MPI_MOD( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will determine if the fortran compiler MPIFC needs to include mpi.h or needs
dnl to use the mpi module.
dnl
dnl If yes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND.
dnl
dnl @author Michele Martone <michele.martone@uniroma2.it>
dnl Modified Salvatore Filippone <salvatore.filippone@uniroma2.it>
dnl
AC_DEFUN(PAC_FORTRAN_CHECK_HAVE_MPI_MOD,
ac_exeext=''
ac_ext='f90'
ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
dnl Warning : square brackets are EVIL!
[AC_MSG_CHECKING([MPI Fortran interface])
cat > conftest.$ac_ext <<EOF
program test
use mpi
end program test
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
AC_MSG_RESULT([ use mpi ])
ifelse([$1], , :, [rm -rf conftest*
$1])
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
AC_MSG_RESULT([ include mpif.h ])
ifelse([$2], , , [ rm -rf conftest*
$2
])dnl
fi
rm -f conftest*])
dnl @synopsis PAC_ARG_WITH_FLAGS(lcase_name, UCASE_NAME)
dnl
dnl Test for --with-lcase_name="compiler/loader flags". if defined, prepend
dnl flags to standard UCASE_NAME definition.
dnl
dnl Use this macro to facilitate additional special flags that should be
dnl passed on to the preprocessor/compilers/loader.
dnl
dnl NOTE : Renamed after TAC_ARG_WITH_FLAGS as in the Trilinos-8.0.4 package.
dnl
dnl NOTE : This macro works in a way the user should invoke
dnl --with-flags=...
dnl only once, otherwise the first one will take effect.
dnl
dnl Example use:
dnl
dnl PAC_ARG_WITH_FLAGS(cxxflags, CXXFLAGS)
dnl
dnl tests for --with-cxxflags and pre-pends to CXXFLAGS
dnl
dnl @author Mike Heroux <mheroux@cs.sandia.gov>
dnl @notes Michele Martone <michele.martone@uniroma2.it>
dnl
AC_DEFUN([PAC_ARG_WITH_FLAGS],
[
AC_MSG_CHECKING([whether additional [$2] flags should be added (should be invoked only once)])
dnl AC_MSG_CHECKING([whether additional [$2] flags should be added])
AC_ARG_WITH($1,
AC_HELP_STRING([--with-$1],
[additional [$2] flags to be added: will prepend to [$2]]),
[
$2="${withval} ${$2}"
AC_MSG_RESULT([$2 = ${$2}])
],
AC_MSG_RESULT(no)
)
])
dnl @synopsis PAC_ARG_WITH_LIBS
dnl
dnl Test for --with-libs="name(s)".
dnl
dnl Prepends the specified name(s) to the list of libraries to link
dnl with.
dnl
dnl note: Renamed after PAC_ARG_WITH_LIBS as in the Trilinos package.
dnl
dnl Example use:
dnl
dnl PAC_ARG_WITH_LIBS
dnl
dnl tests for --with-libs and pre-pends to LIBS
dnl
dnl @author Jim Willenbring <jmwille@sandia.gov>
dnl
AC_DEFUN([PAC_ARG_WITH_LIBS],
[
AC_MSG_CHECKING([whether additional libraries are needed])
AC_ARG_WITH(libs,
AC_HELP_STRING([--with-libs],
[List additional libraries here. For example, --with-libs=-lsuperlu
or --with-libs=/path/libsuperlu.a]),
[
LIBS="${withval} ${LIBS}"
AC_MSG_RESULT([LIBS = ${LIBS}])
],
AC_MSG_RESULT(no)
)
]
)
dnl @synopsis PAC_FORTRAN_HAVE_PSBLAS( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will try to compile and link a program using the PSBLAS library
dnl
dnl Will use MPIFC, otherwise '$FC'.
dnl
dnl If the test passes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND.
dnl
dnl @author Michele Martone <michele.martone@uniroma2.it>
dnl
AC_DEFUN(PAC_FORTRAN_HAVE_PSBLAS,
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!
[cat > conftest.$ac_ext <<EOF
program test
use psb_base_mod
end program test
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
ifelse([$1], , :, [rm -rf conftest*
$1])
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ifelse([$2], , , [ rm -rf conftest*
$2
])dnl
fi
rm -f conftest*])
dnl @synopsis PAC_FORTRAN_TEST_TR15581( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Will try to compile and link a program checking the TR15581 Fortran extension 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 <michele.martone@uniroma2.it>
dnl
AC_DEFUN(PAC_FORTRAN_TEST_TR15581,
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 allocatables TR15581])
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 AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
ifelse([$1], , :, [
$1])
else
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
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 <michele.martone@uniroma2.it>
dnl
AC_DEFUN(PAC_CHECK_BLACS,
[AC_ARG_WITH(blacs, AC_HELP_STRING([--with-blacs=LIB], [Specify BLACSLIBNAME or -lBLACSLIBNAME or the absolute library filename.]),
[psblas_cv_blacs=$withval],
[psblas_cv_blacs=''])
case $psblas_cv_blacs in
yes | "") ;;
-* | */* | *.a | *.so | *.so.* | *.o)
BLACS_LIBS="$psblas_cv_blacs" ;;
*) BLACS_LIBS="-l$psblas_cv_blacs" ;;
esac
#
# Test user-defined BLACS
#
if test x"$psblas_cv_blacs" != "x" ; then
save_LIBS="$LIBS";
AC_LANG([Fortran])
LIBS="$BLACS_LIBS $LIBS"
AC_MSG_CHECKING([for dgesd2d in $BLACS_LIBS])
AC_TRY_LINK_FUNC(dgesd2d, [psblas_cv_blacs_ok=yes], [psblas_cv_blacs_ok=no;BLACS_LIBS=""])
AC_MSG_RESULT($psblas_cv_blacs_ok)
if test x"$psblas_cv_blacs_ok" == x"yes"; then
AC_MSG_CHECKING([for blacs_pinfo in $BLACS_LIBS])
AC_TRY_LINK_FUNC(blacs_pinfo, [psblas_cv_blacs_ok=yes], [psblas_cv_blacs_ok=no;BLACS_LIBS=""])
AC_MSG_RESULT($psblas_cv_blacs_ok)
fi
LIBS="$save_LIBS";
fi
AC_LANG([C])
######################################
# System BLACS with PESSL default names.
######################################
if test x"$BLACS_LIBS" == "x" ; then
AC_LANG([Fortran])
PAC_CHECK_LIBS([blacssmp blacsp2 blacs],
[dgesd2d],
[psblas_cv_blacs_ok=yes; LIBS="$LIBS $pac_check_libs_LIBS " ]
[BLACS_LIBS="$pac_check_libs_LIBS" ]
AC_MSG_NOTICE([BLACS libraries detected.]),[]
)
if test x"$BLACS_LIBS" != "x"; then
save_LIBS="$LIBS";
LIBS="$BLACS_LIBS $LIBS"
AC_MSG_CHECKING([for blacs_pinfo in $BLACS_LIBS])
AC_LANG([Fortran])
AC_TRY_LINK_FUNC(blacs_pinfo, [psblas_cv_blacs_ok=yes], [psblas_cv_blacs_ok=no;BLACS_LIBS=""])
AC_MSG_RESULT($psblas_cv_blacs_ok)
LIBS="$save_LIBS";
fi
fi
######################################
# Maybe we're looking at PESSL BLACS?#
######################################
if test x"$BLACS_LIBS" != "x" ; then
save_LIBS="$LIBS";
LIBS="$BLACS_LIBS $LIBS"
AC_MSG_CHECKING([for PESSL BLACS])
AC_LANG([Fortran])
AC_TRY_LINK_FUNC(esvemonp, [psblas_cv_pessl_blacs=yes], [psblas_cv_pessl_blacs=no])
AC_MSG_RESULT($psblas_cv_pessl_blacs)
LIBS="$save_LIBS";
fi
if test "x$psblas_cv_pessl_blacs" == "xyes"; then
FDEFINES="$psblas_cv_define_prepend-DHAVE_ESSL_BLACS $FDEFINES"
fi
##############################################################################
# Netlib BLACS library with default names
##############################################################################
if test x"$BLACS_LIBS" == "x" ; then
save_LIBS="$LIBS";
AC_LANG([Fortran])
PAC_CHECK_LIBS([ blacs_MPI-LINUX-0 blacs_MPI-SP5-0 blacs_MPI-SP4-0 blacs_MPI-SP3-0 blacs_MPI-SP2-0 blacsCinit_MPI-ALPHA-0 blacsCinit_MPI-IRIX64-0 blacsCinit_MPI-RS6K-0 blacsCinit_MPI-SPP-0 blacsCinit_MPI-SUN4-0 blacsCinit_MPI-SUN4SOL2-0 blacsCinit_MPI-T3D-0 blacsCinit_MPI-T3E-0
],
[dgesd2d],
[psblas_cv_blacs_ok=yes; LIBS="$LIBS $pac_check_libs_LIBS "
psblas_have_netlib_blacs=yes; ]
[BLACS_LIBS="$pac_check_libs_LIBS" ]
AC_MSG_NOTICE([BLACS libraries detected.]),[]
)
if test x"$BLACS_LIBS" != "x" ; then
AC_LANG([Fortran])
PAC_CHECK_LIBS([ blacsF77init_MPI-LINUX-0 blacsF77init_MPI-SP5-0 blacsF77init_MPI-SP4-0 blacsF77init_MPI-SP3-0 blacsF77init_MPI-SP2-0 blacsF77init_MPI-ALPHA-0 blacsF77init_MPI-IRIX64-0 blacsF77init_MPI-RS6K-0 blacsF77init_MPI-SPP-0 blacsF77init_MPI-SUN4-0 blacsF77init_MPI-SUN4SOL2-0 blacsF77init_MPI-T3D-0 blacsF77init_MPI-T3E-0
],
[blacs_pinfo],
[psblas_cv_blacs_ok=yes; LIBS="$pac_check_libs_LIBS $LIBS" ]
[BLACS_LIBS="$pac_check_libs_LIBS $BLACS_LIBS" ]
AC_MSG_NOTICE([Netlib BLACS Fortran initialization libraries detected.]),[]
)
fi
if test x"$BLACS_LIBS" != "x" ; then
AC_LANG([C])
PAC_CHECK_LIBS([ blacsCinit_MPI-LINUX-0 blacsCinit_MPI-SP5-0 blacsCinit_MPI-SP4-0 blacsCinit_MPI-SP3-0 blacsCinit_MPI-SP2-0 blacsCinit_MPI-ALPHA-0 blacsCinit_MPI-IRIX64-0 blacsCinit_MPI-RS6K-0 blacsCinit_MPI-SPP-0 blacsCinit_MPI-SUN4-0 blacsCinit_MPI-SUN4SOL2-0 blacsCinit_MPI-T3D-0 blacsCinit_MPI-T3E-0
],
[Cblacs_pinfo],
[psblas_cv_blacs_ok=yes; LIBS="$pac_check_libs_LIBS $LIBS" ]
[BLACS_LIBS="$BLACS_LIBS $pac_check_libs_LIBS" ]
AC_MSG_NOTICE([Netlib BLACS C initialization libraries detected.]),[]
)
fi
LIBS="$save_LIBS";
fi
if test x"$BLACS_LIBS" == "x" ; then
AC_MSG_ERROR([
No BLACS library detected! $PACKAGE_NAME will be unusable.
Please make sure a BLACS implementation is accessible (ex.: --with-blacs="-lblacsname -L/blacs/dir" )
])
else
save_LIBS="$LIBS";
LIBS="$BLACS_LIBS $LIBS"
AC_MSG_CHECKING([for ksendid in $BLACS_LIBS])
AC_LANG([Fortran])
AC_TRY_LINK_FUNC(ksendid, [psblas_cv_have_sendid=yes],[psblas_cv_have_sendid=no])
AC_MSG_RESULT($psblas_cv_have_sendid)
LIBS="$save_LIBS"
AC_LANG([C])
if test "x$psblas_cv_have_sendid" == "xyes"; then
FDEFINES="$psblas_cv_define_prepend-DHAVE_KSENDID $FDEFINES"
fi
fi
])dnl

11615
configure vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,737 @@
dnl $Id$
dnl
dnl Michele Martone's proposal for a transition towards the GNU build system for the PSBLAS library
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
dnl usage : aclocal -I config/ && autoconf && ./configure && make
dnl then : VAR=VAL ./configure
dnl In some configurations (AIX) the next line is needed:
dnl MPIFC=mpxlf95 ./configure
dnl then : ./configure VAR=VAL
dnl then : ./configure --help=short
dnl then : ./configure --help
dnl OPEN QUESTIONS:
dnl To detect an installed instance of PSBLAS in order for MLD2P4 to be installed: the PSBLAS modules get this task difficult to accomplish!
dnl SEE : --module-path --include-path
dnl NOTE : There is no cross compilation support.
dnl NOTE : missing ifort and kl* library handling..
dnl NOTE : odd configurations like ifc + gcc still await in the mist of the unknown
###############################################################################
###############################################################################
#
# This script is used by the PSBLAS to determine the compilers, linkers, and
# libraries to build its libraries executable code.
# Its behaviour is driven on the compiler it finds or it is dictated to work
# with.
#
###############################################################################
###############################################################################
# NOTE: the literal for version (the second argument to AC_INIT should be a literal!)
AC_INIT([PSBLAS],0.0, salvatore.filippone@uniroma2.it)
# VERSION is the file containing the PSBLAS version code
# FIXME
psblas_cv_version="`cat VERSION`"
# A sample source file
AC_CONFIG_SRCDIR([base/modules/psb_base_mod.f90])
dnl AC_CONFIG_AUX_DIR(config)
# Our custom M4 macros are in the 'config' directory
AC_CONFIG_MACRO_DIR([config])
AC_MSG_NOTICE([
--------------------------------------------------------------------------------
Welcome to the $PACKAGE_NAME $psblas_cv_version configure Script.
This creates Make.inc, but if you read carefully the
documentation, you can make your own by hand for your needs.
Be sure to specify the library paths of your interest. Examples:
./configure CFLAGS=-L/some/directory/LIB <- will force CFLAGS
CFLAGS=-L/some/directory/LIB ./configure <- will force CFLAGS
./configure --with-cflags=-L/some/directory/LIB <- will append to CFLAGS
FC=mpif90 F77=$FC CC=mpicc ./configure <- will force FC,CC,F77
FLINK=gcc FLINK=gcc ./configure <- will force FLINK,F90LINK
See /configure --help=short fore more info.
--------------------------------------------------------------------------------
])
###############################################################################
# Compilers detection: FC,F77,CC should be set, if found.
###############################################################################
# Note that the following line won't save from troubles.
# AC_PROG_FC([mpxlf95 mpxlf90 mpxlf pgf95 pgf90 mpif95 mpif90 gfortran f95 f90 ifc])
AC_PROG_FC([xlf95 xlf90 xlf pgf95 pgf90 ifort ifc gfortran])
#AC_PROG_FC
AC_PROG_F77([xlf pgf77 ifort ifc gfortran])
AC_PROG_CC([xlc pgcc icc gcc ])
dnl AC_PROG_CXX
dnl AC_PROG_F90 doesn't exist, at the time of writing this !
dnl AC_PROG_F90
# Sanity checks, although redundant (useful when debugging this configure.ac)!
if test "X$FC" == "X" ; then
AC_MSG_ERROR([Problem : No Fortran compiler specified nor found!])
fi
if test "X$CC" == "X" ; then
AC_MSG_ERROR([Problem : No C compiler specified nor found!])
fi
###############################################################################
# Suitable MPI compilers detection
###############################################################################
# Note: Someday we will contemplate a fake MPI - configured version of PSBLAS
###############################################################################
#Note : we miss the name of the Intel C compiler
AC_LANG([C])
if test "X$MPICC" = "X" ; then
# This is our MPICC compiler preference: it will override ACX_MPI's first try.
AC_CHECK_PROGS([MPICC],[mpxlc mpcc pgcc mpicc])
fi
ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for C]])])
AC_LANG(Fortran 77)
if test "X$MPIF77" = "X" ; then
# This is our MPIFC compiler preference: it will override ACX_MPI's first try.
AC_CHECK_PROGS([MPIF77],[mpxlf mpif77 pgf77 mpf77 ifc])
fi
ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for Fortran 77]])])
AC_LANG([Fortran])
if test "X$MPIFC" = "X" ; then
# This is our MPIFC compiler preference: it will override ACX_MPI's first try.
AC_CHECK_PROGS([MPIFC],[mpxlf95 mpxlf90 mpif95 mpif90 pgf95 pg90 mpf95 mpf90 ifc ])
fi
ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for Fortran]])])
# We leave a default language for the next checks.
dnl AC_LANG([Fortran 77])
AC_LANG([C])
dnl Now on, MPIFC should be set, as MPIF77 and MPICC
###############################################################################
# Sanity checks, although redundant (useful when debugging this configure.ac)!
###############################################################################
if test "X$MPIFC" == "X" ; then
AC_MSG_ERROR([Problem : No MPI Fortran compiler specified nor found!])
fi
if test "X$MPICC" == "X" ; then
AC_MSG_ERROR([Problem : No MPI C compiler specified nor found!])
fi
###############################################################################
# FLAGS and LIBS user customization
###############################################################################
dnl NOTE : no spaces before the comma, and no brackets before the second argument!
PAC_ARG_WITH_FLAGS(ccflags,CCFLAGS)
PAC_ARG_WITH_FLAGS(cflags,CFLAGS)
PAC_ARG_WITH_FLAGS(fflags,FFLAGS)
#PAC_ARG_WITH_FLAGS(ldflags,LDFLAGS)
PAC_ARG_WITH_LIBS
PAC_ARG_WITH_FLAGS(clibs,CLIBS)
PAC_ARG_WITH_FLAGS(flibs,FLIBS)
dnl candidates for removal:
PAC_ARG_WITH_FLAGS(library-path,LIBRARYPATH)
PAC_ARG_WITH_FLAGS(include-path,INCLUDEPATH)
PAC_ARG_WITH_FLAGS(module-path,MODULE_PATH)
# we just gave the user the chance to append values to these variables
###############################################################################
dnl Library oriented Autotools facilities (we don't care about this for now)
dnl AC_PROG_LIBTOOL
dnl AM_MAINTAINER_MODE
AC_PROG_RANLIB
dnl system's ranlib will be found, too
AM_INIT_AUTOMAKE
dnl Specify required version of autoconf.
AC_PREREQ(2.59)
###############################################################################
# Compiler identification (sadly, it is necessary)
###############################################################################
psblas_cv_fc=""
dnl Do we use gfortran & co ? Compiler identification.
dnl NOTE : in /autoconf/autoconf/fortran.m4 there are plenty of better tests!
PAC_CHECK_HAVE_GFORTRAN(
psblas_cv_fc="gcc",
[]
)
#
# Test for TR 15581, aka allocatables extensions.
#
PAC_FORTRAN_TEST_TR15581(
[AC_MSG_RESULT([yes.])],
[AC_MSG_ERROR([no.
Sorry, cannot build PSBLAS without support for TR15581.
Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.2.])]
)
if test x"$psblas_cv_fc" == "x" ; then
if eval "$MPIFC -qversion | grep XL 2>/dev/null" ; then
psblas_cv_fc="xlf"
# Some configurations of the XLF want "-WF," prepended to -D.. flags.
# TODO : discover the exact conditions when the usage of -WF is needed.
psblas_cv_define_prepend="-WF,"
# Note : there coule be problems with old xlf compiler versions ( <10.1 )
# since (as far as it is known to us) -WF, is not used in earlier versions.
# More problems could be undocumented yet.
else
# Sun compiler detection
if eval "$MPIFC -V | grep Sun 2>/dev/null" ; then
psblas_cv_fc="sun"
else
# Portland group compiler detection
if eval "$MPIFC -V | grep Portland 2>/dev/null" ; then
psblas_cv_fc="pg"
else
# Intel compiler identification
if eval "$MPIFC -V 2>&1 | grep Intel.*Fortran.*Compiler 2>/dev/null" ; then
psblas_cv_fc="ifc"
else
psblas_cv_fc=""
# unsupported MPI Fortran compiler
AC_MSG_ERROR([[Unknown compiler ! Make sure your Fortran compiler is specified as compatible in the documentation!]])
fi
fi
fi
fi
fi
# TODO : SEE _AC_PROG_FC_V
# TODO : AC_MSG_ERROR(see "$ac_cv_prog_FC_fc")
# AC_MSG_NOTICE( "ac_cv_prog_FC_fc : $ac_cv_prog_FC_fc")
###############################################################################
###############################################################################
# Linking, symbol mangling, and misc tests
###############################################################################
# Note : This is functional to Make.inc rules and structure (see below).
AC_LANG([C])
AC_CHECK_SIZEOF(void *)
# Define for platforms with 64 bit (void * ) pointers
if test X"$ac_cv_sizeof_void_p" == X"8" ; then
CDEFINES="-DLargeFptr $CDEFINES"
fi
AC_LANG([Fortran])
__AC_FC_NAME_MANGLING
AC_LANG([C])
dnl AC_MSG_NOTICE([Fortran name mangling: $ac_cv_fc_mangling])
[pac_fc_case=${ac_cv_fc_mangling%%,*}]
[pac_fc_under=${ac_cv_fc_mangling#*,}]
[pac_fc_sec_under=${pac_fc_under#*,}]
[pac_fc_sec_under=${pac_fc_sec_under# }]
[pac_fc_under=${pac_fc_under%%,*}]
[pac_fc_under=${pac_fc_under# }]
AC_MSG_CHECKING([defines for C/Fortran name interfaces])
if test "x$pac_fc_case" == "xlower case"; then
if test "x$pac_fc_under" == "xunderscore"; then
if test "x$pac_fc_sec_under" == "xno extra underscore"; then
pac_f_c_names="-DLowerUnderscore"
elif test "x$pac_fc_sec_under" == "xextra underscore"; then
pac_f_c_names="-DLowerDoubleUnderscore"
else
pac_f_c_names="-DUNKNOWN"
dnl AC_MSG_NOTICE([Fortran name mangling extra underscore unknown case])
fi
elif test "x$pac_fc_under" == "xno underscore"; then
pac_f_c_names="-DLowerCase"
else
pac_f_c_names="-DUNKNOWN"
dnl AC_MSG_NOTICE([Fortran name mangling underscore unknown case])
fi
elif test "x$pac_fc_case" == "xupper case"; then
if test "x$pac_fc_under" == "xunderscore"; then
if test "x$pac_fc_sec_under" == "xno extra underscore"; then
pac_f_c_names="-DUpperUnderscore"
elif test "x$pac_fc_sec_under" == "xextra underscore"; then
pac_f_c_names="-DUpperDoubleUnderscore"
else
pac_f_c_names="-DUNKNOWN"
dnl AC_MSG_NOTICE([Fortran name mangling extra underscore unknown case])
fi
elif test "x$pac_fc_under" == "xno underscore"; then
pac_f_c_names="-DUpperCase"
else
pac_f_c_names="-DUNKNOWN"
dnl AC_MSG_NOTICE([Fortran name mangling underscore unknown case])
fi
dnl AC_MSG_NOTICE([Fortran name mangling UPPERCASE not handled])
else
pac_f_c_names="-DUNKNOWN"
dnl AC_MSG_NOTICE([Fortran name mangling unknown case])
fi
CDEFINES="$pac_f_c_names $CDEFINES"
AC_MSG_RESULT([ $pac_f_c_names ])
###############################################################################
# Make.inc generation logic
###############################################################################
# Note : This script is sensitive to FFLAGS, FCFLAGS, CFLAGS variables.
# Note : We cannot be sure whether ./configure test programs will use these *FLAGS.
dnl Note: CFLAGS == '' is a rare condition, but we provide mechanism, not policy.
dnl So we prefer:
if test "X$CFLAGS" == "X" ; then
dnl over
dnl if true ; then
if test "X$psblas_cv_fc" == "Xgcc" ; then
# note that no space should be placed around the equality symbol in assignations
# Note : 'native' is valid _only_ on GCC/x86 (32/64 bits)
CCOPT="-O3 $CCOPT"
else
if test "X$psblas_cv_fc" == X"xlf" ; then
# XL compiler : consider using -qarch=auto
CCOPT="-O3 $CCOPT"
else
# other compilers ..
CCOPT="-O3 $CCOPT"
# NOTE : PG & Sun use -fast instead -O3
fi
fi
else
CCOPT="${CFLAGS}"
fi
CFLAGS="${CCOPT}"
if test "X$FFLAGS" == "X" ; then
if test "X$psblas_cv_fc" == "Xgcc" ; then
# note that no space should be placed around the equality symbol in assignations
# Note : 'native' is valid _only_ on GCC/x86 (32/64 bits)
FCOPT="-O3 $FCOPT"
else
if test "X$psblas_cv_fc" == X"xlf" ; then
# XL compiler : consider using -qarch=auto
FCOPT="-O3 $FCOPT"
else
# other compilers ..
FCOPT="-O3 $FCOPT"
# NOTE : PG & Sun use -fast instead -O3
fi
fi
else
FCOPT="${FFLAGS}"
fi
FFLAGS="${FCOPT}"
if test "X$FCFLAGS" == "X" ; then
if test "X$psblas_cv_fc" == "Xgcc" ; then
# note that no space should be placed around the equality symbol in assignations
# Note : 'native' is valid _only_ on GCC/x86 (32/64 bits)
F90COPT="-O3 $F90COPT"
else
if test "X$psblas_cv_fc" == X"xlf" ; then
# XL compiler : consider using -qarch=auto
F90COPT="-O3 $F90COPT"
else
# other compilers ..
F90COPT="-O3 $F90COPT"
# NOTE : PG & Sun use -fast instead -O3
fi
fi
else
F90COPT="${FCFLAGS}"
fi
FCFLAGS="${F90COPT}"
# COPT,FCOPT, F90COPT are aliases for FFLAGS,CFLAGS,FCFLAGS .
##############################################################################
# Compilers variables selection
##############################################################################
if true ; then
if test "X$psblas_cv_fc" == X"xlf" ; then
# WARNING : this is EVIL : specifying a pathname prefixed compiler will be ignored!
# But this is necessary since :
# - if called from some script, xlf could behave strangely
# - it is not said that mpxlf95 gets chosen by the configure script.
F90="xlf95 -qsuffix=f=f90:cpp=F90"
# F90="xlf95"
MPF90="mpxlf95 -qsuffix=f=f90:cpp=F90"
# FC="xlf"
# Note : this gives problems in base/serial/aux/isaperm.f
# FC="mpxlf -qsuffix=f=f90:cpp=F90"
# Note : this is the cure
FC="xlf -qsuffix=f=f:cpp=F"
# Note : maybe we will want xlf -qsuffix=cpp=F
F77="xlf"
MPF77="mpxlf95 -qfixed -qsuffix=f=f:cpp=F"
CC="xlc"
MPCC="mpcc"
#MPFCC="mpxlc"
# Note : -qfixed should be not specified in the environment FFLAGS or things will break.
# This fact should be documented somewhere.
else
# We really think about the GCC here but this is our idea for other compilers, too.
# If the user wishes to, she should specify MPICC, MPIF77 after ./configure.
# Note: this behavious should be documented.
F90=${FC}
MPF90=${MPIFC}
FC=${FC}
MPF77=${MPIFC}
CC=${CC}
MPCC=${MPICC}
fi
fi
##############################################################################
# Choice of our compilers, needed by Make.inc
##############################################################################
if test "X$FLINK" == "X" ; then
FLINK=${MPF77}
fi
if test "X$F90LINK" == "X" ; then
F90LINK=${MPF90}
fi
##############################################################################
##############################################################################
# Include flags
##############################################################################
AX_F90_MODULE_EXTENSION
AX_F90_MODULE_FLAG
MODEXT=".$ax_f90_modext"
FMFLAG="$ax_f90_modflag"
FIFLAG=-I
###############################################################################
###############################################################################
# NOTE :
# Missing stuff :
# In the case the detected fortran compiler is ifort, icc or gcc
# should be valid options.
# The same for pg (Portland Group compilers).
###############################################################################
###############################################################################
# Custom test : do we have a module or include for MPI Fortran interface?
PAC_FORTRAN_CHECK_HAVE_MPI_MOD(
[FDEFINES="$psblas_cv_define_prepend-DMPI_MOD $FDEFINES"],
[FDEFINES="$psblas_cv_define_prepend-DMPI_H $FDEFINES"]
)
# Custom test : do we have move_alloc ?
PAC_FORTRAN_HAVE_MOVE_ALLOC(
[FDEFINES="$psblas_cv_define_prepend-DHAVE_MOVE_ALLOC $FDEFINES"],
)
###############################################################################
# Additional pathname stuff (yes, it is redundant and confusing...)
###############################################################################
# -I
if test x"$INCLUDEPATH" != "x" ; then
FINCLUDES="$FINCLUDES $INCLUDEPATH"
CINCLUDES="$CINCLUDES $INCLUDEPATH"
fi
# -L
if test x"$LIBRARYPATH" != "x" ; then
FINCLUDES="$FINCLUDES $LIBRARYPATH"
fi
# -I
if test x"$MODULE_PATH" != "x" ; then
FINCLUDES="$FINCLUDES $MODULE_PATH"
fi
###############################################################################
# Parachute rules for ar and ranlib ... (could cause problems)
###############################################################################
if test "X$AR" == "X" ; then
AR="ar"
fi
if test "X$RANLIB" == "X" ; then
RANLIB="ranlib"
fi
# This should be portable
AR="${AR} -cur"
###############################################################################
# BLAS library presence checks
###############################################################################
# Note : The libmkl.a (Intel Math Kernel Library) library could be used, too.
# It is sufficient to specify it as -lmkl in the CLIBS or FLIBS or LIBS
# and specify its path adjusting -L/path in CFLAGS.
# Right now it is a matter of user's taste when linking custom applications.
# But PSBLAS examples could take advantage of these libraries, too.
AC_LANG([C])
ACX_BLAS([], [AC_MSG_ERROR([[Cannot find BLAS library, specify a path using --with-blas=DIR/LIB (for example --with-blas=/usr/path/lib/libcxml.a)]])])
###############################################################################
# BLACS library presence checks
###############################################################################
save_FC="$FC";
save_CC="$CC";
FC="$MPIFC";
CC="$MPICC";
PAC_CHECK_BLACS
FC="$save_FC";
CC="$save_CC";
###############################################################################
# METIS, SuperLU, SuperLU_Dist UMFPack libraries presence checks
###############################################################################
# Note : also SuperLUStat,superlu_gridexit,..
# Note : SuperLU_Dist produces superlu.a by default..
# Note : THESE WERE NOT TESTED
#AC_CHECK_LIB(superlu,[superlu_malloc_dist],psblas_cv_have_superludist=yes,psblas_cv_have_superludist=no)
#AC_CHECK_LIB(superlu,[superlu_malloc],psblas_cv_have_superlu=yes,psblas_cv_have_superlu=no)
# Note : also umfdi_local_search, ...
#AC_CHECK_LIB(umf,umfpack_di_solve,psblas_cv_have_umfpack=yes,psblas_cv_have_umfpack=no,[amd])
AC_ARG_WITH(metis, AC_HELP_STRING([--with-metis=LIB], [Specify -lMETISLIBNAME or the absolute library filename.]),
[psblas_cv_metis=$withval],
[psblas_cv_metis=''])
if test "x$psblas_cv_metis" != "x" ; then
AC_CHECK_LIB("m",METIS_PartGraphRecursive, psblas_cv_have_metis=yes; METIS_LIBS="$psblas_cv_metis", psblas_cv_have_metis=no,["$psblas_cv_metis"])
else
save_LIBS="$LIBS";
LIBS="-lm $LIBS";
AC_CHECK_LIB(metis,METIS_PartGraphRecursive,psblas_cv_have_metis=yes;METIS_LIBS="-lmetis", psblas_cv_have_metis=no)
LIBS="$save_LIBS";
fi
if test "x$psblas_cv_have_metis" == "xyes" ; then
FDEFINES="$FDEFINES $psblas_cv_define_prepend-DHAVE_METIS"
fi
# Note : We would like to detect PSBLAS, but this is complicated by the
# module symbols mangling rules, which are compiler specific !
#
# Moreover, the PSBLAS doesn't have an installer, currently.
###############################################################################
# Library target directory and archive files.
###############################################################################
LIBDIR=lib
BASELIBNAME=libpsb_base.a
PRECLIBNAME=libpsb_prec.a
METHDLIBNAME=libpsb_krylov.a
# Note: psb_util code will be compiled conditionally for METIS functionalities.. using HAVE_METIS
UTILLIBNAME=libpsb_util.a
###############################################################################
# Variable substitutions : the Make.inc.in will have these @VARIABLES@
# substituted.
AC_SUBST(FDEFINES)
AC_SUBST(CDEFINES)
AC_SUBST(BASELIBNAME)
AC_SUBST(F90)
AC_SUBST(F90COPT)
AC_SUBST(MPF90)
AC_SUBST(MPF77)
AC_SUBST(MPCC)
AC_SUBST(FCOPT)
AC_SUBST(CCOPT)
AC_SUBST(FIFLAG)
AC_SUBST(FMFLAG)
AC_SUBST(MODEXT)
AC_SUBST(MPIF77)
AC_SUBST(FLINK)
AC_SUBST(F90LINK)
AC_SUBST(LIBS)
AC_SUBST(AR)
AC_SUBST(RANLIB)
AC_SUBST(MPIFC)
AC_SUBST(MPIFCC)
AC_SUBST(BLAS_LIBS)
AC_SUBST(BLACS_LIBS)
AC_SUBST(METIS_LIBS)
AC_SUBST(CINCLUDES)
AC_SUBST(FINCLUDES)
if test "X$psblas_cv_fc" == "Xgcc" ; then
PSBLASRULES='
PSBLDLIBS=$(BLACS) $(BLAS) $(METIS_LIB) $(LIBS)
CDEFINES=$(PSBCDEFINES)
FDEFINES=$(PSBFDEFINES)
# Warning : these rules are only valid with GNU make!
%.o: %.c
$(CC) $(F90COPT) $(CINCLUDES) $(CDEFINES) -c $<
%.o: %.f
$(FC) $(FCOPT) $(FINCLUDES) -c $<
%$(.mod): %.f
$(FC) $(FCOPT) $(FINCLUDES) -c $<
%.o: %.f90
$(F90) $(F90COPT) $(FINCLUDES) -c $<
%$(.mod): %.f90
$(F90) $(F90COPT) $(FINCLUDES) -c $<
%.o: %.F
$(FC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $<
%$(.mod): %.F
$(FC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $<
%.o: %.F90
$(F90) $(F90COPT) $(FINCLUDES) $(FDEFINES) -c $<
%$(.mod): %.F90
$(F90) $(F90COPT) $(FINCLUDES) $(FDEFINES) -c $<'
else
PSBLASRULES='
PSBLDLIBS=$(BLACS) $(BLAS) $(METIS_LIB) $(LIBS)
CDEFINES=$(PSBCDEFINES)
FDEFINES=$(PSBFDEFINES)
# These should be portable rules, arent they?
.c.o:
$(CC) $(CCOPT) $(CINCLUDES) $(CDEFINES) -c $<
.f.o:
$(FC) $(FCOPT) $(FINCLUDES) -c $<
.f$(.mod):
$(F90) $(FCOPT) $(FINCLUDES) -c $<
.f90$(.mod):
$(F90) $(F90COPT) $(FINCLUDES) -c $<
.f90.o:
$(F90) $(F90COPT) $(FINCLUDES) -c $<
.F.o:
$(FC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $<
.F$(.mod):
$(FC) $(FCOPT) $(FINCLUDES) $(FDEFINES) -c $<
.F90.o:
$(F90) $(F90COPT) $(FINCLUDES) $(FDEFINES) -c $<
.F90$(.mod):
$(F90) $(F90COPT) $(FINCLUDES) $(FDEFINES) -c $<'
fi
AC_SUBST(PSBLASRULES)
AC_SUBST(LIBDIR)
AC_SUBST(BASELIBNAME)
AC_SUBST(PRECLIBNAME)
AC_SUBST(METHDLIBNAME)
AC_SUBST(UTILLIBNAME)
###############################################################################
# the following files will be created by Automake
AC_CONFIG_FILES([Make.inc])
AC_OUTPUT()
#AC_OUTPUT(Make.inc Makefile)
###############################################################################
dnl Please note that brackets around variable identifiers are absolutely needed for compatibility..
AC_MSG_NOTICE([
${PACKAGE_NAME} ${psblas_cv_version} has been configured as follows:
MPF90 : ${MPF90}
MPF77 : ${MPF77}
MPICC : ${MPICC}
dnl F90LINK : ${F90LINK}
FLINK : ${FLINK}
FDEFINES : ${FDEFINES}
CDEFINES : ${CDEFINES}
CFLAGS : ${CFLAGS}
FFLAGS : ${FFLAGS}
FCFLAGS : ${FCFLAGS}
MODEXT : ${MODEXT}
FMFLAG : ${FMFLAG}
dnl F90COPT : ${F90COPT}
dnl FCOPT : ${FCOPT}
dnl CCOPT : ${CCOPT}
dnl ESSL/PESSL : ${psblas_cv_have_essl} / ${psblas_cv_have_pessl}
BLAS : ${BLAS_LIBS}
BLACS : ${BLACS_LIBS}
METIS detected : ${psblas_cv_have_metis}
dnl SuperLU detected : ${psblas_cv_have_superlu}
dnl SuperLU_Dist detected : ${psblas_cv_have_superludist}
dnl UMFPack detected : ${psblas_cv_have_umfpack}
dnl F90 : ${F90}
dnl FC : ${FC}
dnl CC : ${CC}
dnl F77 : ${F77}
dnl FMFLAG : ${FMFLAG}
dnl FIFLAG : ${FIFLAG}
dnl MPICXX : ${MPICXX}
dnl MPIF77 : ${MPIF77}
dnl MPIFC : ${MPIFC}
dnl MPIF90 : ${MPIF90}
dnl MPCC : ${MPCC}
dnl AR : ${AR}
dnl RANLIB : ${RANLIB}
LIBS : ${LIBS}
dnl FIXME : CLIBS seems an useless variable..
dnl FIXME : FLIBS seems an useless variable..
dnl FIXME : LIBS seems an useless variable..
dnl CLIBS : ${CLIBS}
dnl FLIBS : ${CLIBS}
dnl LIBS : ${LIBS}
dnl Note : we should use LDLIBS sooner or later!
LDLIBS : ${LDLIBS}
LIBRARYPATH : ${LIBRARYPATH}
INCLUDEPATH : ${INCLUDEPATH}
MODULE_PATH : ${MODULE_PATH}
If you are satisfied, run 'make' to build ${PACKAGE_NAME} and its documentation; otherwise
type ./configure --help=short for a complete list of configure options specific to ${PACKAGE_NAME}.
dnl To install the program and its documentation, run 'make install' if you are root,
dnl or run 'su -c "make install"' if you are not root.
])
###############################################################################
Loading…
Cancel
Save