summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure75
1 files changed, 68 insertions, 7 deletions
diff --git a/configure b/configure
index a5e0d2b9..58a13760 100755
--- a/configure
+++ b/configure
@@ -109,7 +109,10 @@ intptr=${intptr-}
tool_prefix=${tool_prefix-}
lex=${lex-'$(cross)$(tool_prefix)flex'}
lexlib=${lexlib--lfl}
-yacc=${yacc-'$(cross)$(tool_prefix)yacc'}
+yaccname_given=${yaccname+yes}
+yaccname=${yaccname-}
+yacc_given=${yacc+yes}
+yacc=${yacc-'$(cross)$(tool_prefix)$(yaccname)'}
nm=${nm-'$(cross)$(tool_prefix)nm'}
opt_flags=${opt_flags--O2}
lang_flags=${lang_flags--ansi -D_POSIX_C_SOURCE=2}
@@ -249,6 +252,12 @@ lexlib [$lexlib]
Specifies the linker flag to use for linking the lex library.
+yaccname [$yaccname]
+
+ Specifies just the name of the yacc program without the path.
+ The following variable, yacc, specifies the full name.
+ If blank, the choice yacc program will be auto-detected.
+
yacc [$yacc]
Specifies the program to use for compiling yacc scanners to C.
@@ -446,12 +455,9 @@ else
printf "warning: its recommended to build in a separate directory\n"
fi
-#
-# Finally, we generate config.make
-#
-printf "generating config.make ...\n"
-
-cat > config.make <<!
+gen_config_make()
+{
+ cat > config.make <<!
# absolute path to source code directory
top_srcdir := $top_srcdir
@@ -480,6 +486,9 @@ cross := $cross
# compiler name
ccname = $ccname
+# name of yacc program
+yaccname = $yaccname
+
# prefix for compiler command
compiler_prefix := $compiler_prefix
@@ -501,6 +510,15 @@ REMOVE_FLAGS := $remove_flags
LEX_DBG_FLAGS := $lex_dbg_flags
TXR_DBG_OPTS := $txr_dbg_opts
!
+}
+
+#
+# Before doing some other tests, we need a config.make
+#
+
+printf "generating config.make ... "
+gen_config_make
+printf "\n"
#
# Start config.h header
@@ -682,14 +700,57 @@ $inline int func(void)
printf "#define HAVE_VALGRIND\n" >> config.h
fi
+#
+# Yacc tests
+#
+
+printf "Checking for yacc program ... "
+
+if [ -z "$yacc_given" -a -z "$yaccname_given" ] ; then
+ for yaccname in "yacc" "byacc" "bison -y" "" ; do
+ yaccpath=$(make yaccname="$yaccname" conftest.yacc)
+ if command -v $yaccpath > /dev/null ; then
+ break;
+ fi
+ done
+
+ if [ -z "$yaccname" ] ; then
+ printf "not found\n"
+ exit 1
+ fi
+
+ printf '"%s"\n' "$yaccpath"
+else
+ yaccpath=$(make conftest.yacc)
+ case $yaccpath in
+ *bison )
+ printf "error\n\n"
+ printf "GNU Bison needs -y to behave like yacc\n\n"
+ printf "This needs to be specified in the --yaccname or --yacc option\n\n"
+ exit 1
+ ;;
+ * )
+ printf "given\n"
+ ;;
+ esac
+fi
#
# Clean up
#
+
rm -f conftest conftest.[co] conftest.{err,syms}
rm -f conftest2 conftest[12].[oc]
#
+# Regenerate config.make
+#
+
+printf "regenerating config.make ... "
+gen_config_make
+printf "\n"
+
+#
# Save configuration in config.log
#
cat > config.log <<!