summaryrefslogtreecommitdiff
path: root/m4/fptools_happy.m4
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-04-02 11:52:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-05 05:42:38 -0400
commit7ffbdc3fa603c6411249ba9b758cf8f109c5fb30 (patch)
tree8a05d6e03ce2790e6e59651c824e569fee088d33 /m4/fptools_happy.m4
parent6acadb79afe685c635fd255f90551a0fbfcbe3dc (diff)
downloadhaskell-7ffbdc3fa603c6411249ba9b758cf8f109c5fb30.tar.gz
Break up aclocal.m4
Diffstat (limited to 'm4/fptools_happy.m4')
-rw-r--r--m4/fptools_happy.m434
1 files changed, 34 insertions, 0 deletions
diff --git a/m4/fptools_happy.m4 b/m4/fptools_happy.m4
new file mode 100644
index 0000000000..d77621eaf7
--- /dev/null
+++ b/m4/fptools_happy.m4
@@ -0,0 +1,34 @@
+dnl
+dnl Check for Happy and version:
+dnl
+dnl 1. Use happy specified in env var HAPPY
+dnl 2. Find happy in path
+dnl 3. Check happy version
+dnl
+dnl If you increase the minimum version requirement, please also update:
+dnl https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation/tools
+dnl
+AC_DEFUN([FPTOOLS_HAPPY],
+[AC_PATH_PROG(HAPPY,[happy],)
+AC_SUBST(HappyCmd,$HAPPY)
+AC_CACHE_CHECK([for version of happy], fptools_cv_happy_version,
+changequote(, )dnl
+[
+if test x"$HappyCmd" != x; then
+ fptools_cv_happy_version=`"$HappyCmd" -v |
+ grep 'Happy Version' | sed -e 's/Happy Version \([^ ]*\).*/\1/g'` ;
+else
+ fptools_cv_happy_version="";
+fi;
+changequote([, ])dnl
+])
+if test ! -f compiler/GHC/Parser.hs || test ! -f compiler/GHC/Cmm/Parser.hs
+then
+ FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.20.0],
+ [AC_MSG_ERROR([Happy version 1.20 or later is required to compile GHC.])])[]
+ FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-ge],[1.21.0],
+ [AC_MSG_ERROR([Happy version 1.20 or earlier is required to compile GHC.])])[]
+fi
+HappyVersion=$fptools_cv_happy_version;
+AC_SUBST(HappyVersion)
+])