]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
autoreconf: require word boundaries when grepping for macros (#111271)
authorZack Weinberg <zack@owlfolio.org>
Tue, 27 Jan 2026 21:00:08 +0000 (16:00 -0500)
committerZack Weinberg <zack@owlfolio.org>
Tue, 27 Jan 2026 21:25:54 +0000 (16:25 -0500)
autoreconf’s first pass over configure.ac is effectively a grep
operation for a number of macros that almost always appear directly
in that file, if they’re going to appear at all.  All but one of the
regular expressions made no attempt to check for word boundaries, and
the one that did was doing it incorrectly (using ^ rather than \b),
leading to issue #111271.

Fix all the regexps to surround each identifier with \b…\b and not
to use ^.

Reported by Kip, originally as gettext bug #52424.

* bin/autoreconf.in (autoreconf_current_directory): In the first pass,
  require each of the macros we look for to be a complete word.

bin/autoreconf.in

index 1dc38c8401395b27c464852d8a5aafcf8d0143cc..4d08e5301131fda75085eb5f45ec809a87d5e8cb 100644 (file)
@@ -450,17 +450,17 @@ sub autoreconf_current_directory ($)
       while ($_ = $configure_ac_file->getline)
        {
          s/#.*//;
-         s/dnl.*//;
-         $uses_autoconf = 1 if /AC_INIT/;
-         $uses_liblink = 1 if /AC_LIB_HAVE_LINKFLAGS/;
-         $uses_liblink = 1 if /AC_LIB_LINKFLAGS/;
-         $uses_liblink = 1 if /AC_LIB_LINKFLAGS_FROM_LIBS/;
-         $uses_iconv = 1 if /AM_ICONV/;
+         s/\bdnl\b.*//;
+         $uses_autoconf = 1 if /\bAC_INIT\b/;
+         $uses_liblink = 1 if /\bAC_LIB_HAVE_LINKFLAGS\b/;
+         $uses_liblink = 1 if /\bAC_LIB_LINKFLAGS\b/;
+         $uses_liblink = 1 if /\bAC_LIB_LINKFLAGS_FROM_LIBS\b/;
+         $uses_iconv = 1 if /\bAM_ICONV\b/;
          # See below for why we look for gettext here.
-         $uses_gettext = 1 if /AM_GNU_GETTEXT/;
-         $uses_gettext = 1 if /AM_PO_SUBDIRS/;
+         $uses_gettext = 1 if /\bAM_GNU_GETTEXT\b/;
+         $uses_gettext = 1 if /\bAM_PO_SUBDIRS\b/;
          # Older autopoint versions fail if this macro is not present.
-         $uses_gettextversion = 1 if /^AM_GNU_GETTEXT_(?:REQUIRE_)?VERSION/;
+         $uses_gettextversion = 1 if /\bAM_GNU_GETTEXT_(?:REQUIRE_)?VERSION\b/;
        }
       if (!$uses_autoconf)
         {