summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-10-22 00:05:54 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-18 22:24:10 -0500
commiteb5a6b91e02b48f9171217743e3417cb33eb92e3 (patch)
treec071a5cffa3d9b6a8d09495fc72e1295fdea71a9 /rts
parentab0d5cdaa5505e5b774b04b9f68dcbbc7ce1071e (diff)
downloadhaskell-eb5a6b91e02b48f9171217743e3417cb33eb92e3.tar.gz
Give the RTS it's own configure script
Currently it doesn't do much anything, we are just trying to introduce it without breaking the build. Later, we will move functionality from the top-level configure script over to it. We need to bump Cabal for https://github.com/haskell/cabal/pull/8649; to facilitate and existing hack of skipping some configure checks for the RTS we now need to skip just *part* not *all* of the "post configure" hook, as running the configure script (which we definitely want to do) is also implemented as part of the "post configure" hook. But doing this requires exposing functionality that wasn't exposed before.
Diffstat (limited to 'rts')
-rw-r--r--rts/.gitignore5
-rw-r--r--rts/configure.ac57
-rw-r--r--rts/rts.cabal.in18
3 files changed, 79 insertions, 1 deletions
diff --git a/rts/.gitignore b/rts/.gitignore
index a0fafa79ab..662c3c974c 100644
--- a/rts/.gitignore
+++ b/rts/.gitignore
@@ -12,7 +12,12 @@
/package.conf.install.raw
/fs.*
+/aclocal.m4
/autom4te.cache/
/config.log
/config.status
/configure
+
+/ghcautoconf.h.autoconf.in
+/ghcautoconf.h.autoconf
+/include/ghcautoconf.h
diff --git a/rts/configure.ac b/rts/configure.ac
new file mode 100644
index 0000000000..fa90a0e114
--- /dev/null
+++ b/rts/configure.ac
@@ -0,0 +1,57 @@
+# Configure script template for the Run-time System of GHC
+#
+# Process with 'autoreconf' to get a working configure script.
+#
+# For the generated configure script, do "./configure --help" to
+# see what flags are available. (Better yet, read the documentation!)
+#
+
+AC_INIT([GHC run-time system], [1.0.2], [libraries@haskell.org], [rts])
+
+AC_CONFIG_MACRO_DIRS([../m4])
+
+# Safety check: Ensure that we are in the correct source directory.
+AC_CONFIG_SRCDIR([include/rts/Constants.h])
+
+dnl * We require autoconf version 2.69 due to
+dnl https://bugs.ruby-lang.org/issues/8179. Also see #14910.
+dnl * We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
+dnl * We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
+dnl * Using autoconf 2.59 started to give nonsense like this
+dnl #define SIZEOF_CHAR 0
+dnl recently.
+AC_PREREQ([2.69])
+
+AC_CONFIG_HEADERS([ghcautoconf.h.autoconf])
+
+# We have to run these unconditionally, but we may discard their
+# results in the following code
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+
+GHC_CONVERT_PLATFORM_PARTS([host], [Host])
+FPTOOLS_SET_PLATFORM_VARS([host], [Host])
+FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host])
+
+AC_OUTPUT
+
+dnl ######################################################################
+dnl Generate ghcautoconf.h
+dnl ######################################################################
+
+[
+mkdir -p include
+touch include/ghcautoconf.h
+> include/ghcautoconf.h
+
+echo "#if !defined(__GHCAUTOCONF_H__)" >> include/ghcautoconf.h
+echo "#define __GHCAUTOCONF_H__" >> include/ghcautoconf.h
+# Copy the contents of $srcdir/../mk/config.h, turning '#define PACKAGE_FOO
+# "blah"' into '/* #undef PACKAGE_FOO */' to avoid clashes.
+cat $srcdir/../mk/config.h ghcautoconf.h.autoconf | sed \
+ -e 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$,\1/* #undef \2 */,' \
+ -e '/__GLASGOW_HASKELL/d' \
+ -e '/REMOVE ME/d' \
+ >> include/ghcautoconf.h
+echo "#endif /* __GHCAUTOCONF_H__ */" >> include/ghcautoconf.h
+]
diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in
index ba2524d593..be54a086e9 100644
--- a/rts/rts.cabal.in
+++ b/rts/rts.cabal.in
@@ -1,9 +1,24 @@
cabal-version: 3.0
name: rts
version: 1.0.2
+synopsis: The GHC runtime system
+description:
+ The GHC runtime system.
+
+ Code produced by GHC links this library to provide missing functionality
+ that cannot be written in Haskell itself.
license: BSD-3-Clause
maintainer: glasgow-haskell-users@haskell.org
-build-type: Simple
+build-type: Configure
+
+extra-source-files:
+ configure
+ configure.ac
+
+extra-tmp-files:
+ autom4te.cache
+ config.log
+ config.status
source-repository head
type: git
@@ -206,6 +221,7 @@ library
include-dirs: include
includes: Rts.h
+ autogen-includes: ghcautoconf.h
install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
-- ^ from include