summaryrefslogtreecommitdiffstats
path: root/gl/m4/setlocale_null.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/setlocale_null.m4')
-rw-r--r--gl/m4/setlocale_null.m449
1 files changed, 35 insertions, 14 deletions
diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4
index 032119d0..3c8b693e 100644
--- a/gl/m4/setlocale_null.m4
+++ b/gl/m4/setlocale_null.m4
@@ -1,10 +1,12 @@
1# setlocale_null.m4 serial 5 1# setlocale_null.m4
2dnl Copyright (C) 2019-2023 Free Software Foundation, Inc. 2# serial 10
3dnl Copyright (C) 2019-2025 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
6 8
7AC_DEFUN([gl_FUNC_SETLOCALE_NULL], 9AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL],
8[ 10[
9 AC_REQUIRE([AC_CANONICAL_HOST]) 11 AC_REQUIRE([AC_CANONICAL_HOST])
10 AC_REQUIRE([gl_PTHREADLIB]) 12 AC_REQUIRE([gl_PTHREADLIB])
@@ -13,11 +15,25 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
13 AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], 15 AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe],
14 [gl_cv_func_setlocale_null_all_mtsafe], 16 [gl_cv_func_setlocale_null_all_mtsafe],
15 [case "$host_os" in 17 [case "$host_os" in
16 # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. 18 # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku.
17 *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) 19 *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku*)
18 gl_cv_func_setlocale_null_all_mtsafe=no ;; 20 gl_cv_func_setlocale_null_all_mtsafe=no ;;
21 # Guess no on Cygwin < 3.4.6.
22 cygwin*)
23 AC_EGREP_CPP([Lucky user],
24 [
25#if defined __CYGWIN__
26 #include <cygwin/version.h>
27 #if CYGWIN_VERSION_DLL_COMBINED >= CYGWIN_VERSION_DLL_MAKE_COMBINED (3004, 6)
28 Lucky user
29 #endif
30#endif
31 ],
32 [gl_cv_func_setlocale_null_all_mtsafe=yes],
33 [gl_cv_func_setlocale_null_all_mtsafe=no])
34 ;;
19 # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. 35 # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows.
20 *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) 36 *-gnu* | gnu* | hpux* | irix* | solaris* | mingw* | windows*)
21 gl_cv_func_setlocale_null_all_mtsafe=yes ;; 37 gl_cv_func_setlocale_null_all_mtsafe=yes ;;
22 # If we don't know, obey --enable-cross-guesses. 38 # If we don't know, obey --enable-cross-guesses.
23 *) 39 *)
@@ -26,7 +42,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
26 ]) 42 ])
27 dnl On platforms without multithreading, there is no issue. 43 dnl On platforms without multithreading, there is no issue.
28 case "$host_os" in 44 case "$host_os" in
29 mingw*) ;; 45 mingw* | windows*) ;;
30 *) 46 *)
31 if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then 47 if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then
32 gl_cv_func_setlocale_null_all_mtsafe="trivially yes" 48 gl_cv_func_setlocale_null_all_mtsafe="trivially yes"
@@ -48,7 +64,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
48 openbsd* | aix*) 64 openbsd* | aix*)
49 gl_cv_func_setlocale_null_one_mtsafe=no ;; 65 gl_cv_func_setlocale_null_one_mtsafe=no ;;
50 # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. 66 # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows.
51 *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) 67 *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw* | windows*)
52 gl_cv_func_setlocale_null_one_mtsafe=yes ;; 68 gl_cv_func_setlocale_null_one_mtsafe=yes ;;
53 # If we don't know, obey --enable-cross-guesses. 69 # If we don't know, obey --enable-cross-guesses.
54 *) 70 *)
@@ -57,7 +73,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
57 ]) 73 ])
58 dnl On platforms without multithreading, there is no issue. 74 dnl On platforms without multithreading, there is no issue.
59 case "$host_os" in 75 case "$host_os" in
60 mingw*) ;; 76 mingw* | windows*) ;;
61 *) 77 *)
62 if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then 78 if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then
63 gl_cv_func_setlocale_null_one_mtsafe="trivially yes" 79 gl_cv_func_setlocale_null_one_mtsafe="trivially yes"
@@ -74,20 +90,25 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
74 dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c. 90 dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c.
75 if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then 91 if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
76 case "$host_os" in 92 case "$host_os" in
77 mingw*) LIB_SETLOCALE_NULL= ;; 93 mingw* | windows*)
94 SETLOCALE_NULL_LIB=
95 ;;
78 *) 96 *)
79 gl_WEAK_SYMBOLS 97 gl_WEAK_SYMBOLS
80 case "$gl_cv_have_weak" in 98 case "$gl_cv_have_weak" in
81 *yes) LIB_SETLOCALE_NULL= ;; 99 *yes) SETLOCALE_NULL_LIB= ;;
82 *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; 100 *) SETLOCALE_NULL_LIB="$LIBPTHREAD" ;;
83 esac 101 esac
84 ;; 102 ;;
85 esac 103 esac
86 else 104 else
87 LIB_SETLOCALE_NULL= 105 SETLOCALE_NULL_LIB=
88 fi 106 fi
89 dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX 107 dnl SETLOCALE_NULL_LIB is expected to be '-pthread' or '-lpthread' on AIX
90 dnl with gcc or xlc, and empty otherwise. 108 dnl with gcc or xlc, and empty otherwise.
109 AC_SUBST([SETLOCALE_NULL_LIB])
110 dnl For backward compatibility.
111 LIB_SETLOCALE_NULL="$SETLOCALE_NULL_LIB"
91 AC_SUBST([LIB_SETLOCALE_NULL]) 112 AC_SUBST([LIB_SETLOCALE_NULL])
92]) 113])
93 114