| 1 |
commit c12734230f00b338e22d94c8dda9a66af32b737e |
| 2 |
Author: Samuel Thibault <[email protected]> |
| 3 |
Date: Tue Mar 25 20:40:05 2025 +0100 |
| 4 |
|
| 5 |
focuspoll: Force c++11 standard only when needed |
| 6 |
|
| 7 |
We need at least c++11 to get unique_ptr, but we can thus not force using |
| 8 |
c++11 any more nowadays, otherwise we get |
| 9 |
|
| 10 |
In file included from /usr/include/unicode/uenum.h:25, |
| 11 |
from /usr/include/unicode/ucnv.h:52, |
| 12 |
from /usr/include/libxml2/libxml/encoding.h:31, |
| 13 |
from /usr/include/libxml2/libxml/parser.h:812, |
| 14 |
from /usr/include/compiz/compiz.h:29, |
| 15 |
from /usr/include/compiz/compiz-plugin.h:29, |
| 16 |
from /usr/include/compiz/compiz-core.h:29, |
| 17 |
from focuspoll.cpp:36: |
| 18 |
/usr/include/unicode/localpointer.h:561:26: error: parameter declared 'auto' |
| 19 |
561 | template <typename Type, auto closeFunction> |
| 20 |
| ^~~~ |
| 21 |
|
| 22 |
Because icu started requiring c++17 in its version 76. |
| 23 |
|
| 24 |
Leaving this empty makes gcc >= 11 assume c++17, and should fare fine on the |
| 25 |
long run. To avoid breaking building with gcc 10 and earlier which does not |
| 26 |
default to c++>=11, we can use ‘ac_prog_cxx_stdcxx’ to detect when |
| 27 |
-std=c++11 is needed. |
| 28 |
|
| 29 |
diff --git a/configure.ac b/configure.ac |
| 30 |
index 0860d99..fc61e6c 100644 |
| 31 |
--- a/configure.ac |
| 32 |
+++ b/configure.ac |
| 33 |
@@ -82,6 +82,11 @@ if test "x$GCC" = "xyes"; then |
| 34 |
fi |
| 35 |
fi |
| 36 |
|
| 37 |
+if test "$ac_prog_cxx_stdcxx" = "cxx98"; then |
| 38 |
+ # Old gcc, we need to enable C++11 explicitly |
| 39 |
+ CPPFLAGS="-std=c++11" |
| 40 |
+fi |
| 41 |
+ |
| 42 |
AC_C_BIGENDIAN |
| 43 |
|
| 44 |
plugindir=$libdir/compiz |
| 45 |
diff --git a/src/focuspoll/Makefile.am b/src/focuspoll/Makefile.am |
| 46 |
index 16ec6c5..199acb0 100644 |
| 47 |
--- a/src/focuspoll/Makefile.am |
| 48 |
+++ b/src/focuspoll/Makefile.am |
| 49 |
@@ -16,8 +16,6 @@ AM_CPPFLAGS = \ |
| 50 |
-DLOCALEDIR="\"@datadir@/locale\"" \ |
| 51 |
-DIMAGEDIR='"$(imagedir)"' |
| 52 |
|
| 53 |
-AM_CXXFLAGS = -std=c++11 |
| 54 |
- |
| 55 |
moduledir = $(plugindir) |
| 56 |
|
| 57 |
if FOCUSPOLL_PLUGIN |