[Git][ghc/ghc][wip/andreask/cygpath] configure: Record cygpath path for use by hls
Andreas Klebinger pushed to branch wip/andreask/cygpath at Glasgow Haskell Compiler / GHC Commits: 16ca0e80 by Andreas Klebinger at 2026-01-15T15:28:11+01:00 configure: Record cygpath path for use by hls Fixes #26683 The M4 macro was initially created by Copilot but then heavily modified by me. - - - - - 5 changed files: - configure.ac - hadrian/cfg/system.config.in - hadrian/src/Builder.hs - hadrian/src/Hadrian/Oracles/Path.hs - + m4/fp_prog_cygpath.m4 Changes: ===================================== configure.ac ===================================== @@ -833,6 +833,9 @@ dnl ** check for installed alex binary + version AC_ARG_VAR(ALEX,[Use as the path to alex [default=autodetect]]) FPTOOLS_ALEX +dnl ** check for cygpath on windows +FP_PROG_CYGPATH + dnl -------------------------------------------------- dnl ### program checking section ends here ### dnl -------------------------------------------------- ===================================== hadrian/cfg/system.config.in ===================================== @@ -23,6 +23,7 @@ makeinfo = @MAKEINFO@ bourne-shell = @SH@ git = @GIT@ cabal = @CABAL@ +cygpath = @CYGPATH@ # Python 3 is required to run test driver. # See: https://github.com/ghc/ghc/blob/master/testsuite/mk/boilerplate.mk#L220 ===================================== hadrian/src/Builder.hs ===================================== @@ -163,6 +163,7 @@ data Builder = Alex | Cabal ConfigurationInfo Stage | Cc CcMode Stage | Configure FilePath + | Cygpath | DeriveConstants | GenApply (Maybe Int) -- ^ vector size, or Nothing for non-vectors | GenPrimopCode ===================================== hadrian/src/Hadrian/Oracles/Path.hs ===================================== @@ -13,6 +13,8 @@ import System.Directory import System.Info.Extra import Hadrian.Utilities +import Hadrian.Oracles.TextFile +import Base -- | Lookup a specified 'FilePath' in the system @PATH@. lookupInPath :: FilePath -> Action FilePath @@ -45,7 +47,8 @@ type instance RuleResult WindowsPath = String pathOracle :: Rules () pathOracle = do void $ addOracleCache $ \(WindowsPath path) -> do - Stdout out <- quietly $ cmd ["cygpath", "-m", path] + cygpath <- fromMaybe (error "cygpath not set by configure") <$> lookupValue configFile "cygpath" + Stdout out <- quietly $ cmd [cygpath, "-m", path] let windowsPath = unifyPath $ dropWhileEnd isSpace out putVerbose $ "| Windows path mapping: " ++ path ++ " => " ++ windowsPath return windowsPath ===================================== m4/fp_prog_cygpath.m4 ===================================== @@ -0,0 +1,20 @@ +# FP_PROG_CYGPATH +# ---------------- +# Record cygpath path for later use by hls on windows. +AC_DEFUN([FP_PROG_CYGPATH], +[ + if test "$HostOS" == "mingw32"; then + AC_PATH_PROG([CYGPATH_POSIX], [cygpath]) + + if test -z "$CYGPATH_POSIX"; then + AC_MSG_ERROR([cygpath not found; Windows path conversion unavailable]) + CYGPATH="" + else + # Convert the POSIX path of the cygpath executable into a Windows path + CYGPATH=`"$CYGPATH_POSIX" -m "$CYGPATH_POSIX"` + AC_MSG_RESULT([using cygpath at $CYGPATH]) + fi + + AC_SUBST([CYGPATH]) + fi +]) \ No newline at end of file View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16ca0e80a54f57d2d85c8bef3c473e32... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16ca0e80a54f57d2d85c8bef3c473e32... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Andreas Klebinger (@AndreasK)