diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-01-31 14:46:01 +0100 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-01-31 14:46:01 +0100 |
commit | e8bd88d1fcded01ccd066572eeaae1b507989cb3 (patch) | |
tree | c8e7be6c07c6f635f6e803e6a6ba9e7a95fee7c0 /gl/m4/setlocale_null.m4 | |
parent | 2ad962c13473607ca0d974bfaa516a0ed53ec73d (diff) | |
download | monitoring-plugins-e8bd88d1fcded01ccd066572eeaae1b507989cb3.tar.gz |
Sync with the latest Gnulib code 668c0b8ffa
Diffstat (limited to 'gl/m4/setlocale_null.m4')
-rw-r--r-- | gl/m4/setlocale_null.m4 | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4 new file mode 100644 index 00000000..032119d0 --- /dev/null +++ b/gl/m4/setlocale_null.m4 | |||
@@ -0,0 +1,98 @@ | |||
1 | # setlocale_null.m4 serial 5 | ||
2 | dnl Copyright (C) 2019-2023 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | AC_DEFUN([gl_FUNC_SETLOCALE_NULL], | ||
8 | [ | ||
9 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
10 | AC_REQUIRE([gl_PTHREADLIB]) | ||
11 | AC_CHECK_HEADERS_ONCE([threads.h]) | ||
12 | |||
13 | AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], | ||
14 | [gl_cv_func_setlocale_null_all_mtsafe], | ||
15 | [case "$host_os" in | ||
16 | # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. | ||
17 | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) | ||
18 | gl_cv_func_setlocale_null_all_mtsafe=no ;; | ||
19 | # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. | ||
20 | *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) | ||
21 | gl_cv_func_setlocale_null_all_mtsafe=yes ;; | ||
22 | # If we don't know, obey --enable-cross-guesses. | ||
23 | *) | ||
24 | gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; | ||
25 | esac | ||
26 | ]) | ||
27 | dnl On platforms without multithreading, there is no issue. | ||
28 | case "$host_os" in | ||
29 | mingw*) ;; | ||
30 | *) | ||
31 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then | ||
32 | gl_cv_func_setlocale_null_all_mtsafe="trivially yes" | ||
33 | fi | ||
34 | ;; | ||
35 | esac | ||
36 | case "$gl_cv_func_setlocale_null_all_mtsafe" in | ||
37 | *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; | ||
38 | *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; | ||
39 | esac | ||
40 | AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ALL_MTSAFE], [$SETLOCALE_NULL_ALL_MTSAFE], | ||
41 | [Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe.]) | ||
42 | |||
43 | dnl This is about a single category (not LC_ALL). | ||
44 | AC_CACHE_CHECK([whether setlocale (category, NULL) is multithread-safe], | ||
45 | [gl_cv_func_setlocale_null_one_mtsafe], | ||
46 | [case "$host_os" in | ||
47 | # Guess no on OpenBSD, AIX. | ||
48 | openbsd* | aix*) | ||
49 | 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. | ||
51 | *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) | ||
52 | gl_cv_func_setlocale_null_one_mtsafe=yes ;; | ||
53 | # If we don't know, obey --enable-cross-guesses. | ||
54 | *) | ||
55 | gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; | ||
56 | esac | ||
57 | ]) | ||
58 | dnl On platforms without multithreading, there is no issue. | ||
59 | case "$host_os" in | ||
60 | mingw*) ;; | ||
61 | *) | ||
62 | if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then | ||
63 | gl_cv_func_setlocale_null_one_mtsafe="trivially yes" | ||
64 | fi | ||
65 | ;; | ||
66 | esac | ||
67 | case "$gl_cv_func_setlocale_null_one_mtsafe" in | ||
68 | *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; | ||
69 | *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; | ||
70 | esac | ||
71 | AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ONE_MTSAFE], [$SETLOCALE_NULL_ONE_MTSAFE], | ||
72 | [Define to 1 if setlocale (category, NULL) is multithread-safe.]) | ||
73 | |||
74 | 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 | ||
76 | case "$host_os" in | ||
77 | mingw*) LIB_SETLOCALE_NULL= ;; | ||
78 | *) | ||
79 | gl_WEAK_SYMBOLS | ||
80 | case "$gl_cv_have_weak" in | ||
81 | *yes) LIB_SETLOCALE_NULL= ;; | ||
82 | *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; | ||
83 | esac | ||
84 | ;; | ||
85 | esac | ||
86 | else | ||
87 | LIB_SETLOCALE_NULL= | ||
88 | fi | ||
89 | dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX | ||
90 | dnl with gcc or xlc, and empty otherwise. | ||
91 | AC_SUBST([LIB_SETLOCALE_NULL]) | ||
92 | ]) | ||
93 | |||
94 | # Prerequisites of lib/setlocale-lock.c. | ||
95 | AC_DEFUN([gl_PREREQ_SETLOCALE_LOCK], | ||
96 | [ | ||
97 | gl_VISIBILITY | ||
98 | ]) | ||