summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-10 19:24:51 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-12 21:25:40 -0500
commit490e8c750ea23ce8e2b7309e0d514b7d27f231bb (patch)
tree67a425e67c39f66165dcddbaa524c53e09068c95 /configure.ac
parent4c6ace75435f23774de8ee3f317c9503bb1c5139 (diff)
downloadhaskell-490e8c750ea23ce8e2b7309e0d514b7d27f231bb.tar.gz
Generate ghcversion.h with the top-level configure
This is, rather unintuitively, part of the goal of making the packages that make of the GHC distribution more freestanding. `ghcversion.h` is very simple, so we easily can move it out of the main build systems (make and Hadrian). By doing so, the RTS becomes less of a special case to those build systems as the header, already existing in the source tree, appears like any other. We could do this with the upcomming RTS configure, but it hardly matters because there is nothing platform-specific here, it is just versioning information like the other files the top-level configure can be responsible for.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac19
1 files changed, 19 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8bab372e81..560e8d6cb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,23 @@ FP_PROG_SORT
dnl ----------------------------------------------------------
FP_SETUP_PROJECT_VERSION
+dnl Don't use AC_DEFINE because it will make C-style comments invalid for
+dnl Haskell.
+
+> rts/include/ghcversion.h
+
+cat rts/ghcversion.h.top >> rts/include/ghcversion.h
+
+echo "#define __GLASGOW_HASKELL__ ${ProjectVersionInt}" >> rts/include/ghcversion.h
+echo "#define __GLASGOW_HASKELL_FULL_VERSION__ \"${ProjectVersion}\"" >> rts/include/ghcversion.h
+echo >> rts/include/ghcversion.h
+AS_IF([test x"${ProjectPatchLevel1}" != x],
+ [echo "#define __GLASGOW_HASKELL_PATCHLEVEL1__ ${ProjectPatchLevel1}" >> rts/include/ghcversion.h])
+AS_IF([test x"${ProjectPatchLevel2}" != x],
+ [echo "#define __GLASGOW_HASKELL_PATCHLEVEL2__ ${ProjectPatchLevel2}" >> rts/include/ghcversion.h])
+
+cat rts/ghcversion.h.bottom >> rts/include/ghcversion.h
+
# Hmmm, we fix the RPM release number to 1 here... Is this convenient?
AC_SUBST([release], [1])
@@ -76,6 +93,8 @@ AC_PREREQ([2.69])
AC_CONFIG_HEADER(mk/config.h)
# This one is manually maintained.
AC_CONFIG_HEADER(compiler/ghc-llvm-version.h)
+dnl manually outputted above, for reasons described there.
+dnl AC_CONFIG_HEADER(rts/include/ghcversion.h)
# No, semi-sadly, we don't do `--srcdir'...
if test x"$srcdir" != 'x.' ; then