2010-09-17  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* include/lcms2.h [DJGPP, DJGPP_MINOR]: For DJGPP 2.03 provide snprintf
	and vsnprintf prototypes.

	* utils/transicc/transicc.c [DJGPP]: For DJGPP include unistd.h for
	isatty prototype.


2010-09-15  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* src/cmscgats.c (BuildAbsolutePath) [CMS_IS_DJGPP_]: For DJGPP check
	for absolute path allowing both slash and backslash charcters.


2010-09-14  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* src/cmscgats.c [CMS_IS_DJGPP_]: For DJGPP define DIR_CHAR_ALT as
	backslash for alternate dir character.
	(isabsolutepath) [CMS_IS_DJGPP_]: For DJGPP check for absolute path
	allowing both slash and backslash charcters.


2010-09-12  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* include/lcms2.h [DJGPP]: For DJGPP define CMS_IS_DJGPP_.
	[CMS_IS_DJGPP_] : For DJGPP use 260 instead of 256 as default for
	cmsMAX_PATH.






diff -aprNU5 lcms-2.0.orig/include/lcms2.h lcms-2.0/include/lcms2.h
--- lcms-2.0.orig/include/lcms2.h	2010-05-07 08:47:36 +0000
+++ lcms-2.0/include/lcms2.h	2010-09-17 21:44:44 +0000
@@ -63,10 +63,21 @@
 // Needed for portability (C99 per 7.1.2)
 #include <limits.h>
 #include <time.h>
 #include <stddef.h>
 
+#if defined(__DJGPP__) && __DJGPP__ == 2 && __DJGPP_MINOR__ < 4
+/*
+ *  snprintf declaration for djgpp.
+ *  This will be removed as soon as
+ *  djdev203 is definitivly replaced
+ *  by djdev204.
+ */
+int snprintf(char *str, size_t n, const char *fmt, ...);
+int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
+#endif
+
 #ifndef CMS_USE_CPP_API
 #   ifdef __cplusplus
 extern "C" {
 #   endif
 #endif
@@ -151,10 +162,15 @@ typedef cmsInt32Number       cmsS15Fixed
 typedef cmsUInt32Number      cmsU16Fixed16Number;
 
 // Boolean type, which will be using the native integer
 typedef int                  cmsBool;
 
+// Try to detect DJGPP
+#if defined (DJGPP) || defined(__DJGPP__)
+#  define CMS_IS_DJGPP_ 1
+#endif
+
 // Try to detect windows
 #if defined (_WIN32) || defined(_WIN64) || defined(WIN32) || defined(_WIN32_)
 #  define CMS_IS_WINDOWS_ 1
 #endif
 
@@ -213,11 +229,15 @@ typedef int                  cmsBool;
 # define CMSEXPORT
 # define CMSAPI
 #endif
 
 // Some common definitions
-#define cmsMAX_PATH     256
+#ifdef CMS_IS_DJGPP_
+# define cmsMAX_PATH     260  /*  Max value from pathconf.  */
+#else
+# define cmsMAX_PATH     256
+#endif
 
 #ifndef FALSE
 #       define FALSE 0
 #endif
 #ifndef TRUE
diff -aprNU5 lcms-2.0.orig/src/cmscgats.c lcms-2.0/src/cmscgats.c
--- lcms-2.0.orig/src/cmscgats.c	2010-03-27 16:04:12 +0000
+++ lcms-2.0/src/cmscgats.c	2010-09-17 21:44:44 +0000
@@ -37,13 +37,16 @@
 
 #define DEFAULT_DBL_FORMAT  "%.10g" // Double formatting
 
 #ifdef CMS_IS_WINDOWS_
 #    include <io.h>
-#    define DIR_CHAR    '\\'
+#    define DIR_CHAR            '\\'
 #else
-#    define DIR_CHAR    '/'
+#    define DIR_CHAR            '/'
+#    ifdef CMS_IS_DJGPP_
+#        define DIR_CHAR_ALT    '\\'
+#    endif
 #endif
 
 // Symbols
 typedef enum { 
 
@@ -392,14 +395,18 @@ cmsBool isabsolutepath(const char *path)
         return FALSE;
 
     strncpy(ThreeChars, path, 3);
     ThreeChars[3] = 0;
 
+#ifdef CMS_IS_DJGPP_
+    if(ThreeChars[0] == DIR_CHAR || ThreeChars[0] == DIR_CHAR_ALT)
+#else
     if(ThreeChars[0] == DIR_CHAR)
+#endif
         return TRUE;
 
-#ifdef  CMS_IS_WINDOWS_
+#if defined( CMS_IS_DJGPP_) || defined( CMS_IS_WINDOWS_)
     if (isalpha((int) ThreeChars[0]) && ThreeChars[1] == ':')
         return TRUE;
 #endif
     return FALSE;
 }
@@ -422,11 +429,18 @@ cmsBool BuildAbsolutePath(const char *re
 
     // No, search for last 
     strncpy(buffer, basePath, MaxLen);  
     buffer[MaxLen-1] = 0;
 
+#ifdef CMS_IS_DJGPP_
+    for (len = MaxLen - 1; len; len--)
+      if (buffer[len] == DIR_CHAR || buffer[len] == DIR_CHAR_ALT)
+        break;
+    tail = len ? buffer + len : NULL;
+#else
     tail = strrchr(buffer, DIR_CHAR);
+#endif
     if (tail == NULL) return FALSE;    // Is not absolute and has no separators??
 
     len = (cmsUInt32Number) (tail - buffer);
     if (len >= MaxLen) return FALSE;
 
diff -aprNU5 lcms-2.0.orig/utils/transicc/transicc.c lcms-2.0/utils/transicc/transicc.c
--- lcms-2.0.orig/utils/transicc/transicc.c	2010-05-06 16:36:04 +0000
+++ lcms-2.0/utils/transicc/transicc.c	2010-09-17 21:45:44 +0000
@@ -28,10 +28,14 @@
 
 #ifdef CMS_IS_WINDOWS_
 #include <io.h>
 #endif
 
+#ifdef CMS_IS_DJGPP_
+#include <unistd.h>
+#endif
+
 #define MAX_INPUT_BUFFER 4096
 
 // Global options
 
 static cmsBool           InHexa                 = FALSE;
