]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix AC_PROG_LEX regression
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Jul 2020 16:46:28 +0000 (09:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Jul 2020 16:49:14 +0000 (09:49 -0700)
Problem reported by Ross Burton in:
https://savannah.gnu.org/support/?110269
* lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL):
If tests indicate that LEX or LEXLIB does not work, set LEX to ":"
and LEXLIB empty, instead of failing out of 'configure' entirely.

lib/autoconf/programs.m4

index 43f3b14e6062ce8ef2341f21413c5e44d552a590..4f910fb0da9caebf066ebb6ec1fc8ec93e8f6513 100644 (file)
@@ -740,15 +740,17 @@ main (void)
   return ! yylex () + ! yywrap ();
 }
 ]_ACEOF
-_AC_DO_VAR(LEX conftest.l)
 AC_CACHE_CHECK([for lex output file root], [ac_cv_prog_lex_root], [
+ac_cv_prog_lex_root=unknown
+_AC_DO_VAR(LEX conftest.l) &&
 if test -f lex.yy.c; then
   ac_cv_prog_lex_root=lex.yy
 elif test -f lexyy.c; then
   ac_cv_prog_lex_root=lexyy
-else
-  AC_MSG_ERROR([cannot find output from $LEX; giving up])
 fi])
+AS_IF([test "$ac_cv_prog_lex_root" = unknown],
+  [AC_MSG_WARN([cannot find output from $LEX; giving up on $LEX])
+   LEX=: LEXLIB=])
 AC_SUBST([LEX_OUTPUT_ROOT], [$ac_cv_prog_lex_root])dnl
 
 AS_VAR_SET_IF([LEXLIB], [], [
@@ -765,13 +767,15 @@ AS_VAR_SET_IF([LEXLIB], [], [
   ])
   AS_IF(
      [test "$ac_cv_lib_lex" = 'not found'],
-       [AC_MSG_ERROR([required lex library not found])],
+       [AC_MSG_WARN([required lex library not found; giving up on $LEX])
+        LEX=: LEXLIB=],
      [test "$ac_cv_lib_lex" = 'none needed'],
         [LEXLIB=''],
        [LEXLIB=$ac_cv_lib_lex])
 ])
 AC_SUBST(LEXLIB)
 
+AS_IF([test "$LEX" != :], [
 AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,
 [# POSIX says lex can declare yytext either as a pointer or an array; the
 # default is implementation-dependent.  Figure out which it is, since
@@ -791,6 +795,7 @@ if test $ac_cv_prog_lex_yytext_pointer = yes; then
            [Define to 1 if `lex' declares `yytext' as a `char *' by default,
             not a `char[]'.])
 fi
+])
 rm -f conftest.l $LEX_OUTPUT_ROOT.c
 ])# _AC_PROG_LEX_YYTEXT_DECL