Skip to content
Snippets Groups Projects
Commit d10cf794 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Moved tests for BLAS, SuperLU, (Par)Metis and Pardiso from dune-common

to dune-istl.

[[Imported from SVN: r6566]]
parent 3aa635e0
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,6 @@
# $Id$
ALLM4S = \
acx_blas.m4 \
acx_lapack.m4 \
acx_mpi.m4 \
acx_pthread.m4 \
......@@ -38,17 +37,12 @@ ALLM4S = \
fortran_overwrite.m4 \
gmp.m4 \
hdf5.m4 \
immdx_lib_metis.m4 \
inkscape.m4 \
libtoolcompat.m4 \
make_shared.m4 \
mpi-config.m4 \
opengl.m4 \
pardiso.m4 \
parmetis.m4 \
shared_ptr.m4 \
superlu-dist.m4 \
superlu.m4 \
xdr.m4
aclocaldir = $(datadir)/aclocal
......
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
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 linked to by default? (happens on some supercomputers)
if test $acx_blas_ok = no; then
save_LIBS="$LIBS"; LIBS="$LIBS"
AC_CHECK_FUNC($sgemm, [acx_blas_ok=yes])
LIBS="$save_LIBS"
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
# 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
dnl @synopsis IMMDX_LIB_METIS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl
dnl This macro searches for the METIS library in the user specified
dnl location. The user may specify the location either by defining the
dnl environment variable METIS or by using the --with-metis option to
dnl configure. If the environment variable is defined it has precedent
dnl over everything else. If no location was specified then it searches
dnl in /usr/lib and /usr/local/lib for the library and in /usr/include
dnl and /usr/local/include for the header files. Upon sucessful
dnl completion the variables METIS_LIB and METIS_INCLUDE are set.
dnl
dnl ACTION-IF-FOUND is a list of shell commands to run if a METIS
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_METIS. If ACTION-IF-NOT-FOUND is
dnl not specified then an error will be generated halting configure.
dnl
dnl @category InstalledPackages
dnl @author Ben Bergen <ben@cs.fau.de>
dnl @version 2003-01-19
dnl @license AllPermissive
AC_DEFUN([IMMDX_LIB_METIS], [
AC_MSG_CHECKING(for METIS library)
AC_REQUIRE([AC_PROG_CC])
#
# User hints...
#
AC_ARG_VAR([METIS], [METIS library location])
AC_ARG_WITH([metis],
[AC_HELP_STRING([--with-metis],
[user defined path to METIS library])],
[
if test -n "$METIS" ; then
AC_MSG_RESULT(yes)
with_metis=$METIS
elif test "$withval" != no ; then
AC_MSG_RESULT(yes)
with_metis=$withval
else
AC_MSG_RESULT(no)
fi
],
[
if test -n "$METIS" ; then
with_metis=$METIS
AC_MSG_RESULT(yes)
else
with_metis=/usr
if test ! -f "$with_metis/include/metis.h" ; then
with_metis=/usr/local
if test ! -f "$with_metis/include/metis.h" ; then
with_metis=""
AC_MSG_RESULT(failed)
else
AC_MSG_RESULT(yes)
fi
else
AC_MSG_RESULT(yes)
fi
fi
])
#
# locate METIS library
#
if test -n "$with_metis" ; then
old_CFLAGS=$CFLAGS
old_LDFLAGS=$LDFLAGS
if test -f "$with_metis/include/metis.h"; then
lib_path="/lib"
include_path="/include"
fi
if test -f "$with_metis/Lib/metis.h"; then
# catch bad convention in the downloadable metis version
lib_path=""
include_path="/Lib"
fi
CFLAGS="-I$with_metis/$include_path"
LDFLAGS="-L$with_metis/$lib_path"
AC_LANG_SAVE
AC_LANG_C
AC_CHECK_LIB(metis, METIS_PartMeshDual,
[metis_lib=yes], [metis_lib=no], [-lm])
AC_CHECK_HEADER(metis.h, [metis_h=yes],
[metis_h=no], [/* check */])
echo x$metis_h
AC_LANG_RESTORE
CFLAGS=$old_CFLAGS
LDFLAGS=$old_LDFLAGS
AC_MSG_CHECKING(METIS in $with_metis)
if test "$metis_lib" = "yes" -a "$metis_h" = "yes" ; then
AC_SUBST(METIS_INCLUDE, [-I$with_metis$include_path])
AC_SUBST(METIS_LDFLAGS, [-L$with_metis$lib_path])
AC_SUBST(METIS_LIB, [-lmetis])
AC_MSG_RESULT(ok)
else
AC_MSG_RESULT(failed)
fi
fi
#
#
#
# tell automake
AM_CONDITIONAL(METIS, test x$METIS_LIB = x1)
if test x = x"$METIS_LIB" ; then
with_metis=no
ifelse([$2],,[AC_MSG_WARN(Failed to find valid METIS library)],[$2])
:
else
with_metis=yes
ifelse([$1],,[AC_DEFINE(HAVE_METIS,1,[Define if you have METIS library])
],[$1])
:
fi
])dnl IMMDX_LIB_METIS
AC_DEFUN([DUNE_PARDISO], [
AC_PREREQ(2.50)
AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
AC_REQUIRE([ACX_LAPACK])
acx_pardiso_ok=no
AC_ARG_WITH(pardiso,
[AC_HELP_STRING([--with-pardiso=<lib>], [use PARDISO library <lib>])])
case $with_pardiso in
yes | "") ;;
no) acx_pardiso_ok=disable ;;
-* | */* | *.a | *.so | *.so.* | *.o) PARDISO_LIBS="$with_pardiso" ;;
*) PARDISO_LIBS="-l$with_pardiso" ;;
esac
# Get fortran linker names of PARDISO functions to check for.
AC_F77_FUNC(pardisoinit)
acx_pardiso_save_LIBS="$LIBS"
LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
# First, check PARDISO_LIBS environment variable
if test $acx_pardiso_ok = no; then
if test "x$PARDISO_LIBS" != x; then
save_LIBS="$LIBS"; LIBS="$PARDISO_LIBS $LIBS"
AC_MSG_CHECKING([for $pardisoinit in $PARDISO_LIBS])
AC_TRY_LINK_FUNC($pardisoinit, [dnl
# add to global list
DUNE_PKG_LIBS="$DUNE_PKG_LIBS $PARDISO_LIBS $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
acx_pardiso_ok=yes],
[PARDISO_LIBS=""])
AC_MSG_RESULT($acx_pardiso_ok)
LIBS="$save_LIBS"
fi
fi
# tell automake
AM_CONDITIONAL(PARDISO, test $acx_pardiso_ok = yes)
AC_SUBST(PARDISO_LIBS)
LIBS="$acx_pardiso_save_LIBS"
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pardiso_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PARDISO,1,[Define if you have a
PARDISO library.]),[$1])
:
else
acx_pardiso_ok=no
$2
fi
])dnl SET_PARDISO
dnl -*- mode: autoconf; tab-width: 8; indent-tabs-mode: nil; -*-
dnl vi: set et ts=8 sw=2 sts=2:
# $Id$
# searches for ParMetis headers and libs
AC_DEFUN([DUNE_PATH_PARMETIS],[
AC_MSG_CHECKING(for ParMETIS library)
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PATH_XTRA])
AC_REQUIRE([DUNE_MPI])
#
# USer hints ...
#
AC_ARG_VAR([PARMETIS], [ParMETIS library location])
AC_ARG_WITH([parmetis],
[AC_HELP_STRING([--with-parmetis],[user defined path to ParMETIS library])],
[
# --with-parmetis supersedes $PARMETIS
PARMETIS=""
if test "$withval" != no ; then
if test -d "$withval" ; then
# get absolute path
with_parmetis=`eval cd $withval 2>&1 && pwd`
AC_MSG_RESULT(yes)
else
with_parmetis="no"
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
fi
],
[
if test -n "$PARMETIS" ; then
if test -d "$PARMETIS" ; then
# get absolute path
with_parmetis=`eval cd $PARMETIS 2>&1 && pwd`
PARMETIS=""
AC_MSG_RESULT(yes)
else
PARMETIS=""
with_parmetis=no
AC_MSG_RESULT(no)
fi
else
with_parmetis=/usr/
include_path=include
lib_path=lib
if test ! -f "$with_parmetis/$include_path/parmetis.h" ; then
with_parmetis=/usr/local/
if test ! -f "$with_metis/$include_path/parmetis.h" ; then
with_parmetis="no"
AC_MSG_RESULT(failed)
else
AC_MSG_RESULT(yes)
fi
else
AC_MSG_RESULT(yes)
fi
fi
])
# store old values
ac_save_LDFLAGS="$LDFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
## do nothing if --without-parmetis is used
if test x"$with_mpi" != x"no" && test x"$with_parmetis" != x"no" ; then
# defaultpath
PARMETIS_LIB_PATH="$with_parmetis$lib_path"
PARMETIS_INCLUDE_PATH="$with_parmetis$lib_path"
PARMETIS_LIBS="-L$PARMETIS_LIB_PATH -lmetis $DUNEMPILIBS -lm"
PARMETIS_LDFLAGS="$DUNEMPILDFLAGS"
# set variables so that tests can use them
CPPFLAGS="$CPPFLAGS -I$PARMETIS_INCLUDE_PATH $DUNEMPICPPFLAGS"
# check for central header
AC_CHECK_HEADER([parmetis.h],[
PARMETIS_CPPFLAGS="-I$PARMETIS_INCLUDE_PATH"
HAVE_PARMETIS="1"],[
HAVE_PARMETIS="0"
AC_MSG_WARN([parmetis.h not found in $PARMETIS_INCLUDE_PATH with $CPPFLAGS])]
)
PARMETIS_CPPFLAGS="${DUNEMPICPPFLAGS} ${PARMETIS_CPPFLAGS} -DENABLE_PARMETIS=1"
# AC_LANG_PUSH([C++])
# if header is found check for the libs
LIBS="$DUNEMPILIBS -lm $LIBS"
if test x$HAVE_PARMETIS = x1 ; then
DUNE_CHECK_LIB_EXT([$PARMETIS_LIB_PATH], [metis], [metis_partgraphkway],
[
PARMETIS_LIBS="-L$PARMETIS_LIB_PATH -lmetis $DUNEMPILIBS -lm"
LIBS="$PARMETIS_LIBS $ac_save_LIBS"
],[
HAVE_PARMETIS="0"
AC_MSG_WARN(libmetis not found!)
])
fi
if test x$HAVE_PARMETIS = x1 ; then
DUNE_CHECK_LIB_EXT([$PARMETIS_LIB_PATH], [parmetis], [parmetis_v3_partkway],
[
PARMETIS_LIBS="-L$PARMETIS_LIB_PATH -lparmetis -lmetis $DUNEMPILIBS -lm"
],[
HAVE_PARMETIS="0"
AC_MSG_WARN(libparmetis not found!)
])
fi
# AC_LANG_POP([C++])
# pre-set variable for summary
#with_parmetis="no"
# did it work?
AC_MSG_CHECKING(ParMETIS in $with_parmetis)
if test x$HAVE_PARMETIS = x1 ; then
AC_SUBST(PARMETIS_LIBS, $PARMETIS_LIBS)
AC_SUBST(PARMETIS_LDFLAGS, $PARMETIS_LDFLAGS)
AC_SUBST(PARMETIS_CPPFLAGS, $PARMETIS_CPPFLAGS)
AC_DEFINE(HAVE_PARMETIS,ENABLE_PARMETIS,[Define if you have the Parmetis library.
This is only true if MPI was found by configure
_and_ if the application uses the PARMETIS_CPPFLAGS])
AC_MSG_RESULT(ok)
# add to global list
DUNE_PKG_LIBS="$PARMETIS_LIBS $DUNE_PKG_LIBS"
DUNE_PKG_LDFLAGS="$DUNE_PKG_LDFLAGS $PARMETIS_LDFLAGS"
DUNE_PKG_CPPFLAGS="$DUNE_PKG_CPPFLAGS $PARMETIS_CPPFLAGS"
# re-set variable correctly
with_parmetis="yes"
else
with_parmetis="no"
AC_MSG_RESULT(failed)
fi
# end of "no --without-parmetis"
else
with_parmetis="no"
fi
# tell automake
AM_CONDITIONAL(PARMETIS, test x$HAVE_PARMETIS = x1)
# restore variables
LDFLAGS="$ac_save_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS"
LIBS="$ac_save_LIBS"
DUNE_ADD_SUMMARY_ENTRY([ParMETIS],[$with_parmetis])
])
# $Id$
# searches for Superlu_Dist headers and libs
AC_DEFUN([_slu_dist_lib_path],
[
my_include_path=include/superludist
my_lib_path=lib
my_slu_found=yes
if test ! -f "$1/$my_include_path/$2" ; then
#Try to find headers under superlu
my_include_path=include
if test ! -f "$with_superlu_dist/$my_include_path/$2" ; then
my_include_path=SRC
my_lib_path=""
if test ! -f "$with_superlu_dist/$my_include_path/$2"; then
my_slu_found=no
fi
fi
fi
]
)
#AC_DEFUN([_slu_dist_search_versions],
# [
# my_slu_header=slu_ddefs.h
# _slu_dist_lib_path($1, "$my_slu_header")
# if test "$my_slu_found" != "yes"; then
# my_slu_header="dsp_defs.h"
# _slu_dist_lib_path($1, "$my_slu_header")
# fi
# ]
#)
AC_DEFUN([_slu_dist_search_default],
[
with_superlu_dist=/usr
_slu_dist_lib_path($with_superlu_dist, "superlu_ddefs.h")
if test "$my_slu_found" = "no"; then
with_superlu_dist=/usr/local
_slu_dist_lib_path($with_superlu_dist, "superlu_ddefs.h")
fi
]
)
AC_DEFUN([DUNE_PATH_SUPERLU_DIST],[
AC_MSG_CHECKING(for SuperLUDist library)
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([ACX_BLAS])
AC_REQUIRE([DUNE_MPI])
#
# USer hints ...
#
my_lib_path=""
my_include_path=""
AC_ARG_WITH([superlu_dist],
[AC_HELP_STRING([--with-superlu-dist],[user defined path to SuperLUDist library])],
[dnl
if test "$withval" != no ; then
# get absolute path
with_superlu_dist=`eval cd $withval 2>&1 && pwd`
if test "$withval" = yes; then
# Search in default locations
_slu_dist_search_default
else
# Search for the headers in the specified location
_slu_dist_lib_path("$with_superlu_dist", "superlu_ddefs.h")
fi
fi
],
[dnl
# Search in default locations
_slu_dist_search_default
])
AC_MSG_RESULT([$with_superlu_dist/$my_include_path])
AC_ARG_WITH([super_lu_dist_lib],
[AC_HELP_STRING([--with-superlu-dist-lib],[The name of the static SuperLUDist library to link to. By default the shared library with the name superlu-mpi is tried])],
[
if test "$withval" != no ; then
with_superlu_dist_lib=$withval
fi
]
)
# store old values
ac_save_LDFLAGS="$LDFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
## do nothing if --without-superlu_dist is used
if test x"$with_superlu_dist" != x"no" ; then
# defaultpath
SUPERLU_DIST_LIB_PATH="$with_superlu_dist/$my_lib_path"
SUPERLU_DIST_INCLUDE_PATH="$with_superlu_dist/$my_include_path"
SUPERLU_DIST_LDFLAGS="-L$SUPERLU_DIST_LIB_PATH $DUNEMPILDFLAGS"
# set variables so that tests can use them
CPPFLAGS="$CPPFLAGS -I$SUPERLU_DIST_INCLUDE_PATH $DUNEMPICPPFLAGS"
# check for central header
AC_CHECK_HEADER([superlu_ddefs.h],[
SUPERLU_DIST_CPPFLAGS="$CPPFLAGS"
HAVE_SUPERLU_DIST="1"],[
HAVE_SUPERLU_DIST="0"
AC_MSG_WARN([superlu_ddefs.h not found in $SUPERLU_DIST_INCLUDE_PATH with $CPPFLAGS])]
)
SUPERLU_DIST_CPPFLAGS="-I$SUPERLU_DIST_INCLUDE_PATH $DUNEMPICPPFLAGS"
# if header is found check for the libs
if test x$HAVE_SUPERLU_DIST = x1 ; then
# set variables so that tests can use them
OLDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$SUPERLU_DIST_LIB_PATH $DUNEMPILDFLAGS"
LIBS="$BLAS_LIBS $LIBS $FLIBS $DUNEMPILIBS"
AC_CHECK_LIB(superlu-mpi, [pdgssvx],
[dnl
SUPERLU_DIST_LIBS="-lsuperlu-mpi $LIBS"
SUPERLU_DIST_LDFLAGS="$LDFLAGS"
HAVE_SUPERLU_DIST="1"
AC_MSG_RESULT(yes)
],[dnl
HAVE_SUPERLU_DIST="0"
AC_MSG_WARN(libsuperlu-mpi not found)])
if test "$HAVE_SUPERLU_DIST" = 0; then
#check for the static library
if test x$with_superlu_dist_lib = x ; then
with_superlu_dist_lib=superlu_mpi.a
fi
AC_MSG_CHECKING([static SuperLUDist library $with_superlu_dist_lib in "$SUPERLU_DIST_LIB_PATH"])
if test -f "$SUPERLU_DIST_LIB_PATH/$with_superlu_dist_lib"; then
LIBS="$SUPERLU_DIST_LIB_PATH/$with_superlu_dist_lib $LIBS"
LDFLAGS="$OLDFLAGS"
AC_CHECK_FUNC(pdgssvx,
[
SUPERLU_DIST_LIBS="$LIBS"
SUPERLU_DIST_LDFLAGS="$LDFLAGS"
HAVE_SUPERLU_DIST="1"
AC_MSG_RESULT(yes)
],
[
HAVE_SUPERLU_DIST="0"
AC_MSG_RESULT(failed)
]
)
else
AC_MSG_RESULT(failed)
HAVE_SUPERLU_DIST="0"
fi
fi
fi
# pre-set variable for summary
#with_superlu_dist="no"
# did it work?
AC_MSG_CHECKING([SuperLUDist in $with_superlu_dist])
if test x$HAVE_SUPERLU_DIST = x1 ; then
AC_SUBST(SUPERLU_DIST_LDFLAGS, $SUPERLU_DIST_LDFLAGS)
AC_SUBST(SUPERLU_DIST_LIBS, $SUPERLU_DIST_LIBS)
AC_SUBST(SUPERLU_DIST_CPPFLAGS, $SUPERLU_DIST_CPPFLAGS)
AC_DEFINE(HAVE_SUPERLU_DIST, 1, [Define to 1 if SUPERLU_DIST is found])
AC_MSG_RESULT(ok)
# add to global list
DUNE_PKG_LDFLAGS="$DUNE_PKG_LDFLAGS $SUPERLU_DIST_LDFLAGS"
DUNE_PKG_LIBS="$DUNE_PKG_LIBS $SUPERLU_DIST_LIBS"
DUNE_PKG_CPPFLAGS="$DUNE_PKG_CPPFLAGS $SUPERLU_DIST_CPPFLAGS"
# re-set variable correctly
with_superlu_dist="yes"
else
with_superlu_dist="no"
AC_MSG_RESULT(failed)
fi
# end of "no --without-superlu_dist"
else
with_superlu_dist="no"
fi
# tell automake
AM_CONDITIONAL(SUPERLU_DIST, test x$HAVE_SUPERLU_DIST = x1)
# restore variables
LDFLAGS="$ac_save_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS"
LIBS="$ac_save_LIBS"
DUNE_ADD_SUMMARY_ENTRY([SuperLU-DIST],[$with_superlu_dist])
]
)
dnl Local Variables:
dnl mode: shell-script
dnl End:
## -*- autoconf -*-
# $Id$
# searches for SuperLU headers and libs
# _slu_lib_path(SUPERLU_ROOT, HEADER)
#
# Try to find the subpath unter SUPERLU_ROOT containing HEADER. Try
# SUPERLU_ROOT/"include/superlu", SUPERLU_ROOT/"include", and
# SUPERLU_ROOT/"SRC", in that order. Set the subpath for the library to
# "lib". If HEADER was found in SUPERLU_ROOT/"SRC", check whether
# SUPERLU_ROOT/"lib" is a directory, and set the subpath for the library to
# the empty string "" if it isn't.
#
# Shell variables:
# my_include_path
# The subpath HEADER was found in: "include/superlu", "include", or
# "SRC". Contents is only meaningful for my_slu_found=yes.
# my_lib_path
# The subpath for the library: "lib" or "". Contents is only meaningful
# for my_slu_found=yes.
# my_slu_found
# Whether HEADER was found at all. Either "yes" or "no".
AC_DEFUN([_slu_lib_path],
[
my_include_path=include/superlu
my_lib_path=lib
my_slu_found=yes
if test ! -f "$1/$my_include_path/$2" ; then
#Try to find headers under superlu
my_include_path=include
if test ! -f "$1/$my_include_path/$2" ; then
my_include_path=SRC
if test ! -f "$1/$my_include_path/$2"; then
my_slu_found=no
else
if ! test -d "$1/$my_lib_path"; then
my_lib_path=""
fi
fi
fi
fi
]
)
# _slu_search_versions(SUPERLU_ROOT)
#
# Search for either "slu_ddefs.h" or "dsp_defs.h" using _slu_lib_path().
#
# Shell variables:
# my_slu_header
# The name of the header that was found: first of "slu_ddefs.h" or
# "dsp_defs.h". Contents is only meaningful for my_slu_found=yes.
# my_include_path
# The subpath the header was found in: "include/superlu", "include", or
# "SRC". Contents is only meaningful for my_slu_found=yes.
# my_lib_path
# The subpath for the library: "lib" or "". Contents is only meaningful
# for my_slu_found=yes.
# my_slu_found
# Whether any of the headers. Either "yes" or "no".
AC_DEFUN([_slu_search_versions],
[
my_slu_header=slu_ddefs.h
_slu_lib_path($1, $my_slu_header)
if test "$my_slu_found" != "yes"; then
my_slu_header="dsp_defs.h"
_slu_lib_path($1, $my_slu_header)
fi
]
)
# _slu_search_default()
#
# Search for SuperLU in the default locations "/usr" and "/usr/local".
#
# Shell variables:
# with_superlu
# Root of the SuperLU installation: first of "/usr" and "/usr/local".
# Contents is only meaningful for my_slu_found=yes.
# For other output variables see documentation of _slu_search_versions().
AC_DEFUN([_slu_search_default],
[
with_superlu=/usr
_slu_search_versions($with_superlu)
if test "$my_slu_found" = "no"; then
with_superlu=/usr/local
_slu_search_versions($with_superlu)
fi
]
)
# DUNE_PATH_SUPERLU()
#
# REQUIRES: AC_PROG_CC, ACX_BLAS
#
# Shell variables:
# with_superlu
# "no", "yes (post 2005)" or "yes (pre 2005)"
# direct_SUPERLU_CPPFLAGS
# direct_SUPERLU_LIBS
# CPPFLAGS and LIBS necessary to link against SuperLU. This variable
# contains no indirect references and is suitable for use inside
# configure. Guaranteed empty if SuperLU was not found.
# SUPERLU_CPPFLAGS
# SUPERLU_LIBS
# CPPFLAGS and LIBS necessary to link against SuperLU. This variable may
# contain indirect references and is suitable for use inside makefiles.
# Guaranteed empty if SuperLU was not found.
# HAVE_SUPERLU
# "0" or "1" depending on whether SuperLU was found.
#
# Substitutions:
# SUPERLU_LIBS
# SUPERLU_CPPFLAGS
# Substitutes the values of the corresponding shell variables.
# ALL_PKG_LIBS
# ALL_PKG_CPPFLAGS
# Adds references to SuperLU's substitutions.
#
# Defines:
# HAVE_SUPERLU
# ENABLE_SUPERLU or undefined. Whether SuperLU was found. The correct
# way to check this is "#if HAVE_SUPERLU": This way SuperLU features will
# be disabled unless ${SUPERLU_CPPFLAGS} was given when compiling.
# SUPERLU_POST_2005_VERSION
# 1 or undefined. A post-2005 version of SuperLU uses the header
# "slu_ddefs.h" while earlier versions use "dsp_defs.h".
# HAVE_MEM_USAGE_T_EXPANSIONS
# 1 or undefined. Whether "mem_usage_t.expansions" was found in
# "slu_ddefs.h" or "dsp_defs.h" as apropriate.
#
# Conditionals:
# SUPERLU
AC_DEFUN([DUNE_PATH_SUPERLU],[
AC_REQUIRE([AC_PROG_CC])
# we need this for FLIBS
AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
AC_REQUIRE([ACX_BLAS])
#
# User hints ...
#
my_lib_path=""
my_include_path=""
AC_ARG_WITH([superlu],
[AC_HELP_STRING([--with-superlu],[user defined path to SuperLU library])],
[dnl
if test x"$withval" != xno ; then
# get absolute path
with_superlu=`eval cd $withval 2>&1 && pwd`
if test x"$withval" = xyes; then
# Search in default locations
_slu_search_default
else
# Search for the headers in the specified location
_slu_search_versions(["$with_superlu"])
fi
fi
], [dnl
# Search in default locations
_slu_search_default
])
AC_ARG_WITH([superlu-lib],
[AC_HELP_STRING([--with-superlu-lib],
[The name of the static SuperLU library to link to. By default
the static library with the name superlu.a is tried, but
only if shared linking has failed first. Giving this
options forces static linking for SuperLU.])],
[
if test x"$withval" = xno ; then
with_superlu_lib=
fi
])
AC_ARG_WITH([superlu-blaslib],
[AC_HELP_STRING([--with-superlu-blaslib],
[The name of the static blas library to link to. By default
we try to link to the systems blas library (see
--with-blas). Giving this options forces static linking
for SuperLU.])],
[
if test "$withval" = no ; then
with_superlu_blaslib=
fi
])
# store old values
ac_save_LDFLAGS="$LDFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
# do nothing if --without-superlu is used
if test x"$with_superlu" != x"no" ; then
# defaultpath
SUPERLU_LIB_PATH="$with_superlu/$my_lib_path"
SUPERLU_INCLUDE_PATH="$with_superlu/$my_include_path"
# set variables so that tests can use them
direct_SUPERLU_CPPFLAGS="-I$SUPERLU_INCLUDE_PATH -DENABLE_SUPERLU"
SUPERLU_CPPFLAGS="-I$SUPERLU_INCLUDE_PATH -DENABLE_SUPERLU"
CPPFLAGS="$CPPFLAGS $direct_SUPERLU_CPPFLAGS"
# check for central header
AC_CHECK_HEADER([$my_slu_header],
[HAVE_SUPERLU="1"],
[
HAVE_SUPERLU="0"
AC_MSG_WARN([$my_slu_header not found in $SUPERLU_INCLUDE_PATH with $CPPFLAGS])
])
# if header is found check for the libs
if test x$HAVE_SUPERLU = x1 ; then
HAVE_SUPERLU=0
# if neither --with-superlu-lib nor --with-superlu-blaslib was
# given, try to link dynamically or with properly names static libs
if test x"$with_superlu_lib$with_superlu_blaslib" = x; then
LDFLAGS="$ac_save_LDFLAGS -L$SUPERLU_LIB_PATH"
LIBS="$ac_save_LIBS"
AC_CHECK_LIB([superlu], [dgssvx],
[
direct_SUPERLU_LIBS="-L$SUPERLU_LIB_PATH -lsuperlu $BLAS_LIBS $FLIBS"
SUPERLU_LIBS="-L$SUPERLU_LIB_PATH -lsuperlu \${BLAS_LIBS} \${FLIBS}"
HAVE_SUPERLU="1"
], [], [$BLAS_LIBS $FLIBS])
fi
if test $HAVE_SUPERLU = 0 && test x"$with_superlu_lib" = x; then
# set the default
with_superlu_lib=superlu.a
fi
if test $HAVE_SUPERLU = 0 &&
test x"$with_superlu_blaslib" = x; then
# try system blas
LDFLAGS="$ac_save_LDFLAGS"
LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $BLAS_LIBS $FLIBS $ac_save_LIBS"
AC_CHECK_FUNC([dgssvx],
[
direct_SUPERLU_LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $BLAS_LIBS $FLIBS"
SUPERLU_LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib \${BLAS_LIBS} \${FLIBS}"
HAVE_SUPERLU="1"
])
fi
# No default for with_superlu_blaslib
if test $HAVE_SUPERLU = 0 &&
test x"$with_superlu_blaslib" != x; then
# try internal blas
LDFLAGS="$ac_save_LDFLAGS"
LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $SUPERLU_LIB_PATH/$with_superlu_blaslib $FLIBS $ac_save_LIBS"
AC_CHECK_FUNC([dgssvx],
[
direct_SUPERLU_LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $SUPERLU_LIB_PATH/$with_superlu_blaslib $FLIBS"
SUPERLU_LIBS="$SUPERLU_LIB_PATH/$with_superlu_lib $SUPERLU_LIB_PATH/$with_superlu_blaslib \${FLIBS}"
HAVE_SUPERLU="1"
])
fi
fi
else # $with_superlu = no
HAVE_SUPERLU=0
fi
# Inform the user whether SuperLU was sucessfully found
AC_MSG_CHECKING([SuperLU])
if test x$HAVE_SUPERLU = x1 ; then
if test "$my_slu_header" = "slu_ddefs.h"; then
with_superlu="yes (post 2005)"
else
with_superlu="yes (pre 2005)"
fi
else
with_superlu="no"
fi
AC_MSG_RESULT([$with_superlu])
# check for optional member
if test $HAVE_SUPERLU = 1 ; then
if test "$my_slu_header" = "slu_ddefs.h"; then
AC_CHECK_MEMBERS([mem_usage_t.expansions],[],[],[#include "slu_ddefs.h"])
else
AC_CHECK_MEMBERS([mem_usage_t.expansions],[],[],[#include "dsp_defs.h"])
fi
fi
# substitute variables
if test x$HAVE_SUPERLU = x0 ; then
SUPERLU_LIBS=
SUPERLU_CPPFLAGS=
fi
AC_SUBST([SUPERLU_LIBS])
AC_SUBST([SUPERLU_CPPFLAGS])
DUNE_ADD_ALL_PKG([SUPERLU], [\${SUPERLU_CPPFLAGS}], [], [\${SUPERLU_LIBS}])
# tell automake
AM_CONDITIONAL(SUPERLU, test x$HAVE_SUPERLU = x1)
# tell the preprocessor
if test x$HAVE_SUPERLU = x1 ; then
AC_DEFINE([HAVE_SUPERLU], [ENABLE_SUPERLU], [Define to ENABLE_SUPERLU if SUPERLU is found])
if test "$my_slu_header" = "slu_ddefs.h"; then
AC_DEFINE([SUPERLU_POST_2005_VERSION], 1, [define to 1 if there is a header slu_ddefs.h in SuperLU])
fi
fi
# summary
DUNE_ADD_SUMMARY_ENTRY([SuperLU],[$with_superlu])
# restore variables
LDFLAGS="$ac_save_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS"
LIBS="$ac_save_LIBS"
])
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