>From 8986dbe3a8edb9296bdd83323b1138a756da2f7a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 29 May 2019 16:33:51 -0700 Subject: [PATCH] Update from Gnulib This incorporates: 2019-05-24 flexmember: update comments 2019-05-18 pthread_sigmask: fix --enable-threads=windows compilation 2019-05-14 close-stream, closein, closeout: simplify 2019-05-09 verify: remove verify_true 2019-05-09 verify: support C2X and C++17 static_assert * build-aux/config.guess, build-aux/config.sub: * doc/misc/texinfo.tex, lib/flexmember.h, lib/verify.h: * m4/flexmember.m4, m4/pthread_sigmask.m4: Copy from Gnulib * m4/gnulib-comp.m4: Regenerate. 2019-05-26 Paul Eggert Update author/maintainer info This mostly updates email addresses and fixes spellings of author and maintainer names. --- build-aux/config.guess | 61 +++++++++--------- build-aux/config.sub | 4 +- doc/misc/texinfo.tex | 17 ++++- lib/flexmember.h | 25 ++++++-- lib/verify.h | 110 ++++++++++++++++---------------- m4/flexmember.m4 | 8 +-- m4/gnulib-comp.m4 | 2 - m4/pthread_sigmask.m4 | 140 ++++++++++++++++++++--------------------- 8 files changed, 195 insertions(+), 172 deletions(-) diff --git a/build-aux/config.guess b/build-aux/config.guess index 4cd9454b35..ae713942d8 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2019 Free Software Foundation, Inc. -timestamp='2019-04-28' +timestamp='2019-05-28' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1325,38 +1325,39 @@ main () echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build fi - if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; diff --git a/build-aux/config.sub b/build-aux/config.sub index f53af5a2da..5b158ac41c 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2019 Free Software Foundation, Inc. -timestamp='2019-01-05' +timestamp='2019-05-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1172,7 +1172,7 @@ IFS= | asmjs \ | ba \ | be32 | be64 \ - | bfin | bs2000 \ + | bfin | bpf | bs2000 \ | c[123]* | c30 | [cjt]90 | c4x \ | c8051 | clipper | craynv | csky | cydra \ | d10v | d30v | dlx | dsp16xx \ diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index ccd112941a..53f2fc4835 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2019-04-12.13} +\def\texinfoversion{2019-05-18.15} % % Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc. % @@ -4952,6 +4952,8 @@ \definedummyword\sup \definedummyword\textdegree % + \definedummyword\subentry + % % We want to disable all macros so that they are not expanded by \write. \macrolist \let\value\dummyvalue @@ -5224,10 +5226,10 @@ } \def\indexwriteseealso#1{ - address@hidden + \gdef\pagenumbertext{\string\seealso{#1}}% } \def\indexwriteseeentry#1{ - address@hidden + \gdef\pagenumbertext{\string\seeentry{#1}}% } % The default definitions @@ -5315,6 +5317,15 @@ % the current value of \escapechar. \def\escapeisbackslash{\escapechar=`\\} +% Use \ in index files by default. texi2dvi didn't support @ as as the escape +% character (as it checked for "\entry" in the files, and not "@entry"). When +% the new version of texi2dvi has had a chance to become more prevalent, then +% the escape character can change back to @ again. This should be an easy +% change to make now because both @ and \ are only used as escape characters in +% index files, never standing for themselves. +% +\set txiindexescapeisbackslash + % Write the entry in \indextext to the index file. % \def\doindwrite{% diff --git a/lib/flexmember.h b/lib/flexmember.h index 0d65f6da60..af17b41d29 100644 --- a/lib/flexmember.h +++ b/lib/flexmember.h @@ -33,11 +33,26 @@ # define FLEXALIGNOF(type) _Alignof (type) #endif -/* Upper bound on the size of a struct of type TYPE with a flexible - array member named MEMBER that is followed by N bytes of other data. - This is not simply sizeof (TYPE) + N, since it may require - alignment on unusually picky C11 platforms, and - FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms. +/* Yield a properly aligned upper bound on the size of a struct of + type TYPE with a flexible array member named MEMBER that is + followed by N bytes of other data. The result is suitable as an + argument to malloc. For example: + + struct s { int n; char d[FLEXIBLE_ARRAY_MEMBER]; }; + struct s *p = malloc (FLEXSIZEOF (struct s, d, n * sizeof (char))); + + FLEXSIZEOF (TYPE, MEMBER, N) is not simply (sizeof (TYPE) + N), + since FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms. Nor is + it simply (offsetof (TYPE, MEMBER) + N), as that might yield a size + that causes malloc to yield a pointer that is not properly aligned + for TYPE; for example, if sizeof (int) == alignof (int) == 4, + malloc (offsetof (struct s, d) + 3 * sizeof (char)) is equivalent + to malloc (7) and might yield a pointer that is not a multiple of 4 + (which means the pointer is not properly aligned for struct s), + whereas malloc (FLEXSIZEOF (struct s, d, 3 * sizeof (char))) is + equivalent to malloc (8) and must yield a pointer that is a + multiple of 4. + Yield a value less than N if and only if arithmetic overflow occurs. */ #define FLEXSIZEOF(type, member, n) \ diff --git a/lib/verify.h b/lib/verify.h index 6930645a35..f8e4eff026 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -21,29 +21,37 @@ #define _GL_VERIFY_H -/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11. - This is supported by GCC 4.6.0 and later, in C mode, and its use - here generates easier-to-read diagnostics when verify (R) fails. - - Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11. - This is supported by GCC 6.1.0 and later, in C++ mode. - - Use this only with GCC. If we were willing to slow 'configure' - down we could also use it with other compilers, but since this - affects only the quality of diagnostics, why bother? */ -#if (4 < __GNUC__ + (6 <= __GNUC_MINOR__) \ - && (201112L <= __STDC_VERSION__ || !defined __STRICT_ANSI__) \ - && !defined __cplusplus) -# define _GL_HAVE__STATIC_ASSERT 1 -#endif -#if (6 <= __GNUC__) && defined __cplusplus -# define _GL_HAVE_STATIC_ASSERT 1 +/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC) + works as per C11. This is supported by GCC 4.6.0 and later, in C + mode. + + Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as + per C2X, and define _GL_HAVE_STATIC_ASSERT1 if static_assert (R) + works as per C++17. This is supported by GCC 9.1 and later. + + Support compilers claiming conformance to the relevant standard, + and also support GCC when not pedantic. If we were willing to slow + 'configure' down we could also use it with other compilers, but + since this affects only the quality of diagnostics, why bother? */ +#ifndef __cplusplus +# if (201112L <= __STDC_VERSION__ \ + || (!defined __STRICT_ANSI__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__))) +# define _GL_HAVE__STATIC_ASSERT 1 +# endif +# if (202000L <= __STDC_VERSION__ \ + || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) +# define _GL_HAVE__STATIC_ASSERT1 1 +# endif +#else +# if 201703L <= __cplusplus || 9 <= __GNUC__ +# define _GL_HAVE_STATIC_ASSERT1 1 +# endif #endif /* FreeBSD 9.1 , included by and lots of other system headers, defines a conflicting _Static_assert that is no better than ours; override it. */ -#ifndef _GL_HAVE_STATIC_ASSERT +#ifndef _GL_HAVE__STATIC_ASSERT # include # undef _Static_assert #endif @@ -141,9 +149,9 @@ #define _GL_VERIFY_H which do not support _Static_assert, also do not warn about the last declaration mentioned above. - * GCC warns if -Wnested-externs is enabled and verify() is used + * GCC warns if -Wnested-externs is enabled and 'verify' is used within a function body; but inside a function, you can always - arrange to use verify_expr() instead. + arrange to use verify_expr instead. * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ @@ -167,11 +175,9 @@ #define _GL_CONCAT0(x, y) x##y #define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) /* Verify requirement R at compile-time, as an integer constant expression - that returns 1. If R is false, fail at compile-time, preferably - with a diagnostic that includes the string-literal DIAGNOSTIC. */ + that returns 1. If R is false, fail at compile-time. */ -#define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ - (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) +#define _GL_VERIFY_TRUE(R) (!!sizeof (_GL_VERIFY_TYPE (R))) #ifdef __cplusplus # if !GNULIB_defined_struct__gl_verify_type @@ -181,40 +187,43 @@ #define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ }; # define GNULIB_defined_struct__gl_verify_type 1 # endif -# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ - _gl_verify_type<(R) ? 1 : -1> -#elif defined _GL_HAVE__STATIC_ASSERT -# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ +# define _GL_VERIFY_TYPE(R) _gl_verify_type<(R) ? 1 : -1> +#elif defined _GL_HAVE__STATIC_ASSERT1 +# define _GL_VERIFY_TYPE(R) \ struct { \ - _Static_assert (R, DIAGNOSTIC); \ + _Static_assert (R); \ int _gl_dummy; \ } #else -# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ +# define _GL_VERIFY_TYPE(R) \ struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } #endif /* Verify requirement R at compile-time, as a declaration without a - trailing ';'. If R is false, fail at compile-time, preferably - with a diagnostic that includes the string-literal DIAGNOSTIC. + trailing ';'. If R is false, fail at compile-time. + + This macro requires three or more arguments but uses at most the first + two, so that the _Static_assert macro optionally defined below supports + both the C11 two-argument syntax and the C2X one-argument syntax. Unfortunately, unlike C11, this implementation must appear as an ordinary declaration, and cannot appear inside struct { ... }. */ -#ifdef _GL_HAVE__STATIC_ASSERT -# define _GL_VERIFY _Static_assert +#if defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) #else -# define _GL_VERIFY(R, DIAGNOSTIC) \ +# define _GL_VERIFY(R, DIAGNOSTIC, ...) \ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ - [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] + [_GL_VERIFY_TRUE (R)] #endif /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ #ifdef _GL_STATIC_ASSERT_H -# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert -# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) +# if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert +# define _Static_assert(...) \ + _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) # endif -# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert +# if !defined _GL_HAVE_STATIC_ASSERT1 && !defined static_assert # define static_assert _Static_assert /* C11 requires this #define. */ # endif #endif @@ -226,31 +235,24 @@ #define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ assert (R), there is no run-time overhead. There are two macros, since no single macro can be used in all - contexts in C. verify_true (R) is for scalar contexts, including + contexts in C. verify_expr (R, E) is for scalar contexts, including integer constant expression contexts. verify (R) is for declaration contexts, e.g., the top level. */ -/* Verify requirement R at compile-time, as an integer constant expression. - Return 1. This is equivalent to verify_expr (R, 1). - - verify_true is obsolescent; please use verify_expr instead. */ - -#define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")") - /* Verify requirement R at compile-time. Return the value of the expression E. */ -#define verify_expr(R, E) \ - (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) +#define verify_expr(R, E) (_GL_VERIFY_TRUE (R) ? (E) : (E)) /* Verify requirement R at compile-time, as a declaration without a - trailing ';'. */ + trailing ';'. verify (R) acts like static_assert (R) except that + it is portable to C11/C++14 and earlier, and its name is shorter + and may be more convenient. */ -#ifdef __GNUC__ -# define verify(R) _GL_VERIFY (R, "verify (" #R ")") +#ifdef _GL_HAVE__STATIC_ASSERT1 +# define verify(R) _Static_assert (R) #else -/* PGI barfs if R is long. Play it safe. */ -# define verify(R) _GL_VERIFY (R, "verify (...)") +# define verify(R) _GL_VERIFY (R, "verify (...)", -) #endif #ifndef __has_builtin diff --git a/m4/flexmember.m4 b/m4/flexmember.m4 index 1347068fe3..c245ab025f 100644 --- a/m4/flexmember.m4 +++ b/m4/flexmember.m4 @@ -34,12 +34,10 @@ AC_DEFUN AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], [Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like 'struct s - { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack + { int n; short d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack can be used with pre-C99 compilers. - When computing the size of such an object, don't use 'sizeof (struct s)' - as it overestimates the size. Use 'offsetof (struct s, d)' instead. - Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with - MSVC and with C++ compilers.]) + Use 'FLEXSIZEOF (struct s, d, N * sizeof (short))' to calculate + the size in bytes of such a struct containing an N-element array.]) else AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1]) fi diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index f648b7a495..0a7a30e5ae 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -200,7 +200,6 @@ AC_DEFUN gl_BYTESWAP AC_CHECK_FUNCS_ONCE([readlinkat]) gl_CLOCK_TIME - gl_CLOSE_STREAM gl_MODULE_INDICATOR([close-stream]) gl_COUNT_LEADING_ZEROS gl_COUNT_ONE_BITS @@ -996,7 +995,6 @@ AC_DEFUN m4/builtin-expect.m4 m4/byteswap.m4 m4/clock_time.m4 - m4/close-stream.m4 m4/count-leading-zeros.m4 m4/count-one-bits.m4 m4/count-trailing-zeros.m4 diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4 index cadc239a3c..648edf911f 100644 --- a/m4/pthread_sigmask.m4 +++ b/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_DEFUN 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 +#include +#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 - #include - ]], - [[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 #include - #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 -- 2.21.0