first experimental MSYS (no cygwin) support

This commit is contained in:
shelarcy 2005-05-13 11:44:36 +00:00
parent df6e070281
commit 7aefa55fde
4 changed files with 26 additions and 9 deletions

View File

@ -12,16 +12,21 @@ AC_PREREQ(2.53)
# Find out what type of system we're running on # Find out what type of system we're running on
AC_CANONICAL_BUILD 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" PREFIX="$prefix"
if test "$prefix" = "NONE" if test "$prefix" = "NONE"
then then
if test "$build_os" = "cygwin"
then
PREFIX="c:/cygwin$ac_default_prefix"
else
PREFIX="$ac_default_prefix" PREFIX="$ac_default_prefix"
fi fi
fi
AC_SUBST(PREFIX) AC_SUBST(PREFIX)
Platform="$build_cpu-$build_vendor-$build_os"
case $Platform in case $Platform in
powerpc-apple-darwin*) powerpc-apple-darwin*)
MACOSX=yes MACOSX=yes
@ -42,6 +47,14 @@ fi
AC_SUBST(WHOLE_ARCHIVE_FLAG) AC_SUBST(WHOLE_ARCHIVE_FLAG)
AC_SUBST(LEADING_UNDERSCORE) 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" if test "$build_os" = "cygwin"
then then
LEADING_UNDERSCORE=1 LEADING_UNDERSCORE=1

View File

@ -1,4 +1,4 @@
{-# GLOBALOPTIONS -package posix #-} {-# GLOBALOPTIONS -package mtl #-}
module M ( resource ) where module M ( resource ) where

View File

@ -57,7 +57,7 @@ import Data.List ( isPrefixOf, nub )
import System.IO.Unsafe ( unsafePerformIO ) import System.IO.Unsafe ( unsafePerformIO )
import System.Directory ( doesFileExist ) import System.Directory ( doesFileExist )
#ifdef CYGWIN #if defined(CYGWIN) || defined(__MINGW32__)
import System.Environment ( getEnv ) import System.Environment ( getEnv )
import Control.Monad ( liftM ) import Control.Monad ( liftM )
@ -310,7 +310,7 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p
Nothing -> go fms q -- look in other pkgs Nothing -> go fms q -- look in other pkgs
Just package -> do Just package -> do
#ifdef CYGWIN #if defined(CYGWIN) || defined(__MINGW32__)
let libdirs = fix_topdir $ libraryDirs package let libdirs = fix_topdir $ libraryDirs package
#else #else
let libdirs = libraryDirs package let libdirs = libraryDirs package
@ -319,7 +319,7 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p
extras = extraLibraries package extras = extraLibraries package
deppkgs = packageDeps package deppkgs = packageDeps package
libs <- mapM (findHSlib libdirs) (hslibs ++ extras) libs <- mapM (findHSlib libdirs) (hslibs ++ extras)
#ifdef CYGWIN #if defined(CYGWIN) || defined(__MINGW32__)
syslibdir <- liftM ( \x -> x ++ "/SYSTEM") (getEnv "SYSTEMROOT") syslibdir <- liftM ( \x -> x ++ "/SYSTEM") (getEnv "SYSTEMROOT")
libs' <- mapM (findDLL $ syslibdir : libdirs) extras libs' <- mapM (findDLL $ syslibdir : libdirs) extras
#else #else
@ -330,7 +330,7 @@ lookupPkg' p = withPkgEnvs env $ \fms -> go fms p
-- anything about that. -- anything about that.
return (deppkgs, (filterJust libs,filterJust libs') ) return (deppkgs, (filterJust libs,filterJust libs') )
#ifdef CYGWIN #if defined(CYGWIN) || defined(__MINGW32__)
-- replace $topdir -- replace $topdir
fix_topdir [] = [] fix_topdir [] = []
fix_topdir (x:xs) = replace_topdir x : fix_topdir xs fix_topdir (x:xs) = replace_topdir x : fix_topdir xs

View File

@ -42,7 +42,11 @@ import Control.Monad ( liftM )
import Control.Exception ( handleJust ) import Control.Exception ( handleJust )
import System.Directory ( doesDirectoryExist, doesFileExist, createDirectory ) import System.Directory ( doesDirectoryExist, doesFileExist, createDirectory )
import System.IO import System.IO
#ifndef __MINGW32__
import System.IO.Error ( isAlreadyExistsError ) import System.IO.Error ( isAlreadyExistsError )
#else
import System.IO.Error ( isAlreadyExistsError, isAlreadyInUseError, isPermissionError )
#endif
import GHC.IOBase ( IOException(IOError), import GHC.IOBase ( IOException(IOError),
Exception(IOException), Exception(IOException),