]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a configure time check DEAL_II_MAC_OSX_C99_BUG
authorMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 10 Dec 2013 10:42:56 +0000 (10:42 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Tue, 10 Dec 2013 10:42:56 +0000 (10:42 +0000)
This is a small configure time check for a regression on Mac OS-X 10.9
where gcc in C++11 mode is unable to link to certain C standard library
functions defined in ctype.h and similar. In this case just disable C++11
support.

git-svn-id: https://svn.dealii.org/trunk@31970 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/checks/check_03_compiler_bugs.cmake

index f278a9435d92b8d912e20a154e2be0002659fd84..f650c69ec964003363e4e693c6d609807c6fc056 100644 (file)
@@ -373,8 +373,36 @@ ENDIF()
 #
 # - Matthias Maier, 2013
 #
-
 IF( CMAKE_SYSTEM_NAME MATCHES "CYGWIN"
     OR CMAKE_SYSTEM_NAME MATCHES "Windows" )
   SET(DEAL_II_CONSTEXPR_BUG TRUE)
 ENDIF()
+
+#
+# On Mac OS-X 10.9 with recent gcc compilers in C++11 mode linking to some
+# standard C library functions, notably toupper and tolower, fail due to
+# unresolved references to this functions. Disable C++11 support in this
+# case.
+#
+# Thanks to Denis Davydov for the testcase.
+#
+# Matthias Maier, 2013
+#
+CHECK_CXX_COMPILER_BUG(
+  "
+  #include <ctype.h>
+  int main ()
+  {
+    char c = toupper('a');
+  }
+  "
+  DEAL_II_MAC_OSX_C99_BUG)
+
+IF(DEAL_II_MAC_OSX_C99_BUG)
+  MESSAGE(STATUS
+    "Mac OS-X C99 bug found, disabling C++11 support"
+    )
+  STRIP_FLAG(CMAKE_CXX_FLAGS "${DEAL_II_CXX11_FLAG}")
+  SET(DEAL_II_CAN_USE_CXX1X FALSE)
+  SET(DEAL_II_USE_CXX11 FALSE)
+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.