Paul Eggert wrote:
> +    AS_CASE([$gl_threads_api@$gl_use_threads@$gl_have_isoc_threads],

Three-dimensional pattern matching is more powerful than a sequence
of one-dimensional 'test' statements. But it's harder to understand.
Therefore, if we don't need it, I prefer the logically simpler one-
dimensional tests.

$ grep -rn 'AS_CASE[^]]*[$][^]]*[$]' *.m4
acl.m4:199:  
AS_CASE([$enable_acl,$with_libsmack,$ac_cv_header_linux_xattr_h,$ac_cv_func_listxattr],
acl.m4:216:  
AS_CASE([$enable_acl,$with_selinux,$ac_cv_header_linux_xattr_h,$ac_cv_func_listxattr],
acl.m4:224:  
AS_CASE([$enable_acl,$gl_file_has_acl_uses_selinux,$gl_file_has_acl_uses_smack],
realloc.m4:80:    
[AS_CASE([$gl_cv_func_realloc_sanitize,$gl_cv_malloc_ptrdiff,$gl_cv_func_malloc_posix,$host],
threadlib.m4:567:    
AS_CASE([$gl_threads_api@$gl_use_threads@$gl_have_isoc_threads],

I'm fixing the case of threadlib.m4 only, at this point.


2025-04-28  Bruno Haible  <br...@clisp.org>

        threadlib: Avoid multi-dimensional pattern matching.
        * m4/threadlib.m4: Change multi-dimensional AS_CASE back to several
        one-dimensional tests.

diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index 37def278f6..85da2e6175 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -529,7 +529,7 @@ AC_DEFUN([gl_THREADLIB_BODY]
         AS_IF([test $gl_pthread_api = yes], [
           AS_IF([test "$gl_use_threads" = isoc+posix &&
                  test "$gl_have_isoc_threads" = yes], [
-            gl_threads_api=isoc+posix
+            gl_threads_api="isoc+posix"
             AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1],
               [Define if the combination of the ISO C and POSIX multithreading 
APIs can be used.])
             LIBTHREAD= LTLIBTHREAD=
@@ -564,16 +564,16 @@ AC_DEFUN([gl_THREADLIB_BODY]
           ])
         ])
        ])
-    AS_CASE([$gl_threads_api@$gl_use_threads@$gl_have_isoc_threads],
-      [none@isoc@yes],
-       [
+    AS_IF([test $gl_threads_api = none], [
+      AS_IF([test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = 
yes], [
         gl_STDTHREADLIB_BODY
         LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD
         LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD
         gl_threads_api=isoc
         AC_DEFINE([USE_ISOC_THREADS], [1],
           [Define if the ISO C multithreading library can be used.])
-       ])
+      ])
+    ])
     AS_IF([test $gl_threads_api = none], [
       # The "win32" is for backward compatibility.
       AS_CASE([$gl_use_threads],




Reply via email to