[PATCH] Revert 'Fix logic error in _AC_PROG_LEX_YYTEXT_DECL (#109320)'

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

Commit 8173e5, 'Fix logic error in _AC_PROG_LEX_YYTEXT_DECL (#109320)',
causes AC_PROG_LEX to always fail when searching for a lex library.
---
 lib/autoconf/programs.m4 | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index 9deb62e8..006c0b66 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -741,7 +741,7 @@ main (void)
 }
 ]_ACEOF
 _AC_DO_VAR(LEX conftest.l)
-AC_CACHE_CHECK([for lex output file root], [ac_cv_prog_lex_root], [
+AC_CACHE_CHECK([lex output file root], [ac_cv_prog_lex_root], [
 if test -f lex.yy.c; then
   ac_cv_prog_lex_root=lex.yy
 elif test -f lexyy.c; then
@@ -751,25 +751,20 @@ else
 fi])
 AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
 
-AS_VAR_SET_IF([LEXLIB], [], [
-  AC_CACHE_CHECK([for lex library], [ac_cv_lib_lex], [
-    ac_cv_lib_lex='not found'
+if ${LEXLIB+false} :; then
+  AC_CACHE_CHECK([lex library], [ac_cv_lib_lex], [
     ac_save_LIBS=$LIBS
+    ac_cv_lib_lex='none needed'
     for ac_lib in '' -lfl -ll; do
       LIBS="$ac_lib $ac_save_LIBS"
       AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED[`cat $LEX_OUTPUT_ROOT.c`]],
-	[ac_cv_lib_lex="${ac_lib:-none needed}"
-         break])
+	[ac_cv_lib_lex=$ac_lib])
+      test "$ac_cv_lib_lex" != 'none needed' && break
     done
     LIBS=$ac_save_LIBS
   ])
-  AS_IF(
-     [test "$ac_cv_lib_lex" = 'not found'],
-	[AC_MSG_ERROR([required lex library not found])],
-     [test "$ac_cv_lib_lex" = 'none needed'],
-        [LEXLIB=''],
-	[LEXLIB=$ac_cv_lib_lex])
-])
+  test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
+fi
 AC_SUBST(LEXLIB)
 
 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
-- 
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.