From: Ross Paterson Date: Fri, 11 Aug 2006 12:40:30 +0000 (+0000) Subject: reduce dependency on ghcconfig.h X-Git-Url: http://git.megacz.com/?p=ghc-base.git;a=commitdiff_plain;h=39a5ea109fa64862651574cb25e1c2b0c792c95d reduce dependency on ghcconfig.h 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) --- diff --git a/cbits/consUtils.c b/cbits/consUtils.c index e0294b2..7c50c7b 100644 --- a/cbits/consUtils.c +++ b/cbits/consUtils.c @@ -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 #include -#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__) || ... */ diff --git a/cbits/dirUtils.c b/cbits/dirUtils.c index 1e981d3..85aa0dc 100644 --- a/cbits/dirUtils.c +++ b/cbits/dirUtils.c @@ -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 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, diff --git a/cbits/execvpe.c b/cbits/execvpe.c index 2234f09..eb24bd3 100644 --- a/cbits/execvpe.c +++ b/cbits/execvpe.c @@ -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" */ diff --git a/cbits/inputReady.c b/cbits/inputReady.c index 2949e94..f827fe5 100644 --- a/cbits/inputReady.c +++ b/cbits/inputReady.c @@ -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); diff --git a/cbits/lockFile.c b/cbits/lockFile.c index bf0a0f0..721246b 100644 --- a/cbits/lockFile.c +++ b/cbits/lockFile.c @@ -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" diff --git a/cbits/runProcess.c b/cbits/runProcess.c index b89e130..39597b7 100644 --- a/cbits/runProcess.c +++ b/cbits/runProcess.c @@ -6,7 +6,7 @@ #include "HsBase.h" -#if defined(mingw32_HOST_OS) +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) #include #include #endif @@ -23,7 +23,7 @@ #include #endif -#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__) +#if !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)) /* ---------------------------------------------------------------------------- UNIX versions ------------------------------------------------------------------------- */ diff --git a/cbits/timeUtils.c b/cbits/timeUtils.c index eb7df20..31cfacb 100644 --- a/cbits/timeUtils.c +++ b/cbits/timeUtils.c @@ -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; } diff --git a/configure.ac b/configure.ac index e91432f..72c1d9c 100644 --- a/configure.ac +++ b/configure.ac @@ -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 and diff --git a/include/HsBase.h b/include/HsBase.h index 2e101dd..cde88cb 100644 --- a/include/HsBase.h +++ b/include/HsBase.h @@ -9,8 +9,6 @@ #ifndef __HSBASE_H__ #define __HSBASE_H__ -#include "ghcconfig.h" - #include "HsBaseConfig.h" /* ultra-evil... */ diff --git a/package.conf.in b/package.conf.in index 700d9a8..447345a 100644 --- a/package.conf.in +++ b/package.conf.in @@ -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