Fix for 687162, CVS HEAD doesn't compile with Cygwin/gcc
Alex Cherepanov <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Organization | Coscript Software |
| Message-ID | <[email protected]> |
Improve C99 type support: recignize systems that have inttypes.h and deal with Cygwin specially. 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 ? 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. _______________________________________________ gs-code-review mailing list [email protected] http://www.ghostscript.com/mailman/listinfo/gs-code-review
c99.patch
(text/plain, 2.6 KB)
Index: gs/src/stdpre.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/stdpre.h,v
retrieving revision 1.18
diff -b -u -r1.18 stdpre.h
--- gs/src/stdpre.h 21 Nov 2003 18:42:01 -0000 1.18
+++ gs/src/stdpre.h 24 Nov 2003 21:04:43 -0000
@@ -265,8 +265,10 @@
#ifdef HAVE_STDINT_H
# include <stdint.h>
# define STDINT_TYPES_DEFINED
-#else
-# ifdef __WIN32__ /* MSVC currently doesn't proved C99 headers */
+#elif defined(HAVE_INTTYPES_H) || defined(__VMS) /* OpenVMS provides these types in inttypes.h */
+# include <inttypes.h>
+# define STDINT_TYPES_DEFINED
+#elif defined(__WIN32__) /* MSVC currently doesn't proved C99 headers */
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
@@ -274,13 +276,16 @@
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
- /* no uint64_t */
+ typedef unsigned __int64 uint64_t;
# define STDINT_TYPES_DEFINED
-# endif
-# if defined(__VMS) /* OpenVMS provides these types in inttypes.h */
-# include <inttypes.h>
+#elif defined (__CYGWIN__)
+ /* Cygwin defines some of the types in sys/types.h */
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+ typedef unsigned long long uint64_t;
# define STDINT_TYPES_DEFINED
-# endif
+#else
/* other archs may want to add defines here,
or use the fallbacks in std.h */
#endif /* STDINT_H */
Index: gs/src/configure.ac
===================================================================
RCS file: /cvs/ghostscript/gs/src/configure.ac,v
retrieving revision 1.34
diff -b -u -r1.34 configure.ac
--- gs/src/configure.ac 19 Nov 2003 20:59:26 -0000 1.34
+++ gs/src/configure.ac 24 Nov 2003 21:04:43 -0000
@@ -91,6 +91,9 @@
if test "$ac_cv_header_stdint_h" = yes; then
GCFLAGS="$GCFLAGS -DHAVE_STDINT_H"
fi
+if test "$ac_cv_header_inttypes_h" = yes; then
+ GCFLAGS="$GCFLAGS -DHAVE_INTTYPES_H"
+fi
dnl try to find a 64 bit type for devicen color index
uint64_type="none"
@@ -251,8 +254,9 @@
fi
if test x$with_jbig2dec != xno; then
JBIG2DEVS='$(PSD)jbig2.dev'
- if test x$ac_cv_header_stdint_h != xyes; then
- AC_MSG_WARN([JBIG2 support requires stdint types which do not seem to be available.])
+ if test x$ac_cv_header_stdint_h != xyes ||\
+ test x$ac_cv_header_inttypes_h != xyes; then
+ AC_MSG_WARN([JBIG2 support requires C99 types which do not seem to be available.])
fi
fi