[project @ 2001-05-03 09:02:24 by simonpj]
[ghc-hetmet.git] / ghc / utils / hsc2hs / KludgedSystem.hs
index 04bbd73..4036df6 100644 (file)
@@ -1,11 +1,11 @@
 {-# OPTIONS -cpp -fglasgow-exts #-}
 -----------------------------------------------------------------------------
--- $Id: KludgedSystem.hs,v 1.2 2001/02/13 15:53:10 qrczak Exp $
+-- $Id: KludgedSystem.hs,v 1.6 2001/04/02 16:10:05 rrt Exp $
 
 -- system that works feasibly under Windows (i.e. passes the command line to sh,
 -- because system() under Windows doesn't look at SHELL, and always uses CMD.EXE)
 
-module KludgedSystem (system, defaultCompiler) where
+module KludgedSystem (system, defaultCompiler, progNameSuffix) where
 
 #include "../../includes/config.h"
 
@@ -15,6 +15,7 @@ import System (system)
 
 defaultCompiler :: String
 defaultCompiler = "gcc"
+progNameSuffix = ""
 
 #else
 
@@ -22,17 +23,19 @@ import qualified System
 import System    (ExitCode)
 import IO        (bracket_)
 import Directory (removeFile)
+import Config
 
 system :: String -> IO ExitCode
 system cmd = do
     pid <- getProcessID
-    let tmp = "/tmp/sh"++show pid
+    let tmp = cDEFAULT_TMPDIR++"/sh"++show pid
     writeFile tmp (cmd++"\n")
     bracket_ (return tmp) removeFile $ System.system ("sh - "++tmp)
 
 foreign import "_getpid" unsafe getProcessID :: IO Int
 
 defaultCompiler :: String
-defaultCompiler = "gcc -mno-cygwin"
+defaultCompiler = "gcc -mno-cygwin -mwin32"
+progNameSuffix = ".exe"
 
 #endif /* mingw32_TARGET_OS */