about summary refs log tree commit diff
path: root/pm_config.in.h
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-02-12 20:44:37 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-02-12 20:44:37 +0000
commiteae74c7acfa484868f5374f8f0ebff1eb39d1c61 (patch)
treeb2ce4f2f26c00e5be74fd4c55a737ca7bed39da7 /pm_config.in.h
parent47e6714f1bb9be3587d5c76d5638887b595e6355 (diff)
downloadnetpbm-mirror-eae74c7acfa484868f5374f8f0ebff1eb39d1c61.tar.gz
netpbm-mirror-eae74c7acfa484868f5374f8f0ebff1eb39d1c61.tar.xz
netpbm-mirror-eae74c7acfa484868f5374f8f0ebff1eb39d1c61.zip
redo conditional compilation of Windows stuff to use MSVCRT, based on _WIN32, instead of WIN32
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1644 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'pm_config.in.h')
-rw-r--r--pm_config.in.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/pm_config.in.h b/pm_config.in.h
index b7243786..2cea5a86 100644
--- a/pm_config.in.h
+++ b/pm_config.in.h
@@ -125,12 +125,37 @@
 */
 #define A_STRERROR
 
+/* MSVCRT means we're using the Microsoft Visual C++ runtime library.
+
+   _WIN32, set by the compiler, apparently means the same thing; we see it set
+   in compiles using the Microsoft Visual C++ development environment and also
+   with Mingw, which is the Windows version of the GNU compiler (which brings
+   with it a runtime library which wraps around the Microsoft one).  We don't
+   see it set in Cygwin compiles, which use GNU libraries instead of the
+   Microsoft one.
+
+   There is also _MSC_VER, which is set by MSVC to the version number of the
+   MSVC runtime library and __MINGW32__.
+ */
+
+#ifdef _WIN32
+#define MSVCRT 1
+#else
+#define MSVCRT 0
+#endif
+
+/* WIN32 is a macro that some older compilers predefine (compilers aren't
+   supposed to because it doesn't start with an underscore, hence the change.
+   Many build systems (project files, etc.) set WIN32 explicitly for
+   backward compatibility.  Netpbm doesn't use it.
+*/
+
 /* CONFIGURE: If your system has the setmode() function, set HAVE_SETMODE.
 ** If you do, and also the O_BINARY file mode, pm_init() will set the mode
 ** of stdin and stdout to binary for all Netpbm programs.
 ** You need this with Cygwin (Windows).
 */
-#if defined(WIN32) || defined(__CYGWIN__) || defined(DJGPP)
+#if MSVCRT || defined(__CYGWIN__) || defined(DJGPP)
 #define HAVE_SETMODE
 #endif
 
@@ -306,7 +331,7 @@ typedef long int pm_filepos;
 typedef int qsort_comparison_fn(const void *, const void *);
     /* A compare function to pass to <stdlib.h>'s qsort() */
 
-#if defined(WIN32) && !defined(__CYGWIN__)
+#if MSVCRT
   #define pm_mkdir(dir, perm) _mkdir(dir)
 #else
   #define pm_mkdir(dir, perm) mkdir(dir, perm)