From 490e8c750ea23ce8e2b7309e0d514b7d27f231bb Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 10 Nov 2021 19:24:51 +0000 Subject: 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. --- configure.ac | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'configure.ac') 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 -- cgit v1.2.1