From: maier Date: Tue, 11 Sep 2012 10:38:33 +0000 (+0000) Subject: Furhter configuration changes X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5e2f63be4a02a4a6ff4cb7e890c636f5232ff1d;p=dealii-svn.git Furhter configuration changes git-svn-id: https://svn.dealii.org/branches/branch_cmake@26277 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 5c3c0e14c1..8a370e9381 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -107,6 +107,8 @@ ADD_CUSTOM_TARGET(deal_ii_target_dependencies) INCLUDE(check_for_cxx_features) +INCLUDE(check_for_compiler_bugs) + diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 0d3bcdcc02..a1ba357478 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -2323,124 +2323,6 @@ AC_DEFUN(DEAL_II_GET_THREAD_FLAGS, dnl -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 @@ -2486,108 +2368,6 @@ AC_DEFUN(DEAL_II_CHECK_PARTLY_BRACKETED_INITIALIZER, dnl -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_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_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_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_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: @@ -3248,64 +3028,6 @@ AC_DEFUN(DEAL_II_CHECK_TEMPLATE_SPEC_ACCESS, dnl - -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 -dnl X operator = (T2 &) { return X(); }; -dnl }; -dnl -dnl template X X::operator= (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 - X operator = (T2 &) { return X(); } - }; - - template X X::operator= (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. @@ -7085,287 +6807,6 @@ AC_DEFUN(DEAL_II_CONFIGURE_METIS, dnl ]) -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 - ( is the GNU F77 support library, 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 @@ -7435,60 +6876,6 @@ AC_DEFUN(DEAL_II_CHECK_BLAS_FRAMEWORK, dnl 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 @@ -7584,3 +6971,6 @@ AC_DEFUN(DEAL_II_CONFIGURE_P4EST, dnl fi ]) + +TODO: Lapack: +# /* Defined to 1 if you have the `strtrs_' function. */HAVE_STRTRS_ 1 TODO diff --git a/deal.II/cmake-TODO b/deal.II/cmake-TODO index e9fdd300ad..d84f769b15 100644 --- a/deal.II/cmake-TODO +++ b/deal.II/cmake-TODO @@ -1,15 +1,17 @@ Next steps: -- convert as much of the config.h.in so that the library can be build in - the current state with cmake - -- Add the version configuration to cmake - -- And lots of the other stuff... +* Add compiler dependend configuration +* Add Bugs, Regressions and Feature tests. +* Add the CFLAGS and CXXFLAGS magic. (With an option to overwrite for distribution packaging.) +* MPI * PETSC + * TRILINOS + +* P4EST + * ... diff --git a/deal.II/contrib/cmake/modules/configure_boost.cmake b/deal.II/contrib/cmake/modules/configure_boost.cmake index ab8ae05c85..a9a8566101 100644 --- a/deal.II/contrib/cmake/modules/configure_boost.cmake +++ b/deal.II/contrib/cmake/modules/configure_boost.cmake @@ -20,7 +20,6 @@ IF(NOT DEAL_II_FORCE_CONTRIB_BOOST) ${Boost_THREAD_LIBRARY_DEBUG} ${Boost_SERIALIZATION_LIBRARY_DEBUG} ) - # TODO: Renaming! SET(DEAL_II_USE_EXTERNAL_BOOST TRUE) ENDIF() ENDIF() diff --git a/deal.II/contrib/cmake/modules/configure_threads.cmake b/deal.II/contrib/cmake/modules/configure_threads.cmake index 14e06f5f3d..1ae8d120d7 100644 --- a/deal.II/contrib/cmake/modules/configure_threads.cmake +++ b/deal.II/contrib/cmake/modules/configure_threads.cmake @@ -1,6 +1,8 @@ +INCLUDE(CheckCXXSourceCompiles) + FIND_PACKAGE(Threads REQUIRED) -# TODO: Necessary link commands for threads? Or are they set automatically +# TODO: Necessary linker flags for threads? Or are they set automatically # by the package? IF(DEAL_II_ALLOW_CONTRIB) @@ -33,6 +35,14 @@ LIST(APPEND deal_ii_external_debug_libraries ${TBB_DEBUG_LIBRARY} ) -# TODO: Renaming! + SET(DEAL_II_USE_MT TRUE) -SET(DEAL_II_USE_MT_POSIX TRUE) + + +IF(CMAKE_USE_PTHREADS_INIT) + SET(DEAL_II_USE_MT_POSIX TRUE) + + # Check whether posix thread barriers are available: + +ENDIF() + diff --git a/deal.II/contrib/cmake/modules/configure_umfpack.cmake b/deal.II/contrib/cmake/modules/configure_umfpack.cmake index 4ad1a64ce3..21eb6852af 100644 --- a/deal.II/contrib/cmake/modules/configure_umfpack.cmake +++ b/deal.II/contrib/cmake/modules/configure_umfpack.cmake @@ -39,6 +39,8 @@ ELSE() INCLUDE_DIRECTORIES(${Umfpack_INCLUDE_DIR} ${AMD_INCLUDE_DIR}) + # TODO: Set necessary linker flags... + LIST(APPEND deal_ii_external_libraries ${Umfpack_LIBRARY} ${AMD_LIBRARY} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ) diff --git a/deal.II/contrib/cmake/tests/check_for_compiler_bugs.cmake b/deal.II/contrib/cmake/tests/check_for_compiler_bugs.cmake new file mode 100644 index 0000000000..69bab9e436 --- /dev/null +++ b/deal.II/contrib/cmake/tests/check_for_compiler_bugs.cmake @@ -0,0 +1,48 @@ +INCLUDE(CheckCXXSourceCompiles) +INCLUDE(CheckIncludeFiles) + +# +# Check for various compiler bugs: +# + + + +# +# Versions of GCC before 3.0 had a problem with the explicit +# instantiation of member templates when the member was in fact +# an operator. In that case, they needed the "template" keyword, +# which is actually not allowed at this place. Test case is +# +# /* ----------------------------------------------- */ +# struct X +# { +# template +# X operator = (T2 &) { return X(); }; +# }; +# +# template X X::operator= (float &); +# /* ---------------------------------------------------------- */ +# +# The compiler only groks this if the "operator=" is prepended +# by "template". We detect this, and either set the +# DEAL_II_MEMBER_OP_TEMPLATE_INST to "template" or nothing, so +# that it gets expanded to the right string needed in this place. +# +CHECK_CXX_SOURCE_COMPILES( + " + struct X + { + template + X operator = (T2 &) { return X(); } + }; + + template X X::operator= (float &); + int main(){return 0;} + " + DEAL_II_MEMBER_OP_TEMPLATE_INST_OK) + +IF(DEAL_II_MEMBER_OP_TEMPLATE_INST_OK) + SET(DEAL_II_MEMBER_OP_TEMPLATE_INST "") +ELSE() + SET(DEAL_II_MEMBER_OP_TEMPLATE_INST "template") +ENDIF() diff --git a/deal.II/contrib/cmake/tests/check_for_cxx_features.cmake b/deal.II/contrib/cmake/tests/check_for_cxx_features.cmake index 8aa63402c8..095c40a294 100644 --- a/deal.II/contrib/cmake/tests/check_for_cxx_features.cmake +++ b/deal.II/contrib/cmake/tests/check_for_cxx_features.cmake @@ -2,7 +2,7 @@ INCLUDE(CheckCXXSourceCompiles) INCLUDE(CheckIncludeFiles) # -# Check for various CXX Features. +# Check for various CXX features. # @@ -80,5 +80,3 @@ CHECK_INCLUDE_FILES("sys/syscall.h" HAVE_SYS_SYSCALL_H) CHECK_INCLUDE_FILES("sys/times.h" HAVE_SYS_TIMES_H) CHECK_INCLUDE_FILES("sys/types.h" HAVE_SYS_TYPES_H) - -# /* Defined to 1 if you have the `strtrs_' function. */HAVE_STRTRS_ 1 diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 1a66ce9923..64c2d04ebc 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -52,6 +52,68 @@ +/* + * Configured in configure_boost.cmake: + */ + + +/* Defined if deal.II is configured with an external Boost library */ +#cmakedefine DEAL_II_USE_EXTERNAL_BOOST + + + + +/* + * Configured in configure_threads.cmake: + */ + + +/* Flag indicating whether the library shall be compiled for multithreaded + * applications. If so, then it is set to one, otherwise to zero. + */ +#cmakedefine DEAL_II_USE_MT 1 + +/* Defined if multi-threading is to be achieved by using the POSIX functions + */ +#cmakedefine DEAL_II_USE_MT_POSIX + +/* 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. + */ +#cmakedefine DEAL_II_USE_MT_POSIX_NO_BARRIERS + +/** + * Depending on the use of threads, we will have to make some variables + * volatile. We do this here in a very old-fashioned C-style, but still + * convenient way. + */ +#if DEAL_II_USE_MT != 0 +# define DEAL_VOLATILE volatile +#else +# define DEAL_VOLATILE +#endif + + + + +/* + * Configured in configure_umfpack.cmake: + */ + + +/* Defined if deal.II was configured with UMFPACK support */ +#cmakedefine HAVE_LIBUMFPACK + +/* Defined if deal.II was configured with BLAS support */ +#cmakedefine HAVE_LIBBLAS + +/* Defined if deal.II was configured with LAPACK support */ +#cmakedefine HAVE_LIBLAPACK + + + + /* * Configured in check_for_cxx_features: */ @@ -108,66 +170,16 @@ - - -/* - * Configured in configure_boost.cmake: - */ - - -/* Defined if deal.II is configured with an external Boost library */ -#cmakedefine DEAL_II_USE_EXTERNAL_BOOST - - - - -/* - * Configured in configure_threads.cmake: - */ - - -/* Flag indicating whether the library shall be compiled for multithreaded - * applications. If so, then it is set to one, otherwise to zero. - */ -#cmakedefine DEAL_II_USE_MT 1 - -/* Defined if multi-threading is to be achieved by using the POSIX functions - */ -#cmakedefine DEAL_II_USE_MT_POSIX - -/* 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. - */ -#cmakedefine DEAL_II_USE_MT_POSIX_NO_BARRIERS - -/** - * Depending on the use of threads, we will have to make some variables - * volatile. We do this here in a very old-fashioned C-style, but still - * convenient way. - */ -#if DEAL_II_USE_MT != 0 -# define DEAL_VOLATILE volatile -#else -# define DEAL_VOLATILE -#endif - - - - /* - * Configured in configure_umfpack.cmake: + * Configured in check_for_compiler_bugs: */ -/* Defined if deal.II was configured with UMFPACK support */ -#cmakedefine HAVE_LIBUMFPACK +/* 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. */ +#define DEAL_II_MEMBER_OP_TEMPLATE_INST @DEAL_II_MEMBER_OP_TEMPLATE_INST@ -/* Defined if deal.II was configured with BLAS support */ -#cmakedefine HAVE_LIBBLAS - -/* Defined if deal.II was configured with LAPACK support */ -#cmakedefine HAVE_LIBLAPACK diff --git a/deal.II/include/deal.II/base/config.h.in.old b/deal.II/include/deal.II/base/config.h.in.old index b393933e82..1bf12fc3f2 100644 --- a/deal.II/include/deal.II/base/config.h.in.old +++ b/deal.II/include/deal.II/base/config.h.in.old @@ -111,11 +111,6 @@ top-level directory. */ #cmakedefine DEAL_II_MEMBER_ARRAY_SPECIALIZATION_BUG -/* 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. */ -#cmakedefine DEAL_II_MEMBER_OP_TEMPLATE_INST - /* Defined if the compiler refuses to specialize an outer class template while keeping a member as a template. For the exact failure mode, look at aclocal.m4 in the top-level directory. */