[Libreoffice-commits] core.git: 2 commits - bridges/source config_host.mk.in configure.ac

Tor Lillqvist tml at iki.fi
Tue May 28 07:05:42 PDT 2013


 bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx |    9 ++++
 config_host.mk.in                                    |    1 
 configure.ac                                         |   38 ++++++++++++++++++-
 3 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit b0a1666f756aa5f5315366eca9d7d02ddd55d2b7
Author: Tor Lillqvist <tml at iki.fi>
Date:   Tue May 28 08:51:01 2013 +0300

    Bypass dynamic type_info generation for now when using libc++
    
    The type_info crack is even harder in the libc++ (with Clang, on OS X)
    case, sigh. Punt for now and let's see what happens...
    
    Change-Id: I17c3a4d9d933acfbf554649c9ec8b6fb5213f2f0

diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
index 3147d6d..62b0cb1 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx
@@ -54,6 +54,8 @@ using namespace ::__cxxabiv1;
 namespace CPPU_CURRENT_NAMESPACE
 {
 
+#ifndef _LIBCPP_VERSION
+
 #if MACOSX_SDK_VERSION >= 1070
 
 // MacOSX10.4u.sdk/usr/include/c++/4.0.0/cxxabi.h defined
@@ -103,6 +105,8 @@ std::type_info * create_FAKE_si_class_type_info(
 
 #endif
 
+#endif
+
 //==================================================================================================
 static OUString toUNOname( char const * p ) SAL_THROW(())
 {
@@ -217,6 +221,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
             t_rtti_map::const_iterator iFind2( m_generatedRttis.find( unoName ) );
             if (iFind2 == m_generatedRttis.end())
             {
+#ifndef _LIBCPP_VERSION
                 // we must generate it !
                 // symbol and rtti-name is nearly identical,
                 // the symbol is prefixed with _ZTI
@@ -250,6 +255,10 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
                 pair< t_rtti_map::iterator, bool > insertion (
                     m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
                 SAL_WARN_IF( !insertion.second, "bridges", "key " << unoName << " already in generated rtti map" );
+#else
+                OSL_FAIL("Cannot generate type_infos with libc++, sigh");
+                return NULL;
+#endif
             }
             else // taking already generated rtti
             {
commit f5aa04485c86a5753bd7af057b86336efe089fae
Author: Tor Lillqvist <tml at iki.fi>
Date:   Wed Apr 17 23:30:48 2013 +0300

    Enable optionally using libc++ on OS X (when targeting 10.7 or later)
    
    Experimental work in progress.
    
    Change-Id: I92663e07c7322037182141603f72c6d442da6ee9

diff --git a/config_host.mk.in b/config_host.mk.in
index 76df377..a3770a5 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -63,6 +63,7 @@ export COMMONS_LOGGING_JAR=@COMMONS_LOGGING_JAR@
 export COMPATH=@COMPATH@
 export COMPILER_PLUGINS=@COMPILER_PLUGINS@
 export COM_GCC_IS_CLANG=@COM_GCC_IS_CLANG@
+export CPP_LIBRARY=@CPP_LIBRARY@
 export CPPUNIT_CFLAGS=$(gb_SPACE)@CPPUNIT_CFLAGS@
 export CPPUNIT_LIBS=$(gb_SPACE)@CPPUNIT_LIBS@
 export CPU=@CPU@
diff --git a/configure.ac b/configure.ac
index 4f422ee..c5aeffb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -367,6 +367,10 @@ DLLPOST=".so"
 
 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
 
+# Most platforms use GNU libstdc++
+CPP_LIBRARY="GLIBCXX"
+AC_SUBST(CPP_LIBRARY)
+
 case "$host_os" in
 
 solaris*)
@@ -1127,6 +1131,13 @@ AC_ARG_WITH(macosx-bundle-identifier,
          org.libreoffice.script ("script", huh?).]),
 ,with_macosx_bundle_identifier=org.libreoffice.script)
 
+AC_ARG_ENABLE(libc++,
+    AS_HELP_STRING([--enable-libc++],
+        [Use the libc++ C++ library instead of GNU libstdc++ on OS X. Only effective
+         if --with-macosx-version-min-required is 10.7 or later. Experimental work in
+         progress, very likely breaks something, don't use unless you plan to fix that.]),
+,)
+
 AC_ARG_ENABLE(ios-simulator,
     AS_HELP_STRING([--enable-ios-simulator],
         [Build for the iOS Simulator, not iOS device.]),
@@ -2537,12 +2548,26 @@ if test "$_os" = "Darwin"; then
             fi
             ;;
         10.7|10.8)
+            if test "$enable_libc__" = yes -a "$with_macosx_version_min_required" != 10.6; then
+                # Use libc++ instead of libstdc++ when possible
+                # and also compile as C++11
+                stdlib="-std=c++11 -stdlib=libc++"
+                CPP_LIBRARY="LIBCPP"
+            fi
             CC="`xcrun -find clang` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
-            CXX="`xcrun -find clang++` $bitness -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
+            CXX="`xcrun -find clang++` $bitness $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
             XCRUN=xcrun
             ;;
         esac
         AC_MSG_RESULT([$CC and $CXX])
+    else
+        # In case somebody insists on passing in CXX, and perhaps CFLAGS or CXXFLAGS to choose
+        # compiler. Not really something we encourage or support.
+        case "$CXX $CFLAGS $CXXFLAGS" in
+        *-stdlib=libc++*)
+            CPP_LIBRARY="LIBCPP"
+            ;;
+        esac
     fi
 
     case "$with_macosx_version_max_allowed" in
@@ -3447,6 +3472,7 @@ cygwin*)
     OS=WNT
     RTL_OS=Windows
     P_SEP=";"
+    CPP_LIBRARY="MSVCRT"
 
     case "$host_cpu" in
     i*86|x86_64)
@@ -5604,7 +5630,15 @@ b thingb[]={{0,0}, {1,1}};
 size_t i = sizeof(sal_n_array_size(thinga));
 size_t j = sizeof(sal_n_array_size(thingb));
 return !(i != 0 && j != 0);
-]])],[HAVE_CXX0X=TRUE CXXFLAGS_CXX11=-std=gnu++0x],[])
+]])
+        ],[
+            HAVE_CXX0X=TRUE
+            if test "$CPP_LIBRARY" = LIBCPP -a $_os = Darwin; then
+                : Already set CXX to contain -std=c++11
+            else
+                CXXFLAGS_CXX11=-std=gnu++0x
+            fi
+        ],[])
 
         AC_LANG_POP([C++])
         CXXFLAGS=$save_CXXFLAGS


More information about the Libreoffice-commits mailing list