diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-01-30 09:25:09 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-01-30 22:47:04 +0100 |
commit | 50cd28e5728b6a64c1e605567540739ea6ef42ca (patch) | |
tree | d53d33ce96ab7641d787cbfb99bd23367217121e | |
parent | 61364e5b983acea4f8607cc74d8cc6c319a6e3a5 (diff) |
Ensure configuration that defines math_errhandling in <cmath>
...as demanded by the C++17 standard, and required in
sc/source/core/tool/math.cxx. At least when building an --arch=i386 Flatpak
(where CFLAGS/CXXFLAGS are passed in containing, among others, -O2), that failed
when using -std=gnu++2a (instead of -std=c++2a) due to what looks like an error
in glibc (cf. <https://flathub.org/builds/#/builders/22/builds/797>).
...and fix fallout in external/firebird for Linux x86 32-bit build: While GCC
defines both __i386 and __i386__ (both as 1) regardless of -std=gnu++* vs.
-std=c++*, it defines i386 (as 1) only for -std=gnu++*. But various places in
the external/firebird sources check for i386 (among them src/common/common.h,
which fails with
#error Define FB_CPU for your platform
if i386 is not defined).
Change-Id: I7dce1961c79aeaccc82b1e2bdc350e02730d46af
Reviewed-on: https://gerrit.libreoffice.org/67105
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | external/firebird/ExternalProject_firebird.mk | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 7297c72a1db9..bb468640b81e 100644 --- a/configure.ac +++ b/configure.ac @@ -6241,6 +6241,7 @@ elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then ]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <algorithm> + #include <cmath> #include <functional> #include <vector> @@ -6260,6 +6261,13 @@ elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then void f(std::vector<int> & v, std::function<bool(int, int)> fn) { std::sort(v.begin(), v.end(), fn); } + + // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit + // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in + // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to + // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as + // needed by sc/source/core/tool/math.cxx): + int g() { return math_errhandling; } ]])],[CXXFLAGS_CXX11=$flag $my_float128hack]) AC_LANG_POP([C++]) CXXFLAGS=$save_CXXFLAGS diff --git a/external/firebird/ExternalProject_firebird.mk b/external/firebird/ExternalProject_firebird.mk index d370df0d83ae..d0614e202951 100644 --- a/external/firebird/ExternalProject_firebird.mk +++ b/external/firebird/ExternalProject_firebird.mk @@ -55,6 +55,7 @@ $(call gb_ExternalProject_get_state_target,firebird,build): -I$(call gb_UnpackedTarball_get_dir,icu)/source/i18n \ -I$(call gb_UnpackedTarball_get_dir,icu)/source/common \ ) \ + $(if $(filter GCC-INTEL,$(COM)-$(CPUNAME)),-Di386=1) \ " \ && export CXXFLAGS=" \ $(if $(filter MSC,$(COM)),$(if $(MSVC_USE_DEBUG_RUNTIME),-DMSVC_USE_DEBUG_RUNTIME)) \ |