-dnl -------------------------------------------------------------
-dnl Test whether multithreading support is requested.
-dnl
-dnl If multithreading support is requested, figure out the right
-dnl compiler flags to use:
-dnl - Use the right -threads/-pthread/-mthread option
-dnl - Set preprocessor directives if necessary
-dnl - __USE_MALLOC tells gcc to use thread safe STL allocators
-dnl (don't use this for gcc3.1 or later)
-dnl - _REENTRANT is a flag that is used in the standard UNIX
-dnl headers to make reentrant functions (with suffix _r) declared
-dnl
-dnl Do not use AC_DEFINE when using these two flags, since that would
-dnl put them into config.h, instead of the compiler flags. Then, however,
-dnl it would be necessary to include config.h as _first_ file in all
-dnl files, since the flags change the things we include. It is therefore
-dnl better to put the flags into the command line, since then we have them
-dnl defined for all include files.
-dnl
-dnl Usage:
-dnl DEAL_II_CHECK_MULTITHREADING
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_MULTITHREADING, dnl
-[
- AC_ARG_ENABLE(threads,
- [AS_HELP_STRING([--enable-threads],
- [Use multiple threads inside deal.II])],
- [
- enablethreads="$enableval"
- ],
- [
- dnl Set default to yes unless on cygwin where the TBB is
- dnl currently not yet ported to
- case "$target" in
- *cygwin* )
- enablethreads=no
- ;;
-
- * )
- enablethreads=yes
- ;;
- esac
- ])
-
- if test "$enablethreads" = yes ; then
- dnl On cygwin, the TBB does not compile. Error out.
- case "$target" in
- *cygwin* )
- AC_MSG_ERROR(Multithreading is not supported on CygWin)
- ;;
- esac
-
- if test "$GXX" = yes ; then
- DEAL_II_GET_THREAD_FLAGS
- DEAL_II_THREAD_CPPFLAGS
-
- CXXFLAGSG="$CXXFLAGSG -D_REENTRANT"
- CXXFLAGSO="$CXXFLAGSO -D_REENTRANT"
- else
- case "$GXX_VERSION" in
- ibm_xlc)
- CXXFLAGSG="$CXXFLAGSG -qthreaded"
- CXXFLAGSO="$CXXFLAGSO -qthreaded"
- ;;
-
- compaq_cxx)
- CXXFLAGSG="$CXXFLAGSG -pthread"
- CXXFLAGSO="$CXXFLAGSO -pthread"
- ;;
-
- intel_icc*)
- LDFLAGS="$LDFLAGS -lpthread"
- ;;
-
- clang*)
- LDFLAGS="$LDFLAGS -lpthread"
- ;;
-
- cray*)
- LDFLAGS="$LDFLAGS -lpthread"
- ;;
-
- pgCC*)
- LDFLAGS="$LDFLAGS -lpthread"
- ;;
-
- *)
- AC_MSG_ERROR(No threading compiler options for this C++ compiler specified at present)
- exit 1
- ;;
- esac
- fi
-
- DEAL_II_CHECK_POSIX_THREAD_FUNCTIONS
- AC_DEFINE(DEAL_II_USE_MT_POSIX, 1,
- [Defined if multi-threading is to be achieved by using
- the POSIX functions])
-
- dnl In any case, we need to link with libdl since the Threading
- dnl Building Blocks require this
- LDFLAGS="$LDFLAGS -ldl"
- fi
-
- if test "x$enablethreads" != "xno" ; then
- DEAL_II_USE_MT_VAL=1
- else
- DEAL_II_USE_MT_VAL=0
- fi
-
- AC_DEFINE_UNQUOTED(DEAL_II_USE_MT, $DEAL_II_USE_MT_VAL,
- [Flag indicating whether the library shall be
- compiled for multithreaded applications. If so,
- then it is set to one, otherwise to zero.])
-])
-
-
-
dnl -------------------------------------------------------------
dnl On some systems, notably AIX and SUN Solaris, using threads
dnl leads to warnings since the POSIX_MUTEX_INITIALIZER preprocessor
-dnl -------------------------------------------------------------
-dnl Check whether the POSIX functions needed for multi-threading
-dnl are available on this system
-dnl
-dnl Usage: DEAL_II_CHECK_POSIX_THREAD_FUNCTIONS
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_POSIX_THREAD_FUNCTIONS, dnl
-[
- AC_MSG_CHECKING(for posix thread functions)
- AC_LANG(C++)
- CXXFLAGS="$CXXFLAGSG"
- AC_TRY_COMPILE(
- [
-# include <pthread.h>
- ],
- [
- pthread_t p;
- pthread_create (&p, 0, 0, 0);
- pthread_join (p, 0);
- ],
- [
- AC_MSG_RESULT(ok)
- ],
- [
- AC_MSG_ERROR(not found)
- ])
-
- AC_MSG_CHECKING(for posix thread mutex functions)
- AC_LANG(C++)
- AC_TRY_COMPILE(
- [
-# include <pthread.h>
- ],
- [
- pthread_mutex_t pm;
- pthread_mutex_init (&pm, 0);
- pthread_mutex_lock (&pm);
- pthread_mutex_unlock (&pm);
- pthread_mutex_destroy (&pm);
- ],
- [
- AC_MSG_RESULT(ok)
- ],
- [
- AC_MSG_ERROR(not found)
- ])
-
- AC_MSG_CHECKING(for posix thread condition variable functions)
- AC_LANG(C++)
- AC_TRY_COMPILE(
- [
-# include <pthread.h>
- ],
- [
- pthread_cond_t pc;
- pthread_cond_init (&pc, 0);
- pthread_cond_signal (&pc);
- pthread_cond_broadcast (&pc);
-
- pthread_mutex_t pm;
- pthread_cond_wait (&pc, &pm);
- pthread_cond_destroy (&pc);
- ],
- [
- AC_MSG_RESULT(ok)
- ],
- [
- AC_MSG_ERROR(not found)
- ])
-
- AC_MSG_CHECKING(for posix thread barrier functions)
- AC_LANG(C++)
- AC_TRY_COMPILE(
- [
-# include <pthread.h>
- ],
- [
- pthread_barrier_t pb;
- pthread_barrier_init (&pb, 0, 1);
- pthread_barrier_wait (&pb);
- pthread_barrier_destroy (&pb);
- ],
- [
- AC_MSG_RESULT(ok)
- x=0
- ],
- [
- AC_MSG_RESULT(not found. barriers will not be supported)
- x=1
- ])
- if test "x$x" = "x1" ; then
- AC_DEFINE(DEAL_II_USE_MT_POSIX_NO_BARRIERS, 1,
- [Defined if POSIX is supported but not the newer POSIX
- barrier functions. Barriers will then not work in
- the library, but the other threading functionality
- is available.])
- fi
-])
-
-
-
dnl -------------------------------------------------------------
dnl Check whether some backward compatibility features are disabled
dnl Usage:
-
-dnl -------------------------------------------------------------
-dnl Versions of GCC before 3.0 had a problem with the explicit
-dnl instantiation of member templates when the member was in fact
-dnl an operator. In that case, they needed the "template" keyword,
-dnl which is actually not allowed at this place. Test case is
-dnl
-dnl /* ----------------------------------------------- */
-dnl struct X
-dnl {
-dnl template <typename T2>
-dnl X operator = (T2 &) { return X(); };
-dnl };
-dnl
-dnl template X X::operator=<float> (float &);
-dnl /* ---------------------------------------------------------- */
-dnl
-dnl The compiler only groks this if the "operator=" is prepended
-dnl by "template". We detect this, and either set the
-dnl DEAL_II_MEMBER_OP_TEMPLATE_INST to "template" or nothing, so
-dnl that it gets expanded to the right string needed in this place.
-dnl
-dnl Usage: DEAL_II_CHECK_MEMBER_OP_TEMPLATE_INST
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_MEMBER_OP_TEMPLATE_INST, dnl
-[
- AC_MSG_CHECKING(for template member operator instantiation bug)
- AC_LANG(C++)
- CXXFLAGS="$CXXFLAGSG"
- AC_TRY_COMPILE(
- [
- struct X
- {
- template <typename T2>
- X operator = (T2 &) { return X(); }
- };
-
- template X X::operator=<float> (float &);
- ],
- [],
- [
- AC_MSG_RESULT(no)
- x=""
- ],
- [
- AC_MSG_RESULT(yes. using workaround)
- x="template"
- ])
- AC_DEFINE_UNQUOTED(DEAL_II_MEMBER_OP_TEMPLATE_INST, $x,
- [Define if we have to work around a bug in gcc with
- explicitly instantiating template member operators.
- See the aclocal.m4 file in the top-level directory
- for a description of this bug.])
-])
-
-
-
dnl -------------------------------------------------------------
dnl Some compiler versions, notably ICC, have trouble with the
dnl following code in which we explicitly call a destructor.
])
-dnl --------------------------------------------------
-dnl What to do if UMFPack is selected
-dnl --------------------------------------------------
-AC_DEFUN(DEAL_II_WITH_UMFPACK, dnl
-[
- AC_ARG_WITH(umfpack,
- [AS_HELP_STRING([--with-umfpack=umfpack-root-directory],
- [Use installed UMFPack version. 'umfpack-root-directory' should be the directory containing directories AMD and UMFPACK. The contributed UMFPack library is used if no argument is given. Default is not to use UMFPack.])],
- [
- AC_MSG_CHECKING(UMFPACK library)
- if test "x$withval" = "xyes" ; then
- USE_CONTRIB_UMFPACK='yes'
- UMFPACK_DIR="`pwd`/contrib/umfpack"
- UMFPACK_INCLUDE_DIR="-I`pwd`/contrib/umfpack/UMFPACK/Include"
- AC_MSG_RESULT(using included version)
- DEAL_II_USE_INTERNAL_UMFPACK=yes
- AC_DEFINE(HAVE_LIBUMFPACK,1,[UMFPACK is $1])
- else
- if test "x$withval" != "xno" ; then
- USE_CONTRIB_UMFPACK='yes'
- UMFPACK_DIR="$withval"
- UMFPACK_INCLUDE_DIR="-I$withval/Include"
- AC_MSG_RESULT(trying version at $withval)
- AC_DEFINE(HAVE_LIBUMFPACK,1,[UMFPACK is $1])
- else
- AC_MSG_RESULT(explicitly disabled)
- fi
- fi
-
- ])
-
- acx_umfpack=no
-
- AC_ARG_WITH(umfpack-include,
- [AS_HELP_STRING([--with-umfpack-include=/path/to/UMFPACK],
- [Specify the path to the UMFPACK headers file; use this if you want to override the UMFPACK_INCDIR environment variable.])],
- [
- UMFPACK_INCDIR="$withval"
- acx_umfpack=yes
- ])
-
- AC_ARG_WITH(umfpack-libs,
- [AS_HELP_STRING([--with-umfpack-libs=/path/to/UMFPACK],
- [Specify the path to the UMFPACK libraries; use this if you want to override the UMFPACK_LIBDIR environment variable.])],
- [
- UMFPACK_LIBDIR="$withval"
- acx_umfpack=yes
- ])
-
- if test "x$acx_umfpack" = "xyes" ; then
- AC_DEFINE(HAVE_LIBUMFPACK,1,[UMFPACK is $1])
- fi
-
- if test "x$UMFPACK_DIR" != "x" -a "x$acx_umfpack" = "xno" ; then
- dnl A pathname has been given to --with-umfpack but nothing
- dnl has been specified through the other two flags
-
- dnl Check whether the libraries are there (unless we use the
- dnl internal version, which we will first have to compile
- dnl before the libs are there)
- if test "x$DEAL_II_USE_INTERNAL_UMFPACK" != "xyes" ; then
- dnl Try old naming scheme for umfpack/amd libraries (before
- dnl Tim Davis incorporated everything into SuiteSparse)
- OLD_LDFLAGS="$LDFLAGS"
- LDFLAGS="-L${UMFPACK_DIR}/UMFPACK $LDFLAGS"
- AC_CHECK_LIB(
- [umfpack],
- [umfpack_di_defaults],
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lumfpack)
- if test "$LD_PATH_OPTION" != "no"; then
- LDFLAGS="$LD_PATH_OPTION${UMFPACK_DIR}/UMFPACK $LDFLAGS"
- fi
- ],
- [
- dnl Old naming scheme failed, try the new one
- LDFLAGS="-L${UMFPACK_DIR}/lib $OLD_LDFLAGS"
- AC_CHECK_LIB(
- [umfpack],
- [umfpack_di_defaults],
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lumfpack)
- if test "$LD_PATH_OPTION" != "no"; then
- LDFLAGS="$LD_PATH_OPTION${UMFPACK_DIR}/lib $LDFLAGS"
- fi
- ],
- [
- AC_MSG_ERROR(installation of UMFPACK could not be determined)
- ]
- )
- ]
- )
-
- dnl Now do the same for amd. this one comes second since on the linker
- dnl line, -lumfpack has to preceded -lamd
- OLD_LDFLAGS="$LDFLAGS"
- LDFLAGS="-L${UMFPACK_DIR}/AMD/Lib $LDFLAGS"
- AC_CHECK_LIB(
- [amd],
- [amd_info],
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lamd)
- if test "$LD_PATH_OPTION" != "no"; then
- LDFLAGS="$LD_PATH_OPTION${UMFPACK_DIR}/AMD/Lib $LDFLAGS"
- fi
- ],
- [
- dnl Old naming scheme failed, try the new one
- LDFLAGS="-L${UMFPACK_DIR}/lib $OLD_LDFLAGS"
- AC_CHECK_LIB(
- [amd],
- [amd_info],
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lamd)
- if test "$LD_PATH_OPTION" != "no"; then
- LDFLAGS="$LD_PATH_OPTION${UMFPACK_DIR}/lib $LDFLAGS"
- fi
- ],
- [
- AC_MSG_ERROR(installation of AMD could not be determined)
- ]
- )
- ]
- )
- fi
-
- dnl Try old and new naming scheme for header files
- AC_CHECK_FILE(
- [${UMFPACK_DIR}/UMFPACK/Include/umfpack.h],
- [
- UMFPACK_INCLUDE_DIR=-I${UMFPACK_DIR}/UMFPACK/Include
- ],
- [
- AC_CHECK_FILE(
- [${UMFPACK_DIR}/include/suitesparse/umfpack.h],
- [
- UMFPACK_INCLUDE_DIR=-I${UMFPACK_DIR}/include/suitesparse
- ],
- [
- AC_MSG_ERROR(installation of UMFPACK could not be determined)
- ]
- )
- ]
- )
-
- AC_CHECK_FILE(
- [${UMFPACK_DIR}/AMD/Include/amd.h],
- [
- UMFPACK_INCLUDE_DIR="${UMFPACK_INCLUDE_DIR} -I${UMFPACK_DIR}/AMD/Include"
- ],
- [
- AC_CHECK_FILE(
- [${UMFPACK_DIR}/include/suitesparse/umfpack.h],
- [
- UMFPACK_INCLUDE_DIR="${UMFPACK_INCLUDE_DIR} -I${UMFPACK_DIR}/include/suitesparse"
- ],
- [
- AC_MSG_ERROR(installation of UMFPACK could not be determined)
- ]
- )
- ]
- )
-
- dnl We also have to see whether the UFconfig.h file can be found
- dnl somewhere. This is not of importance if we use the
- dnl built-in version
- if test "x$DEAL_II_USE_INTERNAL_UMFPACK" != "xyes" ; then
- AC_CHECK_FILE(
- [${UMFPACK_DIR}/UFconfig/UFconfig.h],
- [
- UMFPACK_INCLUDE_DIR="${UMFPACK_INCLUDE_DIR} -I${UMFPACK_DIR}/UFconfig"
- ],
- [
- AC_MSG_ERROR(not found)
- ]
- )
- fi
-
- else
-
- if test "x$UMFPACK_INCDIR" != "x" ; then
- dnl Something has been passed to --with-umfpack-include
-
- UMFPACK_INCLUDE_DIR="-I${UMFPACK_INCDIR}"
- OLD_CXXFLAGS="$CXXFLAGS"
- OLD_CPPFLAGS="$CPPFLAGS"
- CXXFLAGS="-I$UMFPACK_INCDIR $CXXFLAGS"
- CPPFLAGS="-I$UMFPACK_INCDIR $CPPFLAGS"
- AC_CHECK_HEADER(
- [umfpack.h],
- [],
- [AC_MSG_ERROR(installation of UMFPACK could not be determined)]
- )
- AC_CHECK_HEADER([amd.h], [],
- [AC_MSG_ERROR(installation of UMFPACK could not be determined)])
- AC_CHECK_HEADER([UFconfig.h], [],
- [AC_MSG_ERROR(installation of UMFPACK could not be determined)])
-
- if test "x$UMFPACK_LIBDIR" != "x" ; then
- AC_CHECK_LIB(
- [amd],
- [amd_info],
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lamd)
- if test "$LD_PATH_OPTION" != "no"; then
- LDFLAGS="$LD_PATH_OPTION${UMFPACK_LIBDIR} $LDFLAGS"
- fi
- ],
- [AC_MSG_ERROR(installation of AMD could not be determined)]
- )
- AC_CHECK_LIB(
- [umfpack],
- [umfpack_di_defaults],
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lumfpack)
- if test "$LD_PATH_OPTION" != "no"; then
- LDFLAGS="$LD_PATH_OPTION${UMFPACK_LIBDIR} $LDFLAGS"
- fi
- ],
- [AC_MSG_ERROR(installation of UMFPACK could not be determined)]
- )
- else
- AC_CHECK_LIB(
- [amd],
- [amd_info],
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lamd)
- ],
- [AC_MSG_ERROR(installation of AMD could not be determined)]
- )
- AC_CHECK_LIB(
- [umfpack],
- [umfpack_di_defaults],
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lumfpack)
- ],
- [AC_MSG_ERROR(installation of UMFPACK could not be determined)]
- )
- fi
- fi
- fi
-])
-
-
-dnl --------------------------------------------------
-dnl Include the LAPACK library
-dnl --------------------------------------------------
-AC_DEFUN(DEAL_II_WITH_LAPACK, dnl
-[
- if test "x$1" != "xno" ; then
- if test "x$1" != "xyes" ; then lapack="$1"; else lapack="lapack"; fi
- AC_CHECK_LIB($lapack, dgbsv_,
- [ DEAL_II_ADD_EXTERNAL_LIBS_AT_FRONT(-l$lapack)
- AC_DEFINE([HAVE_LIBLAPACK], [1],
- [Defined if deal.II was configured with LAPACK support])
- AC_SUBST(DEAL_II_USE_LAPACK, "yes")
- USE_CONTRIB_LAPACK='yes'
- ],
- [AC_MSG_ERROR([LAPACK library $lapack not found])]
- )
- fi
-])
-
-dnl --------------------------------------------------
-dnl Print error in BLAS detection
-dnl --------------------------------------------------
-AC_DEFUN(ABORT_BLAS_ON_ERROR, dnl
-[
- AC_MSG_ERROR([[Configuring BLAS library failed although it was requested.
- Most common is one of the following reasons:
- 1. A library with name lib$1.a or lib$1.so is not in your library path.
- 2. Neither -lgfortran nor -lg2c is in \$F77LIBS.
- 3. BLAS requires -lg2c, but only -lgfortran was found.
- 4. BLAS requires -lgfortran, but only -lg2c was found.
-
- In cases 2-4, you may not have the right version of GNU FORTRAN installed
- (<g2c> is the GNU F77 support library, <gfortran> the library for the
- GNU Fortran95 compiler shipped since gcc 4.0) or BLAS has to be recompiled.
-]])
-])
-
dnl --------------------------------------------------
dnl Make sure we can link with blas. If something was
dnl given as an argument to --with-blas=xxx, then use
fi
])
-AC_DEFUN(DEAL_II_WITH_BLAS, dnl
-[
- if test "x$1" != "xno" ; then
- if test "x$1" != "xyes" ; then
- blas="$1"
- AC_CHECK_LIB($blas, daxpy_,
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_FRONT(-l$blas)
- AC_DEFINE([HAVE_LIBBLAS], [1],
- [Defined if deal.II was configured with BLAS support])
- ],,$F77LIBS)
- AC_SUBST(DEAL_II_USE_BLAS, "yes")
- AC_SUBST(NEEDS_F77LIBS, "yes")
- USE_CONTRIB_BLAS='yes'
- else
- DEAL_II_CHECK_BLAS_FRAMEWORK
- if test "x$framework_works" != "xyes"; then
- blas="blas";
- AC_CHECK_LIB($blas, daxpy_,
- [
- DEAL_II_ADD_EXTERNAL_LIBS_AT_FRONT(-l$blas)
- AC_DEFINE([HAVE_LIBBLAS], [1],
- [Defined if deal.II was configured with BLAS support])
- ],,$F77LIBS)
-
- AC_SUBST(DEAL_II_USE_BLAS, "yes")
- AC_SUBST(NEEDS_F77LIBS, "yes")
- USE_CONTRIB_BLAS='yes'
- fi
- fi
- fi
-])
-
-
-
-dnl --------------------------------------------------
-dnl What to do if external boost is selected
-dnl --------------------------------------------------
-AC_DEFUN(DEAL_II_WITH_BOOST, dnl
-[
- if test "x$1" != "xyes" ; then
- BOOST_INCLUDE_DIR="-I$1"
- if test "$LD_PATH_OPTION" != "no" ; then
- BOOST_LIB_DIR="$LD_PATH_OPTION$1/lib"
- fi
- AC_DEFINE([DEAL_II_USE_EXTERNAL_BOOST], [1],
- [Defined if deal.II is configured with an external Boost library])
- DEAL_II_ADD_EXTERNAL_LIBS_AT_FRONT(-lboost_thread-mt -lboost_serialization-mt)
- else
- BOOST_INCLUDE_DIR=''
- BOOST_LIB_DIR=''
- fi
-])
-
dnl --------------------------------------------------
dnl Include the GSL library
fi
])
+
+TODO: Lapack:
+# /* Defined to 1 if you have the `strtrs_' function. */HAVE_STRTRS_ 1 TODO