summaryrefslogtreecommitdiff
path: root/packages/gettext/0.20.1/0001-pthread_sigmask.c-mingw.patch
blob: c3879d5c84a13d953a65db513896042014c001e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
commit 64e905db05c32792c3f0e77ce271f65e77980a92
Author: Bruno Haible <bruno@clisp.org>
Date:   Sat May 18 14:36:33 2019 +0200

    pthread_sigmask: Fix compilation error with --enable-threads=windows.
    
    Reported by Tim Rühsen in
    <https://lists.gnu.org/archive/html/bug-gnulib/2018-01/msg00018.html>
    and Michele Locati in
    <https://lists.gnu.org/archive/html/bug-gettext/2019-04/msg00057.html>.
    
    * m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Revert change from
    2015-06-01. Test whether pthread_sigmask is a macro, regardless of
    $LIBMULTITHREAD. Consider it regardless whether module 'threadlib' is
    in use and regardless which threads API is chosen.

[Dropped ChangeLog; adjusted the paths to apply to gettext; regenerate.]

---
 gettext-tools/configure                    |  105 ++++++++++-----------
 gettext-tools/gnulib-m4/pthread_sigmask.m4 |  140 ++++++++++++++---------------
 2 files changed, 118 insertions(+), 127 deletions(-)

--- a/gettext-tools/gnulib-m4/pthread_sigmask.m4
+++ b/gettext-tools/gnulib-m4/pthread_sigmask.m4
@@ -1,4 +1,4 @@
-# pthread_sigmask.m4 serial 16
+# pthread_sigmask.m4 serial 17
 dnl Copyright (C) 2011-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,
@@ -9,103 +9,101 @@
   AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
 
   AC_CHECK_FUNCS_ONCE([pthread_sigmask])
+
+  dnl On MinGW pthread_sigmask is just a macro which always returns 0.
+  dnl It does not exist as a real function, which is required by POSIX.
+  AC_CACHE_CHECK([whether pthread_sigmask is a macro],
+    [gl_cv_func_pthread_sigmask_macro],
+    [AC_EGREP_CPP([headers_define_pthread_sigmask], [
+#include <pthread.h>
+#include <signal.h>
+#ifdef pthread_sigmask
+ headers_define_pthread_sigmask
+#endif],
+       [gl_cv_func_pthread_sigmask_macro=yes],
+       [gl_cv_func_pthread_sigmask_macro=no])
+    ])
+
   LIB_PTHREAD_SIGMASK=
 
-  dnl Test whether the gnulib module 'threadlib' is in use.
-  dnl Some packages like Emacs use --avoid=threadlib.
-  dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
-  dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
-  m4_ifdef([gl_][THREADLIB], [
-    AC_REQUIRE([gl_][THREADLIB])
+  if test $gl_cv_func_pthread_sigmask_macro = yes; then
+    dnl pthread_sigmask is a dummy macro.
+    HAVE_PTHREAD_SIGMASK=0
+    dnl Make sure to '#undef pthread_sigmask' before defining it.
+    REPLACE_PTHREAD_SIGMASK=1
+  else
+    dnl Test whether the gnulib module 'threadlib' is in use.
+    dnl Some packages like Emacs use --avoid=threadlib.
+    dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
+    dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
+    m4_ifdef([gl_][THREADLIB], [
+      AC_REQUIRE([gl_][THREADLIB])
 
-    if test "$gl_threads_api" = posix; then
-      if test $ac_cv_func_pthread_sigmask = yes; then
-        dnl pthread_sigmask is available without -lpthread.
-        :
-      else
-        if test -n "$LIBMULTITHREAD"; then
-          AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD],
-            [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD],
-            [gl_save_LIBS="$LIBS"
-             LIBS="$LIBS $LIBMULTITHREAD"
-             AC_LINK_IFELSE(
-               [AC_LANG_PROGRAM(
-                  [[#include <pthread.h>
-                    #include <signal.h>
-                  ]],
-                  [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]])
-               ],
-               [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes],
-               [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no])
-             LIBS="$gl_save_LIBS"
-            ])
-          if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
-            AC_CACHE_CHECK([whether pthread_sigmask is only a macro],
-              [gl_cv_func_pthread_sigmask_is_macro],
+      if test "$gl_threads_api" = posix; then
+        if test $ac_cv_func_pthread_sigmask = yes; then
+          dnl pthread_sigmask is available without -lpthread.
+          :
+        else
+          if test -n "$LIBMULTITHREAD"; then
+            AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD],
+              [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD],
               [gl_save_LIBS="$LIBS"
                LIBS="$LIBS $LIBMULTITHREAD"
                AC_LINK_IFELSE(
                  [AC_LANG_PROGRAM(
                     [[#include <pthread.h>
                       #include <signal.h>
-                      #undef pthread_sigmask
                     ]],
                     [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]])
                  ],
-                 [gl_cv_func_pthread_sigmask_is_macro=no],
-                 [gl_cv_func_pthread_sigmask_is_macro=yes])
+                 [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes],
+                 [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no])
                LIBS="$gl_save_LIBS"
               ])
