[gjs: 13/26] build: Move locale choosing into separate script
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 13/26] build: Move locale choosing into separate script
- Date: Sun, 14 Apr 2019 14:04:28 +0000 (UTC)
commit 94933c9c3478f3e1464ea94d72c50c25d57b9757
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Mar 17 20:40:57 2019 -0700
build: Move locale choosing into separate script
In order to port to Meson in the future, we'll need to have this
functionality in a separate script. Splitting it out now and using the
script in the Autotools build will be handy if we decide to keep the two
build systems in parallel for a while.
Makefile.am | 1 +
build/choose-tests-locale.sh | 22 ++++++++++++++++++++++
configure.ac | 17 +----------------
3 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 2ef69a31..6e555780 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -166,6 +166,7 @@ include Makefile-insttest.am
EXTRA_DIST += \
autogen.sh \
+ build/choose-tests-locale.sh \
COPYING.LGPL \
doc/ByteArray.md \
doc/cairo.md \
diff --git a/build/choose-tests-locale.sh b/build/choose-tests-locale.sh
new file mode 100755
index 00000000..e0489372
--- /dev/null
+++ b/build/choose-tests-locale.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+locales=$(locale -a)
+
+case $locales in
+ # Prefer C.UTF-8 although it is only available with newer libc
+ *C.UTF-8*) tests_locale=C.UTF-8 ;;
+
+ # Most systems will probably have this
+ *en_US.UTF-8*) tests_locale=en_US.UTF-8 ;;
+ *en_US.utf8*) tests_locale=en_US.utf8 ;;
+
+ # If not, fall back to any English UTF-8 locale or any UTF-8 locale at all
+ *en_*.UTF-8*) tests_locale=$(echo $locales | grep -m1 en_.\*\\.UTF-8) ;;
+ *en_*.utf8*) tests_locale=$(echo $locales | grep -m1 en_.\*\\.utf8) ;;
+ *.UTF-8*) tests_locale=$(echo $locales | grep -m1 \\.UTF-8) ;;
+ *.utf8*) tests_locale=$(echo $locales | grep -m1 \\.utf8) ;;
+
+ *) tests_locale=C ;;
+esac
+
+echo $tests_locale
diff --git a/configure.ac b/configure.ac
index 0d65decc..71bdffb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -339,22 +339,7 @@ AS_IF([test "x$with_dbus_tests" != "xno"], [
AM_CONDITIONAL([DBUS_TESTS], [test "x$with_dbus_tests" != "xno"])
AC_MSG_CHECKING([for a suitable UTF-8 locale to run the tests in])
-LOCALES=$(locale -a)
-AS_CASE([$LOCALES],
- dnl Prefer C.UTF-8 although it is only available with newer libc
- [*C.UTF-8*], [TESTS_LOCALE=C.UTF-8],
-
- dnl Most systems will probably have this
- [*en_US.UTF-8*], [TESTS_LOCALE=en_US.UTF-8],
- [*en_US.utf8*], [TESTS_LOCALE=en_US.utf8],
-
- dnl If not, fall back to any English UTF-8 locale or any UTF-8 locale at all
- [*en_*.UTF-8*], [TESTS_LOCALE=$(echo $LOCALES | grep -m1 en_.\*\\.UTF-8)],
- [*en_*.utf8*], [TESTS_LOCALE=$(echo $LOCALES | grep -m1 en_.\*\\.utf8)],
- [*.UTF-8*], [TESTS_LOCALE=$(echo $LOCALES | grep -m1 \\.UTF-8)],
- [*.utf8*], [TESTS_LOCALE=$(echo $LOCALES | grep -m1 \\.utf8)],
-
- [TESTS_LOCALE=C])
+TESTS_LOCALE=$($srcdir/build/choose-tests-locale.sh)
AC_MSG_RESULT([$TESTS_LOCALE])
AC_SUBST([TESTS_LOCALE])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]