Make libc++ optional for iOS and use the right library in the Xcode projects

It seems that using libc++ when building with Xcode 4 (and iOS SDK 6)
you get linking errors. Stick to libstdc++ for now then with that.

Propagate the choice to the iOS Xcode projects through the lo.xcconfig
file.

Change-Id: Ic61dd2336066a77c4219c532106e3e50e85d0689
This commit is contained in:
Tor Lillqvist
2013-10-16 16:12:54 +03:00
parent 687275db4c
commit 795dcf9da4
4 changed files with 28 additions and 10 deletions

View File

@@ -2911,6 +2911,7 @@ if test $_os = iOS; then
for sdkver in 7.0 6.1 6.0; do for sdkver in 7.0 6.1 6.0; do
t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
if test -d $t; then if test -d $t; then
ios_sdk=$sdkver
sysroot=$t sysroot=$t
break break
fi fi
@@ -2956,9 +2957,27 @@ if test $_os = iOS; then
# Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also # Just add -fvisibility=hidden to CC and CXX directly so that the 3rd-party libs also
# get compiled with it, to avoid ld warnings when linking all that together into one # get compiled with it, to avoid ld warnings when linking all that together into one
# executable. # executable.
# Also, use libc++. # Use libc++ if opted in only, and only when building against iOS 7 SDK or newer.
XCODE_CLANG_CXX_LIBRARY=libstdc++
case $ios_sdk in
6.*)
if test "$enable_libc__" = yes; then
AC_MSG_ERROR([--enable-libc++ requires using Xcode 5 and iOS SDK 7 or newer it seems])
fi
;;
*)
if test "$enable_libc__" = yes; then
XCODE_CLANG_CXX_LIBRARY=libc++
fi
;;
esac
stdlib="-stdlib=$XCODE_CLANG_CXX_LIBRARY"
CC="`xcrun -find clang` -arch $arch -fvisibility=hidden -isysroot $sysroot $lto $versionmin" CC="`xcrun -find clang` -arch $arch -fvisibility=hidden -isysroot $sysroot $lto $versionmin"
CXX="`xcrun -find clang++` -arch $arch -fvisibility=hidden -stdlib=libc++ -isysroot $sysroot $lto $versionmin" CXX="`xcrun -find clang++` -arch $arch -fvisibility=hidden $stdlib -isysroot $sysroot $lto $versionmin"
INSTALL_NAME_TOOL=`xcrun -find install_name_tool` INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
AR=`xcrun -find ar` AR=`xcrun -find ar`
NM=`xcrun -find nm` NM=`xcrun -find nm`
@@ -2967,6 +2986,8 @@ if test $_os = iOS; then
RANLIB=`xcrun -find ranlib` RANLIB=`xcrun -find ranlib`
fi fi
AC_SUBST(XCODE_CLANG_CXX_LIBRARY)
AC_MSG_CHECKING([whether to treat the installation as read-only]) AC_MSG_CHECKING([whether to treat the installation as read-only])
if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \ if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \

View File

@@ -1510,7 +1510,6 @@
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = armv7; ARCHS = armv7;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
@@ -1555,7 +1554,6 @@
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = armv7; ARCHS = armv7;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
@@ -1592,7 +1590,6 @@
689EBB0E18069FB8002F1CD7 /* Debug */ = { 689EBB0E18069FB8002F1CD7 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -1614,7 +1611,6 @@
689EBB0F18069FB8002F1CD7 /* Release */ = { 689EBB0F18069FB8002F1CD7 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp; GCC_INPUT_FILETYPE = sourcecode.cpp.objcpp;
GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES;

View File

@@ -16,3 +16,8 @@ LO_BUILDDIR = @BUILDDIR@
LO_INSTDIR = @INSTDIR@ LO_INSTDIR = @INSTDIR@
LO_OUTDIR = @OUTDIR@ LO_OUTDIR = @OUTDIR@
LO_WORKDIR = @WORKDIR@ LO_WORKDIR = @WORKDIR@
// These are actual Xcode-known settings. The corresponding autoconf
// variables are prefixed with XCODE_ to make it clear in configure.ac
// what they will be used for.
CLANG_CXX_LIBRARY = @XCODE_CLANG_CXX_LIBRARY@

View File

@@ -459,7 +459,6 @@
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = armv7; ARCHS = armv7;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
@@ -500,7 +499,6 @@
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = armv7; ARCHS = armv7;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
@@ -531,7 +529,6 @@
68FDBE3918053A140064DD74 /* Debug */ = { 68FDBE3918053A140064DD74 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
DSTROOT = /tmp/ios_sharedlo.dst; DSTROOT = /tmp/ios_sharedlo.dst;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO; GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;
@@ -549,7 +546,6 @@
68FDBE3A18053A140064DD74 /* Release */ = { 68FDBE3A18053A140064DD74 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
DSTROOT = /tmp/ios_sharedlo.dst; DSTROOT = /tmp/ios_sharedlo.dst;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO; GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;