diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-02-10 10:43:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-10 10:43:20 (GMT) |
commit | c07206f2ccc2356aa74bc6813a94c2190017d44e (patch) | |
tree | 1677e5fdca5c3ce544e92c5484e16a0b68df1cc9 /gl/m4/setlocale_null.m4 | |
parent | e92046f810658016b7c373677efefda3b21400e4 (diff) | |
parent | d2fcf49ad4afc15f37d082d7bc96a808369ec2d4 (diff) | |
download | monitoring-plugins-c07206f.tar.gz |
Merge pull request #1832 from RincewindsHat/gnulib_update_2023
Gnulib update 2023 and attendant fixes
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 0000000..032119d --- /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 | ]) | ||