summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2017-07-25 13:37:52 +0100
committerSimon McVittie <smcv@collabora.com>2018-02-07 07:34:35 +0000
commit97d480c09c66ad7860f6c0e0a3d56fdf3a0d56a8 (patch)
tree04c4445e607b76cbdf30b8e458039aae7cc3ff4e
parentd4d6cdab994f99d4e9613a1ee0c8ec6bebec3f1c (diff)
downloaddbus-97d480c09c66ad7860f6c0e0a3d56fdf3a0d56a8.tar.gz
cmake: Match AC_DEFINE more precisely, respecting [] quoting
The regular expression previously used here to select the second comma-delimited argument won't work when we introduce an argument containing a comma, which I need to do now. We can address this by recognising Autoconf's quoting mechanism (which uses square brackets). This is not 100% right (it doesn't understand nested square brackets), but it's good enough in practice. Signed-off-by: Simon McVittie <smcv@collabora.com> Acked-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354 (cherry picked from commit 83b439f7b4c6a946e0fe9a0287910ba4f6318143)
-rw-r--r--cmake/modules/MacrosAutotools.cmake2
-rw-r--r--configure.ac3
2 files changed, 4 insertions, 1 deletions
diff --git a/cmake/modules/MacrosAutotools.cmake b/cmake/modules/MacrosAutotools.cmake
index 8bb83cdf..888d5e72 100644
--- a/cmake/modules/MacrosAutotools.cmake
+++ b/cmake/modules/MacrosAutotools.cmake
@@ -108,7 +108,7 @@ macro(autodefine name)
foreach(line ${_configure_ac})
if(line MATCHES ".*AC_DEFINE(.*${name}.*).*")
string (REGEX REPLACE ".*AC_DEFINE(.*).*" "\\1" value ${line})
- string (REGEX REPLACE ".*,(.*),.*" "\\1" value2 ${value})
+ string (REGEX REPLACE "[^[]*\\[[^]]*\\], *\\[([^]]*)\\],.*" "\\1" value2 ${value})
string (REPLACE "[" "" value3 ${value2})
string (REPLACE "]" "" value4 ${value3})
set(${name} ${value4})
diff --git a/configure.ac b/configure.ac
index 132e1630..413f6580 100644
--- a/configure.ac
+++ b/configure.ac
@@ -258,6 +258,9 @@ fi
# default (unless you don't have GLib), because they don't bloat the library
# or binaries.
+dnl Don't do anything too subtle here, because the CMake build system
+dnl parses these lines with regular expressions. If necessary, adjust
+dnl cmake/modules/MacrosAutotools.cmake to compensate.
AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_40], [Ignore post-2.40 deprecations])
AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_40], [Prevent post-2.40 APIs])