]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add DEAL_II_HAVE_SANE_MT_DEFINITIONS
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 12 Sep 2012 11:24:59 +0000 (11:24 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 12 Sep 2012 11:24:59 +0000 (11:24 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_cmake@26305 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/compiler-mumbo-jumbo.m4
deal.II/contrib/cmake/configure/configure_threads.cmake

index 837262b2a992d04969c2499f2358459626e5d8c3..672322683c8f16d9758bf715955af46d253f2a54 100644 (file)
@@ -2605,43 +2605,3 @@ template <typename T, int N>
       AC_MSG_RESULT(no)
     ])
 ])
-
-
-
-
-dnl -------------------------------------------------------------
-dnl Check whether CXXFLAGSG and CXXFLAGSO are a valid combination
-dnl of flags or if there are contradicting flags in them.
-dnl
-dnl Usage: DEAL_II_CHECK_CXXFLAGS_CONSISTENCY
-dnl
-dnl -------------------------------------------------------------
-AC_DEFUN(DEAL_II_CHECK_CXXFLAGS_CONSISTENCY, dnl
-[
-  AC_MSG_CHECKING(for consistency of CXXFLAGSG flags)
-  AC_LANG(C++)
-  CXXFLAGS="$CXXFLAGSG"
-  AC_TRY_COMPILE(
-    [],
-    [;],
-    [
-      AC_MSG_RESULT(yes)
-    ],
-    [
-      AC_MSG_ERROR(invalid combination of flags!)
-      exit 1;
-    ])
-
-  AC_MSG_CHECKING(for consistency of CXXFLAGSO flags)
-  CXXFLAGS="$CXXFLAGSO"
-  AC_TRY_COMPILE(
-    [],
-    [;],
-    [
-      AC_MSG_RESULT(yes)
-    ],
-    [
-      AC_MSG_ERROR(invalid combination of flags!)
-      exit 1;
-    ])
-])
index b87ce31cfa1de51b29604b8cc6437efe21fc5b19..c52e43e8634b97771e975c6afbbb9945228ec04d 100644 (file)
@@ -34,15 +34,16 @@ LIST(APPEND deal_ii_external_debug_libraries
   ${TBB_DEBUG_LIBRARY}
   )
 
-
 SET(DEAL_II_USE_MT TRUE)
 
+# Set up some posix threads specific configuration toggles:
 IF(CMAKE_USE_PTHREADS_INIT)
   SET(DEAL_II_USE_MT_POSIX TRUE)
 
   # Check whether posix thread barriers are available:
 
-  SET(CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+  LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+
   CHECK_CXX_SOURCE_COMPILES(
   "
   #include <pthread.h>
@@ -57,11 +58,34 @@ IF(CMAKE_USE_PTHREADS_INIT)
   "
   DEAL_II_HAVE_MT_POSIX_BARRIERS)
 
-  SET(CMAKE_REQUIRED_FLAGS "")
+  LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
 
   IF(NOT DEAL_II_HAVE_MT_POSIX_BARRIERS)
     SET(DEAL_II_USE_MT_POSIX_NO_BARRIERS TRUE)
   ENDIF()
-
 ENDIF()
 
+
+
+#
+#
+# In some cases, -threads (or whatever else command line option)
+# switches on some preprocessor flags. If this is not the case,
+# then define them explicitely.
+#
+
+LIST(APPEND CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+CHECK_CXX_SOURCE_COMPILES(
+  "
+  #if !defined (_REENTRANT) && !defined (_THREAD_SAFE)
+  # error Neither _REENTRANT nor _THREAD_SAFE were defined.
+    nonsense
+  #endif
+  int main(){ return 0; }
+  "
+  DEAL_II_HAVE_SANE_MT_DEFINITIONS)
+LIST(REMOVE_ITEM CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
+
+IF(NOT DEAL_II_HAVE_SANE_MT_DEFINITIONS)
+  ADD_DEFINITIONS("-D_REENTRANT" "-D_THREAD_SAFE")
+ENDIF()

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.