* builds/win32/detect.mk: Corrected logic that detects Windows NT to use the previous change even when win32 is forced. Corrected detection of win32 on Win9X.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
diff --git a/builds/win32/detect.mk b/builds/win32/detect.mk
index 7f55e2c..a7de659 100644
--- a/builds/win32/detect.mk
+++ b/builds/win32/detect.mk
@@ -19,34 +19,47 @@
ifeq ($(PLATFORM),ansi)
# Detecting Windows NT is easy, as the OS variable must be defined and
- # contains `Windows_NT'. This also works with W2K, XP, and Windows 98.
+ # contains `Windows_NT'. This also works with Windows 2000, XP.
#
ifeq ($(OS),Windows_NT)
- is_windows := 1
-
- # We have to use the shell for copying files to preserve the case of
- # file names. Without this, we get a `CONFIG.MK' file which isn't
- # found later on by `make'.
- COPY := cmd.exe /c copy
+ PLATFORM := win32
else
- # We test for the COMSPEC environment variable, then run the `ver'
- # command-line program to see if its output contains the word `Windows'.
- #
- # If this is true, we are running a win32 platform (or an emulation).
- #
- ifdef COMSPEC
- is_windows := $(findstring Windows,$(strip $(shell ver)))
- COPY := copy
- endif
- endif # test NT
- ifdef is_windows
+ # Detecting Windows 9X
- PLATFORM := win32
+ # We used to run the `ver' command to see if its output contains the
+ # word `Windows'. If this is true, we are running Windows 95 or later.
+
+ ###ifdef COMSPEC
+ ### First, check if we have the COMSPEC environment variable, which
+ ### indicates we can use COMMAND.COM's internal commands
+ ### is_windows := $(findstring Windows,$(strip $(shell ver)))
+ ###endif
+
+ # Unfortunately, this also detects the case when one is running
+ # DOS 7.x (MS-DOS version that lies below Windows) without actually
+ # launching the GUI.
+
+ # A better test is to check is there are both %winbootdir% and %windir%
+ # environment variables. The first indicates underlying DOS 7.x, and
+ # the second is set only when Win32 is available.
+
+ # Note that on Windows NT, such environment variable will not be seen
+ # from DOS-based tools like DJGPP make; this is not actually a problem
+ # since NT is detected independantly above. But do not try to be clever!
+
+ ifdef winbootdir
+ ifdef windir
+
+ PLATFORM := win32
+
+ endif
+ endif
+
+ endif # test NT
- endif
endif # test PLATFORM ansi
ifeq ($(PLATFORM),win32)
@@ -54,6 +67,24 @@ ifeq ($(PLATFORM),win32)
DELETE := del
SEP := $(BACKSLASH)
+ # Setting COPY is a bit trickier. Plain COPY on NT will not work
+ # correctly, because it will uppercase 8.3 filenames, so we will get
+ # a `CONFIG.MK' file which isn't found later on by `make'.
+ # And we do not want that. So we need to force execution of CMD.EXE.
+ # Unfortunately this latter is not available on Windows 9X...
+ # So we need to hack.
+
+ # Kudos to Eli Zaretskii (DJGPP guru) that helped debug it.
+ # Details available in threads in freetype mailing list (2004-11-11)
+ # and then devel mailing list (2004-11-20 to -23).
+
+ ifeq ($(OS),Windows_NT)
+ COPY := cmd.exe /c copy
+ else
+ COPY := copy
+ endif # test NT
+
+
# gcc Makefile by default
CONFIG_FILE := w32-gcc.mk
ifeq ($(firstword $(CC)),cc)