From: rrt Date: Tue, 7 Aug 2001 08:16:48 +0000 (+0000) Subject: [project @ 2001-08-07 08:16:48 by rrt] X-Git-Tag: Approximately_9120_patches~1353 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=722e459569c6891fc9408221d9b0eb9d9cf48430;p=ghc-hetmet.git [project @ 2001-08-07 08:16:48 by rrt] Revert to System.system using the shell, hence need to use new rawSystem on Windows to launch GHC's sub-processes. --- diff --git a/ghc/compiler/Makefile b/ghc/compiler/Makefile index 054a97a..dea298a 100644 --- a/ghc/compiler/Makefile +++ b/ghc/compiler/Makefile @@ -1,5 +1,5 @@ # ----------------------------------------------------------------------------- -# $Id: Makefile,v 1.181 2001/08/04 06:19:54 ken Exp $ +# $Id: Makefile,v 1.182 2001/08/07 08:16:48 rrt Exp $ TOP = .. include $(TOP)/mk/boilerplate.mk @@ -113,6 +113,7 @@ compiling_with_4xx=NO else bootstrapped = $(shell if (test $(CANON_HC_VERSION) -ge $(ProjectVersionInt)0); then echo YES; else echo NO; fi) compiling_with_4xx = $(shell if (test $(CANON_HC_VERSION) -lt 5000); then echo YES; else echo NO; fi) +ghc_502_at_least = $(shell if (test $(CANON_HC_VERSION) -ge 5020); then echo YES; else echo NO; fi) endif # Only include GHCi if we're bootstrapping with at least version 411 @@ -126,26 +127,27 @@ endif # Enable code that assumes a MSDOSish subshell. See mk/config.mk.in # for explanatory comment as to what this does. ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" -ghc_501_at_least = $(shell if (test $(CANON_HC_VERSION) -gt 5000); then echo YES; else echo NO; fi) +ghc_501_at_least = $(shell if (test $(CANON_HC_VERSION) -ge 5010); then echo YES; else echo NO; fi) # ----------------------------------------------- -# GHCi calls the C procedure 'system', but alas GHC 4.08's -# implementation of this (in the library System) didn't work -# properly on Windows. Everything is fine if you are compiling -# GHC with GHC 5.01 or better, but lacking that we have the following +# GHCi calls the C procedure 'rawSystem'; but alas GHC 4.08 +# does not have this. Everything is fine if you are compiling +# GHC with GHC 5.02 or better, but lacking that we have the following # hack: -# copy system.c from lib/std (where it is correct) -# into main/system.c (where it'll be compiled and -# linked with the compiler) +# copy rawSystem.c from hslibs/lang/cbits +# and SystemExts.lhs from hslibs/lang +# into main/ (where they'll be compiled and linked with the compiler) -ifneq "$(ghc_501_at_least)" "YES" -C_SRCS += main/system.c +ifneq "$(ghc_502_at_least)" "YES" +C_SRCS += main/rawSystem.c +HS_SRCS += main/SystemExts.lhs SRC_CC_OPTS += -I$(GHC_LIB_DIR)/std/cbits SRC_MKDEPENDC_OPTS += -I$(GHC_LIB_DIR)/std/cbits -HS_OBJS += main/system.o - -main/system.c : ../lib/std/cbits/system.c - $(CP) ../lib/std/cbits/system.c main +HS_OBJS += main/rawSystem.o +main/rawSystem.c : $(FPTOOLS_TOP)/hslibs/lang/cbits/rawSystem.c + $(CP) $< main +main/SystemExts.lhs: $(FPTOOLS_TOP)/hslibs/lang/SystemExts.lhs + $(CP) $< main endif endif # End of system hack diff --git a/ghc/compiler/main/SysTools.lhs b/ghc/compiler/main/SysTools.lhs index efcb634..a0b47b9 100644 --- a/ghc/compiler/main/SysTools.lhs +++ b/ghc/compiler/main/SysTools.lhs @@ -17,9 +17,9 @@ module SysTools ( -- Where package.conf is -- Interface to system tools - runUnlit, runCpp, runCc, -- [String] -> IO () - runMangle, runSplit, -- [String] -> IO () - runAs, runLink, -- [String] -> IO () + runUnlit, runCpp, runCc,-- [String] -> IO () + runMangle, runSplit, -- [String] -> IO () + runAs, runLink, -- [String] -> IO () runMkDLL, touch, -- String -> String -> IO () @@ -34,7 +34,7 @@ module SysTools ( -- System interface getProcessID, -- IO Int - system, -- String -> IO Int + system, -- String -> IO ExitCode -- Misc showGhcUsage, -- IO () Shows usage message and exits @@ -54,18 +54,19 @@ import IO import Directory ( doesFileExist, removeFile ) import IOExts ( IORef, readIORef, writeIORef ) import Monad ( when, unless ) -import System ( system, ExitCode(..), exitWith, getEnv ) +import System ( ExitCode(..), exitWith, getEnv, system ) import CString import Int import Addr #include "../includes/config.h" -#if !defined(mingw32_TARGET_OS) +#ifndef mingw32_TARGET_OS import qualified Posix #else import List ( isPrefixOf ) import MarshalArray +import SystemExts ( rawSystem ) #endif #include "HsVersions.h" @@ -553,7 +554,12 @@ runSomething :: String -- For -v message runSomething phase_name pgm args = traceCmd phase_name cmd_line $ - do { exit_code <- system cmd_line + do { +#ifndef mingw32_TARGET_OS + exit_code <- system cmd_line +#else + exit_code <- rawSystem cmd_line +#endif ; if exit_code /= ExitSuccess then throwDyn (PhaseFailed phase_name exit_code) else return ()