summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2020-09-03 21:08:17 +0200
committerDave Davenport <qball@gmpclient.org>2020-09-03 21:08:17 +0200
commit5deac0a697e3e6b4ee9b06f9fed8944c7d5fdacb (patch)
treeed14c1f1e92306fa41a7b12c9cb10a79e4054505
parente4e59b99ea5de1f73c990499c9e02b2484042cb2 (diff)
Try to improve bison check so it works on bsd
-rw-r--r--configure.ac22
1 files changed, 21 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 7f366d05..ecc3a884 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,27 @@ dnl ---------------------------------------------------------------------
AC_PROG_LEX([flex])
AC_PROG_YACC
-AS_IF([test "x${YACC}" != "xbison -y" ], [AC_MSG_ERROR( "Failed to find bison")])
+
+AC_DEFUN([AX_PROG_BISON], [
+ AC_REQUIRE([AC_PROG_YACC])
+ AC_REQUIRE([AC_PROG_EGREP])
+
+ AC_CACHE_CHECK([if bison is the parser generator],[ax_cv_prog_bison],[
+ AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '],
+ [ax_cv_prog_bison=yes], [ax_cv_prog_bison=no])
+ ])
+ AS_IF([test "$ax_cv_prog_bison" = "yes"], [
+ dnl replace the yacc-compatible compiler with the real bison, as
+ dnl otherwise autoconf limits us to the POSIX yacc.
+ dnl We also change the generated filename to the old one, so that
+ dnl automake's ylwrap can deal with it.
+ YACC="${YACC% -y} -o y.tab.c"
+ ] m4_ifnblank([$1], [[$1]]),
+ m4_ifnblank([$2], [[$2]])
+ )
+])
+
+AX_PROG_BISON([],[AC_MSG_ERROR("Failed to find bison")])
m4_include([m4/ax_prog_flex_version.m4])
m4_include([m4/ax_compare_version.m4])