Generate settings by make/hadrian instead of configure
authorJohn Ericson <git@JohnEricson.me>
Wed, 3 Apr 2019 13:32:05 +0000 (09:32 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 1 May 2019 00:29:31 +0000 (20:29 -0400)
This allows it to eventually become stage-specific

14 files changed:
aclocal.m4
configure.ac
distrib/configure.ac.in
ghc.mk
ghc/ghc.mk
hadrian/cfg/system.config.in
hadrian/doc/make.md
hadrian/src/Oracles/Setting.hs
hadrian/src/Rules/BinaryDist.hs
hadrian/src/Rules/Configure.hs
hadrian/src/Rules/Generate.hs
hadrian/src/Rules/SourceDist.hs
includes/ghc.mk
mk/config.mk.in

index d2d42f2..5004a05 100644 (file)
@@ -497,16 +497,16 @@ AC_DEFUN([FP_SETTINGS],
 [
     if test "$windows" = YES -a "$EnableDistroToolchain" = "NO"
     then
-        mingw_bin_prefix=mingw/bin/
-       SettingsCCompilerCommand="\$tooldir/${mingw_bin_prefix}gcc.exe"
-       SettingsHaskellCPPCommand="\$tooldir/${mingw_bin_prefix}gcc.exe"
+        mingw_bin_prefix='$$tooldir/mingw/bin/'
+        SettingsCCompilerCommand="${mingw_bin_prefix}gcc.exe"
+        SettingsHaskellCPPCommand="${mingw_bin_prefix}gcc.exe"
         SettingsHaskellCPPFlags="$HaskellCPPArgs"
-       SettingsLdCommand="\$tooldir/${mingw_bin_prefix}ld.exe"
-       SettingsArCommand="\$tooldir/${mingw_bin_prefix}ar.exe"
-       SettingsRanlibCommand="\$tooldir/${mingw_bin_prefix}ranlib.exe"
-       SettingsDllWrapCommand="\$tooldir/${mingw_bin_prefix}dllwrap.exe"
-       SettingsWindresCommand="\$tooldir/${mingw_bin_prefix}windres.exe"
-        SettingsTouchCommand='$topdir/bin/touchy.exe'
+        SettingsLdCommand="${mingw_bin_prefix}ld.exe"
+        SettingsArCommand="${mingw_bin_prefix}ar.exe"
+        SettingsRanlibCommand="${mingw_bin_prefix}ranlib.exe"
+        SettingsDllWrapCommand="${mingw_bin_prefix}dllwrap.exe"
+        SettingsWindresCommand="${mingw_bin_prefix}windres.exe"
+        SettingsTouchCommand='$$topdir/bin/touchy.exe'
     elif test "$EnableDistroToolchain" = "YES"
     then
         SettingsCCompilerCommand="$(basename $CC)"
@@ -517,7 +517,7 @@ AC_DEFUN([FP_SETTINGS],
         SettingsArCommand="$(basename $ArCmd)"
         SettingsDllWrapCommand="$(basename $DllWrapCmd)"
         SettingsWindresCommand="$(basename $WindresCmd)"
-        SettingsTouchCommand='$topdir/bin/touchy.exe'
+        SettingsTouchCommand='$$topdir/bin/touchy.exe'
     else
         SettingsCCompilerCommand="$CC"
         SettingsHaskellCPPCommand="$HaskellCPPCmd"
index 7772bd4..e1b2342 100644 (file)
@@ -897,7 +897,7 @@ FP_CHECK_SIZEOF_AND_ALIGNMENT(int64_t)
 FP_CHECK_SIZEOF_AND_ALIGNMENT(uint64_t)
 
 
-dnl for use in settings.in
+dnl for use in settings file
 TargetWordSize=$ac_cv_sizeof_void_p
 if test "x$TargetWordSize" == 8; then
   AC_SUBST([Cabal64bit],[True])
@@ -1292,7 +1292,7 @@ checkMake380() {
 checkMake380 make
 checkMake380 gmake
 
-AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/iserv/iserv.cabal utils/iserv-proxy/iserv-proxy.cabal utils/remote-iserv/remote-iserv.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal libraries/ghc-heap/ghc-heap.cabal libraries/libiserv/libiserv.cabal libraries/template-haskell/template-haskell.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
+AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk rts/rts.cabal compiler/ghc.cabal ghc/ghc-bin.cabal utils/iserv/iserv.cabal utils/iserv-proxy/iserv-proxy.cabal utils/remote-iserv/remote-iserv.cabal utils/runghc/runghc.cabal utils/gen-dll/gen-dll.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal libraries/ghc-heap/ghc-heap.cabal libraries/libiserv/libiserv.cabal libraries/template-haskell/template-haskell.cabal docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac])
 AC_OUTPUT
 [
 if test "$print_make_warning" = "true"; then
index f9f14d1..9cdb635 100644 (file)
@@ -159,7 +159,7 @@ dnl May need to use gcc to find platform details.
 dnl --------------------------------------------------------------
 FPTOOLS_SET_HASKELL_PLATFORM_VARS
 
-dnl TargetWordSize for settings.in
+dnl TargetWordSize for settings file
 AC_CHECK_SIZEOF(void *, 4)
 if test "x$ac_cv_sizeof_void_p" = "x0"; then
     AC_MSG_ERROR([Failed to determine machine word size. Does your toolchain actually work?])
diff --git a/ghc.mk b/ghc.mk
index 984dfc6..5f1d856 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -1010,7 +1010,6 @@ $(eval $(call bindist-list,.,\
     README \
     INSTALL \
     configure config.sub config.guess install-sh \
-    settings.in \
     llvm-targets \
     llvm-passes \
     packages \
@@ -1067,7 +1066,7 @@ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
 unix-binary-dist-prep:
        $(call removeTrees,bindistprep/)
        "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
-       set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh settings.in llvm-targets llvm-passes ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
+       set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh llvm-targets llvm-passes ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
        echo "HADDOCK_DOCS       = $(HADDOCK_DOCS)"       >> $(BIN_DIST_MK)
        echo "BUILD_SPHINX_HTML  = $(BUILD_SPHINX_HTML)"  >> $(BIN_DIST_MK)
        echo "BUILD_SPHINX_PDF   = $(BUILD_SPHINX_PDF)"   >> $(BIN_DIST_MK)
@@ -1165,7 +1164,7 @@ SRC_DIST_GHC_DIRS = mk rules docs distrib bindisttest libffi includes \
 SRC_DIST_GHC_FILES += \
     configure.ac config.guess config.sub configure \
     aclocal.m4 README.md ANNOUNCE HACKING.md INSTALL.md LICENSE Makefile \
-    install-sh settings.in llvm-targets llvm-passes VERSION GIT_COMMIT_ID \
+    install-sh llvm-targets llvm-passes VERSION GIT_COMMIT_ID \
     boot packages ghc.mk MAKEHELP.md
 
 .PHONY: VERSION
index 4c3fbdf..9747e34 100644 (file)
@@ -129,6 +129,9 @@ all_ghc_stage1 : $(GHC_STAGE1)
 all_ghc_stage2 : $(GHC_STAGE2)
 all_ghc_stage3 : $(GHC_STAGE3)
 
+settings : $(includes_SETTINGS)
+       "$(CP)" $< $@
+
 $(INPLACE_LIB)/settings : settings
        "$(CP)" $< $@
 
index e3c612e..fbb1f54 100644 (file)
@@ -108,6 +108,46 @@ conf-ld-linker-args-stage1  = @CONF_LD_LINKER_OPTS_STAGE1@
 conf-ld-linker-args-stage2  = @CONF_LD_LINKER_OPTS_STAGE2@
 conf-ld-linker-args-stage3  = @CONF_LD_LINKER_OPTS_STAGE3@
 
+# Settings:
+#==========
+
+# We are in the process of moving the settings file from being entirely
+# generated by configure, to generated being by the build system. Many of these
+# might become redundant.
+
+gcc-extra-via-c-opts = @GccExtraViaCOpts@
+ld-has-no-compact-unwind = @LdHasNoCompactUnwind@
+ld-has-build-id = @LdHasBuildId@
+ld-has-filelist = @LdHasFilelist@
+ld-is-gnu-ld = @LdIsGNULd@
+ar-args = @ArArgs@
+
+settings-c-compiler-command = @SettingsCCompilerCommand@
+settings-haskell-cpp-command = @SettingsHaskellCPPCommand@
+settings-haskell-cpp-flags = @SettingsHaskellCPPFlags@
+settings-c-compiler-flags = @SettingsCCompilerFlags@
+settings-c-compiler-link-flags = @SettingsCCompilerLinkFlags@
+settings-c-compiler-supports-no-pie = @SettingsCCompilerSupportsNoPie@
+settings-ld-command = @SettingsLdCommand@
+settings-ld-flags = @SettingsLdFlags@
+settings-ar-command = @SettingsArCommand@
+settings-ranlib-command = @SettingsRanlibCommand@
+settings-dll-wrap-command = @SettingsDllWrapCommand@
+settings-windres-command = @SettingsWindresCommand@
+settings-libtool-command = @SettingsLibtoolCommand@
+settings-touch-command = @SettingsTouchCommand@
+settings-clang-command = @SettingsClangCommand@
+settings-llc-command = @SettingsLlcCommand@
+settings-opt-command = @SettingsOptCommand@
+
+haskell-target-os = @HaskellTargetOs@
+haskell-target-arch = @HaskellTargetArch@
+target-word-size = @TargetWordSize@
+haskell-have-gnu-nonexec-stack = @HaskellHaveGnuNonexecStack@
+haskell-have-ident-directive = @HaskellHaveIdentDirective@
+haskell-have-subsections-via-symbols = @HaskellHaveSubsectionsViaSymbols@
+haskell-have-rts-linker = @HaskellHaveRTSLinker@
+
 # Include and library directories:
 #=================================
 
index c163317..ff51f6d 100644 (file)
@@ -163,6 +163,17 @@ time you fire up a build. This is not possible with the Make build system.
   build _build/stage1/lib/platformConstants
   ```
 
+- Generate the `settings` file to be used for stage 1/2 GHC
+
+  ``` sh
+  # Make
+  make inplace/lib/settings
+
+  # Hadrian
+  build _build/stage0/lib/settings
+  build _build/stage1/lib/settings
+  ```
+
 - Build a static library for base with the stage 1 compiler
 
   ``` sh
index 46ae5b5..4c87d53 100644 (file)
@@ -3,7 +3,9 @@ module Oracles.Setting (
     getSettingList,  anyTargetPlatform, anyTargetOs, anyTargetArch, anyHostOs,
     ghcWithInterpreter, ghcEnableTablesNextToCode, useLibFFIForAdjustors,
     ghcCanonVersion, cmdLineLengthLimit, iosHost, osxHost, windowsHost,
-    hostSupportsRPaths, topDirectory, libsuf, ghcVersionStage
+    hostSupportsRPaths, topDirectory, libsuf, ghcVersionStage,
+    SettingsFileSetting (..),
+    settingsFileSetting
     ) where
 
 import Hadrian.Expression
@@ -75,6 +77,31 @@ data SettingList = ConfCcArgs Stage
                  | ConfLdLinkerArgs Stage
                  | HsCppArgs
 
+-- TODO compute solely in Hadrian, removing these variables' definitions
+-- from aclocal.m4 whenever they can be calculated from other variables
+-- already fed into Hadrian.
+
+-- | Each 'SettingsFileSetting' is defined by 'FP_SETTINGS' in aclocal.m4.
+-- Eventually much of that local can probably be computed just in Hadrian.
+data SettingsFileSetting
+    = SettingsFileSetting_CCompilerCommand
+    | SettingsFileSetting_HaskellCPPCommand
+    | SettingsFileSetting_HaskellCPPFlags
+    | SettingsFileSetting_CCompilerFlags
+    | SettingsFileSetting_CCompilerLinkFlags
+    | SettingsFileSetting_CCompilerSupportsNoPie
+    | SettingsFileSetting_LdCommand
+    | SettingsFileSetting_LdFlags
+    | SettingsFileSetting_ArCommand
+    | SettingsFileSetting_RanlibCommand
+    | SettingsFileSetting_DllWrapCommand
+    | SettingsFileSetting_WindresCommand
+    | SettingsFileSetting_LibtoolCommand
+    | SettingsFileSetting_TouchCommand
+    | SettingsFileSetting_ClangCommand
+    | SettingsFileSetting_LlcCommand
+    | SettingsFileSetting_OptCommand
+
 -- | Look up the value of a 'Setting' in @cfg/system.config@, tracking the
 -- result.
 setting :: Setting -> Action String
@@ -127,6 +154,28 @@ settingList key = fmap words $ lookupValueOrError configFile $ case key of
     ConfLdLinkerArgs  stage -> "conf-ld-linker-args-"  ++ stageString stage
     HsCppArgs               -> "hs-cpp-args"
 
+-- | Look up the value of a 'SettingList' in @cfg/system.config@, tracking the
+-- result.
+settingsFileSetting :: SettingsFileSetting -> Action String
+settingsFileSetting key = lookupValueOrError configFile $ case key of
+    SettingsFileSetting_CCompilerCommand -> "settings-c-compiler-command"
+    SettingsFileSetting_HaskellCPPCommand -> "settings-haskell-cpp-command"
+    SettingsFileSetting_HaskellCPPFlags -> "settings-haskell-cpp-flags"
+    SettingsFileSetting_CCompilerFlags -> "settings-c-compiler-flags"
+    SettingsFileSetting_CCompilerLinkFlags -> "settings-c-compiler-link-flags"
+    SettingsFileSetting_CCompilerSupportsNoPie -> "settings-c-compiler-supports-no-pie"
+    SettingsFileSetting_LdCommand -> "settings-ld-command"
+    SettingsFileSetting_LdFlags -> "settings-ld-flags"
+    SettingsFileSetting_ArCommand -> "settings-ar-command"
+    SettingsFileSetting_RanlibCommand -> "settings-ranlib-command"
+    SettingsFileSetting_DllWrapCommand -> "settings-dll-wrap-command"
+    SettingsFileSetting_WindresCommand -> "settings-windres-command"
+    SettingsFileSetting_LibtoolCommand -> "settings-libtool-command"
+    SettingsFileSetting_TouchCommand -> "settings-touch-command"
+    SettingsFileSetting_ClangCommand -> "settings-clang-command"
+    SettingsFileSetting_LlcCommand -> "settings-llc-command"
+    SettingsFileSetting_OptCommand -> "settings-opt-command"
+
 -- | An expression that looks up the value of a 'Setting' in @cfg/system.config@,
 -- tracking the result.
 getSetting :: Setting -> Expr c b String
index 3db64ee..c02d978 100644 (file)
@@ -204,7 +204,7 @@ bindistRules = do
 bindistInstallFiles :: [FilePath]
 bindistInstallFiles =
     [ "config.sub", "config.guess", "install-sh", "mk" -/- "config.mk.in"
-    , "mk" -/- "install.mk.in", "mk" -/- "project.mk", "settings.in", "README"
+    , "mk" -/- "install.mk.in", "mk" -/- "project.mk", "README"
     , "INSTALL" ]
 
 -- | This auxiliary function gives us a top-level 'Filepath' that we can 'need'
index 8395472..ba67df2 100644 (file)
@@ -14,7 +14,7 @@ import qualified System.Info.Extra as System
 -- | Files generated by running the @configure@ script.
 configureResults :: [FilePath]
 configureResults =
-    [ configFile, "settings", configH, "compiler/ghc.cabal", "rts/rts.cabal"]
+    [ configFile, configH, "compiler/ghc.cabal", "rts/rts.cabal"]
 
 configureRules :: Rules ()
 configureRules = do
index ba35e03..b167cd1 100644 (file)
@@ -7,6 +7,7 @@ module Rules.Generate (
 import Base
 import Expression
 import Flavour
+import Hadrian.Oracles.TextFile (lookupValueOrError)
 import Oracles.Flag
 import Oracles.ModuleFiles
 import Oracles.Setting
@@ -161,7 +162,7 @@ copyRules = do
         prefix -/- "llvm-targets"      <~ return "."
         prefix -/- "llvm-passes"       <~ return "."
         prefix -/- "platformConstants" <~ (buildRoot <&> (-/- generatedDir))
-        prefix -/- "settings"          <~ return "."
+        prefix -/- "settings"          <~ (buildRoot <&> (-/- generatedDir))
         prefix -/- "template-hsc.h"    <~ return (pkgPath hsc2hs)
 
         prefix -/- "html//*"           <~ return "utils/haddock/haddock-api/resources"
@@ -177,6 +178,7 @@ generateRules = do
     priority 2.0 $ (root -/- generatedDir -/- "ghcautoconf.h") <~ generateGhcAutoconfH
     priority 2.0 $ (root -/- generatedDir -/- "ghcplatform.h") <~ generateGhcPlatformH
     priority 2.0 $ (root -/- generatedDir -/-  "ghcversion.h") <~ generateGhcVersionH
+    priority 2.0 $ (root -/- generatedDir -/-      "settings") <~ generateSettings
 
     -- TODO: simplify, get rid of fake rts context
     root -/- generatedDir ++ "//*" %> \file -> do
@@ -261,6 +263,55 @@ generateGhcPlatformH = do
         ++
         [ "\n#endif /* __GHCPLATFORM_H__ */" ]
 
+generateSettings :: Expr String
+generateSettings = do
+    let flag' = flag >=> \case
+            True  -> pure "YES"
+            False -> pure "NO"
+    settings <- (traverse . traverse) expr $
+        [ ("GCC extra via C opts", lookupValueOrError configFile "gcc-extra-via-c-opts")
+        , ("C compiler command", settingsFileSetting SettingsFileSetting_CCompilerCommand)
+        , ("C compiler flags", settingsFileSetting SettingsFileSetting_CCompilerFlags)
+        , ("C compiler link flags", settingsFileSetting SettingsFileSetting_CCompilerLinkFlags)
+        , ("C compiler supports -no-pie", settingsFileSetting SettingsFileSetting_CCompilerSupportsNoPie)
+        , ("Haskell CPP command", settingsFileSetting SettingsFileSetting_HaskellCPPCommand)
+        , ("Haskell CPP flags", settingsFileSetting SettingsFileSetting_HaskellCPPFlags)
+        , ("ld command", settingsFileSetting SettingsFileSetting_LdCommand)
+        , ("ld flags", settingsFileSetting SettingsFileSetting_LdFlags)
+        , ("ld supports compact unwind", lookupValueOrError configFile "ld-has-no-compact-unwind")
+        , ("ld supports build-id", lookupValueOrError configFile "ld-has-build-id")
+        , ("ld supports filelist", lookupValueOrError configFile "ld-has-filelist")
+        , ("ld is GNU ld", lookupValueOrError configFile "ld-is-gnu-ld")
+        , ("ar command", settingsFileSetting SettingsFileSetting_ArCommand)
+        , ("ar flags", lookupValueOrError configFile "ar-args")
+        , ("ar supports at file", flag' ArSupportsAtFile)
+        , ("ranlib command", settingsFileSetting SettingsFileSetting_RanlibCommand)
+        , ("touch command", settingsFileSetting SettingsFileSetting_TouchCommand)
+        , ("dllwrap command", settingsFileSetting SettingsFileSetting_DllWrapCommand)
+        , ("windres command", settingsFileSetting SettingsFileSetting_WindresCommand)
+        , ("libtool command", settingsFileSetting SettingsFileSetting_LibtoolCommand)
+        , ("cross compiling", flag' CrossCompiling)
+        , ("target os", lookupValueOrError configFile "haskell-target-os")
+        , ("target arch", lookupValueOrError configFile "haskell-target-arch")
+        , ("target word size", lookupValueOrError configFile "target-word-size")
+        , ("target has GNU nonexec stack", lookupValueOrError configFile "haskell-have-gnu-nonexec-stack")
+        , ("target has .ident directive", lookupValueOrError configFile "haskell-have-ident-directive")
+        , ("target has subsections via symbols", lookupValueOrError configFile "haskell-have-subsections-via-symbols")
+        , ("target has RTS linker", lookupValueOrError configFile "haskell-have-rts-linker")
+        , ("Unregisterised", flag' GhcUnregisterised)
+        , ("LLVM llc command", settingsFileSetting SettingsFileSetting_LlcCommand)
+        , ("LLVM opt command", settingsFileSetting SettingsFileSetting_OptCommand)
+        , ("LLVM clang command", settingsFileSetting SettingsFileSetting_ClangCommand)
+        ]
+    let showTuple (k, v) = "(" ++ show k ++ ", " ++ show v ++ ")"
+    pure $ case settings of
+        [] -> "[]"
+        s : ss -> unlines $
+            ("[" ++ showTuple s)
+            : ((\s' -> "," ++ showTuple s') <$> ss)
+            ++ ["]"]
+
+
 -- | Generate @Config.hs@ files.
 generateConfigHs :: Expr String
 generateConfigHs = do
index 6e56c66..e70dc5c 100644 (file)
@@ -110,4 +110,4 @@ prepareTree dest = do
         , "ghc.mk"
         , "install-sh"
         , "packages"
-        , "settings.in" ]
+        ]
index 939bf19..27b704d 100644 (file)
@@ -166,6 +166,52 @@ endif
 
 endif
 
+# -----------------------------------------------------------------------------
+# Settings
+
+# These settings are read by GHC at runtime, so as to not cause spurious
+# rebuilds.
+
+includes_SETTINGS = includes/dist/build/settings
+
+$(includes_SETTINGS) : includes/Makefile | $$(dir $$@)/.
+       $(call removeFiles,$@)
+       @echo '[("GCC extra via C opts", "$(GccExtraViaCOpts)")' >> $@
+       @echo ',("C compiler command", "$(SettingsCCompilerCommand)")' >> $@
+       @echo ',("C compiler flags", "$(SettingsCCompilerFlags)")' >> $@
+       @echo ',("C compiler link flags", "$(SettingsCCompilerLinkFlags)")' >> $@
+       @echo ',("C compiler supports -no-pie", "$(SettingsCCompilerSupportsNoPie)")' >> $@
+       @echo ',("Haskell CPP command", "$(SettingsHaskellCPPCommand)")' >> $@
+       @echo ',("Haskell CPP flags", "$(SettingsHaskellCPPFlags)")' >> $@
+       @echo ',("ld command", "$(SettingsLdCommand)")' >> $@
+       @echo ',("ld flags", "$(SettingsLdFlags)")' >> $@
+       @echo ',("ld supports compact unwind", "$(LdHasNoCompactUnwind)")' >> $@
+       @echo ',("ld supports build-id", "$(LdHasBuildId)")' >> $@
+       @echo ',("ld supports filelist", "$(LdHasFilelist)")' >> $@
+       @echo ',("ld is GNU ld", "$(LdIsGNULd)")' >> $@
+       @echo ',("ar command", "$(SettingsArCommand)")' >> $@
+       @echo ',("ar flags", "$(ArArgs)")' >> $@
+       @echo ',("ar supports at file", "$(ArSupportsAtFile)")' >> $@
+       @echo ',("ranlib command", "$(SettingsRanlibCommand)")' >> $@
+       @echo ',("touch command", "$(SettingsTouchCommand)")' >> $@
+       @echo ',("dllwrap command", "$(SettingsDllWrapCommand)")' >> $@
+       @echo ',("windres command", "$(SettingsWindresCommand)")' >> $@
+       @echo ',("libtool command", "$(SettingsLibtoolCommand)")' >> $@
+       @echo ',("cross compiling", "$(CrossCompiling)")' >> $@
+       @echo ',("target os", "$(HaskellTargetOs)")' >> $@
+       @echo ',("target arch", "$(HaskellTargetArch)")' >> $@
+       @echo ',("target word size", "$(TargetWordSize)")' >> $@
+       @echo ',("target has GNU nonexec stack", "$(HaskellHaveGnuNonexecStack)")' >> $@
+       @echo ',("target has .ident directive", "$(HaskellHaveIdentDirective)")' >> $@
+       @echo ',("target has subsections via symbols", "$(HaskellHaveSubsectionsViaSymbols)")' >> $@
+       @echo ',("target has RTS linker", "$(HaskellHaveRTSLinker)")' >> $@
+       @echo ',("Unregisterised", "$(Unregisterised)")' >> $@
+       @echo ',("LLVM llc command", "$(SettingsLlcCommand)")' >> $@
+       @echo ',("LLVM opt command", "$(SettingsOptCommand)")' >> $@
+       @echo ',("LLVM clang command", "$(SettingsClangCommand)")' >> $@
+       @echo ']' >> $@
+
+
 # ---------------------------------------------------------------------------
 # Make DerivedConstants.h for the compiler
 
index 79191af..6abf018 100644 (file)
@@ -488,6 +488,43 @@ endif
 GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@
 
 #-----------------------------------------------------------------------------
+# Settings
+
+# We are in the process of moving the settings file from being entirely
+# generated by configure, to generated being by the build system. Many of these
+# might become redundant.
+
+GccExtraViaCOpts = @GccExtraViaCOpts@
+LdHasFilelist = @LdHasFilelist@
+ArArgs = @ArArgs@
+HaskellTargetOs = @HaskellTargetOs@
+HaskellTargetArch = @HaskellTargetArch@
+TargetWordSize = @TargetWordSize@
+HaskellHaveGnuNonexecStack = @HaskellHaveGnuNonexecStack@
+HaskellHaveIdentDirective = @HaskellHaveIdentDirective@
+HaskellHaveSubsectionsViaSymbols = @HaskellHaveSubsectionsViaSymbols@
+HaskellHaveRTSLinker = @HaskellHaveRTSLinker@
+Unregisterised = @Unregisterised@
+
+SettingsCCompilerCommand = @SettingsCCompilerCommand@
+SettingsHaskellCPPCommand = @SettingsHaskellCPPCommand@
+SettingsHaskellCPPFlags = @SettingsHaskellCPPFlags@
+SettingsCCompilerFlags = @SettingsCCompilerFlags@
+SettingsCCompilerLinkFlags = @SettingsCCompilerLinkFlags@
+SettingsCCompilerSupportsNoPie = @SettingsCCompilerSupportsNoPie@
+SettingsLdCommand = @SettingsLdCommand@
+SettingsLdFlags = @SettingsLdFlags@
+SettingsArCommand = @SettingsArCommand@
+SettingsRanlibCommand = @SettingsRanlibCommand@
+SettingsDllWrapCommand = @SettingsDllWrapCommand@
+SettingsWindresCommand = @SettingsWindresCommand@
+SettingsLibtoolCommand = @SettingsLibtoolCommand@
+SettingsTouchCommand = @SettingsTouchCommand@
+SettingsClangCommand = @SettingsClangCommand@
+SettingsLlcCommand = @SettingsLlcCommand@
+SettingsOptCommand = @SettingsOptCommand@
+
+#-----------------------------------------------------------------------------
 # C compiler
 #
 # NB. Don't override $(CC) using build.mk,  re-configure using