From 0c3d696d84c1d76482d83e76e4c2b4218b028f1f Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 19 Jan 2024 00:14:02 -0500 Subject: [PATCH] Don't run configure tests for threading if disabled. If the user passes --disable-threads, we shouldn't run all the configure tests to probe threading system characteristics. Like with the conditional NLS bits, we create a local "dx-threadlib" module which uses conditional dependencies to pull in the actual threading modules. We additionally have to monkey patch gl_MBRTOWC which hoists the threading library probes out of the conditional, not so great (we have disabled the multithread support in gnulib's mbrtowc replacement anyway) -- this can be done in the new module too. --- lib/local/modules/dx-threadlib | 27 +++++++++++++++++++++++++++ m4/gnulib-cache.m4 | 8 +++----- 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 lib/local/modules/dx-threadlib diff --git a/lib/local/modules/dx-threadlib b/lib/local/modules/dx-threadlib new file mode 100644 index 0000000..6578fdc --- /dev/null +++ b/lib/local/modules/dx-threadlib @@ -0,0 +1,27 @@ +Description: +Conditionally pull in gnulib modules for threading support, and work around +issues related to conditional execution of threading tests. + +Files: + +Depends-on: +gnulib-local +threadlib +lock [test x"$glthreads_api" != x"none"] +tls [test x"$glthreads_api" != x"none"] + +configure.ac-early: +dnl AC_REQUIRE has the effect of making the macro expansion unconditional; +dnl we don't want this: gl_PTHREADLIB will be expanded if it is needed. +DX_PATCH_MACRO([gl_FUNC_MBRTOWC], [AC_REQUIRE(\[gl_PTHREADLIB\])], [dnl])dnl + +configure.ac: +m4_set_add([DX_GNULIB_LOCAL_DIST], [modules/dx-threadlib])dnl + +Makefile.am: + +License: +WTFPL2 + +Maintainer: +Nick Bowler diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index 13e0fa2..dbd91f0 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -42,25 +42,23 @@ # --avoid=gperf \ # --avoid=std-gnu11 \ # dx-nls \ +# dx-threadlib \ # getopt-gnu \ # gitlog-to-changelog \ # inttypes-incomplete \ -# lock \ # readline \ -# stdbool \ -# tls +# stdbool # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([lib/local]) gl_MODULES([ dx-nls + dx-threadlib getopt-gnu gitlog-to-changelog inttypes-incomplete - lock readline stdbool - tls ]) gl_AVOID([gperf std-gnu11]) gl_SOURCE_BASE([lib]) -- 2.43.2