[gimp] configure.ac: improve compiler version string escaping
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] configure.ac: improve compiler version string escaping
- Date: Mon, 20 May 2019 07:10:05 +0000 (UTC)
commit 04f9281bdd1ee05bed93eb98d9f697e38fcc94ea
Author: Ell <ell_se yahoo com>
Date: Mon May 20 03:06:02 2019 -0400
configure.ac: improve compiler version string escaping
In configure.ac, improve backslash escaping in the compiler
version string. Backslashes are currently not properly escaped in
our Windows builds, leading to spurious (and, in particular, non-
UTF8) characters in the compiler version string.
configure.ac | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1df622df65..ca4a643971 100644
--- a/configure.ac
+++ b/configure.ac
@@ -578,23 +578,22 @@ WARNING: GCC 7.2.0 has a serious bug affecting GEGL/GIMP. We advise
See https://bugzilla.gnome.org/show_bug.cgi?id=787222"
fi
# For GCC, use -v which has more information than --version.
- CC_VERSION="`$CC -v 2>&1`"
+ CC_VERSION_OPTS="-v"
else
# This is the list of common options used by autotools to check
# versions for various compilers.
- CC_VERSION="`$CC --version 2>&1`"
- if test $? != 0; then
- CC_VERSION="`$CC -v 2>&1`"
- if test $? != 0; then
- CC_VERSION="`$CC -V 2>&1`"
- if test $? != 0; then
- CC_VERSION="`$CC -qversion 2>&1`"
- fi
- fi
- fi
+ CC_VERSION_OPTS="--version -v -V -qversion"
fi
-# Format and escape CC_VERSION
-CC_VERSION="\\t`echo "$CC_VERSION" | sed -e 's/\\\\/\\\\\\\\/g;s/$/\\\\n\\\\t/g' | tr -d '\n'`"
+
+for CC_VERSION_OPT in $CC_VERSION_OPTS; do
+ # We run $CC, and escape and format its output, in a single step,
+ # since some shells expand escape sequences in "echo" arguments.
+ CC_VERSION="`$CC $CC_VERSION_OPT 2>&1 | sed -e 's/\\\\/\\\\\\\\/g;s/^/\\\\t/;s/$/\\\\n/' | tr -d '\n'`"
+ if test $? -eq 0; then
+ break
+ fi
+done
+
AC_SUBST(CC_VERSION)
AC_HEADER_STDC
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]