summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-03-23 15:53:06 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-17 00:25:02 -0400
commitfb579e15c56994bc6c4cc266535024f20a81f830 (patch)
treecceee15e84d67bdbbe6eced0a4e89449a416bcc4 /hadrian
parent8dfea0789957278b99bf302dfb24078fff84b6d2 (diff)
downloadhaskell-fb579e15c56994bc6c4cc266535024f20a81f830.tar.gz
driver: Introduce pgmcxx
Here we introduce proper support for compilation of C++ objects. This includes: * logic in `configure` to detect the C++ toolchain and propagating this information into the `settings` file * logic in the driver to use the C++ toolchain when compiling C++ sources
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/bindist/Makefile1
-rw-r--r--hadrian/cfg/system.config.in1
-rw-r--r--hadrian/doc/user-settings.md1
-rw-r--r--hadrian/src/Oracles/Setting.hs2
-rw-r--r--hadrian/src/Rules/Generate.hs1
5 files changed, 6 insertions, 0 deletions
diff --git a/hadrian/bindist/Makefile b/hadrian/bindist/Makefile
index dbed7a0502..6b2e1f8754 100644
--- a/hadrian/bindist/Makefile
+++ b/hadrian/bindist/Makefile
@@ -105,6 +105,7 @@ lib/settings :
@echo '[("GCC extra via C opts", "$(GccExtraViaCOpts)")' >> $@
@echo ',("C compiler command", "$(SettingsCCompilerCommand)")' >> $@
@echo ',("C compiler flags", "$(SettingsCCompilerFlags)")' >> $@
+ @echo ',("C++ compiler command", "$(SettingsCxxCompilerCommand)")' >> $@
@echo ',("C++ compiler flags", "$(SettingsCxxCompilerFlags)")' >> $@
@echo ',("C compiler link flags", "$(SettingsCCompilerLinkFlags)")' >> $@
@echo ',("C compiler supports -no-pie", "$(SettingsCCompilerSupportsNoPie)")' >> $@
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in
index ae70823202..385279a435 100644
--- a/hadrian/cfg/system.config.in
+++ b/hadrian/cfg/system.config.in
@@ -142,6 +142,7 @@ ld-is-gnu-ld = @LdIsGNULd@
ar-args = @ArArgs@
settings-c-compiler-command = @SettingsCCompilerCommand@
+settings-cxx-compiler-command = @SettingsCxxCompilerCommand@
settings-haskell-cpp-command = @SettingsHaskellCPPCommand@
settings-haskell-cpp-flags = @SettingsHaskellCPPFlags@
settings-c-compiler-flags = @SettingsCCompilerFlags@
diff --git a/hadrian/doc/user-settings.md b/hadrian/doc/user-settings.md
index 82f9964ac6..7b304ec0f3 100644
--- a/hadrian/doc/user-settings.md
+++ b/hadrian/doc/user-settings.md
@@ -369,6 +369,7 @@ the right names for them:
argument for `hadrian/ghci` to work
* `cc` refers to C compiler commands
+ * `cxx` refers to C++ compiler commands
* `c.opts` for commands that call the C compiler on some C files
* `deps.opts` for commands that call the C compiler for figuring out
diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs
index 6ce01327c5..62a1ebcd67 100644
--- a/hadrian/src/Oracles/Setting.hs
+++ b/hadrian/src/Oracles/Setting.hs
@@ -106,6 +106,7 @@ data SettingList = ConfCcArgs Stage
-- Eventually much of that local can probably be computed just in Hadrian.
data SettingsFileSetting
= SettingsFileSetting_CCompilerCommand
+ | SettingsFileSetting_CxxCompilerCommand
| SettingsFileSetting_HaskellCPPCommand
| SettingsFileSetting_HaskellCPPFlags
| SettingsFileSetting_CCompilerFlags
@@ -198,6 +199,7 @@ settingList key = fmap words $ lookupSystemConfig $ case key of
settingsFileSetting :: SettingsFileSetting -> Action String
settingsFileSetting key = lookupSystemConfig $ case key of
SettingsFileSetting_CCompilerCommand -> "settings-c-compiler-command"
+ SettingsFileSetting_CxxCompilerCommand -> "settings-cxx-compiler-command"
SettingsFileSetting_HaskellCPPCommand -> "settings-haskell-cpp-command"
SettingsFileSetting_HaskellCPPFlags -> "settings-haskell-cpp-flags"
SettingsFileSetting_CCompilerFlags -> "settings-c-compiler-flags"
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index 5653bd1d25..1cd95d7961 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -298,6 +298,7 @@ generateSettings = do
[ ("GCC extra via C opts", expr $ lookupSystemConfig "gcc-extra-via-c-opts")
, ("C compiler command", expr $ settingsFileSetting SettingsFileSetting_CCompilerCommand)
, ("C compiler flags", expr $ settingsFileSetting SettingsFileSetting_CCompilerFlags)
+ , ("C++ compiler command", expr $ settingsFileSetting SettingsFileSetting_CxxCompilerCommand)
, ("C++ compiler flags", expr $ settingsFileSetting SettingsFileSetting_CxxCompilerFlags)
, ("C compiler link flags", expr $ settingsFileSetting SettingsFileSetting_CCompilerLinkFlags)
, ("C compiler supports -no-pie", expr $ settingsFileSetting SettingsFileSetting_CCompilerSupportsNoPie)