summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-07 05:06:39 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-07 16:26:10 -0500
commit184f6bc6f17360421eb101c9deffb7f701072885 (patch)
tree09f35b655ec15d127166d2ac860a406a6be91a11
parent3d7e3d911c3dbfc114b7af33ad4b28cd2af29bbc (diff)
downloadhaskell-184f6bc6f17360421eb101c9deffb7f701072885.tar.gz
Factor out unregisterised and tables next to code m4 macros
These will be useful for upcoming RTS configure script.
-rw-r--r--configure.ac55
-rw-r--r--m4/ghc_tables_next_to_code.m441
-rw-r--r--m4/ghc_unregisterised.m426
3 files changed, 69 insertions, 53 deletions
diff --git a/configure.ac b/configure.ac
index e8c49be7ac..79e0de904b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -302,64 +302,13 @@ AC_SUBST(SOLARIS_BROKEN_SHLD)
dnl ** Do an unregisterised build?
dnl --------------------------------------------------------------
-AC_MSG_CHECKING(whether target supports a registerised ABI)
-case "$TargetArch" in
- i386|x86_64|powerpc|powerpc64|powerpc64le|s390x|arm|aarch64|riscv64)
- UnregisterisedDefault=NO
- AC_MSG_RESULT([yes])
- ;;
- *)
- UnregisterisedDefault=YES
- AC_MSG_RESULT([no])
- ;;
-esac
-FP_DEFAULT_CHOICE_OVERRIDE_CHECK(
- [unregisterised],
- [unregisterised],
- [registerised],
- [Unregisterised],
- [Build a toolchain with the unregisterised ABI (disabled by default on platforms with registerised support)],
- [NO],
- [YES],
- [no])
+GHC_UNREGISTERISED
AC_SUBST(Unregisterised)
dnl ** Do a build with tables next to code?
-dnl
-dnl Whether the target architecture supports placing info tables
-dnl directly before the entry code (see TABLES_NEXT_TO_CODE in the RTS).
-dnl Whether we actually compile for TABLES_NEXT_TO_CODE depends on
-dnl whether we're building unregisterised code or not, which may be
-dnl decided by options to the compiler later.
-dnl
-dnl See https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/storage/heap-objects#tables_next_to_code
dnl --------------------------------------------------------------
-AC_MSG_CHECKING(whether target supports tables next to code)
-case "$Unregisterised" in
- NO)
- case "$TargetArch" in
- ia64|powerpc64|powerpc64le|s390x)
- TablesNextToCodeDefault=NO
- AC_MSG_RESULT([no])
- ;;
- *)
- TablesNextToCodeDefault=YES
- AC_MSG_RESULT([yes])
- ;;
- esac
- ;;
- YES)
- TablesNextToCodeDefault=NO
- AC_MSG_RESULT([no])
- ;;
-esac
-FP_DEFAULT_CHOICE_OVERRIDE_CHECK(
- [tables-next-to-code],
- [tables next to code],
- [tables apart from code],
- [TablesNextToCode],
- [Build a tool chain with info tables laid out next to code (enabled by default when using the registerised ABI, on platforms that support it)])
+GHC_TABLES_NEXT_TO_CODE
if test x"$TablesNextToCode" = xYES; then
AC_DEFINE([TABLES_NEXT_TO_CODE], [1], [Define to 1 if info tables are laid out next to code])
fi
diff --git a/m4/ghc_tables_next_to_code.m4 b/m4/ghc_tables_next_to_code.m4
new file mode 100644
index 0000000000..0f262bba57
--- /dev/null
+++ b/m4/ghc_tables_next_to_code.m4
@@ -0,0 +1,41 @@
+# GHC_TABLES_NEXT_TO_CODE
+# --------------------------------
+# Do a build with tables next to code?
+#
+# Whether the target architecture supports placing info tables
+# directly before the entry code (see TABLES_NEXT_TO_CODE in the RTS).
+# Whether we actually compile for TABLES_NEXT_TO_CODE depends on
+# whether we're building unregisterised code or not, which may be
+# decided by options to the compiler later.
+#
+# See https://gitlab.haskell.org/ghc/ghc/wikis/commentary/rts/storage/heap-objects#tables_next_to_code
+#
+AC_DEFUN([GHC_TABLES_NEXT_TO_CODE],
+[
+ AC_REQUIRE([GHC_UNREGISTERISED])
+ AC_MSG_CHECKING(whether target supports tables next to code)
+ case "$Unregisterised" in
+ NO)
+ case "$TargetArch" in
+ ia64|powerpc64|powerpc64le|s390x)
+ TablesNextToCodeDefault=NO
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ TablesNextToCodeDefault=YES
+ AC_MSG_RESULT([yes])
+ ;;
+ esac
+ ;;
+ YES)
+ TablesNextToCodeDefault=NO
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+ FP_DEFAULT_CHOICE_OVERRIDE_CHECK(
+ [tables-next-to-code],
+ [tables next to code],
+ [tables apart from code],
+ [TablesNextToCode],
+ [Build a tool chain with info tables laid out next to code (enabled by default when using the registerised ABI, on platforms that support it)])
+])
diff --git a/m4/ghc_unregisterised.m4 b/m4/ghc_unregisterised.m4
new file mode 100644
index 0000000000..ca3beb8733
--- /dev/null
+++ b/m4/ghc_unregisterised.m4
@@ -0,0 +1,26 @@
+# GHC_UNREGISTERISED
+# --------------------------------
+# Do an unregisterised build?
+AC_DEFUN([GHC_UNREGISTERISED],
+[
+ AC_MSG_CHECKING(whether target supports a registerised ABI)
+ case "$TargetArch" in
+ i386|x86_64|powerpc|powerpc64|powerpc64le|s390x|arm|aarch64|riscv64)
+ UnregisterisedDefault=NO
+ AC_MSG_RESULT([yes])
+ ;;
+ *)
+ UnregisterisedDefault=YES
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+ FP_DEFAULT_CHOICE_OVERRIDE_CHECK(
+ [unregisterised],
+ [unregisterised],
+ [registerised],
+ [Unregisterised],
+ [Build a toolchain with the unregisterised ABI (disabled by default on platforms with registerised support)],
+ [NO],
+ [YES],
+ [no])
+])