diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-11-22 06:41:59 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-11-22 06:41:59 -0800 |
commit | 3d81b9553891a1ebc5065b10237186df634ef841 (patch) | |
tree | 710da97218ddd67f331b7895c466dbdd3068adb0 /configure | |
parent | 574af30bb232619d36b0bd0956f9815f65db915a (diff) | |
download | txr-3d81b9553891a1ebc5065b10237186df634ef841.tar.gz txr-3d81b9553891a1ebc5065b10237186df634ef841.tar.bz2 txr-3d81b9553891a1ebc5065b10237186df634ef841.zip |
configure: search for working lex.
* configure (lexname, lexname_given, lex_given):
New variables.
(lex): interpolate lexname (in make syntax).
Inform about lexname in help text.
(gen_config_make): Generate lexname make var.
New lex test.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 43 |
1 files changed, 41 insertions, 2 deletions
@@ -97,7 +97,10 @@ cc='$(cross)$(compiler_prefix)$(ccname)' intptr= exe= tool_prefix= -lex='$(cross)$(tool_prefix)$(LEX)' +lexname_given= +lexname= +lex_given= +lex='$(cross)$(tool_prefix)$(lexname)' yaccname_given= yaccname='' # test tries $(YACC) first yacc='$(cross)$(tool_prefix)$(yaccname)' @@ -338,6 +341,12 @@ tool-prefix [$tool_prefix] Specifies a prefix to be added to tool commands other than the compiler, like lex and yacc, in addition to \$cross. +lexname [$lexname] + + Specifies just the name of the lex program without the path. + The following variable, lex, specifies the full name. + If blank, the choice lex program will be auto-detected. + lex [$lex] Specifies the program to use for compiling lex scanners to C. @@ -645,6 +654,9 @@ cross := $cross # compiler name ccname = $ccname +# name of lex program +lexname = $lexname + # name of yacc program yaccname = $yaccname @@ -1341,9 +1353,36 @@ syntax error fi # -# Yacc tests +# Lex and Yacc tests # +printf "Checking for lex ... " + +if [ -z "$lex_given" -a -z "$lexname_given" ] ; then + for lexname in '$(LEX)' "lex" "flex" "" ; do + rm -f lex.yy.c + if make lexname="$lexname" lex.yy.c > /dev/null 2>&1; then + break; + fi + done + if [ -z "$lexname" ] ; then + printf "not found\n" + exit 1 + fi +else + rm -f lex.yy.c + if ! make lexname="$lexname" lex.yy.c > /dev/null 2>&1; then + printf "error\n\n" + printf 'values --lexname="%s" --lex="%s" are not working\n\n' "$lexname" "$lex" + printf 'A GNU Flex compatible lex is required\n\n' + exit 1 + fi +fi + +rm -f lex.yy.c + +printf '"%s"\n' "$lexname" + printf "Checking for yacc program ... " if [ -z "$yacc_given" -a -z "$yaccname_given" ] ; then |