Remove special casing of Windows in generic files
authorTamar Christina <tamar@zhox.com>
Tue, 31 May 2016 18:12:55 +0000 (20:12 +0200)
committerTamar Christina <tamar@zhox.com>
Thu, 9 Jun 2016 09:32:02 +0000 (11:32 +0200)
Summary:
Remove some Windows specific code from the .m4 files
and have configure figure it out.

Unfortunately touchy can't be removed since there
is no mingw build of coreutils. Only msys builds
which would give us a dependency on the msys runtime.

Reviewers: hvr, austin, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: thomie, erikd, #ghc_windows_task_force

Differential Revision: https://phabricator.haskell.org/D2248

aclocal.m4
configure.ac
utils/touchy/touchy.c

index dcc3448..cbf51df 100644 (file)
@@ -458,42 +458,55 @@ AC_DEFUN([GET_ARM_ISA],
 # Set the variables used in the settings file
 AC_DEFUN([FP_SETTINGS],
 [
 # Set the variables used in the settings file
 AC_DEFUN([FP_SETTINGS],
 [
-    if test "$windows" = YES
+    SettingsCCompilerCommand="$CC"
+    SettingsHaskellCPPCommand="$HaskellCPPCmd"
+    SettingsHaskellCPPFlags="$HaskellCPPArgs"
+    SettingsLdCommand="$LdCmd"
+    SettingsArCommand="$ArCmd"
+    SettingsPerlCommand="$PerlCmd"
+
+    if test -z "$DllWrap"
     then
     then
-        mingw_bin_prefix=mingw/bin/
-        SettingsCCompilerCommand="\$topdir/../${mingw_bin_prefix}gcc.exe"
-        SettingsHaskellCPPCommand="\$topdir/../${mingw_bin_prefix}gcc.exe"
-        SettingsHaskellCPPFlags="$HaskellCPPArgs"
-        SettingsLdCommand="\$topdir/../${mingw_bin_prefix}ld.exe"
-        SettingsArCommand="\$topdir/../${mingw_bin_prefix}ar.exe"
-        SettingsPerlCommand='$topdir/../perl/perl.exe'
-        SettingsDllWrapCommand="\$topdir/../${mingw_bin_prefix}dllwrap.exe"
-        SettingsWindresCommand="\$topdir/../${mingw_bin_prefix}windres.exe"
-        SettingsTouchCommand='$topdir/bin/touchy.exe'
-    else
-        SettingsCCompilerCommand="$CC"
-        SettingsHaskellCPPCommand="$HaskellCPPCmd"
-        SettingsHaskellCPPFlags="$HaskellCPPArgs"
-        SettingsLdCommand="$LdCmd"
-        SettingsArCommand="$ArCmd"
-        SettingsPerlCommand="$PerlCmd"
         SettingsDllWrapCommand="/bin/false"
         SettingsDllWrapCommand="/bin/false"
+    else
+        SettingsDllWrapCommand="$DllWrap"
+    fi
+
+    if test -z "$Windres"
+    then
         SettingsWindresCommand="/bin/false"
         SettingsWindresCommand="/bin/false"
+    else
+        SettingsWindresCommand="$Windres"
+    fi
+
+    if test -z "$Libtool"
+    then
         SettingsLibtoolCommand="libtool"
         SettingsLibtoolCommand="libtool"
+    else
+        SettingsLibtoolCommand="$Libtool"
+    fi
+
+    if test -z "$Touch"
+    then
         SettingsTouchCommand='touch'
         SettingsTouchCommand='touch'
+    else
+        SettingsTouchCommand='$Touch'
     fi
     fi
+
     if test -z "$LlcCmd"
     then
       SettingsLlcCommand="llc"
     else
       SettingsLlcCommand="$LlcCmd"
     fi
     if test -z "$LlcCmd"
     then
       SettingsLlcCommand="llc"
     else
       SettingsLlcCommand="$LlcCmd"
     fi
+
     if test -z "$OptCmd"
     then
       SettingsOptCommand="opt"
     else
       SettingsOptCommand="$OptCmd"
     fi
     if test -z "$OptCmd"
     then
       SettingsOptCommand="opt"
     else
       SettingsOptCommand="$OptCmd"
     fi
+
     SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2"
     SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2"
     SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2"
     SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2"
     SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2"
     SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2"
index 15561d0..d7eb738 100644 (file)
@@ -177,13 +177,9 @@ then
 
     if test "$ghc_host_os" = "mingw32"
     then
 
     if test "$ghc_host_os" = "mingw32"
     then
-        if test "${OSTYPE}" = "msys"
-        then
-            WithGhc=`echo "${WithGhc}" | sed "s#^/\([a-zA-Z]\)/#\1:/#"`
-        else
-            # Canonicalise to <drive>:/path/to/ghc
-            WithGhc=`cygpath -m "${WithGhc}"`
-        fi
+        # Canonicalise to <drive>:/path/to/ghc
+        WithGhc=`cygpath -m "${WithGhc}"`
+
         echo "GHC path canonicalised to: ${WithGhc}"
     fi
 fi
         echo "GHC path canonicalised to: ${WithGhc}"
     fi
 fi
@@ -366,6 +362,8 @@ then
     NM="${mingwbin}nm.exe"
     RANLIB="${mingwbin}ranlib.exe"
     OBJDUMP="${mingwbin}objdump.exe"
     NM="${mingwbin}nm.exe"
     RANLIB="${mingwbin}ranlib.exe"
     OBJDUMP="${mingwbin}objdump.exe"
+    Windres="${mingwbin}windres.exe"
+    DllWrap="${mingwbin}dllwrap.exe"
     fp_prog_ar="${mingwbin}ar.exe"
 
     # NB. Download the perl binaries if required
     fp_prog_ar="${mingwbin}ar.exe"
 
     # NB. Download the perl binaries if required
@@ -733,7 +731,6 @@ AC_SUBST(HaveDtrace)
 AC_PATH_PROG(HSCOLOUR,HsColour)
 # HsColour is passed to Cabal, so we need a native path
 if test "$HostOS"      = "mingw32" && \
 AC_PATH_PROG(HSCOLOUR,HsColour)
 # HsColour is passed to Cabal, so we need a native path
 if test "$HostOS"      = "mingw32" && \
-   test "${OSTYPE}"   != "msys"    && \
    test "${HSCOLOUR}" != ""
 then
     # Canonicalise to <drive>:/path/to/gcc
    test "${HSCOLOUR}" != ""
 then
     # Canonicalise to <drive>:/path/to/gcc
index 88ababa..dbcf712 100644 (file)
 #include <windows.h>
 
 /*
 #include <windows.h>
 
 /*
+touch is used by GHC both during building and during compilation of
+Haskell files. Unfortunately this means we need a 'touch' like program
+in the GHC bindist. Since touch is not standard on Windows and msys2
+doesn't include a mingw-w64 build of coreutils we need touchy for now.
+
 With Windows 7 in a virtual box VM on OS X, some very odd things happen
 with dates and time stamps when SSHing into cygwin. e.g. here the
 "Change" time is in the past:
 With Windows 7 in a virtual box VM on OS X, some very odd things happen
 with dates and time stamps when SSHing into cygwin. e.g. here the
 "Change" time is in the past: