GNU clisp contains invocations of AC_LIB_FROMPACKAGE and
AC_LIB_LINKFLAGS like this:

  AC_LIB_FROMPACKAGE([avcall], [libffcall])
  AC_LIB_FROMPACKAGE([callback], [libffcall])
  ...
  AC_LIB_LINKFLAGS([avcall])
  AC_LIB_LINKFLAGS([callback])

This is expected to produce a "configure --help" message like this:

  --with-libffcall-prefix[=DIR]  search for libavcall, libcallback in 
DIR/include and DIR/lib
  --without-libffcall-prefix     don't search for libavcall, libcallback in 
includedir and libdir

But the comma in there, between libavcall and libcallback, gets stuffed
into the expansion of the locally defined macro PACKLIBS and, from there,
is apparently being interpreted as an m4 argument separator, somewhere
in the m4 macro invocation chain (look at $3):

AC_DEFUN([AC_ARG_WITH],
[...
_AC_ENABLE_IF([with], [$1], [$3], [$4])dnl
])# AC_ARG_WITH

m4_define([_AC_ENABLE_IF],
[@%:@ Check whether --$1-$2 was given.
_AC_ENABLE_IF_ACTION([$1], m4_translit([$2], [-+.], [___]), [$3], [$4])
])

m4_define([_AC_ENABLE_IF_ACTION],
[...
AS_IF([test ${$1_$2+y}], [$1val=$$1_$2; $3], [$4])dnl
])

Part of what was intended to be the $2 of the AC_ARG_WITH invocation
ends up being the $3 in this macro invocation chain.

Adding one or two levels of additional m4 quotes fixes this.


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

        havelib: Fix m4 underquoting bug in AC_LIB_FROMPACKAGE.
        Reported for GNU clisp by Adam Sampson <a...@offog.org> at
        <https://gitlab.com/gnu-clisp/clisp/-/issues/60>.
        * m4/lib-link.m4 (AC_LIB_FROMPACKAGE): Protect the comma in the
        expansion of [acl_libsinpackage_]PACKUP by one more level of quotes.

diff --git a/m4/lib-link.m4 b/m4/lib-link.m4
index d6de4fe2fe..1863f4e168 100644
--- a/m4/lib-link.m4
+++ b/m4/lib-link.m4
@@ -1,5 +1,5 @@
 # lib-link.m4
-# serial 34
+# serial 35
 dnl Copyright (C) 2001-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -170,7 +170,7 @@ AC_DEFUN([AC_LIB_FROMPACKAGE]
   pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
                                      [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
   define([acl_libsinpackage_]PACKUP,
-    m4_ifdef([acl_libsinpackage_]PACKUP, 
[m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
+    m4_ifdef([acl_libsinpackage_]PACKUP, 
[m4_defn([acl_libsinpackage_]PACKUP)[[, ]]],)[lib$1])
   popdef([PACKUP])
   popdef([PACK])
 ])




Reply via email to