This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Provide AC_PROG_LEX that copes with LEX=missing from top-level


As per the comment, provide our own definition of AC_PROG_LEX,
modified from the autoconf provided one to avoid an error when flex is
"missing".

config/
	PR binutils/19481
	* override.m4 (AC_PROG_LEX): Define.
binutils/
	* configure: Regenerate.
gas/
	* configure: Regenerate.
ld/
	* configure: Regenerate.

diff --git a/config/override.m4 b/config/override.m4
index 52bd1c3..cb72cdb 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -101,4 +101,16 @@ m4_define([_AC_CHECK_DECLS],
 
 ])
 
+dnl If flex/lex are not found, the top level configure sets LEX to
+dnl "/path_to/missing flex".  When AC_PROG_LEX tries to find the flex
+dnl output file, it calls $LEX to do so, but the current lightweight
+dnl "missing" won't create a file.  This results in an error.
+dnl Avoid calling the bulk of AC_PROG_LEX when $LEX is "missing".
+AC_DEFUN_ONCE([AC_PROG_LEX],
+[AC_CHECK_PROGS(LEX, flex lex, :)
+case "$LEX" in
+  :|*"missing "*) ;;
+  *) _AC_PROG_LEX_YYTEXT_DECL ;;
+esac])
+
 ])
diff --git a/binutils/configure b/binutils/configure
index e1452e3..dc735dc 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -12112,8 +12112,9 @@ fi
 done
 test -n "$LEX" || LEX=":"
 
-if test "x$LEX" != "x:"; then
-  cat >conftest.l <<_ACEOF
+case "$LEX" in
+  :|*"missing "*) ;;
+  *) cat >conftest.l <<_ACEOF
 %%
 a { ECHO; }
 b { REJECT; }
@@ -12224,8 +12225,8 @@ $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h
 
 fi
 rm -f conftest.l $LEX_OUTPUT_ROOT.c
-
-fi
+ ;;
+esac
 if test "$LEX" = :; then
   LEX=${am_missing_run}flex
 fi
diff --git a/gas/configure b/gas/configure
index ceb99f5..c69edf5 100755
--- a/gas/configure
+++ b/gas/configure
@@ -12862,8 +12862,9 @@ fi
 done
 test -n "$LEX" || LEX=":"
 
-if test "x$LEX" != "x:"; then
-  cat >conftest.l <<_ACEOF
+case "$LEX" in
+  :|*"missing "*) ;;
+  *) cat >conftest.l <<_ACEOF
 %%
 a { ECHO; }
 b { REJECT; }
@@ -12974,8 +12975,8 @@ $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h
 
 fi
 rm -f conftest.l $LEX_OUTPUT_ROOT.c
-
-fi
+ ;;
+esac
 if test "$LEX" = :; then
   LEX=${am_missing_run}flex
 fi
diff --git a/ld/configure b/ld/configure
index 65b280c..2141ee7 100755
--- a/ld/configure
+++ b/ld/configure
@@ -16130,8 +16130,9 @@ fi
 done
 test -n "$LEX" || LEX=":"
 
-if test "x$LEX" != "x:"; then
-  cat >conftest.l <<_ACEOF
+case "$LEX" in
+  :|*"missing "*) ;;
+  *) cat >conftest.l <<_ACEOF
 %%
 a { ECHO; }
 b { REJECT; }
@@ -16242,8 +16243,8 @@ $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h
 
 fi
 rm -f conftest.l $LEX_OUTPUT_ROOT.c
-
-fi
+ ;;
+esac
 if test "$LEX" = :; then
   LEX=${am_missing_run}flex
 fi

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]