reduce dependency on ghcconfig.h
authorRoss Paterson <ross@soi.city.ac.uk>
Fri, 11 Aug 2006 12:40:30 +0000 (12:40 +0000)
committerRoss Paterson <ross@soi.city.ac.uk>
Fri, 11 Aug 2006 12:40:30 +0000 (12:40 +0000)
The only remaining use is in cbits/dirUtils.h, which tests solaris2_HOST_OS

(Also System.Info uses ghcplatform.h and several modules import MachDeps.h
to get SIZEOF_* and ALIGNMENT_* from ghcautoconf.h)

cbits/consUtils.c
cbits/dirUtils.c
cbits/execvpe.c
cbits/inputReady.c
cbits/lockFile.c
cbits/runProcess.c
cbits/timeUtils.c
configure.ac
include/HsBase.h
package.conf.in

index e0294b2..7c50c7b 100644 (file)
@@ -3,15 +3,14 @@
  *
  * Win32 Console API support
  */
-#include "ghcconfig.h"
-#if defined(mingw32_HOST_OS) || defined(cygwin32_HOST_OS) || defined(__MINGW32__) || defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) || defined(__CYGWIN__)
 /* to the end */
 
 #include "consUtils.h"
 #include <windows.h>
 #include <io.h>
 
-#if defined(cygwin32_HOST_OS)
+#if defined(__CYGWIN__)
 #define _get_osfhandle get_osfhandle
 #endif
 
@@ -86,4 +85,4 @@ flush_input_console__(int fd)
     return -1;
 }
 
-#endif /* defined(mingw32_HOST_OS) || ... */
+#endif /* defined(__MINGW32__) || ... */
index 1e981d3..85aa0dc 100644 (file)
@@ -4,6 +4,7 @@
  * Directory Runtime Support
  */
 
+/* needed only for solaris2_HOST_OS */
 #include "ghcconfig.h"
 
 // The following is required on Solaris to force the POSIX versions of
@@ -14,7 +15,7 @@
 
 #include "HsBase.h"
 
-#if defined(mingw32_HOST_OS) || defined(__MINGW32__) || defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
 #include <windows.h>
 
 static
@@ -117,7 +118,7 @@ HsInt
 __hscore_renameFile( HsAddr src,
                     HsAddr dest)
 {
-#if defined(mingw32_HOST_OS) || defined(__MINGW32__) || defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
     static int forNT = -1;
     
     /* ToDo: propagate error codes back */
@@ -179,7 +180,7 @@ __hscore_renameFile( HsAddr src,
  * that have shell32's lacking that particular API.
  *
  */
-#if defined(mingw32_HOST_OS) || defined(__MINGW32__) || defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
 typedef HRESULT (*HSCORE_GETAPPFOLDERFUNTY)(HWND,int,HANDLE,DWORD,char*);
 int
 __hscore_getFolderPath(HWND hwndOwner,
index 2234f09..eb24bd3 100644 (file)
@@ -5,7 +5,7 @@
    -------------------------------------------------------------------------- */
 #include "HsBase.h"
 
-#if !defined(mingw32_HOST_OS) /* to the end */
+#if !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)) /* to the end */
 
 /* Evidently non-Posix. */
 /* #include "PosixSource.h" */
index 2949e94..f827fe5 100644 (file)
@@ -17,10 +17,10 @@ int
 inputReady(int fd, int msecs, int isSock)
 {
     if 
-#ifndef mingw32_HOST_OS
-    ( 1 ) {
-#else
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
     ( isSock ) {
+#else
+    ( 1 ) {
 #endif
        int maxfd, ready;
        fd_set rfd;
@@ -45,7 +45,7 @@ inputReady(int fd, int msecs, int isSock)
        /* 1 => Input ready, 0 => not ready, -1 => error */
        return (ready);
     }
-#ifdef mingw32_HOST_OS
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
     else {
        DWORD rc;
        HANDLE hFile = (HANDLE)_get_osfhandle(fd);
index bf0a0f0..721246b 100644 (file)
@@ -6,7 +6,7 @@
  * stdin/stout/stderr Runtime Support
  */
 
-#ifndef mingw32_HOST_OS
+#if !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32))
 
 #include "HsBase.h"
 #include "Rts.h"
index b89e130..39597b7 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "HsBase.h"
 
-#if defined(mingw32_HOST_OS)
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
 #include <windows.h>
 #include <stdlib.h>
 #endif
@@ -23,7 +23,7 @@
 #include <signal.h>
 #endif
 
-#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+#if !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32))
 /* ----------------------------------------------------------------------------
    UNIX versions
    ------------------------------------------------------------------------- */
index eb7df20..31cfacb 100644 (file)
@@ -5,7 +5,7 @@
  */
 #include "HsBase.h"
 
-#if defined(mingw32_HOST_OS) /* to the end */
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) /* to the end */
 
 HsAddr __hscore_timezone( void )
 { return (HsAddr)&_timezone; }
index e91432f..72c1d9c 100644 (file)
@@ -8,8 +8,17 @@ AC_CONFIG_HEADERS([include/HsBaseConfig.h])
 # do we have long longs?
 AC_CHECK_TYPES([long long])
 
+dnl ** Working vfork?
+AC_FUNC_FORK
+
+dnl ** determine whether or not const works
+AC_C_CONST
+
+dnl ** check for full ANSI header (.h) files
+AC_HEADER_STDC
+
 # check for specific header (.h) files that we are interested in
-AC_CHECK_HEADERS([ctype.h fcntl.h signal.h sys/resource.h termios.h time.h])
+AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h limits.h signal.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h time.h utime.h windows.h winsock.h])
 
 # Enable large file support. Do this before testing the types ino_t, off_t, and
 # rlim_t, because it will affect the result of that test.
@@ -26,7 +35,7 @@ dnl functions if it's really there.
 AC_CHECK_HEADERS([wctype.h], [AC_CHECK_FUNCS(iswspace)])
 
 AC_CHECK_FUNCS([ftime gmtime_r localtime_r lstat readdir_r])
-
+AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer times])
 AC_CHECK_FUNCS([_chsize ftruncate])
 
 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
index 2e101dd..cde88cb 100644 (file)
@@ -9,8 +9,6 @@
 #ifndef __HSBASE_H__
 #define __HSBASE_H__
 
-#include "ghcconfig.h"
-
 #include "HsBaseConfig.h"
 
 /* ultra-evil... */
index 700d9a8..447345a 100644 (file)
@@ -1,5 +1,3 @@
-#include "ghcconfig.h"
-
 name:          PACKAGE
 version:       VERSION
 license:       BSD3
@@ -183,7 +181,7 @@ library-dirs:       LIB_DIR
 hs-libraries:   "HSbase"
 
 extra-libraries:  "HSbase_cbits"
-#if defined(mingw32_HOST_OS) || defined(__MINGW32__) || defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
             , "wsock32", "msvcrt", "kernel32", "user32", "shell32"
 #endif