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