|
Packit Service |
4684c1 |
# setlocale.m4 serial 7
|
|
Packit Service |
4684c1 |
dnl Copyright (C) 2011-2020 Free Software Foundation, Inc.
|
|
Packit Service |
4684c1 |
dnl This file is free software; the Free Software Foundation
|
|
Packit Service |
4684c1 |
dnl gives unlimited permission to copy and/or distribute it,
|
|
Packit Service |
4684c1 |
dnl with or without modifications, as long as this notice is preserved.
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
AC_DEFUN([gl_FUNC_SETLOCALE],
|
|
Packit Service |
4684c1 |
[
|
|
Packit Service |
4684c1 |
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
|
|
Packit Service |
4684c1 |
AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
|
|
Packit Service |
4684c1 |
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
dnl Test whether we need to improve on the general working of setlocale.
|
|
Packit Service |
4684c1 |
NEED_SETLOCALE_IMPROVED=0
|
|
Packit Service |
4684c1 |
case "$host_os" in
|
|
Packit Service |
4684c1 |
dnl On native Windows systems, setlocale(category,NULL) does not look at
|
|
Packit Service |
4684c1 |
dnl the environment variables LC_ALL, category, and LANG.
|
|
Packit Service |
4684c1 |
mingw*) NEED_SETLOCALE_IMPROVED=1 ;;
|
|
Packit Service |
4684c1 |
dnl On Cygwin 1.5.x, setlocale always succeeds but setlocale(LC_CTYPE,NULL)
|
|
Packit Service |
4684c1 |
dnl is then still "C".
|
|
Packit Service |
4684c1 |
cygwin*)
|
|
Packit Service |
4684c1 |
case `uname -r` in
|
|
Packit Service |
4684c1 |
1.5.*) NEED_SETLOCALE_IMPROVED=1 ;;
|
|
Packit Service |
4684c1 |
esac
|
|
Packit Service |
4684c1 |
;;
|
|
Packit Service |
4684c1 |
dnl On Android 4.3, setlocale(category,"C") always fails.
|
|
Packit Service |
4684c1 |
*)
|
|
Packit Service |
4684c1 |
AC_CACHE_CHECK([whether setlocale supports the C locale],
|
|
Packit Service |
4684c1 |
[gl_cv_func_setlocale_works],
|
|
Packit Service |
4684c1 |
[AC_RUN_IFELSE(
|
|
Packit Service |
4684c1 |
[AC_LANG_SOURCE([[
|
|
Packit Service |
4684c1 |
#include <locale.h>
|
|
Packit Service |
4684c1 |
int main ()
|
|
Packit Service |
4684c1 |
{
|
|
Packit Service |
4684c1 |
return setlocale (LC_ALL, "C") == NULL;
|
|
Packit Service |
4684c1 |
}]])],
|
|
Packit Service |
4684c1 |
[gl_cv_func_setlocale_works=yes],
|
|
Packit Service |
4684c1 |
[gl_cv_func_setlocale_works=no],
|
|
Packit Service |
4684c1 |
[case "$host_os" in
|
|
Packit Service |
4684c1 |
# Guess no on Android.
|
|
Packit Service |
4684c1 |
linux*-android*) gl_cv_func_setlocale_works="guessing no";;
|
|
Packit Service |
4684c1 |
# Guess yes otherwise.
|
|
Packit Service |
4684c1 |
*) gl_cv_func_setlocale_works="guessing yes";;
|
|
Packit Service |
4684c1 |
esac
|
|
Packit Service |
4684c1 |
])
|
|
Packit Service |
4684c1 |
])
|
|
Packit Service |
4684c1 |
case "$gl_cv_func_setlocale_works" in
|
|
Packit Service |
4684c1 |
*yes) ;;
|
|
Packit Service |
4684c1 |
*) NEED_SETLOCALE_IMPROVED=1 ;;
|
|
Packit Service |
4684c1 |
esac
|
|
Packit Service |
4684c1 |
;;
|
|
Packit Service |
4684c1 |
esac
|
|
Packit Service |
4684c1 |
AC_DEFINE_UNQUOTED([NEED_SETLOCALE_IMPROVED], [$NEED_SETLOCALE_IMPROVED],
|
|
Packit Service |
4684c1 |
[Define to 1 to enable general improvements of setlocale.])
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
dnl Test whether we need a multithread-safe setlocale(category,NULL).
|
|
Packit Service |
4684c1 |
NEED_SETLOCALE_MTSAFE=0
|
|
Packit Service |
4684c1 |
if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
|
|
Packit Service |
4684c1 |
NEED_SETLOCALE_MTSAFE=1
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
AC_DEFINE_UNQUOTED([NEED_SETLOCALE_MTSAFE], [$NEED_SETLOCALE_MTSAFE],
|
|
Packit Service |
4684c1 |
[Define to 1 to enable a multithread-safety fix of setlocale.])
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
if test $NEED_SETLOCALE_IMPROVED = 1 || test $NEED_SETLOCALE_MTSAFE = 1; then
|
|
Packit Service |
4684c1 |
REPLACE_SETLOCALE=1
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
if test $NEED_SETLOCALE_MTSAFE = 1; then
|
|
Packit Service |
4684c1 |
LIB_SETLOCALE="$LIB_SETLOCALE_NULL"
|
|
Packit Service |
4684c1 |
else
|
|
Packit Service |
4684c1 |
LIB_SETLOCALE=
|
|
Packit Service |
4684c1 |
fi
|
|
Packit Service |
4684c1 |
dnl LIB_SETLOCALE is expected to be '-pthread' or '-lpthread' on AIX with gcc
|
|
Packit Service |
4684c1 |
dnl or xlc, and empty otherwise.
|
|
Packit Service |
4684c1 |
AC_SUBST([LIB_SETLOCALE])
|
|
Packit Service |
4684c1 |
])
|
|
Packit Service |
4684c1 |
|
|
Packit Service |
4684c1 |
# Prerequisites of lib/setlocale.c.
|
|
Packit Service |
4684c1 |
AC_DEFUN([gl_PREREQ_SETLOCALE],
|
|
Packit Service |
4684c1 |
[
|
|
Packit Service |
4684c1 |
dnl No need to check for CFLocaleCopyPreferredLanguages and
|
|
Packit Service |
4684c1 |
dnl CFPreferencesCopyAppValue because lib/setlocale.c is not used on Mac OS X.
|
|
Packit Service |
4684c1 |
dnl (The Mac OS X specific code is only used in libintl.)
|
|
Packit Service |
4684c1 |
:
|
|
Packit Service |
4684c1 |
])
|