-            if test $gl_cv_func_pthread_sigmask_is_macro = yes; then
-              dnl On MinGW pthread_sigmask is just a macro which always returns 0.
-              dnl It does not exist as a real function, which is required by POSIX.
-              REPLACE_PTHREAD_SIGMASK=1
-              gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
+            if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
+              dnl pthread_sigmask is available with -pthread or -lpthread.
+              LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
+            else
+              dnl pthread_sigmask is not available at all.
+              HAVE_PTHREAD_SIGMASK=0
             fi
-          fi
-          if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
-            dnl pthread_sigmask is available with -pthread or -lpthread.
-            LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
           else
             dnl pthread_sigmask is not available at all.
             HAVE_PTHREAD_SIGMASK=0
           fi
+        fi
+      else
+        dnl pthread_sigmask may exist but does not interoperate with the chosen
+        dnl multithreading facility.
+        dnl If "$gl_threads_api" = pth, we could use the function pth_sigmask,
+        dnl but it is equivalent to sigprocmask, so we choose to emulate
+        dnl pthread_sigmask with sigprocmask also in this case. This yields
+        dnl fewer link dependencies.
+        if test $ac_cv_func_pthread_sigmask = yes; then
+          REPLACE_PTHREAD_SIGMASK=1
         else
-          dnl pthread_sigmask is not available at all.
           HAVE_PTHREAD_SIGMASK=0
         fi
       fi
-    else
-      dnl pthread_sigmask may exist but does not interoperate with the chosen
-      dnl multithreading facility.
-      dnl If "$gl_threads_api" = pth, we could use the function pth_sigmask,
-      dnl but it is equivalent to sigprocmask, so we choose to emulate
-      dnl pthread_sigmask with sigprocmask also in this case. This yields fewer
-      dnl link dependencies.
+    ], [
+      dnl The module 'threadlib' is not in use, due to --avoid=threadlib being
+      dnl specified.
+      dnl The package either has prepared CPPFLAGS and LIBS for use of
+      dnl POSIX:2008 threads, or wants to build single-threaded programs.
       if test $ac_cv_func_pthread_sigmask = yes; then
-        REPLACE_PTHREAD_SIGMASK=1
+        dnl pthread_sigmask exists and does not require extra libraries.
+        dnl Assume that it is declared.
+        :
       else
+        dnl pthread_sigmask either does not exist or needs extra libraries.
         HAVE_PTHREAD_SIGMASK=0
+        dnl Define the symbol rpl_pthread_sigmask, not pthread_sigmask,
+        dnl so as to not accidentally override the system's pthread_sigmask
+        dnl symbol from libpthread. This is necessary on IRIX 6.5.
+        REPLACE_PTHREAD_SIGMASK=1
       fi
-    fi
-  ], [
-    dnl The module 'threadlib' is not in use, due to --avoid=threadlib being
-    dnl specified.
-    dnl The package either has prepared CPPFLAGS and LIBS for use of POSIX:2008
-    dnl threads, or wants to build single-threaded programs.
-    if test $ac_cv_func_pthread_sigmask = yes; then
-      dnl pthread_sigmask exists and does not require extra libraries.
-      dnl Assume that it is declared.
-      :
-    else
-      dnl pthread_sigmask either does not exist or needs extra libraries.
-      HAVE_PTHREAD_SIGMASK=0
-      dnl Define the symbol rpl_pthread_sigmask, not pthread_sigmask,
-      dnl so as to not accidentally override the system's pthread_sigmask
-      dnl symbol from libpthread. This is necessary on IRIX 6.5.
-      REPLACE_PTHREAD_SIGMASK=1
-    fi
-  ])
+    ])
+  fi
 
   AC_SUBST([LIB_PTHREAD_SIGMASK])
   dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when
