summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-05-20 02:56:53 +0200
committerBruno Haible <bruno@clisp.org>2019-05-20 02:58:27 +0200
commitbf5935a7c870a4aef806cc5aa41f938b2929fdcb (patch)
tree27456fff92c195c42ce101e8de4f84f3a28c1471 /m4
parentf56afa9a60d407990f420439969a1903a5f0783b (diff)
downloadgnulib-bf5935a7c870a4aef806cc5aa41f938b2929fdcb.tar.gz
localename: Fix default on macOS.
* m4/intlmacosx.m4 (gt_INTL_MACOSX): Don't test for CFLocaleCopyCurrent. * lib/localename.c: Remove includes for HAVE_CFLOCALECOPYCURRENT. (gl_locale_name_environ, gl_locale_name_default): Remove code for HAVE_CFLOCALECOPYCURRENT. * lib/localename.h (gl_locale_name_default): Update.
Diffstat (limited to 'm4')
-rw-r--r--m4/intlmacosx.m427
1 files changed, 10 insertions, 17 deletions
diff --git a/m4/intlmacosx.m4 b/m4/intlmacosx.m4
index 30e6f50e0a..3495174304 100644
--- a/m4/intlmacosx.m4
+++ b/m4/intlmacosx.m4
@@ -1,4 +1,4 @@
-# intlmacosx.m4 serial 6 (gettext-0.20)
+# intlmacosx.m4 serial 7 (gettext-0.20.2)
dnl Copyright (C) 2004-2014, 2016, 2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -33,21 +33,15 @@ AC_DEFUN([gt_INTL_MACOSX],
AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
[Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
fi
- dnl Check for API introduced in Mac OS X 10.5.
- AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
- [gt_save_LIBS="$LIBS"
- LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <CoreFoundation/CFLocale.h>]],
- [[CFLocaleCopyCurrent();]])],
- [gt_cv_func_CFLocaleCopyCurrent=yes],
- [gt_cv_func_CFLocaleCopyCurrent=no])
- LIBS="$gt_save_LIBS"])
- if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
- AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
- [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
- fi
+ dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
+ dnl because in macOS 10.13.4 it has the following behaviour:
+ dnl When two or more languages are specified in the
+ dnl "System Preferences > Language & Region > Preferred Languages" panel,
+ dnl it returns en_CC where CC is the territory (even when English is not among
+ dnl the preferred languages!). What we want instead is what
+ dnl CFLocaleCopyCurrent returned in earlier macOS releases and what
+ dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
+ dnl first among the preferred languages and CC is the territory.
AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages],
[gt_save_LIBS="$LIBS"
LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
@@ -64,7 +58,6 @@ AC_DEFUN([gt_INTL_MACOSX],
fi
INTL_MACOSX_LIBS=
if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
- || test $gt_cv_func_CFLocaleCopyCurrent = yes \
|| test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
fi