{-# 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"
defaultCompiler :: String
defaultCompiler = "gcc"
+progNameSuffix = ""
#else
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 */