diff --git a/configure.ac b/configure.ac index 5f07864..d02a94a 100644 --- a/configure.ac +++ b/configure.ac @@ -12,16 +12,21 @@ AC_PREREQ(2.53) # Find out what type of system we're running on AC_CANONICAL_BUILD -# This isn't right for cygwin. +Platform="$build_cpu-$build_vendor-$build_os" + +# This isn't right for msys mingw. PREFIX="$prefix" if test "$prefix" = "NONE" then - PREFIX="$ac_default_prefix" + if test "$build_os" = "cygwin" + then + PREFIX="c:/cygwin$ac_default_prefix" + else + PREFIX="$ac_default_prefix" + fi fi AC_SUBST(PREFIX) -Platform="$build_cpu-$build_vendor-$build_os" - case $Platform in powerpc-apple-darwin*) MACOSX=yes @@ -42,6 +47,14 @@ fi AC_SUBST(WHOLE_ARCHIVE_FLAG) AC_SUBST(LEADING_UNDERSCORE) +if test "$build_os" = "mingw32" +then + LEADING_UNDERSCORE=1 + SYMS="$SYMS -D__MINGW32__" +fi +AC_SUBST(LEADING_UNDERSCORE) +AC_SUBST(SYMS) + if test "$build_os" = "cygwin" then LEADING_UNDERSCORE=1 diff --git a/examples/makewith/global_pragma/Plugin.hs b/examples/makewith/global_pragma/Plugin.hs index 2c80e71..8e1530e 100644 --- a/examples/makewith/global_pragma/Plugin.hs +++ b/examples/makewith/global_pragma/Plugin.hs @@ -1,4 +1,4 @@ -{-# GLOBALOPTIONS -package posix #-} +{-# GLOBALOPTIONS -package mtl #-} module M ( resource ) where diff --git a/src/plugins/Plugins/Env.hs b/src/plugins/Plugins/Env.hs index 6c23675..74e4172 100644 --- a/src/plugins/Plugins/Env.hs +++ b/src/plugins/Plugins/Env.hs @@ -57,7 +57,7 @@ import Data.List ( isPrefixOf, nub ) import System.IO.Unsafe ( unsafePerformIO ) import System.Directory ( doesFileExist ) -#ifdef CYGWIN +#if defined(CYGWIN) || defined(__MINGW32__) import System.Environment ( getEnv ) import Control.Monad ( liftM ) @@ -310,7 +310,7 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p Nothing -> go fms q -- look in other pkgs Just package -> do -#ifdef CYGWIN +#if defined(CYGWIN) || defined(__MINGW32__) let libdirs = fix_topdir $ libraryDirs package #else let libdirs = libraryDirs package @@ -319,7 +319,7 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p extras = extraLibraries package deppkgs = packageDeps package libs <- mapM (findHSlib libdirs) (hslibs ++ extras) -#ifdef CYGWIN +#if defined(CYGWIN) || defined(__MINGW32__) syslibdir <- liftM ( \x -> x ++ "/SYSTEM") (getEnv "SYSTEMROOT") libs' <- mapM (findDLL $ syslibdir : libdirs) extras #else @@ -330,7 +330,7 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p -- anything about that. return (deppkgs, (filterJust libs,filterJust libs') ) -#ifdef CYGWIN +#if defined(CYGWIN) || defined(__MINGW32__) -- replace $topdir fix_topdir [] = [] fix_topdir (x:xs) = replace_topdir x : fix_topdir xs diff --git a/src/plugins/Plugins/MkTemp.hs b/src/plugins/Plugins/MkTemp.hs index 68f4f7f..523147b 100644 --- a/src/plugins/Plugins/MkTemp.hs +++ b/src/plugins/Plugins/MkTemp.hs @@ -42,7 +42,11 @@ import Control.Monad ( liftM ) import Control.Exception ( handleJust ) import System.Directory ( doesDirectoryExist, doesFileExist, createDirectory ) import System.IO +#ifndef __MINGW32__ import System.IO.Error ( isAlreadyExistsError ) +#else +import System.IO.Error ( isAlreadyExistsError, isAlreadyInUseError, isPermissionError ) +#endif import GHC.IOBase ( IOException(IOError), Exception(IOException),