Re: Fix for 687162, CVS HEAD doesn't compile with Cygwin/gcc

Ralph Giles <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
On Mon, Nov 24, 2003 at 04:30:03PM -0500, Alex Cherepanov wrote:

> Cygwin is not yet recognized as a target for jbig2dec inclusion. One can
> easily add platform identification code to configure.ac but it will
> bring in config.guess and some other files. Do we want this now ?

No, but it does look like we need to move to generating a config.h from and/or replacing genarch 
with the configure script. That's post 8.12, of course.

> Re the code freeze, this patch fixes the build process, and won't
> introduce subtle changes. It either breaks everything or significantly
> improves portabilty. The latter seems to be more likely outcome.

Can you try the attached, more minimal patch?

Thanks,
 -r

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
cygwin-buildfix.diff (text/plain, 2.6 KB)
Index: src/stdpre.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/stdpre.h,v
retrieving revision 1.19
diff -u -r1.19 stdpre.h
--- src/stdpre.h	30 Nov 2003 19:03:35 -0000	1.19
+++ src/stdpre.h	30 Nov 2003 19:27:38 -0000
@@ -250,6 +250,27 @@
 typedef unsigned int uint;
 typedef unsigned long ulong;
 
+/* Since sys/types.h may define one or more of these (depending on
+ * the platform), we have to take steps to prevent name clashes.
+ * Unfortunately this can clobber valid definitions for the size-
+ * specific types, but there's no simple solution.
+ *
+ * NOTE: This requires that you include std.h *before* any other
+ * header file that includes sys/types.h.
+ *
+ */
+#define bool bool_		/* (maybe not needed) */
+#define uchar uchar_
+#define uint uint_
+#define ushort ushort_
+#define ulong ulong_
+#include <sys/types.h>
+#undef bool
+#undef uchar
+#undef uint
+#undef ushort
+#undef ulong
+
 /* Some systems are guaranteed to have stdint.h
  * but don't use the autoconf detection
  */
@@ -266,7 +287,7 @@
 # include <stdint.h>
 # define STDINT_TYPES_DEFINED
 #else
-# ifdef __WIN32__ /* MSVC currently doesn't proved C99 headers */
+# if defined(__WIN32__) /* MSVC currently doesn't provide C99 headers */
    typedef signed char             int8_t;
    typedef short int               int16_t;
    typedef int                     int32_t;
@@ -281,31 +302,18 @@
 #  include <inttypes.h>
 #  define STDINT_TYPES_DEFINED
 # endif
+# if defined(__CYGWIN__)
+   /* Cygwin defines the signed versions in sys/types.h */
+   typedef unsigned int8_t         uint8_t;
+   typedef unsigned int16_t        uint16_t;
+   typedef unsigned int32_t        uint32_t;
+   typedef unsigned int64_t        uint64_t;
+#  define STDINT_TYPES_DEFINED
+# endif
    /* other archs may want to add defines here, 
       or use the fallbacks in std.h */
 #endif /* STDINT_H */
 
-/* Since sys/types.h may define one or more of these (depending on
- * the platform), we have to take steps to prevent name clashes.
- * Unfortunately this can clobber valid definitions for the size-
- * specific types, but there's no simple solution.
- *
- * NOTE: This requires that you include std.h *before* any other
- * header file that includes sys/types.h.
- *
- */
-#define bool bool_		/* (maybe not needed) */
-#define uchar uchar_
-#define uint uint_
-#define ushort ushort_
-#define ulong ulong_
-#include <sys/types.h>
-#undef bool
-#undef uchar
-#undef uint
-#undef ushort
-#undef ulong
-
 /*
  * Define a Boolean type.  Even though we would like it to be
  * unsigned char, it pretty well has to be int, because
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.