From e1c7b0fc6a91605d0dd1bbf3496ea5fe1bb0c7c9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 27 Jan 2016 04:22:41 +0100 Subject: [PATCH] Also add C++11 options to OBJCXXFLAGS in configure We need these options in both CXXFLAGS and OBJCXXFLAGS, otherwise Objective-C++ code would fail to compile when including C++11 headers such as . --- configure | 7 ++++++- configure.in | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 1cc233dfa2..9e3b20f6b7 100755 --- a/configure +++ b/configure @@ -20186,6 +20186,10 @@ $as_echo "#define HAVE_CXX11 1" >>confdefs.h fi + + if test "$HAVE_CXX11" = "1" ; then + OBJCXXFLAGS="$OBJCXXFLAGS $switch" + fi fi if test "x$SUNCXX" != xyes; then @@ -20415,7 +20419,8 @@ if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then fi if test "$HAVE_CXX11" = "1" ; then - CXXFLAGS="$CXXFLAGS -stdlib=libc++" + CXXFLAGS="$CXXFLAGS -stdlib=libc++" + OBJCXXFLAGS="$OBJCXXFLAGS -stdlib=libc++" LDFLAGS="$LDFLAGS -stdlib=libc++" fi diff --git a/configure.in b/configure.in index 8457112a47..6804f244bc 100644 --- a/configure.in +++ b/configure.in @@ -1065,6 +1065,12 @@ if test "$wxUSE_CXX11" = "yes"; then dnl We still continue even if C++11 support is not available, would it be dnl better to stop with an error in this case? AX_CXX_COMPILE_STDCXX(11,,optional) + + if test "$HAVE_CXX11" = "1" ; then + dnl The standard macro above doesn't set Objective-C++ flags, but we do + dnl need them too. + OBJCXXFLAGS="$OBJCXXFLAGS $switch" + fi fi dnl ar command @@ -1233,8 +1239,10 @@ fi if test "$HAVE_CXX11" = "1" ; then dnl We also need to use libc++ standard library instead of libstdc++ for - dnl C++11 support, both when compiling and when linking. + dnl C++11 support, both when compiling (for both C++ and Objective-C++) and + dnl when linking. CXXFLAGS="$CXXFLAGS -stdlib=libc++" + OBJCXXFLAGS="$OBJCXXFLAGS -stdlib=libc++" LDFLAGS="$LDFLAGS -stdlib=libc++" fi