Merge branch 'rj/cygwin-msvc'
authorJunio C Hamano <gitster@pobox.com>
Sat, 21 Nov 2009 07:48:11 +0000 (23:48 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 21 Nov 2009 07:48:11 +0000 (23:48 -0800)
* rj/cygwin-msvc:
MSVC: Add support for building with NO_MMAP
Makefile: keep MSVC and Cygwin configuration separate

Makefile
compat/mingw.c
compat/mingw.h
compat/win32mmap.c
index 7b8d11d118c7b17213014caee4b50a3d0ce19995..4e596dcd0bfe01c2d325a02ac5d7b39b67df2912 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -216,6 +216,12 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
 uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
 uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
 
+ifdef MSVC
+       # avoid the MingW and Cygwin configuration sections
+       uname_S := Windows
+       uname_O := Windows
+endif
+
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
 CFLAGS = -g -O2 -Wall
@@ -900,7 +906,7 @@ ifeq ($(uname_S),HP-UX)
        NO_SYS_SELECT_H = YesPlease
        SNPRINTF_RETURNS_BOGUS = YesPlease
 endif
-ifdef MSVC
+ifeq ($(uname_S),Windows)
        GIT_VERSION := $(GIT_VERSION).MSVC
        pathsep = ;
        NO_PREAD = YesPlease
@@ -953,7 +959,7 @@ else
        BASIC_CFLAGS += -Zi -MTd
 endif
        X = .exe
-else
+endif
 ifneq (,$(findstring MINGW,$(uname_S)))
        pathsep = ;
        NO_PREAD = YesPlease
@@ -1003,7 +1009,6 @@ else
        NO_PTHREADS = YesPlease
 endif
 endif
-endif
 
 -include config.mak.autogen
 -include config.mak
index 6b5b5b2c7011a89c0415ebb89406c4a3ac53e9a9..15fe33eaa0f220e94131006bca89effd14d6d058 100644 (file)
@@ -1000,6 +1000,18 @@ int mingw_rename(const char *pold, const char *pnew)
        return -1;
 }
 
+/*
+ * Note that this doesn't return the actual pagesize, but
+ * the allocation granularity. If future Windows specific git code
+ * needs the real getpagesize function, we need to find another solution.
+ */
+int mingw_getpagesize(void)
+{
+       SYSTEM_INFO si;
+       GetSystemInfo(&si);
+       return si.dwAllocationGranularity;
+}
+
 struct passwd *getpwuid(int uid)
 {
        static char user_name[100];
index 6907345f90128eb20c1ca0a81c452af775877b4b..51993ef114b4743267fc7b922dcae68345d2fd0a 100644 (file)
@@ -187,7 +187,7 @@ int mingw_connect(int sockfd, struct sockaddr *sa, size_t sz);
 int mingw_rename(const char*, const char*);
 #define rename mingw_rename
 
-#ifdef USE_WIN32_MMAP
+#if defined(USE_WIN32_MMAP) || defined(_MSC_VER)
 int mingw_getpagesize(void);
 #define getpagesize mingw_getpagesize
 #endif
index 779d796cd5f017d4effbede360185a4690cf414e..1c5a14922f255af2c3b0e75e06925b748d3d7684 100644 (file)
@@ -1,17 +1,5 @@
 #include "../git-compat-util.h"
 
-/*
- * Note that this doesn't return the actual pagesize, but
- * the allocation granularity. If future Windows specific git code
- * needs the real getpagesize function, we need to find another solution.
- */
-int mingw_getpagesize(void)
-{
-       SYSTEM_INFO si;
-       GetSystemInfo(&si);
-       return si.dwAllocationGranularity;
-}
-
 void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
 {
        HANDLE hmap;