Update to 2.0.0 tree from current Fremantle build
[opencv] / 3rdparty / include / pngconf.h
1
2 /* pngconf.h - machine configurable file for libpng
3  *
4  * libpng version 1.2.29 - May 8, 2008
5  * For conditions of distribution and use, see copyright notice in png.h
6  * Copyright (c) 1998-2008 Glenn Randers-Pehrson
7  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
9  */
10
11 /* Any machine specific code is near the front of this file, so if you
12  * are configuring libpng for a machine, you may want to read the section
13  * starting here down to where it starts to typedef png_color, png_text,
14  * and png_info.
15  */
16
17 #ifndef PNGCONF_H
18 #define PNGCONF_H
19
20 #define PNG_1_2_X
21
22 /* 
23  * PNG_USER_CONFIG has to be defined on the compiler command line. This
24  * includes the resource compiler for Windows DLL configurations.
25  */
26 #ifdef PNG_USER_CONFIG
27 #  ifndef PNG_USER_PRIVATEBUILD
28 #    define PNG_USER_PRIVATEBUILD
29 #  endif
30 #include "pngusr.h"
31 #endif
32
33 /* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
34 #ifdef PNG_CONFIGURE_LIBPNG
35 #ifdef HAVE_CONFIG_H
36 #include "config.h"
37 #endif
38 #endif
39
40 /*
41  * Added at libpng-1.2.8
42  *  
43  * If you create a private DLL you need to define in "pngusr.h" the followings:
44  * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
45  *        the DLL was built>
46  *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
47  * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
48  *        distinguish your DLL from those of the official release. These
49  *        correspond to the trailing letters that come after the version
50  *        number and must match your private DLL name>
51  *  e.g. // private DLL "libpng13gx.dll"
52  *       #define PNG_USER_DLLFNAME_POSTFIX "gx"
53  * 
54  * The following macros are also at your disposal if you want to complete the 
55  * DLL VERSIONINFO structure.
56  * - PNG_USER_VERSIONINFO_COMMENTS
57  * - PNG_USER_VERSIONINFO_COMPANYNAME
58  * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
59  */
60
61 #ifdef __STDC__
62 #ifdef SPECIALBUILD
63 #  pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
64  are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
65 #endif
66
67 #ifdef PRIVATEBUILD
68 # pragma message("PRIVATEBUILD is deprecated.\
69  Use PNG_USER_PRIVATEBUILD instead.")
70 # define PNG_USER_PRIVATEBUILD PRIVATEBUILD
71 #endif
72 #endif /* __STDC__ */
73
74 #ifndef PNG_VERSION_INFO_ONLY
75
76 /* End of material added to libpng-1.2.8 */
77
78 /* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
79    Restored at libpng-1.2.21 */
80 #if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \
81     !defined(PNG_WARN_UNINITIALIZED_ROW)
82 #  define PNG_WARN_UNINITIALIZED_ROW 1
83 #endif
84 /* End of material added at libpng-1.2.19/1.2.21 */
85
86 /* This is the size of the compression buffer, and thus the size of
87  * an IDAT chunk.  Make this whatever size you feel is best for your
88  * machine.  One of these will be allocated per png_struct.  When this
89  * is full, it writes the data to the disk, and does some other
90  * calculations.  Making this an extremely small size will slow
91  * the library down, but you may want to experiment to determine
92  * where it becomes significant, if you are concerned with memory
93  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
94  * this describes the size of the buffer available to read the data in.
95  * Unless this gets smaller than the size of a row (compressed),
96  * it should not make much difference how big this is.
97  */
98
99 #ifndef PNG_ZBUF_SIZE
100 #  define PNG_ZBUF_SIZE 8192
101 #endif
102
103 /* Enable if you want a write-only libpng */
104
105 #ifndef PNG_NO_READ_SUPPORTED
106 #  define PNG_READ_SUPPORTED
107 #endif
108
109 /* Enable if you want a read-only libpng */
110
111 #ifndef PNG_NO_WRITE_SUPPORTED
112 #  define PNG_WRITE_SUPPORTED
113 #endif
114
115 /* Enabled by default in 1.2.0.  You can disable this if you don't need to
116    support PNGs that are embedded in MNG datastreams */
117 #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
118 #  ifndef PNG_MNG_FEATURES_SUPPORTED
119 #    define PNG_MNG_FEATURES_SUPPORTED
120 #  endif
121 #endif
122
123 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
124 #  ifndef PNG_FLOATING_POINT_SUPPORTED
125 #    define PNG_FLOATING_POINT_SUPPORTED
126 #  endif
127 #endif
128
129 /* If you are running on a machine where you cannot allocate more
130  * than 64K of memory at once, uncomment this.  While libpng will not
131  * normally need that much memory in a chunk (unless you load up a very
132  * large file), zlib needs to know how big of a chunk it can use, and
133  * libpng thus makes sure to check any memory allocation to verify it
134  * will fit into memory.
135 #define PNG_MAX_MALLOC_64K
136  */
137 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
138 #  define PNG_MAX_MALLOC_64K
139 #endif
140
141 /* Special munging to support doing things the 'cygwin' way:
142  * 'Normal' png-on-win32 defines/defaults:
143  *   PNG_BUILD_DLL -- building dll
144  *   PNG_USE_DLL   -- building an application, linking to dll
145  *   (no define)   -- building static library, or building an
146  *                    application and linking to the static lib
147  * 'Cygwin' defines/defaults:
148  *   PNG_BUILD_DLL -- (ignored) building the dll
149  *   (no define)   -- (ignored) building an application, linking to the dll
150  *   PNG_STATIC    -- (ignored) building the static lib, or building an 
151  *                    application that links to the static lib.
152  *   ALL_STATIC    -- (ignored) building various static libs, or building an 
153  *                    application that links to the static libs.
154  * Thus,
155  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
156  * this bit of #ifdefs will define the 'correct' config variables based on
157  * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
158  * unnecessary.
159  *
160  * Also, the precedence order is:
161  *   ALL_STATIC (since we can't #undef something outside our namespace)
162  *   PNG_BUILD_DLL
163  *   PNG_STATIC
164  *   (nothing) == PNG_USE_DLL
165  * 
166  * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
167  *   of auto-import in binutils, we no longer need to worry about 
168  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
169  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
170  *   to __declspec() stuff.  However, we DO need to worry about 
171  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
172  *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
173  */
174 #if defined(__CYGWIN__)
175 #  if defined(ALL_STATIC)
176 #    if defined(PNG_BUILD_DLL)
177 #      undef PNG_BUILD_DLL
178 #    endif
179 #    if defined(PNG_USE_DLL)
180 #      undef PNG_USE_DLL
181 #    endif
182 #    if defined(PNG_DLL)
183 #      undef PNG_DLL
184 #    endif
185 #    if !defined(PNG_STATIC)
186 #      define PNG_STATIC
187 #    endif
188 #  else
189 #    if defined (PNG_BUILD_DLL)
190 #      if defined(PNG_STATIC)
191 #        undef PNG_STATIC
192 #      endif
193 #      if defined(PNG_USE_DLL)
194 #        undef PNG_USE_DLL
195 #      endif
196 #      if !defined(PNG_DLL)
197 #        define PNG_DLL
198 #      endif
199 #    else
200 #      if defined(PNG_STATIC)
201 #        if defined(PNG_USE_DLL)
202 #          undef PNG_USE_DLL
203 #        endif
204 #        if defined(PNG_DLL)
205 #          undef PNG_DLL
206 #        endif
207 #      else
208 #        if !defined(PNG_USE_DLL)
209 #          define PNG_USE_DLL
210 #        endif
211 #        if !defined(PNG_DLL)
212 #          define PNG_DLL
213 #        endif
214 #      endif  
215 #    endif  
216 #  endif
217 #endif
218
219 /* This protects us against compilers that run on a windowing system
220  * and thus don't have or would rather us not use the stdio types:
221  * stdin, stdout, and stderr.  The only one currently used is stderr
222  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
223  * prevent these from being compiled and used. #defining PNG_NO_STDIO
224  * will also prevent these, plus will prevent the entire set of stdio
225  * macros and functions (FILE *, printf, etc.) from being compiled and used,
226  * unless (PNG_DEBUG > 0) has been #defined.
227  *
228  * #define PNG_NO_CONSOLE_IO
229  * #define PNG_NO_STDIO
230  */
231
232 #if defined(_WIN32_WCE)
233 #  include <windows.h>
234    /* Console I/O functions are not supported on WindowsCE */
235 #  define PNG_NO_CONSOLE_IO
236 #  ifdef PNG_DEBUG
237 #    undef PNG_DEBUG
238 #  endif
239 #endif
240
241 #ifdef PNG_BUILD_DLL
242 #  ifndef PNG_CONSOLE_IO_SUPPORTED
243 #    ifndef PNG_NO_CONSOLE_IO
244 #      define PNG_NO_CONSOLE_IO
245 #    endif
246 #  endif
247 #endif
248
249 #  ifdef PNG_NO_STDIO
250 #    ifndef PNG_NO_CONSOLE_IO
251 #      define PNG_NO_CONSOLE_IO
252 #    endif
253 #    ifdef PNG_DEBUG
254 #      if (PNG_DEBUG > 0)
255 #        include <stdio.h>
256 #      endif
257 #    endif
258 #  else
259 #    if !defined(_WIN32_WCE)
260 /* "stdio.h" functions are not supported on WindowsCE */
261 #      include <stdio.h>
262 #    endif
263 #  endif
264
265 /* This macro protects us against machines that don't have function
266  * prototypes (ie K&R style headers).  If your compiler does not handle
267  * function prototypes, define this macro and use the included ansi2knr.
268  * I've always been able to use _NO_PROTO as the indicator, but you may
269  * need to drag the empty declaration out in front of here, or change the
270  * ifdef to suit your own needs.
271  */
272 #ifndef PNGARG
273
274 #ifdef OF /* zlib prototype munger */
275 #  define PNGARG(arglist) OF(arglist)
276 #else
277
278 #ifdef _NO_PROTO
279 #  define PNGARG(arglist) ()
280 #  ifndef PNG_TYPECAST_NULL
281 #     define PNG_TYPECAST_NULL
282 #  endif
283 #else
284 #  define PNGARG(arglist) arglist
285 #endif /* _NO_PROTO */
286
287
288 #endif /* OF */
289
290 #endif /* PNGARG */
291
292 /* Try to determine if we are compiling on a Mac.  Note that testing for
293  * just __MWERKS__ is not good enough, because the Codewarrior is now used
294  * on non-Mac platforms.
295  */
296 #ifndef MACOS
297 #  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
298       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
299 #    define MACOS
300 #  endif
301 #endif
302
303 /* enough people need this for various reasons to include it here */
304 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
305 #  include <sys/types.h>
306 #endif
307
308 #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
309 #  define PNG_SETJMP_SUPPORTED
310 #endif
311
312 #ifdef PNG_SETJMP_SUPPORTED
313 /* This is an attempt to force a single setjmp behaviour on Linux.  If
314  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
315  */
316
317 #  ifdef __linux__
318 #    ifdef _BSD_SOURCE
319 #      define PNG_SAVE_BSD_SOURCE
320 #      undef _BSD_SOURCE
321 #    endif
322 #    ifdef _SETJMP_H
323      /* If you encounter a compiler error here, see the explanation
324       * near the end of INSTALL.
325       */
326          __pngconf.h__ already includes setjmp.h;
327          __dont__ include it again.;
328 #    endif
329 #  endif /* __linux__ */
330
331    /* include setjmp.h for error handling */
332 #  include <setjmp.h>
333
334 #  ifdef __linux__
335 #    ifdef PNG_SAVE_BSD_SOURCE
336 #      ifndef _BSD_SOURCE
337 #        define _BSD_SOURCE
338 #      endif
339 #      undef PNG_SAVE_BSD_SOURCE
340 #    endif
341 #  endif /* __linux__ */
342 #endif /* PNG_SETJMP_SUPPORTED */
343
344 #ifdef BSD
345 #  include <strings.h>
346 #else
347 #  include <string.h>
348 #endif
349
350 /* Other defines for things like memory and the like can go here.  */
351 #ifdef PNG_INTERNAL
352
353 #include <stdlib.h>
354
355 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
356  * aren't usually used outside the library (as far as I know), so it is
357  * debatable if they should be exported at all.  In the future, when it is
358  * possible to have run-time registry of chunk-handling functions, some of
359  * these will be made available again.
360 #define PNG_EXTERN extern
361  */
362 #define PNG_EXTERN
363
364 /* Other defines specific to compilers can go here.  Try to keep
365  * them inside an appropriate ifdef/endif pair for portability.
366  */
367
368 #if defined(PNG_FLOATING_POINT_SUPPORTED)
369 #  if defined(MACOS)
370      /* We need to check that <math.h> hasn't already been included earlier
371       * as it seems it doesn't agree with <fp.h>, yet we should really use
372       * <fp.h> if possible.
373       */
374 #    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
375 #      include <fp.h>
376 #    endif
377 #  else
378 #    include <math.h>
379 #  endif
380 #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
381      /* Amiga SAS/C: We must include builtin FPU functions when compiling using
382       * MATH=68881
383       */
384 #    include <m68881.h>
385 #  endif
386 #endif
387
388 /* Codewarrior on NT has linking problems without this. */
389 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
390 #  define PNG_ALWAYS_EXTERN
391 #endif
392
393 /* This provides the non-ANSI (far) memory allocation routines. */
394 #if defined(__TURBOC__) && defined(__MSDOS__)
395 #  include <mem.h>
396 #  include <alloc.h>
397 #endif
398
399 /* I have no idea why is this necessary... */
400 #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
401     defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
402 #  include <malloc.h>
403 #endif
404
405 /* This controls how fine the dithering gets.  As this allocates
406  * a largish chunk of memory (32K), those who are not as concerned
407  * with dithering quality can decrease some or all of these.
408  */
409 #ifndef PNG_DITHER_RED_BITS
410 #  define PNG_DITHER_RED_BITS 5
411 #endif
412 #ifndef PNG_DITHER_GREEN_BITS
413 #  define PNG_DITHER_GREEN_BITS 5
414 #endif
415 #ifndef PNG_DITHER_BLUE_BITS
416 #  define PNG_DITHER_BLUE_BITS 5
417 #endif
418
419 /* This controls how fine the gamma correction becomes when you
420  * are only interested in 8 bits anyway.  Increasing this value
421  * results in more memory being used, and more pow() functions
422  * being called to fill in the gamma tables.  Don't set this value
423  * less then 8, and even that may not work (I haven't tested it).
424  */
425
426 #ifndef PNG_MAX_GAMMA_8
427 #  define PNG_MAX_GAMMA_8 11
428 #endif
429
430 /* This controls how much a difference in gamma we can tolerate before
431  * we actually start doing gamma conversion.
432  */
433 #ifndef PNG_GAMMA_THRESHOLD
434 #  define PNG_GAMMA_THRESHOLD 0.05
435 #endif
436
437 #endif /* PNG_INTERNAL */
438
439 /* The following uses const char * instead of char * for error
440  * and warning message functions, so some compilers won't complain.
441  * If you do not want to use const, define PNG_NO_CONST here.
442  */
443
444 #ifndef PNG_NO_CONST
445 #  define PNG_CONST const
446 #else
447 #  define PNG_CONST
448 #endif
449
450 /* The following defines give you the ability to remove code from the
451  * library that you will not be using.  I wish I could figure out how to
452  * automate this, but I can't do that without making it seriously hard
453  * on the users.  So if you are not using an ability, change the #define
454  * to and #undef, and that part of the library will not be compiled.  If
455  * your linker can't find a function, you may want to make sure the
456  * ability is defined here.  Some of these depend upon some others being
457  * defined.  I haven't figured out all the interactions here, so you may
458  * have to experiment awhile to get everything to compile.  If you are
459  * creating or using a shared library, you probably shouldn't touch this,
460  * as it will affect the size of the structures, and this will cause bad
461  * things to happen if the library and/or application ever change.
462  */
463
464 /* Any features you will not be using can be undef'ed here */
465
466 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
467  * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
468  * on the compile line, then pick and choose which ones to define without
469  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
470  * if you only want to have a png-compliant reader/writer but don't need
471  * any of the extra transformations.  This saves about 80 kbytes in a
472  * typical installation of the library. (PNG_NO_* form added in version
473  * 1.0.1c, for consistency)
474  */
475
476 /* The size of the png_text structure changed in libpng-1.0.6 when
477  * iTXt support was added.  iTXt support was turned off by default through
478  * libpng-1.2.x, to support old apps that malloc the png_text structure
479  * instead of calling png_set_text() and letting libpng malloc it.  It
480  * was turned on by default in libpng-1.3.0.
481  */
482
483 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
484 #  ifndef PNG_NO_iTXt_SUPPORTED
485 #    define PNG_NO_iTXt_SUPPORTED
486 #  endif
487 #  ifndef PNG_NO_READ_iTXt
488 #    define PNG_NO_READ_iTXt
489 #  endif
490 #  ifndef PNG_NO_WRITE_iTXt
491 #    define PNG_NO_WRITE_iTXt
492 #  endif
493 #endif
494
495 #if !defined(PNG_NO_iTXt_SUPPORTED)
496 #  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
497 #    define PNG_READ_iTXt
498 #  endif
499 #  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
500 #    define PNG_WRITE_iTXt
501 #  endif
502 #endif
503
504 /* The following support, added after version 1.0.0, can be turned off here en
505  * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
506  * with old applications that require the length of png_struct and png_info
507  * to remain unchanged.
508  */
509
510 #ifdef PNG_LEGACY_SUPPORTED
511 #  define PNG_NO_FREE_ME
512 #  define PNG_NO_READ_UNKNOWN_CHUNKS
513 #  define PNG_NO_WRITE_UNKNOWN_CHUNKS
514 #  define PNG_NO_READ_USER_CHUNKS
515 #  define PNG_NO_READ_iCCP
516 #  define PNG_NO_WRITE_iCCP
517 #  define PNG_NO_READ_iTXt
518 #  define PNG_NO_WRITE_iTXt
519 #  define PNG_NO_READ_sCAL
520 #  define PNG_NO_WRITE_sCAL
521 #  define PNG_NO_READ_sPLT
522 #  define PNG_NO_WRITE_sPLT
523 #  define PNG_NO_INFO_IMAGE
524 #  define PNG_NO_READ_RGB_TO_GRAY
525 #  define PNG_NO_READ_USER_TRANSFORM
526 #  define PNG_NO_WRITE_USER_TRANSFORM
527 #  define PNG_NO_USER_MEM
528 #  define PNG_NO_READ_EMPTY_PLTE
529 #  define PNG_NO_MNG_FEATURES
530 #  define PNG_NO_FIXED_POINT_SUPPORTED
531 #endif
532
533 /* Ignore attempt to turn off both floating and fixed point support */
534 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
535     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
536 #  define PNG_FIXED_POINT_SUPPORTED
537 #endif
538
539 #ifndef PNG_NO_FREE_ME
540 #  define PNG_FREE_ME_SUPPORTED
541 #endif
542
543 #if defined(PNG_READ_SUPPORTED)
544
545 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
546       !defined(PNG_NO_READ_TRANSFORMS)
547 #  define PNG_READ_TRANSFORMS_SUPPORTED
548 #endif
549
550 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
551 #  ifndef PNG_NO_READ_EXPAND
552 #    define PNG_READ_EXPAND_SUPPORTED
553 #  endif
554 #  ifndef PNG_NO_READ_SHIFT
555 #    define PNG_READ_SHIFT_SUPPORTED
556 #  endif
557 #  ifndef PNG_NO_READ_PACK
558 #    define PNG_READ_PACK_SUPPORTED
559 #  endif
560 #  ifndef PNG_NO_READ_BGR
561 #    define PNG_READ_BGR_SUPPORTED
562 #  endif
563 #  ifndef PNG_NO_READ_SWAP
564 #    define PNG_READ_SWAP_SUPPORTED
565 #  endif
566 #  ifndef PNG_NO_READ_PACKSWAP
567 #    define PNG_READ_PACKSWAP_SUPPORTED
568 #  endif
569 #  ifndef PNG_NO_READ_INVERT
570 #    define PNG_READ_INVERT_SUPPORTED
571 #  endif
572 #  ifndef PNG_NO_READ_DITHER
573 #    define PNG_READ_DITHER_SUPPORTED
574 #  endif
575 #  ifndef PNG_NO_READ_BACKGROUND
576 #    define PNG_READ_BACKGROUND_SUPPORTED
577 #  endif
578 #  ifndef PNG_NO_READ_16_TO_8
579 #    define PNG_READ_16_TO_8_SUPPORTED
580 #  endif
581 #  ifndef PNG_NO_READ_FILLER
582 #    define PNG_READ_FILLER_SUPPORTED
583 #  endif
584 #  ifndef PNG_NO_READ_GAMMA
585 #    define PNG_READ_GAMMA_SUPPORTED
586 #  endif
587 #  ifndef PNG_NO_READ_GRAY_TO_RGB
588 #    define PNG_READ_GRAY_TO_RGB_SUPPORTED
589 #  endif
590 #  ifndef PNG_NO_READ_SWAP_ALPHA
591 #    define PNG_READ_SWAP_ALPHA_SUPPORTED
592 #  endif
593 #  ifndef PNG_NO_READ_INVERT_ALPHA
594 #    define PNG_READ_INVERT_ALPHA_SUPPORTED
595 #  endif
596 #  ifndef PNG_NO_READ_STRIP_ALPHA
597 #    define PNG_READ_STRIP_ALPHA_SUPPORTED
598 #  endif
599 #  ifndef PNG_NO_READ_USER_TRANSFORM
600 #    define PNG_READ_USER_TRANSFORM_SUPPORTED
601 #  endif
602 #  ifndef PNG_NO_READ_RGB_TO_GRAY
603 #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
604 #  endif
605 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
606
607 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
608  !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive   */
609 #  define PNG_PROGRESSIVE_READ_SUPPORTED  /* reading.  This is not talking */
610 #endif                            /* about interlacing capability!  You'll */
611            /* still have interlacing unless you change the following line: */
612
613 #define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
614
615 #ifndef PNG_NO_READ_COMPOSITE_NODIV
616 #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
617 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED  /* well tested on Intel, SGI */
618 #  endif
619 #endif
620
621 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
622 /* Deprecated, will be removed from version 2.0.0.
623    Use PNG_MNG_FEATURES_SUPPORTED instead. */
624 #ifndef PNG_NO_READ_EMPTY_PLTE
625 #  define PNG_READ_EMPTY_PLTE_SUPPORTED
626 #endif
627 #endif
628
629 #endif /* PNG_READ_SUPPORTED */
630
631 #if defined(PNG_WRITE_SUPPORTED)
632
633 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
634     !defined(PNG_NO_WRITE_TRANSFORMS)
635 #  define PNG_WRITE_TRANSFORMS_SUPPORTED
636 #endif
637
638 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
639 #  ifndef PNG_NO_WRITE_SHIFT
640 #    define PNG_WRITE_SHIFT_SUPPORTED
641 #  endif
642 #  ifndef PNG_NO_WRITE_PACK
643 #    define PNG_WRITE_PACK_SUPPORTED
644 #  endif
645 #  ifndef PNG_NO_WRITE_BGR
646 #    define PNG_WRITE_BGR_SUPPORTED
647 #  endif
648 #  ifndef PNG_NO_WRITE_SWAP
649 #    define PNG_WRITE_SWAP_SUPPORTED
650 #  endif
651 #  ifndef PNG_NO_WRITE_PACKSWAP
652 #    define PNG_WRITE_PACKSWAP_SUPPORTED
653 #  endif
654 #  ifndef PNG_NO_WRITE_INVERT
655 #    define PNG_WRITE_INVERT_SUPPORTED
656 #  endif
657 #  ifndef PNG_NO_WRITE_FILLER
658 #    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
659 #  endif
660 #  ifndef PNG_NO_WRITE_SWAP_ALPHA
661 #    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
662 #  endif
663 #  ifndef PNG_NO_WRITE_INVERT_ALPHA
664 #    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
665 #  endif
666 #  ifndef PNG_NO_WRITE_USER_TRANSFORM
667 #    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
668 #  endif
669 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
670
671 #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
672     !defined(PNG_WRITE_INTERLACING_SUPPORTED)
673 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
674                                             encoders, but can cause trouble
675                                             if left undefined */
676 #endif
677
678 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
679     !defined(PNG_WRITE_WEIGHTED_FILTER) && \
680      defined(PNG_FLOATING_POINT_SUPPORTED)
681 #  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
682 #endif
683
684 #ifndef PNG_NO_WRITE_FLUSH
685 #  define PNG_WRITE_FLUSH_SUPPORTED
686 #endif
687
688 #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
689 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
690 #ifndef PNG_NO_WRITE_EMPTY_PLTE
691 #  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
692 #endif
693 #endif
694
695 #endif /* PNG_WRITE_SUPPORTED */
696
697 #ifndef PNG_1_0_X
698 #  ifndef PNG_NO_ERROR_NUMBERS
699 #    define PNG_ERROR_NUMBERS_SUPPORTED
700 #  endif
701 #endif /* PNG_1_0_X */
702
703 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
704     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
705 #  ifndef PNG_NO_USER_TRANSFORM_PTR
706 #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
707 #  endif
708 #endif
709
710 #ifndef PNG_NO_STDIO
711 #  define PNG_TIME_RFC1123_SUPPORTED
712 #endif
713
714 /* This adds extra functions in pngget.c for accessing data from the
715  * info pointer (added in version 0.99)
716  * png_get_image_width()
717  * png_get_image_height()
718  * png_get_bit_depth()
719  * png_get_color_type()
720  * png_get_compression_type()
721  * png_get_filter_type()
722  * png_get_interlace_type()
723  * png_get_pixel_aspect_ratio()
724  * png_get_pixels_per_meter()
725  * png_get_x_offset_pixels()
726  * png_get_y_offset_pixels()
727  * png_get_x_offset_microns()
728  * png_get_y_offset_microns()
729  */
730 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
731 #  define PNG_EASY_ACCESS_SUPPORTED
732 #endif
733
734 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 
735  * and removed from version 1.2.20.  The following will be removed
736  * from libpng-1.4.0
737 */
738
739 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
740 #  ifndef PNG_OPTIMIZED_CODE_SUPPORTED
741 #    define PNG_OPTIMIZED_CODE_SUPPORTED
742 #  endif
743 #endif
744
745 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
746 #  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
747 #    define PNG_ASSEMBLER_CODE_SUPPORTED
748 #  endif
749
750 #  if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4)
751      /* work around 64-bit gcc compiler bugs in gcc-3.x */
752 #    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
753 #      define PNG_NO_MMX_CODE
754 #    endif
755 #  endif
756
757 #  if defined(__APPLE__)
758 #    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
759 #      define PNG_NO_MMX_CODE
760 #    endif
761 #  endif
762
763 #  if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh))
764 #    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
765 #      define PNG_NO_MMX_CODE
766 #    endif
767 #  endif
768
769 #  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
770 #    define PNG_MMX_CODE_SUPPORTED
771 #  endif
772
773 #endif
774 /* end of obsolete code to be removed from libpng-1.4.0 */
775
776 #if !defined(PNG_1_0_X)
777 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
778 #  define PNG_USER_MEM_SUPPORTED
779 #endif
780 #endif /* PNG_1_0_X */
781
782 /* Added at libpng-1.2.6 */
783 #if !defined(PNG_1_0_X)
784 #ifndef PNG_SET_USER_LIMITS_SUPPORTED
785 #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
786 #  define PNG_SET_USER_LIMITS_SUPPORTED
787 #endif
788 #endif
789 #endif /* PNG_1_0_X */
790
791 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
792  * how large, set these limits to 0x7fffffffL
793  */
794 #ifndef PNG_USER_WIDTH_MAX
795 #  define PNG_USER_WIDTH_MAX 1000000L
796 #endif
797 #ifndef PNG_USER_HEIGHT_MAX
798 #  define PNG_USER_HEIGHT_MAX 1000000L
799 #endif
800
801 /* These are currently experimental features, define them if you want */
802
803 /* very little testing */
804 /*
805 #ifdef PNG_READ_SUPPORTED
806 #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
807 #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
808 #  endif
809 #endif
810 */
811
812 /* This is only for PowerPC big-endian and 680x0 systems */
813 /* some testing */
814 /*
815 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
816 #  define PNG_READ_BIG_ENDIAN_SUPPORTED
817 #endif
818 */
819
820 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
821 /*
822 #define PNG_NO_POINTER_INDEXING
823 */
824
825 /* These functions are turned off by default, as they will be phased out. */
826 /*
827 #define  PNG_USELESS_TESTS_SUPPORTED
828 #define  PNG_CORRECT_PALETTE_SUPPORTED
829 */
830
831 /* Any chunks you are not interested in, you can undef here.  The
832  * ones that allocate memory may be expecially important (hIST,
833  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
834  * a bit smaller.
835  */
836
837 #if defined(PNG_READ_SUPPORTED) && \
838     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
839     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
840 #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
841 #endif
842
843 #if defined(PNG_WRITE_SUPPORTED) && \
844     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
845     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
846 #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
847 #endif
848
849 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
850
851 #ifdef PNG_NO_READ_TEXT
852 #  define PNG_NO_READ_iTXt
853 #  define PNG_NO_READ_tEXt
854 #  define PNG_NO_READ_zTXt
855 #endif
856 #ifndef PNG_NO_READ_bKGD
857 #  define PNG_READ_bKGD_SUPPORTED
858 #  define PNG_bKGD_SUPPORTED
859 #endif
860 #ifndef PNG_NO_READ_cHRM
861 #  define PNG_READ_cHRM_SUPPORTED
862 #  define PNG_cHRM_SUPPORTED
863 #endif
864 #ifndef PNG_NO_READ_gAMA
865 #  define PNG_READ_gAMA_SUPPORTED
866 #  define PNG_gAMA_SUPPORTED
867 #endif
868 #ifndef PNG_NO_READ_hIST
869 #  define PNG_READ_hIST_SUPPORTED
870 #  define PNG_hIST_SUPPORTED
871 #endif
872 #ifndef PNG_NO_READ_iCCP
873 #  define PNG_READ_iCCP_SUPPORTED
874 #  define PNG_iCCP_SUPPORTED
875 #endif
876 #ifndef PNG_NO_READ_iTXt
877 #  ifndef PNG_READ_iTXt_SUPPORTED
878 #    define PNG_READ_iTXt_SUPPORTED
879 #  endif
880 #  ifndef PNG_iTXt_SUPPORTED
881 #    define PNG_iTXt_SUPPORTED
882 #  endif
883 #endif
884 #ifndef PNG_NO_READ_oFFs
885 #  define PNG_READ_oFFs_SUPPORTED
886 #  define PNG_oFFs_SUPPORTED
887 #endif
888 #ifndef PNG_NO_READ_pCAL
889 #  define PNG_READ_pCAL_SUPPORTED
890 #  define PNG_pCAL_SUPPORTED
891 #endif
892 #ifndef PNG_NO_READ_sCAL
893 #  define PNG_READ_sCAL_SUPPORTED
894 #  define PNG_sCAL_SUPPORTED
895 #endif
896 #ifndef PNG_NO_READ_pHYs
897 #  define PNG_READ_pHYs_SUPPORTED
898 #  define PNG_pHYs_SUPPORTED
899 #endif
900 #ifndef PNG_NO_READ_sBIT
901 #  define PNG_READ_sBIT_SUPPORTED
902 #  define PNG_sBIT_SUPPORTED
903 #endif
904 #ifndef PNG_NO_READ_sPLT
905 #  define PNG_READ_sPLT_SUPPORTED
906 #  define PNG_sPLT_SUPPORTED
907 #endif
908 #ifndef PNG_NO_READ_sRGB
909 #  define PNG_READ_sRGB_SUPPORTED
910 #  define PNG_sRGB_SUPPORTED
911 #endif
912 #ifndef PNG_NO_READ_tEXt
913 #  define PNG_READ_tEXt_SUPPORTED
914 #  define PNG_tEXt_SUPPORTED
915 #endif
916 #ifndef PNG_NO_READ_tIME
917 #  define PNG_READ_tIME_SUPPORTED
918 #  define PNG_tIME_SUPPORTED
919 #endif
920 #ifndef PNG_NO_READ_tRNS
921 #  define PNG_READ_tRNS_SUPPORTED
922 #  define PNG_tRNS_SUPPORTED
923 #endif
924 #ifndef PNG_NO_READ_zTXt
925 #  define PNG_READ_zTXt_SUPPORTED
926 #  define PNG_zTXt_SUPPORTED
927 #endif
928 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
929 #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
930 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
931 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
932 #  endif
933 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
934 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
935 #  endif
936 #endif
937 #if !defined(PNG_NO_READ_USER_CHUNKS) && \
938      defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
939 #  define PNG_READ_USER_CHUNKS_SUPPORTED
940 #  define PNG_USER_CHUNKS_SUPPORTED
941 #  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
942 #    undef PNG_NO_READ_UNKNOWN_CHUNKS
943 #  endif
944 #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
945 #    undef PNG_NO_HANDLE_AS_UNKNOWN
946 #  endif
947 #endif
948 #ifndef PNG_NO_READ_OPT_PLTE
949 #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
950 #endif                      /* optional PLTE chunk in RGB and RGBA images */
951 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
952     defined(PNG_READ_zTXt_SUPPORTED)
953 #  define PNG_READ_TEXT_SUPPORTED
954 #  define PNG_TEXT_SUPPORTED
955 #endif
956
957 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
958
959 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
960
961 #ifdef PNG_NO_WRITE_TEXT
962 #  define PNG_NO_WRITE_iTXt
963 #  define PNG_NO_WRITE_tEXt
964 #  define PNG_NO_WRITE_zTXt
965 #endif
966 #ifndef PNG_NO_WRITE_bKGD
967 #  define PNG_WRITE_bKGD_SUPPORTED
968 #  ifndef PNG_bKGD_SUPPORTED
969 #    define PNG_bKGD_SUPPORTED
970 #  endif
971 #endif
972 #ifndef PNG_NO_WRITE_cHRM
973 #  define PNG_WRITE_cHRM_SUPPORTED
974 #  ifndef PNG_cHRM_SUPPORTED
975 #    define PNG_cHRM_SUPPORTED
976 #  endif
977 #endif
978 #ifndef PNG_NO_WRITE_gAMA
979 #  define PNG_WRITE_gAMA_SUPPORTED
980 #  ifndef PNG_gAMA_SUPPORTED
981 #    define PNG_gAMA_SUPPORTED
982 #  endif
983 #endif
984 #ifndef PNG_NO_WRITE_hIST
985 #  define PNG_WRITE_hIST_SUPPORTED
986 #  ifndef PNG_hIST_SUPPORTED
987 #    define PNG_hIST_SUPPORTED
988 #  endif
989 #endif
990 #ifndef PNG_NO_WRITE_iCCP
991 #  define PNG_WRITE_iCCP_SUPPORTED
992 #  ifndef PNG_iCCP_SUPPORTED
993 #    define PNG_iCCP_SUPPORTED
994 #  endif
995 #endif
996 #ifndef PNG_NO_WRITE_iTXt
997 #  ifndef PNG_WRITE_iTXt_SUPPORTED
998 #    define PNG_WRITE_iTXt_SUPPORTED
999 #  endif
1000 #  ifndef PNG_iTXt_SUPPORTED
1001 #    define PNG_iTXt_SUPPORTED
1002 #  endif
1003 #endif
1004 #ifndef PNG_NO_WRITE_oFFs
1005 #  define PNG_WRITE_oFFs_SUPPORTED
1006 #  ifndef PNG_oFFs_SUPPORTED
1007 #    define PNG_oFFs_SUPPORTED
1008 #  endif
1009 #endif
1010 #ifndef PNG_NO_WRITE_pCAL
1011 #  define PNG_WRITE_pCAL_SUPPORTED
1012 #  ifndef PNG_pCAL_SUPPORTED
1013 #    define PNG_pCAL_SUPPORTED
1014 #  endif
1015 #endif
1016 #ifndef PNG_NO_WRITE_sCAL
1017 #  define PNG_WRITE_sCAL_SUPPORTED
1018 #  ifndef PNG_sCAL_SUPPORTED
1019 #    define PNG_sCAL_SUPPORTED
1020 #  endif
1021 #endif
1022 #ifndef PNG_NO_WRITE_pHYs
1023 #  define PNG_WRITE_pHYs_SUPPORTED
1024 #  ifndef PNG_pHYs_SUPPORTED
1025 #    define PNG_pHYs_SUPPORTED
1026 #  endif
1027 #endif
1028 #ifndef PNG_NO_WRITE_sBIT
1029 #  define PNG_WRITE_sBIT_SUPPORTED
1030 #  ifndef PNG_sBIT_SUPPORTED
1031 #    define PNG_sBIT_SUPPORTED
1032 #  endif
1033 #endif
1034 #ifndef PNG_NO_WRITE_sPLT
1035 #  define PNG_WRITE_sPLT_SUPPORTED
1036 #  ifndef PNG_sPLT_SUPPORTED
1037 #    define PNG_sPLT_SUPPORTED
1038 #  endif
1039 #endif
1040 #ifndef PNG_NO_WRITE_sRGB
1041 #  define PNG_WRITE_sRGB_SUPPORTED
1042 #  ifndef PNG_sRGB_SUPPORTED
1043 #    define PNG_sRGB_SUPPORTED
1044 #  endif
1045 #endif
1046 #ifndef PNG_NO_WRITE_tEXt
1047 #  define PNG_WRITE_tEXt_SUPPORTED
1048 #  ifndef PNG_tEXt_SUPPORTED
1049 #    define PNG_tEXt_SUPPORTED
1050 #  endif
1051 #endif
1052 #ifndef PNG_NO_WRITE_tIME
1053 #  define PNG_WRITE_tIME_SUPPORTED
1054 #  ifndef PNG_tIME_SUPPORTED
1055 #    define PNG_tIME_SUPPORTED
1056 #  endif
1057 #endif
1058 #ifndef PNG_NO_WRITE_tRNS
1059 #  define PNG_WRITE_tRNS_SUPPORTED
1060 #  ifndef PNG_tRNS_SUPPORTED
1061 #    define PNG_tRNS_SUPPORTED
1062 #  endif
1063 #endif
1064 #ifndef PNG_NO_WRITE_zTXt
1065 #  define PNG_WRITE_zTXt_SUPPORTED
1066 #  ifndef PNG_zTXt_SUPPORTED
1067 #    define PNG_zTXt_SUPPORTED
1068 #  endif
1069 #endif
1070 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
1071 #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
1072 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
1073 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
1074 #  endif
1075 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
1076 #     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1077 #       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1078 #     endif
1079 #  endif
1080 #endif
1081 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
1082     defined(PNG_WRITE_zTXt_SUPPORTED)
1083 #  define PNG_WRITE_TEXT_SUPPORTED
1084 #  ifndef PNG_TEXT_SUPPORTED
1085 #    define PNG_TEXT_SUPPORTED
1086 #  endif
1087 #endif
1088
1089 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
1090
1091 /* Turn this off to disable png_read_png() and
1092  * png_write_png() and leave the row_pointers member
1093  * out of the info structure.
1094  */
1095 #ifndef PNG_NO_INFO_IMAGE
1096 #  define PNG_INFO_IMAGE_SUPPORTED
1097 #endif
1098
1099 /* need the time information for reading tIME chunks */
1100 #if defined(PNG_tIME_SUPPORTED)
1101 #  if !defined(_WIN32_WCE)
1102      /* "time.h" functions are not supported on WindowsCE */
1103 #    include <time.h>
1104 #  endif
1105 #endif
1106
1107 /* Some typedefs to get us started.  These should be safe on most of the
1108  * common platforms.  The typedefs should be at least as large as the
1109  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
1110  * don't have to be exactly that size.  Some compilers dislike passing
1111  * unsigned shorts as function parameters, so you may be better off using
1112  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
1113  * want to have unsigned int for png_uint_32 instead of unsigned long.
1114  */
1115
1116 typedef unsigned long png_uint_32;
1117 typedef long png_int_32;
1118 typedef unsigned short png_uint_16;
1119 typedef short png_int_16;
1120 typedef unsigned char png_byte;
1121
1122 /* This is usually size_t.  It is typedef'ed just in case you need it to
1123    change (I'm not sure if you will or not, so I thought I'd be safe) */
1124 #ifdef PNG_SIZE_T
1125    typedef PNG_SIZE_T png_size_t;
1126 #  define png_sizeof(x) png_convert_size(sizeof (x))
1127 #else
1128    typedef size_t png_size_t;
1129 #  define png_sizeof(x) sizeof (x)
1130 #endif
1131
1132 /* The following is needed for medium model support.  It cannot be in the
1133  * PNG_INTERNAL section.  Needs modification for other compilers besides
1134  * MSC.  Model independent support declares all arrays and pointers to be
1135  * large using the far keyword.  The zlib version used must also support
1136  * model independent data.  As of version zlib 1.0.4, the necessary changes
1137  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
1138  * changes that are needed. (Tim Wegner)
1139  */
1140
1141 /* Separate compiler dependencies (problem here is that zlib.h always
1142    defines FAR. (SJT) */
1143 #ifdef __BORLANDC__
1144 #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
1145 #    define LDATA 1
1146 #  else
1147 #    define LDATA 0
1148 #  endif
1149    /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
1150 #  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
1151 #    define PNG_MAX_MALLOC_64K
1152 #    if (LDATA != 1)
1153 #      ifndef FAR
1154 #        define FAR __far
1155 #      endif
1156 #      define USE_FAR_KEYWORD
1157 #    endif   /* LDATA != 1 */
1158      /* Possibly useful for moving data out of default segment.
1159       * Uncomment it if you want. Could also define FARDATA as
1160       * const if your compiler supports it. (SJT)
1161 #    define FARDATA FAR
1162       */
1163 #  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
1164 #endif   /* __BORLANDC__ */
1165
1166
1167 /* Suggest testing for specific compiler first before testing for
1168  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
1169  * making reliance oncertain keywords suspect. (SJT)
1170  */
1171
1172 /* MSC Medium model */
1173 #if defined(FAR)
1174 #  if defined(M_I86MM)
1175 #    define USE_FAR_KEYWORD
1176 #    define FARDATA FAR
1177 #    include <dos.h>
1178 #  endif
1179 #endif
1180
1181 /* SJT: default case */
1182 #ifndef FAR
1183 #  define FAR
1184 #endif
1185
1186 /* At this point FAR is always defined */
1187 #ifndef FARDATA
1188 #  define FARDATA
1189 #endif
1190
1191 /* Typedef for floating-point numbers that are converted
1192    to fixed-point with a multiple of 100,000, e.g., int_gamma */
1193 typedef png_int_32 png_fixed_point;
1194
1195 /* Add typedefs for pointers */
1196 typedef void            FAR * png_voidp;
1197 typedef png_byte        FAR * png_bytep;
1198 typedef png_uint_32     FAR * png_uint_32p;
1199 typedef png_int_32      FAR * png_int_32p;
1200 typedef png_uint_16     FAR * png_uint_16p;
1201 typedef png_int_16      FAR * png_int_16p;
1202 typedef PNG_CONST char  FAR * png_const_charp;
1203 typedef char            FAR * png_charp;
1204 typedef png_fixed_point FAR * png_fixed_point_p;
1205
1206 #ifndef PNG_NO_STDIO
1207 #if defined(_WIN32_WCE)
1208 typedef HANDLE                png_FILE_p;
1209 #else
1210 typedef FILE                * png_FILE_p;
1211 #endif
1212 #endif
1213
1214 #ifdef PNG_FLOATING_POINT_SUPPORTED
1215 typedef double          FAR * png_doublep;
1216 #endif
1217
1218 /* Pointers to pointers; i.e. arrays */
1219 typedef png_byte        FAR * FAR * png_bytepp;
1220 typedef png_uint_32     FAR * FAR * png_uint_32pp;
1221 typedef png_int_32      FAR * FAR * png_int_32pp;
1222 typedef png_uint_16     FAR * FAR * png_uint_16pp;
1223 typedef png_int_16      FAR * FAR * png_int_16pp;
1224 typedef PNG_CONST char  FAR * FAR * png_const_charpp;
1225 typedef char            FAR * FAR * png_charpp;
1226 typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
1227 #ifdef PNG_FLOATING_POINT_SUPPORTED
1228 typedef double          FAR * FAR * png_doublepp;
1229 #endif
1230
1231 /* Pointers to pointers to pointers; i.e., pointer to array */
1232 typedef char            FAR * FAR * FAR * png_charppp;
1233
1234 #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
1235 /* SPC -  Is this stuff deprecated? */
1236 /* It'll be removed as of libpng-1.3.0 - GR-P */
1237 /* libpng typedefs for types in zlib. If zlib changes
1238  * or another compression library is used, then change these.
1239  * Eliminates need to change all the source files.
1240  */
1241 typedef charf *         png_zcharp;
1242 typedef charf * FAR *   png_zcharpp;
1243 typedef z_stream FAR *  png_zstreamp;
1244 #endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
1245
1246 /*
1247  * Define PNG_BUILD_DLL if the module being built is a Windows
1248  * LIBPNG DLL.
1249  *
1250  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
1251  * It is equivalent to Microsoft predefined macro _DLL that is
1252  * automatically defined when you compile using the share
1253  * version of the CRT (C Run-Time library)
1254  *
1255  * The cygwin mods make this behavior a little different:
1256  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1257  * Define PNG_STATIC if you are building a static library for use with cygwin,
1258  *   -or- if you are building an application that you want to link to the
1259  *   static library.
1260  * PNG_USE_DLL is defined by default (no user action needed) unless one of
1261  *   the other flags is defined.
1262  */
1263
1264 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
1265 #  define PNG_DLL
1266 #endif
1267 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
1268  * When building a static lib, default to no GLOBAL ARRAYS, but allow
1269  * command-line override
1270  */
1271 #if defined(__CYGWIN__)
1272 #  if !defined(PNG_STATIC)
1273 #    if defined(PNG_USE_GLOBAL_ARRAYS)
1274 #      undef PNG_USE_GLOBAL_ARRAYS
1275 #    endif
1276 #    if !defined(PNG_USE_LOCAL_ARRAYS)
1277 #      define PNG_USE_LOCAL_ARRAYS
1278 #    endif
1279 #  else
1280 #    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
1281 #      if defined(PNG_USE_GLOBAL_ARRAYS)
1282 #        undef PNG_USE_GLOBAL_ARRAYS
1283 #      endif
1284 #    endif
1285 #  endif
1286 #  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1287 #    define PNG_USE_LOCAL_ARRAYS
1288 #  endif
1289 #endif
1290
1291 /* Do not use global arrays (helps with building DLL's)
1292  * They are no longer used in libpng itself, since version 1.0.5c,
1293  * but might be required for some pre-1.0.5c applications.
1294  */
1295 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1296 #  if defined(PNG_NO_GLOBAL_ARRAYS) || \
1297       (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
1298 #    define PNG_USE_LOCAL_ARRAYS
1299 #  else
1300 #    define PNG_USE_GLOBAL_ARRAYS
1301 #  endif
1302 #endif
1303
1304 #if defined(__CYGWIN__)
1305 #  undef PNGAPI
1306 #  define PNGAPI __cdecl
1307 #  undef PNG_IMPEXP
1308 #  define PNG_IMPEXP
1309 #endif  
1310
1311 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
1312  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
1313  * Don't ignore those warnings; you must also reset the default calling
1314  * convention in your compiler to match your PNGAPI, and you must build
1315  * zlib and your applications the same way you build libpng.
1316  */
1317
1318 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
1319 #  ifndef PNG_NO_MODULEDEF
1320 #    define PNG_NO_MODULEDEF
1321 #  endif
1322 #endif
1323
1324 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
1325 #  define PNG_IMPEXP
1326 #endif
1327
1328 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
1329     (( defined(_Windows) || defined(_WINDOWS) || \
1330        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
1331
1332 #  ifndef PNGAPI
1333 #     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
1334 #        define PNGAPI __cdecl
1335 #     else
1336 #        define PNGAPI _cdecl
1337 #     endif
1338 #  endif
1339
1340 #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1341        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1342 #     define PNG_IMPEXP
1343 #  endif
1344
1345 #  if !defined(PNG_IMPEXP)
1346
1347 #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
1348 #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
1349
1350       /* Borland/Microsoft */
1351 #     if defined(_MSC_VER) || defined(__BORLANDC__)
1352 #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1353 #           define PNG_EXPORT PNG_EXPORT_TYPE1
1354 #        else
1355 #           define PNG_EXPORT PNG_EXPORT_TYPE2
1356 #           if defined(PNG_BUILD_DLL)
1357 #              define PNG_IMPEXP __export
1358 #           else
1359 #              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
1360                                                  VC++ */
1361 #           endif                             /* Exists in Borland C++ for
1362                                                  C++ classes (== huge) */
1363 #        endif
1364 #     endif
1365
1366 #     if !defined(PNG_IMPEXP)
1367 #        if defined(PNG_BUILD_DLL)
1368 #           define PNG_IMPEXP __declspec(dllexport)
1369 #        else
1370 #           define PNG_IMPEXP __declspec(dllimport)
1371 #        endif
1372 #     endif
1373 #  endif  /* PNG_IMPEXP */
1374 #else /* !(DLL || non-cygwin WINDOWS) */
1375 #   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
1376 #      ifndef PNGAPI
1377 #         define PNGAPI _System
1378 #      endif
1379 #   else
1380 #      if 0 /* ... other platforms, with other meanings */
1381 #      endif
1382 #   endif
1383 #endif
1384
1385 #ifndef PNGAPI
1386 #  define PNGAPI
1387 #endif
1388 #ifndef PNG_IMPEXP
1389 #  define PNG_IMPEXP
1390 #endif
1391
1392 #ifdef PNG_BUILDSYMS
1393 #  ifndef PNG_EXPORT
1394 #    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
1395 #  endif
1396 #  ifdef PNG_USE_GLOBAL_ARRAYS
1397 #    ifndef PNG_EXPORT_VAR
1398 #      define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
1399 #    endif
1400 #  endif
1401 #endif
1402
1403 #ifndef PNG_EXPORT
1404 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
1405 #endif
1406
1407 #ifdef PNG_USE_GLOBAL_ARRAYS
1408 #  ifndef PNG_EXPORT_VAR
1409 #    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
1410 #  endif
1411 #endif
1412
1413 /* User may want to use these so they are not in PNG_INTERNAL. Any library
1414  * functions that are passed far data must be model independent.
1415  */
1416
1417 #ifndef PNG_ABORT
1418 #  define PNG_ABORT() abort()
1419 #endif
1420
1421 #ifdef PNG_SETJMP_SUPPORTED
1422 #  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
1423 #else
1424 #  define png_jmpbuf(png_ptr) \
1425    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
1426 #endif
1427
1428 #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
1429 /* use this to make far-to-near assignments */
1430 #  define CHECK   1
1431 #  define NOCHECK 0
1432 #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1433 #  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
1434 #  define png_snprintf _fsnprintf   /* Added to v 1.2.19 */
1435 #  define png_strlen  _fstrlen
1436 #  define png_memcmp  _fmemcmp    /* SJT: added */
1437 #  define png_memcpy  _fmemcpy
1438 #  define png_memset  _fmemset
1439 #else /* use the usual functions */
1440 #  define CVT_PTR(ptr)         (ptr)
1441 #  define CVT_PTR_NOCHECK(ptr) (ptr)
1442 #  ifndef PNG_NO_SNPRINTF
1443 #    ifdef _MSC_VER
1444 #      define png_snprintf _snprintf   /* Added to v 1.2.19 */
1445 #      define png_snprintf2 _snprintf
1446 #      define png_snprintf6 _snprintf
1447 #    else
1448 #      define png_snprintf snprintf   /* Added to v 1.2.19 */
1449 #      define png_snprintf2 snprintf
1450 #      define png_snprintf6 snprintf
1451 #    endif
1452 #  else
1453      /* You don't have or don't want to use snprintf().  Caution: Using
1454       * sprintf instead of snprintf exposes your application to accidental
1455       * or malevolent buffer overflows.  If you don't have snprintf()
1456       * as a general rule you should provide one (you can get one from
1457       * Portable OpenSSH). */
1458 #    define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
1459 #    define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
1460 #    define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
1461         sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
1462 #  endif
1463 #  define png_strlen  strlen
1464 #  define png_memcmp  memcmp      /* SJT: added */
1465 #  define png_memcpy  memcpy
1466 #  define png_memset  memset
1467 #endif
1468 /* End of memory model independent support */
1469
1470 /* Just a little check that someone hasn't tried to define something
1471  * contradictory.
1472  */
1473 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
1474 #  undef PNG_ZBUF_SIZE
1475 #  define PNG_ZBUF_SIZE 65536L
1476 #endif
1477
1478 /* Added at libpng-1.2.8 */
1479 #endif /* PNG_VERSION_INFO_ONLY */
1480
1481 #endif /* PNGCONF_H */