--- a/gettext-tools/configure
+++ b/gettext-tools/configure
@@ -61291,53 +61291,51 @@
 
 
 
-  LIB_PTHREAD_SIGMASK=
-
-
 
-
-    if test "$gl_threads_api" = posix; then
-      if test $ac_cv_func_pthread_sigmask = yes; then
-                :
-      else
-        if test -n "$LIBMULTITHREAD"; then
-          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_sigmask in $LIBMULTITHREAD" >&5
-$as_echo_n "checking for pthread_sigmask in $LIBMULTITHREAD... " >&6; }
-if ${gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD+:} false; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthread_sigmask is a macro" >&5
+$as_echo_n "checking whether pthread_sigmask is a macro... " >&6; }
+if ${gl_cv_func_pthread_sigmask_macro+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  gl_save_LIBS="$LIBS"
-             LIBS="$LIBS $LIBMULTITHREAD"
-             cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <pthread.h>
-                    #include <signal.h>
-
-int
-main ()
-{
-return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);
-  ;
-  return 0;
-}
 
+#include <pthread.h>
+#include <signal.h>
+#ifdef pthread_sigmask
+ headers_define_pthread_sigmask
+#endif
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "headers_define_pthread_sigmask" >/dev/null 2>&1; then :
+  gl_cv_func_pthread_sigmask_macro=yes
 else
-  gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
+  gl_cv_func_pthread_sigmask_macro=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-             LIBS="$gl_save_LIBS"
+rm -f conftest*
+
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&5
-$as_echo "$gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&6; }
-          if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthread_sigmask is only a macro" >&5
-$as_echo_n "checking whether pthread_sigmask is only a macro... " >&6; }
-if ${gl_cv_func_pthread_sigmask_is_macro+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_macro" >&5
+$as_echo "$gl_cv_func_pthread_sigmask_macro" >&6; }
+
+  LIB_PTHREAD_SIGMASK=
+
+  if test $gl_cv_func_pthread_sigmask_macro = yes; then
+        HAVE_PTHREAD_SIGMASK=0
+        REPLACE_PTHREAD_SIGMASK=1
+  else
+
+
+
+      if test "$gl_threads_api" = posix; then
+        if test $ac_cv_func_pthread_sigmask = yes; then
+                    :
+        else
+          if test -n "$LIBMULTITHREAD"; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_sigmask in $LIBMULTITHREAD" >&5
+$as_echo_n "checking for pthread_sigmask in $LIBMULTITHREAD... " >&6; }
+if ${gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   gl_save_LIBS="$LIBS"
@@ -61346,7 +61344,6 @@
 /* end confdefs.h.  */
 #include <pthread.h>
                       #include <signal.h>
-                      #undef pthread_sigmask
 
 int
 main ()
@@ -61358,39 +61355,35 @@
 
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_func_pthread_sigmask_is_macro=no
+  gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes
 else
-  gl_cv_func_pthread_sigmask_is_macro=yes
+  gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
                LIBS="$gl_save_LIBS"
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_is_macro" >&5
-$as_echo "$gl_cv_func_pthread_sigmask_is_macro" >&6; }
-            if test $gl_cv_func_pthread_sigmask_is_macro = yes; then
-                                          REPLACE_PTHREAD_SIGMASK=1
-              gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&5
+$as_echo "$gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&6; }
+            if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
+                            LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
+            else
+                            HAVE_PTHREAD_SIGMASK=0
             fi
-          fi
-          if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
-                        LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
           else
                         HAVE_PTHREAD_SIGMASK=0
           fi
-        else
-                    HAVE_PTHREAD_SIGMASK=0
         fi
-      fi
-    else
-                                          if test $ac_cv_func_pthread_sigmask = yes; then
-        REPLACE_PTHREAD_SIGMASK=1
       else
-        HAVE_PTHREAD_SIGMASK=0
+                                                        if test $ac_cv_func_pthread_sigmask = yes; then
+          REPLACE_PTHREAD_SIGMASK=1
+        else
+          HAVE_PTHREAD_SIGMASK=0
+        fi
       fi
-    fi
 
+  fi