[Libreoffice-commits] .: 2 commits - configure.in solenv/gbuild solenv/inc
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 4 08:49:08 PDT 2012
configure.in | 84 +++++++++++++++------------------
solenv/gbuild/platform/com_GCC_defs.mk | 4 +
solenv/gbuild/platform/macosx.mk | 4 -
solenv/inc/unxgcc.mk | 3 +
solenv/inc/unxiosr.mk | 3 +
solenv/inc/unxsogs.mk | 4 +
solenv/inc/wntgcci.mk | 3 +
7 files changed, 56 insertions(+), 49 deletions(-)
New commits:
commit 4a42f84a70f38ee848b01baeaa6da5219dfe9b53
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 4 17:46:32 2012 +0200
Clean up HAVE_THREADSAFE_STATICS
Change-Id: I042269aabaa2e9952c5d2f41cf93e55d654f6313
diff --git a/configure.in b/configure.in
index 8fb7287..4ea7155 100644
--- a/configure.in
+++ b/configure.in
@@ -5166,51 +5166,42 @@ dnl ===================================================================
AC_MSG_CHECKING([whether $CXX supports thread safe statics])
unset HAVE_THREADSAFE_STATICS
if test "$GCC" = "yes"; then
- save_CXXFLAGS=$CXXFLAGS
- CXXFLAGS="$CXXFLAGS -fthreadsafe-statics"
- AC_LANG_PUSH([C++])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)],[HAVE_THREADSAFE_STATICS=TRUE],[])
- AC_LANG_POP([C++])
- CXXFLAGS=$save_CXXFLAGS
- if test "$HAVE_THREADSAFE_STATICS" = "TRUE"; then
- dnl Some C++ runtimes use a single lock for all static variables, which
- dnl can cause deadlock in multi-threaded applications. This is not
- dnl easily tested here; for POSIX-based systems, if executing the
- dnl following C++ program does not terminate then the tool chain
- dnl apparently has this problem:
- dnl
- dnl #include <pthread.h>
- dnl int h() { return 0; }
- dnl void * g(void * unused) {
- dnl static int n = h();
- dnl return &n;
- dnl }
- dnl int f() {
- dnl pthread_t t;
- dnl pthread_create(&t, 0, g, 0);
- dnl pthread_join(t, 0);
- dnl return 0;
- dnl }
- dnl int main() {
- dnl static int n = f();
- dnl return n;
- dnl }
- dnl
- dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is
- dnl at least one instance of GCC 4.2.4 (used on a "Linux
- dnl ooobuild1.osuosl.org 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15
- dnl EDT 2011 i686 i686 i386 GNU/Linux" machine); see the definition of
- dnl __cxa_guard_acquire in GCC's libstdc++-v3/libsupc++/guard.cc for
- dnl what #ifdefs actually make a difference there. Conservative advice
- dnl from Jakub Jelinek is to assume it working in GCC >= 4.3:
- if test "$_os" = "Darwin" -o "${GCCVER?}" -lt 040300; then
- unset HAVE_THREADSAFE_STATICS
- AC_MSG_RESULT([broken (i.e., no)])
- else
- AC_MSG_RESULT([yes])
- fi
- else
- AC_MSG_RESULT([no])
+ dnl -fthreadsafe-statics is available since GCC 4, so always available for
+ dnl us. However, some C++ runtimes use a single lock for all static
+ dnl variables, which can cause deadlock in multi-threaded applications.
+ dnl This is not easily tested here; for POSIX-based systems, if executing
+ dnl the following C++ program does not terminate then the tool chain
+ dnl apparently has this problem:
+ dnl
+ dnl #include <pthread.h>
+ dnl int h() { return 0; }
+ dnl void * g(void * unused) {
+ dnl static int n = h();
+ dnl return &n;
+ dnl }
+ dnl int f() {
+ dnl pthread_t t;
+ dnl pthread_create(&t, 0, g, 0);
+ dnl pthread_join(t, 0);
+ dnl return 0;
+ dnl }
+ dnl int main() {
+ dnl static int n = f();
+ dnl return n;
+ dnl }
+ dnl
+ dnl Mac OS X up to at least 10.7.1 is known to have this problem, as is at
+ dnl least one instance of GCC 4.2.4 (used on a "Linux ooobuild1.osuosl.org
+ dnl 2.6.9-101.plus.c4smp #1 SMP Thu Jul 21 19:08:15 EDT 2011 i686 i686 i386
+ dnl GNU/Linux" machine); see the definition of __cxa_guard_acquire in GCC's
+ dnl libstdc++-v3/libsupc++/guard.cc for what #ifdefs actually make a
+ dnl difference there. Conservative advice from Jakub Jelinek is to assume
+ dnl it working in GCC >= 4.3:
+ if test "$_os" = "Darwin" -o "${GCCVER?}" -lt 040300; then
+ AC_MSG_RESULT([broken (i.e., no)])
+ else
+ HAVE_THREADSAFE_STATICS=TRUE
+ AC_MSG_RESULT([yes])
fi
else
AC_MSG_RESULT([unknown (assuming no)])
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 0cc86e3..1e349f0 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -81,6 +81,10 @@ gb_CXXFLAGS_COMMON := \
-fno-common \
-pipe \
+ifneq ($(HAVE_THREADSAFE_STATICS),TRUE)
+gb_CXXFLAGS_COMMON += -fno-threadsafe-statics
+endif
+
ifeq ($(HAVE_GCC_VISIBILITY_FEATURE),TRUE)
gb_VISIBILITY_FLAGS := -DHAVE_GCC_VISIBILITY_FEATURE -fvisibility=hidden
ifneq ($(HAVE_GCC_VISIBILITY_BROKEN),TRUE)
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 2e2c203..ecb7d71 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -87,10 +87,6 @@ ifeq ($(HAVE_GCC_NO_LONG_DOUBLE),TRUE)
gb_CXXFLAGS += -Wno-long-double
endif
-ifneq ($(HAVE_THREADSAFE_STATICS),TRUE)
-gb_CXXFLAGS += -fno-threadsafe-statics
-endif
-
# these are to get g++ to switch to Objective-C++ mode
# (see toolkit module for a case where it is necessary to do it this way)
gb_OBJCXXFLAGS := -x objective-c++ -fobjc-exceptions
diff --git a/solenv/inc/unxgcc.mk b/solenv/inc/unxgcc.mk
index 3ac4956..0441986 100644
--- a/solenv/inc/unxgcc.mk
+++ b/solenv/inc/unxgcc.mk
@@ -93,6 +93,9 @@ CFLAGS_NO_EXCEPTIONS=-fno-exceptions
# -fpermissive should be removed as soon as possible
CFLAGSCXX= -pipe $(ARCH_FLAGS)
+.IF "$(HAVE_THREADSAFE_STATICS)" != "TRUE"
+CFLAGSCXX += -fno-threadsafe-statics
+.END
.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" && "$(HAVE_GCC_VISIBILITY_BROKEN)" != "TRUE"
CFLAGSCXX+=-fvisibility-inlines-hidden
.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
diff --git a/solenv/inc/unxiosr.mk b/solenv/inc/unxiosr.mk
index 089dc3d..f1a6492 100644
--- a/solenv/inc/unxiosr.mk
+++ b/solenv/inc/unxiosr.mk
@@ -64,6 +64,9 @@ CFLAGS_NO_EXCEPTIONS=-fno-exceptions
# Normal C++ compilation flags
CFLAGSCXX=-pipe -fsigned-char $(ARCH_FLAGS) -Wno-ctor-dtor-privacy
+.IF "$(HAVE_THREADSAFE_STATICS)" != "TRUE"
+CFLAGSCXX += -fno-threadsafe-statics
+.END
# No PIC needed as we don't build dynamic objects
PICSWITCH:=
diff --git a/solenv/inc/unxsogs.mk b/solenv/inc/unxsogs.mk
index a415143..f75c4aa 100644
--- a/solenv/inc/unxsogs.mk
+++ b/solenv/inc/unxsogs.mk
@@ -58,6 +58,10 @@ CFLAGSEXCEPTIONS=-fexceptions
CFLAGS_NO_EXCEPTIONS=-fno-exceptions
CFLAGSCXX= -pipe $(ARCH_FLAGS)
+.IF "$(HAVE_THREADSAFE_STATICS)" != "TRUE"
+CFLAGSCXX += -fno-threadsafe-statics
+.END
+
PICSWITCH:=-fPIC
CFLAGSOBJGUIMT=
CFLAGSOBJCUIMT=
diff --git a/solenv/inc/wntgcci.mk b/solenv/inc/wntgcci.mk
index c8e39d1..496e8c2 100644
--- a/solenv/inc/wntgcci.mk
+++ b/solenv/inc/wntgcci.mk
@@ -46,6 +46,9 @@ CFLAGS+=-fmessage-length=0 -c
CFLAGSCC=-pipe $(ARCH_FLAGS)
CFLAGSCXX=-pipe $(ARCH_FLAGS)
+.IF "$(HAVE_THREADSAFE_STATICS)" != "TRUE"
+CFLAGSCXX += -fno-threadsafe-statics
+.END
.IF "$(HAVE_CXX0X)" == "TRUE"
# FIXME still does not compile fully CFLAGSCXX+=-std=gnu++0x
commit 4bcf34ae5a524d4c35407bd087aef52c4592011c
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 4 17:08:17 2012 +0200
Codify the fact that GCC < 4 is not supported any more
Change-Id: I8d0eb681cdfefbf7524de4478e3296ca797b4c5e
diff --git a/configure.in b/configure.in
index 25ab277..8fb7287 100644
--- a/configure.in
+++ b/configure.in
@@ -2919,6 +2919,9 @@ if test "$GCC" = "yes"; then
else
AC_MSG_RESULT([gcc $_gcc_version])
fi
+ if test "$GCCVER" -lt 040000; then
+ AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.0.0])
+ fi
fi
dnl ===================================================================
More information about the Libreoffice-commits
mailing list