[PATCH] Be more lenient in what is accepted in _AC_PROG_LEX_YYTEXT_DECL

Ross Burton <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <[email protected]>
From: Ross Burton <[email protected]>

Most users of flex provide their own implementation of yywrap instead of
linking to libfl.so, which simply provides stub main() and yywrap()
implementations.

However the recent change 'Fix logic error in _AC_PROG_LEX_YYTEXT_DECL
(#109320)' means that the flex tool being present but not libfl.so
(which is easy in cross-compilation environments) resullts in
AC_PROG_LEX failing, because the test lexer doesn't provide yywrap().

Add a minimal yywrap() to the test lexer so that the test case is
standalone and correctly uses lexes which don't *need* a separate
library to work (such as flex).
---
 lib/autoconf/programs.m4 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index 9deb62e8..c11ea62d 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -739,6 +739,11 @@ main (void)
 {
   return ! yylex () + ! yywrap ();
 }
+int
+yywrap (void)
+{
+  return 1;
+}
 ]_ACEOF
 _AC_DO_VAR(LEX conftest.l)
 AC_CACHE_CHECK([for lex output file root], [ac_cv_prog_lex_root], [
-- 
2.26.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.