summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-07 04:45:26 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-02 02:55:22 -0500
commitec6d3c89ca73bf13cc8d9ec9600f003dfc33ebf5 (patch)
treed33080612efc681699350818f5108f510615f4c0
parent4bf3224065f37b299f259a937b1e3690c4b12686 (diff)
downloadhaskell-ec6d3c89ca73bf13cc8d9ec9600f003dfc33ebf5.tar.gz
Move/Copy remaining AC_DEFINE to RTS config
Only exception is the LLVM version macros, which are used for GHC itself.
-rw-r--r--configure.ac32
-rw-r--r--m4/fp_cc_supports__atomics.m48
-rw-r--r--m4/fptools_set_haskell_platform_vars.m42
-rw-r--r--rts/configure.ac61
4 files changed, 66 insertions, 37 deletions
diff --git a/configure.ac b/configure.ac
index d173f5e2ed..cb622ce05a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,28 +142,6 @@ if test "$EnableDistroToolchain" = "YES"; then
TarballsAutodownload=NO
fi
-AC_ARG_ENABLE(asserts-all-ways,
-[AS_HELP_STRING([--enable-asserts-all-ways],
- [Usually ASSERTs are only compiled in the DEBUG way,
- this will enable them in all ways.])],
- [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableAssertsAllWays])],
- [EnableAssertsAllWays=NO]
-)
-if test "$enable_asserts_all_ways" = "yes" ; then
- AC_DEFINE([USE_ASSERTS_ALL_WAYS], [1], [Compile-in ASSERTs in all ways.])
-fi
-
-AC_ARG_ENABLE(native-io-manager,
-[AS_HELP_STRING([--enable-native-io-manager],
- [Enable the native I/O manager by default.])],
- [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableNativeIOManager])],
- [EnableNativeIOManager=NO]
-)
-if test "$EnableNativeIOManager" = "YES"; then
- AC_DEFINE_UNQUOTED([DEFAULT_NATIVE_IO_MANAGER], [1], [Enable Native I/O manager as default.])
-fi
-
-
dnl CC_STAGE0, LD_STAGE0, AR_STAGE0 are like the "previous" variable
dnl CC, LD, AR (inherited by CC_STAGE[123], etc.)
dnl but instead used by stage0 for bootstrapping stage1
@@ -325,9 +303,6 @@ dnl ** Do a build with tables next to code?
dnl --------------------------------------------------------------
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
AC_SUBST(TablesNextToCode)
dnl ** Does target have runtime linker support?
@@ -637,14 +612,17 @@ dnl unregisterised, Sparc, and PPC backends. Also determines whether
dnl linking to libatomic is required for atomic operations, e.g. on
dnl RISCV64 GCC.
FP_CC_SUPPORTS__ATOMICS
+if test "$need_latomic" = 1; then
+ AC_SUBST([NeedLibatomic],[YES])
+else
+ AC_SUBST([NeedLibatomic],[NO])
+fi
FP_GCC_EXTRA_FLAGS
dnl ** look to see if we have a C compiler using an llvm back end.
dnl
FP_CC_LLVM_BACKEND
-AS_IF([test x"$CcLlvmBackend" = x"YES"],
- [AC_DEFINE([CC_LLVM_BACKEND], [1], [Define (to 1) if C compiler has an LLVM back end])])
AC_SUBST(CcLlvmBackend)
FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
diff --git a/m4/fp_cc_supports__atomics.m4 b/m4/fp_cc_supports__atomics.m4
index bd3750e972..8876b8d1b6 100644
--- a/m4/fp_cc_supports__atomics.m4
+++ b/m4/fp_cc_supports__atomics.m4
@@ -61,12 +61,4 @@ AC_DEFUN([FP_CC_SUPPORTS__ATOMICS],
AC_MSG_RESULT(no)
AC_MSG_ERROR([C compiler needs to support __atomic primitives.])
])
- AC_DEFINE([HAVE_C11_ATOMICS], [1], [Does C compiler support __atomic primitives?])
- if test "$need_latomic" = 1; then
- AC_SUBST([NeedLibatomic],[YES])
- else
- AC_SUBST([NeedLibatomic],[NO])
- fi
- AC_DEFINE_UNQUOTED([NEED_ATOMIC_LIB], [$need_latomic],
- [Define to 1 if we need -latomic.])
])
diff --git a/m4/fptools_set_haskell_platform_vars.m4 b/m4/fptools_set_haskell_platform_vars.m4
index 1a32b3046b..75c5ecf409 100644
--- a/m4/fptools_set_haskell_platform_vars.m4
+++ b/m4/fptools_set_haskell_platform_vars.m4
@@ -162,8 +162,6 @@ AC_DEFUN([GHC_SUBSECTIONS_VIA_SYMBOLS],
TargetHasSubsectionsViaSymbols=NO
else
TargetHasSubsectionsViaSymbols=YES
- AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
- [Define to 1 if Apple-style dead-stripping is supported.])
fi
],
[TargetHasSubsectionsViaSymbols=NO
diff --git a/rts/configure.ac b/rts/configure.ac
index 7fed02f2c7..21e6f57602 100644
--- a/rts/configure.ac
+++ b/rts/configure.ac
@@ -24,15 +24,76 @@ AC_PREREQ([2.69])
AC_CONFIG_HEADERS([ghcautoconf.h.autoconf])
+AC_ARG_ENABLE(asserts-all-ways,
+[AS_HELP_STRING([--enable-asserts-all-ways],
+ [Usually ASSERTs are only compiled in the DEBUG way,
+ this will enable them in all ways.])],
+ [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableAssertsAllWays])],
+ [EnableAssertsAllWays=NO]
+)
+if test "$enable_asserts_all_ways" = "yes" ; then
+ AC_DEFINE([USE_ASSERTS_ALL_WAYS], [1], [Compile-in ASSERTs in all ways.])
+fi
+
+AC_ARG_ENABLE(native-io-manager,
+[AS_HELP_STRING([--enable-native-io-manager],
+ [Enable the native I/O manager by default.])],
+ [FP_CAPITALIZE_YES_NO(["$enableval"], [EnableNativeIOManager])],
+ [EnableNativeIOManager=NO]
+)
+if test "$EnableNativeIOManager" = "YES"; then
+ AC_DEFINE_UNQUOTED([DEFAULT_NATIVE_IO_MANAGER], [1], [Enable Native I/O manager as default.])
+fi
+
# We have to run these unconditionally, but we may discard their
# results in the following code
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
+dnl ** Do an unregisterised build?
+dnl --------------------------------------------------------------
+
+GHC_UNREGISTERISED
+
+dnl ** Do a build with tables next to code?
+dnl --------------------------------------------------------------
+
+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
+
+dnl detect compiler (prefer gcc over clang) and set $CC (unless CC already set),
+dnl later CC is copied to CC_STAGE{1,2,3}
+AC_PROG_CC([cc gcc clang])
+
+dnl make extensions visible to allow feature-tests to detect them lateron
+AC_USE_SYSTEM_EXTENSIONS
+
+dnl ** Used to determine how to compile ghc-prim's atomics.c, used by
+dnl unregisterised, Sparc, and PPC backends. Also determines whether
+dnl linking to libatomic is required for atomic operations, e.g. on
+dnl RISCV64 GCC.
+FP_CC_SUPPORTS__ATOMICS
+AC_DEFINE([HAVE_C11_ATOMICS], [1], [Does C compiler support __atomic primitives?])
+AC_DEFINE_UNQUOTED([NEED_ATOMIC_LIB], [$need_latomic],
+ [Define to 1 if we need -latomic for sub-word atomic operations.])
+
+dnl ** look to see if we have a C compiler using an llvm back end.
+dnl
+FP_CC_LLVM_BACKEND
+AS_IF([test x"$CcLlvmBackend" = x"YES"],
+ [AC_DEFINE([CC_LLVM_BACKEND], [1], [Define (to 1) if C compiler has an LLVM back end])])
+
GHC_CONVERT_PLATFORM_PARTS([host], [Host])
FPTOOLS_SET_PLATFORM_VARS([host], [Host])
FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host])
+GHC_SUBSECTIONS_VIA_SYMBOLS
+AS_IF([test x"${TargetHasSubsectionsViaSymbols}" = x"YES"],
+ [AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
+ [Define to 1 if Apple-style dead-stripping is supported.])])
+
dnl --------------------------------------------------
dnl * Platform header file and syscall feature tests
dnl ### checking the state of the local header files and syscalls ###