From dc2161727b7df545fc43006d13165d1442c42271 Mon Sep 17 00:00:00 2001 From: maier Date: Tue, 10 Dec 2013 10:42:56 +0000 Subject: [PATCH] Add a configure time check DEAL_II_MAC_OSX_C99_BUG 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 --- .../cmake/checks/check_03_compiler_bugs.cmake | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/deal.II/cmake/checks/check_03_compiler_bugs.cmake b/deal.II/cmake/checks/check_03_compiler_bugs.cmake index f278a9435d..f650c69ec9 100644 --- a/deal.II/cmake/checks/check_03_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_03_compiler_bugs.cmake @@ -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 + 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() -- 2.39.5