Kaydet (Commit) f5aa0448 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Enable optionally using libc++ on OS X (when targeting 10.7 or later)

Experimental work in progress.

Change-Id: I92663e07c7322037182141603f72c6d442da6ee9
üst 7b91e84c
...@@ -63,6 +63,7 @@ export COMMONS_LOGGING_JAR=@COMMONS_LOGGING_JAR@ ...@@ -63,6 +63,7 @@ export COMMONS_LOGGING_JAR=@COMMONS_LOGGING_JAR@
export COMPATH=@COMPATH@ export COMPATH=@COMPATH@
export COMPILER_PLUGINS=@COMPILER_PLUGINS@ export COMPILER_PLUGINS=@COMPILER_PLUGINS@
export COM_GCC_IS_CLANG=@COM_GCC_IS_CLANG@ export COM_GCC_IS_CLANG=@COM_GCC_IS_CLANG@
export CPP_LIBRARY=@CPP_LIBRARY@
export CPPUNIT_CFLAGS=$(gb_SPACE)@CPPUNIT_CFLAGS@ export CPPUNIT_CFLAGS=$(gb_SPACE)@CPPUNIT_CFLAGS@
export CPPUNIT_LIBS=$(gb_SPACE)@CPPUNIT_LIBS@ export CPPUNIT_LIBS=$(gb_SPACE)@CPPUNIT_LIBS@
export CPU=@CPU@ export CPU=@CPU@
......
...@@ -367,6 +367,10 @@ DLLPOST=".so" ...@@ -367,6 +367,10 @@ DLLPOST=".so"
LINKFLAGSNOUNDEFS="-Wl,-z,defs" LINKFLAGSNOUNDEFS="-Wl,-z,defs"
# Most platforms use GNU libstdc++
CPP_LIBRARY="GLIBCXX"
AC_SUBST(CPP_LIBRARY)
case "$host_os" in case "$host_os" in
solaris*) solaris*)
...@@ -1127,6 +1131,13 @@ AC_ARG_WITH(macosx-bundle-identifier, ...@@ -1127,6 +1131,13 @@ AC_ARG_WITH(macosx-bundle-identifier,
org.libreoffice.script ("script", huh?).]), org.libreoffice.script ("script", huh?).]),
,with_macosx_bundle_identifier=org.libreoffice.script) ,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, AC_ARG_ENABLE(ios-simulator,
AS_HELP_STRING([--enable-ios-simulator], AS_HELP_STRING([--enable-ios-simulator],
[Build for the iOS Simulator, not iOS device.]), [Build for the iOS Simulator, not iOS device.]),
...@@ -2537,12 +2548,26 @@ if test "$_os" = "Darwin"; then ...@@ -2537,12 +2548,26 @@ if test "$_os" = "Darwin"; then
fi fi
;; ;;
10.7|10.8) 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" 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 XCRUN=xcrun
;; ;;
esac esac
AC_MSG_RESULT([$CC and $CXX]) 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 fi
case "$with_macosx_version_max_allowed" in case "$with_macosx_version_max_allowed" in
...@@ -3447,6 +3472,7 @@ cygwin*) ...@@ -3447,6 +3472,7 @@ cygwin*)
OS=WNT OS=WNT
RTL_OS=Windows RTL_OS=Windows
P_SEP=";" P_SEP=";"
CPP_LIBRARY="MSVCRT"
case "$host_cpu" in case "$host_cpu" in
i*86|x86_64) i*86|x86_64)
...@@ -5604,7 +5630,15 @@ b thingb[]={{0,0}, {1,1}}; ...@@ -5604,7 +5630,15 @@ b thingb[]={{0,0}, {1,1}};
size_t i = sizeof(sal_n_array_size(thinga)); size_t i = sizeof(sal_n_array_size(thinga));
size_t j = sizeof(sal_n_array_size(thingb)); size_t j = sizeof(sal_n_array_size(thingb));
return !(i != 0 && j != 0); 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++]) AC_LANG_POP([C++])
CXXFLAGS=$save_CXXFLAGS CXXFLAGS=$save_CXXFLAGS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment