summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlp Mestanogullari <alpmestan@gmail.com>2019-02-26 11:21:55 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-03-03 19:35:18 -0500
commitf77229e3c30fa9e353c061dc038a5d0b2ee01c48 (patch)
tree3bf1185a553b474be1539e040b2715edb0bed669
parent1285d6b95fbae7858abbc4722bc2301d7fe40425 (diff)
downloadhaskell-f77229e3c30fa9e353c061dc038a5d0b2ee01c48.tar.gz
detect 'autoreconf' path during configure, and use it in hadrian
-rw-r--r--configure.ac3
-rw-r--r--hadrian/cfg/system.config.in2
-rw-r--r--hadrian/src/Builder.hs14
3 files changed, 17 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index e5ea0912cc..1aae46526e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -817,6 +817,9 @@ dnl ** check for patch
dnl if GNU patch is named gpatch, look for it first
AC_PATH_PROGS(PatchCmd,gpatch patch, patch)
+dnl ** check for autoreconf
+AC_PATH_PROG(AutoreconfCmd, autoreconf, autoreconf)
+
dnl ** check for dtrace (currently only implemented for Mac OS X)
AC_ARG_ENABLE(dtrace,
[AC_HELP_STRING([--enable-dtrace],
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in
index 7b92b29a6d..4cae2b6783 100644
--- a/hadrian/cfg/system.config.in
+++ b/hadrian/cfg/system.config.in
@@ -7,7 +7,7 @@
alex = @AlexCmd@
ar = @ArCmd@
-autoreconf = autoreconf
+autoreconf = @AutoreconfCmd@
cc = @CC@
happy = @HappyCmd@
hs-cpp = @HaskellCPPCmd@
diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs
index 02edb199d3..38d21b3fdd 100644
--- a/hadrian/src/Builder.hs
+++ b/hadrian/src/Builder.hs
@@ -288,7 +288,7 @@ systemBuilderPath builder = case builder of
Alex -> fromKey "alex"
Ar _ Stage0 -> fromKey "system-ar"
Ar _ _ -> fromKey "ar"
- Autoreconf _ -> fromKey "autoreconf"
+ Autoreconf _ -> stripExe =<< fromKey "autoreconf"
Cc _ Stage0 -> fromKey "system-cc"
Cc _ _ -> fromKey "cc"
-- We can't ask configure for the path to configure!
@@ -329,6 +329,18 @@ systemBuilderPath builder = case builder of
(True , True ) -> fixAbsolutePathOnWindows fullPath
(True , False) -> fixAbsolutePathOnWindows fullPath <&> (<.> exe)
+ -- Without this function, on Windows we can observe a bad builder path
+ -- for 'autoreconf'. If the relevant system.config field is set to
+ -- /usr/bin/autoreconf in the file, the path that we read
+ -- is C:/msys64/usr/bin/autoreconf.exe. A standard msys2 set up happens
+ -- to have an executable named 'autoreconf' there, without the 'exe'
+ -- extension. Hence this function.
+ stripExe s = do
+ let sNoExt = dropExtension s
+ exists <- doesFileExist s
+ if exists then return s else return sNoExt
+
+
-- | Was the path to a given system 'Builder' specified in configuration files?
isSpecified :: Builder -> Action Bool
isSpecified = fmap (not . null) . systemBuilderPath