Subject: [PATCH v2] m4: Update invocation of AC_PROG_LEX
From: Łukasz Stelmach <[email-masked]>
To: [email-masked]
Cc: [email-masked], Łukasz Stelmach <[email-masked]>
Date: Mon, 4 Sep 2023 13:40:09 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Commit 73f1be5e42e3 to autoconf has introduced an argument
to AC_PROG_LEX. Invocation without the argument has been treated
as obsolete since then.

* m4/lex.m4: pass the required argument to AC_PROG_LEX

* doc/automake.texi: Describe it.

* NEWS: Mention it
---
 NEWS              | 2 ++
 doc/automake.texi | 5 +++--
 m4/lex.m4         | 6 +++---
 3 files changed, 8 insertions(+), 5 deletions(-)

I sent v1[1] by mistake to [email-masked] where Zack Weinberg
sent[2] some suggestions.

[1] https://lists.gnu.org/archive/html/autoconf-patches/2023-08/msg00002.html
[2] https://lists.gnu.org/archive/html/autoconf-patches/2023-08/msg00003.html

diff --git a/NEWS b/NEWS
index ced0fd640..78162b746 100644
--- a/NEWS
+++ b/NEWS
@@ -57,6 +57,8 @@ New in 1.17:
 
   - tests: avoid some declaration conflicts for lex et al. on SunOS.
 
+  - Pass options AC_PROG_LEX requires
+
 * Obsolescent features:
 
   - py-compile no longer supports Python 0.x or 1.x versions.  Python 2.0,
diff --git a/doc/automake.texi b/doc/automake.texi
index d14b769fd..61b7fd095 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -4130,7 +4130,7 @@ Automake 1.14, the @code{AC_PROG_CC} is rewritten to implement such
 checks itself, and thus the explicit use of @code{AM_PROG_CC_C_O}
 should no longer be required.
 
-@item AM_PROG_LEX
+@item AM_PROG_LEX(@var{options})
 @acindex AM_PROG_LEX
 @acindex AC_PROG_LEX
 @cindex HP-UX 10, @command{lex} problems
@@ -4138,7 +4138,8 @@ should no longer be required.
 Like @code{AC_PROG_LEX} (@pxref{Particular Programs, , Particular
 Program Checks, autoconf, The Autoconf Manual}), but uses the
 @command{missing} script on systems that do not have @command{lex}.
-HP-UX 10 is one such system.
+HP-UX 10 is one such system. @var{options} are passed directly to
+@code{AC_PROG_LEX}.
 
 @item AM_PROG_GCJ
 @acindex AM_PROG_GCJ
diff --git a/m4/lex.m4 b/m4/lex.m4
index 7b0511526..e9a8485d6 100644
--- a/m4/lex.m4
+++ b/m4/lex.m4
@@ -6,14 +6,14 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# AM_PROG_LEX
-# -----------
+# AM_PROG_LEX(OPTIONS)
+# --------------------
 # Autoconf leaves LEX=: if lex or flex can't be found.  Change that to a
 # "missing" invocation, for better error output.
 AC_DEFUN([AM_PROG_LEX],
 [AC_PREREQ([2.50])dnl
 AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
-AC_REQUIRE([AC_PROG_LEX])dnl
+AC_PROVIDE_IFELSE([AC_PROG_LEX], [], [AC_PROG_LEX($@)])dnl
 if test "$LEX" = :; then
   LEX=${am_missing_run}flex
 fi])
-- 
2.30.2