Home | History | Annotate | Download | only in scripts
      1 # scripts/pnglibconf.dfa - library build configuration control
      2 #
      3 @/*- pnglibconf.dfn intermediate file
      4 @ *  generated from scripts/pnglibconf.dfa
      5 @ */
      6 #
      7 com pnglibconf.h - library build configuration
      8 com
      9 version
     10 com
     11 com Copyright (c) 1998-2017 Glenn Randers-Pehrson
     12 com
     13 com This code is released under the libpng license.
     14 com For conditions of distribution and use, see the disclaimer
     15 com and license in png.h
     16 com
     17 
     18 file pnglibconf.h scripts/pnglibconf.dfa PNGLCONF_H
     19 
     20 # This file is preprocessed by scripts/options.awk and the
     21 # C compiler to generate 'pnglibconf.h' - a list of all the
     22 # configuration options.  The file lists the various options
     23 # that can *only* be specified during the libpng build;
     24 # pnglibconf.h freezes the definitions selected for the specific
     25 # build.
     26 #
     27 # The syntax is detailed in scripts/options.awk; this is a summary
     28 # only:
     29 #
     30 # setting <name> [requires ...] [default]
     31 #    #define PNG_<name> <value>  /* value comes from current setting */
     32 # option <name> [requires ...] [if ...] [enables ...] [disabled]
     33 #    #define PNG_<name>_SUPPORTED if the requirements are met and
     34 #    enable the other options listed
     35 # chunk <name> [requires ...] [enables ...] [disabled]
     36 #    Enable chunk processing for the given ancillary chunk; any
     37 #    'requires something' expands to READ_something for read and
     38 #    WRITE_something for write, but the enables list members are
     39 #    used as given (e.g. enables GAMMA just expands to that on the
     40 #    correspond READ_name and WRITE_name lines.)
     41 #
     42 # "," may be used to separate options on an 'option' line and is ignored; it
     43 # doesn't change the meaning of the line.  (NOT setting, where "," becomes
     44 # part of the setting!)  A comma at the end of an option line causes a
     45 # continuation (the next line is included in the option too.)
     46 #
     47 # Note that the 'on' and 'off' keywords, while valid on both option
     48 # and chunk, should not be used in this file because they force the
     49 # relevant options on or off.
     50 
     51 #----------------------------------------------------------------------
     52 
     53 # The following setting, option and chunk values can all be changed
     54 # while building libpng:
     55 #
     56 # setting: change 'setting' lines to fine tune library performance;
     57 #   changes to the settings don't affect the libpng API functionally
     58 #
     59 # option: change 'option' lines to remove or add capabilities from
     60 #   or to the library; options change the library API
     61 #
     62 # chunk: change 'chunk' lines to remove capabilities to process
     63 #   optional ('ancillary') chunks.  This does not prevent PNG
     64 #   decoding but does change the libpng API because some chunks
     65 #   will be ignored.
     66 #
     67 # There are three ways of disabling features, in no particular order:
     68 #
     69 # 1) Create 'pngusr.h', enter the required private build information
     70 # detailed below and #define PNG_NO_<option> for each option you
     71 # don't want in that file in that file.  You can also turn on options
     72 # using PNG_<option>_SUPPORTED.  When you have finished rerun
     73 # configure and rebuild pnglibconf.h file with -DPNG_USER_CONFIG:
     74 #
     75 #  make clean
     76 #  CPPFLAGS='-DPNG_USER_CONFIG' ./configure
     77 #  make pnglibconf.h
     78 #
     79 # pngusr.h is only used during the creation of pnglibconf.h, but it
     80 # is safer to ensure that -DPNG_USER_CONFIG is specified throughout
     81 # the build by changing the CPPFLAGS passed to the initial ./configure
     82 #
     83 # 2) Add definitions of the settings you want to change to
     84 # CPPFLAGS; for example:
     85 #
     86 #   -DPNG_DEFAULT_READ_MACROS=0
     87 #
     88 # (This would change the default to *not* use read macros.)  Be
     89 # very careful to change only settings that don't alter the API
     90 # because this approach bypasses the private build checking.  You
     91 # can also change settings from pngpriv.h (read pngpriv.h) safely
     92 # without API changes.  Do that in the same way.
     93 #
     94 # 3) Write a new '.dfa' file (say 'pngusr.dfa') and in this file
     95 # provide override values for setting entries and turn option or
     96 # chunk values explicitly 'on' or 'off':
     97 #
     98 #    setting FOO default VALUE
     99 #    option BAR [on|off]
    100 #
    101 # Then add this file to the options.awk command line (the *first*
    102 # one) after this file.  The make macro DFA_XTRA is provided to make
    103 # this easier (set it like CPPFLAGS prior to running ./configure).
    104 # Look at the builds below contrib/pngminim for some extreme examples
    105 # of how this can be used.
    106 #
    107 # Don't edit this file unless you are contributing a patch to
    108 # libpng and need new or modified options/settings.
    109 #----------------------------------------------------------------------
    110 
    111 # The following causes commented out #undef lines to be written to
    112 # pnglibconf.h; this can be stopped by logunsupported=0 in a later
    113 # file or on the command line (after pnglibconf.dfa)
    114 
    115 logunsupported = 1
    116 
    117 # The following allows the output from configure to modify the contents of
    118 # pnglibconf.h
    119 
    120 @#ifdef HAVE_CONFIG_H
    121 @#  include "config.h"
    122 @#endif
    123 
    124 # PNG_USER_CONFIG has to be defined on the compiler command line
    125 # to cause pngusr.h to be read while constructing pnglibconf.h
    126 #
    127 # If you create a private DLL you need to define the following
    128 # macros in the file 'pngusr.h' and set -DPNG_USER_CONFIG for
    129 # compilation (i.e. in CPPFLAGS.)
    130 # #define PNG_USER_PRIVATEBUILD \
    131 #     <Describes by whom and why this version of the DLL was built>
    132 #  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
    133 # #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
    134 #        distinguish your DLL from those of the official release. These
    135 #        correspond to the trailing letters that come after the version
    136 #        number and must match your private DLL name>
    137 #  e.g. // private DLL "libpng13gx.dll"
    138 #       #define PNG_USER_DLLFNAME_POSTFIX "gx"
    139 #
    140 # The following macros are also at your disposal if you want to complete the
    141 # DLL VERSIONINFO structure.
    142 # - PNG_USER_VERSIONINFO_COMMENTS
    143 # - PNG_USER_VERSIONINFO_COMPANYNAME
    144 # - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
    145 
    146 # It is necessary to include configures definitions here so that AC_DEFINE
    147 # in configure.ac works in a comprehensible way
    148 @#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
    149 @#  include "config.h"
    150 @#endif
    151 
    152 @#ifdef PNG_USER_CONFIG
    153 @#  include "pngusr.h"
    154 @#endif
    155 
    156 # This is a special fixup for the Watcom C compiler on Windows, which has
    157 # multiple procedure call standards.  Unless PNG_API_RULE is set explicitly
    158 # (i.e. if it is not defined at this point) it will be forced to '2' here when
    159 # using Watcom.  This indicates to the other header files that Watcom behaviour
    160 # is required where appropriate.
    161 
    162 @#ifdef __WATCOMC__
    163 @#  ifndef PNG_API_RULE
    164 @#     define PNG_API_RULE 2 /* Use Watcom calling conventions */
    165 @#  endif
    166 @#endif
    167 
    168 # IN DEVELOPMENT
    169 # These are currently experimental features; define them if you want (NOTE:
    170 # experimental options must be disabled before they are defined in this file!)
    171 
    172 # NONE
    173 
    174 # Note that PNG_USER_CONFIG only has an effect when building
    175 # pnglibconf.h
    176 
    177 setting USER_CONFIG
    178 setting USER_PRIVATEBUILD
    179 setting USER_DLLFNAME_POSTFIX
    180 setting USER_VERSIONINFO_COMMENTS
    181 setting USER_VERSIONINFO_COMPANYNAME
    182 setting USER_VERSIONINFO_LEGALTRADEMARKS
    183 
    184 # Record the 'API rule' used to select calling conventions on
    185 # those systems that support such things (see all the comments in
    186 # pngconf.h)
    187 # Changing this setting has a fundamental affect on the PNG ABI,
    188 # do not release shared libraries with this changed.
    189 
    190 setting API_RULE default 0
    191 
    192 # This allows a prefix to be added to the front of every API functon name (and
    193 # therefore every symbol) by redefining all the function names with the prefix
    194 # at the end of pnglibconf.h.  It also turns on similar internal symbol renaming
    195 # by causing a similar build-time only file, pngprefix.h, to be generated.
    196 
    197 setting PREFIX
    198 
    199 # Implementation specific control of the optimizations, enabled by those
    200 # hardware or software options that need it (typically when run-time choices
    201 # must be made by the user)
    202 option SET_OPTION disabled
    203 
    204 # These options are specific to the ARM NEON hardware optimizations.  At present
    205 # these optimizations depend on GCC specific pre-processing of an assembler (.S)
    206 # file so they probably won't work with other compilers.
    207 #
    208 # ARM_NEON_OPT: unset: check at compile time (__ARM_NEON__ must be defined by
    209 #                      the compiler, typically as a result of specifying
    210 #                      CC="gcc -mfpu=neon".)
    211 #                   0: disable (even if the CPU has a NEON FPU.)
    212 #                   1: check at run time (via ARM_NEON_{API,CHECK})
    213 #                   2: switch on unconditionally (inadvisable - instead pass
    214 #                      -mfpu=neon to GCC in CC)
    215 #           When building libpng avoid using any setting other than '0'; '1' is
    216 #           set automatically when either 'API' or 'CHECK' are configured in,
    217 #           '2' should not be necessary as -mfpu=neon will achieve the same
    218 #           effect as well as applying NEON optimizations to the rest of the
    219 #           libpng code.
    220 #           NOTE: any setting other than '0' requires ALIGNED_MEMORY
    221 # ARM_NEON_API:   (PNG_ARM_NEON == 1) allow the optimization to be switched on
    222 #                 with png_set_option
    223 # ARM_NEON_CHECK: (PNG_ARM_NEON == 1) compile a run-time check to see if Neon
    224 #                 extensions are supported. This is poorly supported and
    225 #                 deprecated - use the png_set_option API.
    226 setting ARM_NEON_OPT
    227 option ARM_NEON_API disabled requires ALIGNED_MEMORY enables SET_OPTION,
    228    sets ARM_NEON_OPT 1
    229 option ARM_NEON_CHECK disabled requires ALIGNED_MEMORY,
    230    sets ARM_NEON_OPT 1
    231 
    232 # These options are specific to the PowerPC VSX hardware optimizations.
    233 #
    234 # POWERPC_VSX_OPT: unset: check at compile time (__PPC64__,__ALTIVEC__,__VSX__
    235 #                      must be defined by the compiler, typically as a result
    236 #                      of specifying
    237 #                      "-mvsx -maltivec" compiler flags)
    238 #                   0: disable (even if the CPU supports VSX.)
    239 #                   1: check at run time (via POWERPC_VSX_{API,CHECK})
    240 #                   2: switch on unconditionally (inadvisable - instead pass
    241 #                      -mvsx -maltivec to compiler options)
    242 #           When building libpng avoid using any setting other than '0'; '1' is
    243 #           set automatically when either 'API' or 'CHECK' are configured in,
    244 #           '2' should not be necessary as "-mvsx -maltivec" will achieve the same
    245 #           effect as well as applying VSX optimizations to the rest of the
    246 #           libpng code.
    247 # POWERPC_VSX_API:   (PNG_POWERPC_VSX == 1) allow the optimization to be switched on
    248 #                 with png_set_option
    249 # POWERPC_VSX_CHECK: (PNG_POWERPC_VSX == 1) compile a run-time check to see if VSX
    250 #                 extensions are supported. This is supported not for all OSes
    251 #                 (see contrib/powerpc/README)
    252 setting POWERPC_VSX_OPT
    253 option POWERPC_VSX_API disabled enables SET_OPTION,
    254   sets POWERPC_VSX_OPT 1
    255 option POWERPC_VSX_CHECK disabled,
    256   sets POWERPC_VSX_OPT 1
    257 
    258 
    259 # These settings configure the default compression level (0-9) and 'strategy';
    260 # strategy is as defined by the implementors of zlib. It describes the input
    261 # data and modifies the zlib parameters in an attempt to optimize the balance
    262 # between search and huffman encoding in the zlib algorithms.  The defaults are
    263 # the zlib.h defaults - the apparently recursive definition does not arise
    264 # because the name of the setting is prefixed by PNG_
    265 #
    266 # The TEXT values are the defaults when writing compressed text (all forms)
    267 
    268 # Include the zlib header so that the defaults below are known
    269 @#  include <zlib.h>
    270 
    271 # The '@' here means to substitute the value when pnglibconf.h is built
    272 setting Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION
    273 # TODO: why aren't these Z_RLE; zlib.h says that Z_RLE, specifically, is
    274 # appropriate for PNG images, maybe it doesn't exist in all versions?
    275 setting Z_DEFAULT_STRATEGY default @Z_FILTERED
    276 setting Z_DEFAULT_NOFILTER_STRATEGY default @Z_DEFAULT_STRATEGY
    277 setting ZLIB_VERNUM default @ZLIB_VERNUM
    278 
    279 # Linkage of:
    280 #
    281 #  API:      libpng API functions
    282 #  CALLBACK: internal non-file-local callbacks
    283 #  FUNCTION: internal non-file-local functions
    284 #  DATA:     internal non-file-local (const) data
    285 setting LINKAGE_API default extern
    286 setting LINKAGE_CALLBACK default extern
    287 setting LINKAGE_FUNCTION default extern
    288 setting LINKAGE_DATA default extern
    289 
    290 setting TEXT_Z_DEFAULT_COMPRESSION default @Z_DEFAULT_COMPRESSION
    291 setting TEXT_Z_DEFAULT_STRATEGY default @Z_DEFAULT_STRATEGY
    292 
    293 # Default to using the read macros
    294 
    295 setting DEFAULT_READ_MACROS default 1
    296 
    297 # The alternative is to call functions to read PNG values, if
    298 # the functions are turned *off* the read macros must always
    299 # be enabled, so turning this off will actually force the
    300 # USE_READ_MACROS option on (see pngconf.h)
    301 
    302 option READ_INT_FUNCTIONS requires READ
    303 
    304 # The same for write  but these can only be switched off if no writing
    305 # is required at all - hence the use of a 'disabled', not a 'requires'.
    306 # If these are needed, they are enabled in the 'WRITE options' section
    307 # below.
    308 
    309 option WRITE_INT_FUNCTIONS disabled
    310 
    311 # Error controls
    312 #
    313 # WARNINGS: normally on, if off no warnings are generated
    314 # ERROR_TEXT: normally on, if off errors happen but there is no message
    315 # ERROR_NUMBERS: unimplemented feature, therefore disabled
    316 # BENIGN_ERRORS: support for just issuing warnings for recoverable errors
    317 #
    318 # BENIGN_READ_ERRORS:
    319 #     By default recoverable errors on read should just generate warnings,
    320 #     generally safe but PNG files that don't conform to the specification will
    321 #     be accepted if a meaningful result can be produced.
    322 #
    323 # BENIGN_WRITE_ERRORS:
    324 #     By default recoverable errors on write should just generate warnings,
    325 #     not generally safe because this allows the application to write invalid
    326 #     PNG files.  Applications should enable this themselves; it's useful
    327 #     because it means that a failure to write an ancilliary chunk can often be
    328 #     ignored.
    329 
    330 option WARNINGS
    331 option ERROR_TEXT
    332 option ERROR_NUMBERS disabled
    333 
    334 option BENIGN_ERRORS
    335 option BENIGN_WRITE_ERRORS requires BENIGN_ERRORS disabled
    336 option BENIGN_READ_ERRORS requires BENIGN_ERRORS
    337 
    338 
    339 # Generic options - affect both read and write.
    340 
    341 option MNG_FEATURES
    342 
    343 # Arithmetic options, the first is the big switch that chooses between internal
    344 # floating and fixed point arithmetic implementations - it does not affect any
    345 # APIs.  The second two (the _POINT settings) switch off individual APIs.
    346 #
    347 # Prior to libpng 1.6.8 one of the API (_POINT) variants had to be selected.  At
    348 # 1.6.8 this restriction has been removed; the simplified API can be used
    349 # without enabling any of the low level fixed/floating APIs.
    350 
    351 option FLOATING_ARITHMETIC
    352 option FLOATING_POINT
    353 option FIXED_POINT
    354 
    355 # This protects us against compilers that run on a windowing system
    356 # and thus don't have or would rather us not use the stdio types:
    357 # stdin, stdout, and stderr.  The only one currently used is stderr
    358 # in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
    359 # prevent these from being compiled and used. #defining PNG_NO_STDIO
    360 # will also prevent these, plus will prevent the entire set of stdio
    361 # macros and functions (FILE *, printf, etc.) from being compiled and used,
    362 # unless (PNG_DEBUG > 0) has been #defined.
    363 
    364 option STDIO
    365 option CONSOLE_IO requires STDIO
    366 
    367 # Note: prior to 1.5.0 this option could not be disabled if STDIO
    368 # was enabled.  Prior to 1.5.3 this option required STDIO
    369 
    370 option TIME_RFC1123
    371 
    372 # PNG_SETJMP_NOT_SUPPORTED is an old equivalent for NO_SETJMP
    373 
    374 option SETJMP
    375 = NO_SETJMP SETJMP_NOT_SUPPORTED
    376 
    377 # If this is disabled it is not possible for apps to get the
    378 # values from the 'info' structure, this effectively removes
    379 # quite a lot of the READ API.
    380 
    381 option EASY_ACCESS
    382 
    383 # Added at libpng-1.2.0
    384 
    385 option USER_MEM
    386 
    387 # Added at libpng-1.4.0
    388 
    389 option IO_STATE
    390 
    391 # Libpng limits: limit the size of images and data on read.
    392 #
    393 # If this option is disabled all the limit checking code will be disabled:
    394 
    395 option USER_LIMITS requires READ
    396 
    397 # The default settings given below for the limits mean that libpng will
    398 # limit the size of images or the size of data in ancilliary chunks to less
    399 # than the specification or implementation limits. Settings have the
    400 # following interpretations:
    401 #
    402 # USER_WIDTH_MAX: maximum width of an image that will be read
    403 # USER_HEIGHT_MAX: maximum height
    404 # USER_CHUNK_MALLOC_MAX: maximum in-memory (decompressed) size of a single chunk
    405 # USER_CHUNK_CACHE_MAX: maximum number of chunks to be cached
    406 #
    407 # Only chunks that are variable in number are counted towards the
    408 
    409 # Use 0x7fffffff for unlimited
    410 setting USER_WIDTH_MAX default        1000000
    411 setting USER_HEIGHT_MAX default       1000000
    412 
    413 # Use 0 for unlimited
    414 setting USER_CHUNK_CACHE_MAX default     1000
    415 setting USER_CHUNK_MALLOC_MAX default 8000000
    416 
    417 # If this option is enabled APIs to set the above limits at run time are added;
    418 # without this the hardwired (compile time) limits will be used.
    419 option SET_USER_LIMITS requires USER_LIMITS
    420 
    421 # All of the following options relate to code capabilities for
    422 # processing image data before creating a PNG or after reading one.
    423 # You can remove these capabilities safely and still be PNG
    424 # conformant, however the library that results is still non-standard.
    425 # See the comments above about how to change options and settings.
    426 
    427 # READ options
    428 #
    429 # WARNING: in libpng 1.5 maintained configuration compatibility with earlier
    430 # versions.  In some cases turning off an option turned off other options, in
    431 # others it was ineffective unless dependent options were also turned off.
    432 # Libpng 1.6 changes this: in general if you turn off an option that affects
    433 # APIs it stays off and simply disables APIs that depend on it.
    434 #
    435 # As a result if you simply port the libpng 1.5 configuration to libpng 1.6 you
    436 # will probably see build failures due to missing APIs.  Fixing these failures
    437 # requires some, perhaps considerable, knowledge of what your libpng using
    438 # applications are doing, fortunately there is no great reason for you to move
    439 # to libpng 1.6; the new interfaces in 1.6 will take several years to become
    440 # popular.
    441 
    442 option READ enables READ_INTERLACING SET_OPTION
    443 
    444 # Disabling READ_16BIT does not disable reading 16-bit PNG files, but it
    445 # forces them to be chopped down to 8-bit, and disables any 16-bit
    446 # processing after that has happened.  You need to be sure to enable
    447 # READ_SCALE_16_TO_8 or READ_STRIP_16_TO_8 when you disable READ_16BIT for
    448 # this to work properly.  You should disable the other option if you need to
    449 # ensure a particular conversion (otherwise the app can chose.)
    450 
    451 option READ_16BIT requires READ enables 16BIT
    452 
    453 option READ_QUANTIZE requires READ
    454 
    455 option READ_TRANSFORMS requires READ
    456 = NO_READ_TRANSFORMS READ_TRANSFORMS_NOT_SUPPORTED
    457 
    458 # Read gamma handling.  Gamma processing is a core part of libpng and many of
    459 # the capabilities are dependent on libpng performing gamma correction.
    460 #
    461 # In libpng 1.6 disabling gamma processing (setting PNG_NO_READ_GAMMA)
    462 # consistently disables those parts of the API that depend on it.  Prior to
    463 # 1.6.0 this was not true; the results were unpredictable and varied between
    464 # releases.
    465 #
    466 # If you disable gamma processing and your program no longer compiles you need
    467 # to ask whether you really need the APIs that are missing.  If you do then you
    468 # almost certainly need the gamma processing.
    469 #
    470 # If you handle gamma issues outside libpng then you do not need the libpng
    471 # gamma processing; and it is an enormous waste of space.  You just need to
    472 # remove the use of libpng APIs that depend on it.
    473 option READ_GAMMA requires READ_TRANSFORMS, READ_gAMA, READ_sRGB
    474 
    475 option READ_ALPHA_MODE requires READ_TRANSFORMS, READ_GAMMA
    476 option READ_BACKGROUND requires READ_TRANSFORMS, READ_STRIP_ALPHA, READ_GAMMA
    477 option READ_BGR requires READ_TRANSFORMS
    478 option READ_EXPAND_16 requires READ_TRANSFORMS, READ_16BIT, READ_EXPAND
    479 option READ_EXPAND requires READ_TRANSFORMS
    480 option READ_FILLER requires READ_TRANSFORMS
    481 option READ_GRAY_TO_RGB requires READ_TRANSFORMS
    482 option READ_INVERT_ALPHA requires READ_TRANSFORMS
    483 option READ_INVERT requires READ_TRANSFORMS
    484 option READ_PACK requires READ_TRANSFORMS
    485 option READ_PACKSWAP requires READ_TRANSFORMS
    486 option READ_RGB_TO_GRAY requires READ_TRANSFORMS, READ_GAMMA enables COLORSPACE
    487 option READ_SCALE_16_TO_8 requires READ_TRANSFORMS
    488 option READ_SHIFT requires READ_TRANSFORMS
    489 option READ_STRIP_16_TO_8 requires READ_TRANSFORMS
    490 option READ_STRIP_ALPHA requires READ_TRANSFORMS
    491 option READ_SWAP_ALPHA requires READ_TRANSFORMS
    492 option READ_SWAP requires READ_TRANSFORMS, READ_16BIT
    493 option READ_USER_TRANSFORM requires READ_TRANSFORMS
    494 
    495 option PROGRESSIVE_READ requires READ
    496 option SEQUENTIAL_READ requires READ
    497 
    498 # You can define PNG_NO_PROGRESSIVE_READ if you don't do progressive reading.
    499 # This is not talking about interlacing capability!  You'll still have
    500 # interlacing unless you turn off the following which is required
    501 # for PNG-compliant decoders.  (In other words, do not do this - in
    502 # fact it can't be disabled from the command line!)
    503 #option READ_INTERLACING requires READ
    504 
    505 option READ_COMPOSITE_NODIV requires READ
    506 = NO_READ_COMPOSITE_NODIV NO_READ_COMPOSITED_NODIV
    507 
    508 # Inch conversions
    509 
    510 option INCH_CONVERSIONS
    511 = INCH_CONVERSIONS INCH_CONVERSIONS
    512 
    513 # API to build a grayscale palette
    514 # NOTE: this is not used internally by libpng at present.
    515 
    516 option BUILD_GRAYSCALE_PALETTE
    517 
    518 # WRITE options
    519 
    520 option WRITE enables WRITE_INT_FUNCTIONS
    521 
    522 # Disabling WRITE_16BIT prevents 16-bit PNG files from being
    523 # generated.
    524 option WRITE_16BIT requires WRITE enables 16BIT
    525 
    526 option WRITE_TRANSFORMS requires WRITE
    527 = NO_WRITE_TRANSFORMS WRITE_TRANSFORMS_NOT_SUPPORTED
    528 
    529 option WRITE_SHIFT requires WRITE_TRANSFORMS
    530 option WRITE_PACK requires WRITE_TRANSFORMS
    531 option WRITE_BGR requires WRITE_TRANSFORMS
    532 option WRITE_SWAP requires WRITE_TRANSFORMS, WRITE_16BIT
    533 option WRITE_PACKSWAP requires WRITE_TRANSFORMS
    534 option WRITE_INVERT requires WRITE_TRANSFORMS
    535 option WRITE_FILLER requires WRITE_TRANSFORMS
    536 option WRITE_SWAP_ALPHA requires WRITE_TRANSFORMS
    537 option WRITE_INVERT_ALPHA requires WRITE_TRANSFORMS
    538 option WRITE_USER_TRANSFORM requires WRITE_TRANSFORMS
    539 
    540 # This is not required for PNG-compliant encoders, but can cause
    541 # trouble if left undefined
    542 
    543 option WRITE_INTERLACING requires WRITE
    544 
    545 # Deprecated, will be removed.
    546 option WRITE_WEIGHTED_FILTER requires WRITE
    547 
    548 option WRITE_FLUSH requires WRITE
    549 
    550 # Note: these can be turned off explicitly if not required by the
    551 # apps implementing the user transforms
    552 option USER_TRANSFORM_PTR if READ_USER_TRANSFORM, WRITE_USER_TRANSFORM
    553 option USER_TRANSFORM_INFO if READ_USER_TRANSFORM, WRITE_USER_TRANSFORM
    554 
    555 # This enables API to set compression parameters for compressing
    556 # non-IDAT chunks (zTXt, iTXt, iCCP, and unknown chunks).  This feature
    557 # was added at libpng-1.5.3.
    558 option WRITE_CUSTOMIZE_ZTXT_COMPRESSION requires WRITE
    559 option WRITE_CUSTOMIZE_COMPRESSION requires WRITE
    560 
    561 # Any chunks you are not interested in, you can undef here.  The
    562 # ones that allocate memory may be expecially important (hIST,
    563 # tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
    564 # a bit smaller.
    565 
    566 # The size of the png_text structure changed in libpng-1.0.6 when
    567 # iTXt support was added.  iTXt support was turned off by default through
    568 # libpng-1.2.x, to support old apps that malloc the png_text structure
    569 # instead of calling png_set_text() and letting libpng malloc it.  It
    570 # was turned on by default in libpng-1.4.0.
    571 
    572 option READ_ANCILLARY_CHUNKS requires READ
    573 # PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated.
    574 = NO_READ_ANCILLARY_CHUNKS READ_ANCILLARY_CHUNKS_NOT_SUPPORTED
    575 
    576 option WRITE_ANCILLARY_CHUNKS requires WRITE
    577 # PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED is deprecated.
    578 = NO_WRITE_ANCILLARY_CHUNKS WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED
    579 
    580 # These options disable *all* the text chunks if turned off
    581 
    582 option TEXT disabled
    583 option READ_TEXT requires READ_ANCILLARY_CHUNKS enables TEXT
    584 option WRITE_TEXT requires WRITE_ANCILLARY_CHUNKS enables TEXT
    585 
    586 # Moved to pnglibconf.h at libpng-1.5.0
    587 # Feature support: in 1.4 this was in pngconf.h, but the following
    588 # features have no affect on the libpng API.  Add library
    589 # only features to the end of this list.  Add features that
    590 # affect the API above.  (Note: the list of chunks follows
    591 # the library-only settings.)
    592 #
    593 # BUILD TIME ONLY OPTIONS
    594 #   These options do not affect the API but rather alter how the
    595 #   API is implemented, they get recorded in pnglibconf.h, but
    596 #   can't be changed by the application.
    597 
    598 # Colorspace support (enabled as required); just the support for colorant
    599 # information.  Gamma support, likewise, is just support for the gamma
    600 # information, READ_GAMMA is required for gamma transformations (so it
    601 # is possible to read PNG gamma without enabling all the libpng transform
    602 # code - do this for applications that do their own gamma processing)
    603 #
    604 # As of 1.6.0 COLORSPACE is only useful if the application processes the
    605 # information; this is because the library does not do any colorspace
    606 # processing, it just validates the data in the PNG file.
    607 
    608 option GAMMA disabled
    609 option COLORSPACE enables GAMMA disabled
    610 
    611 # When an ICC profile is read, or png_set, it will be checked for a match
    612 # against known sRGB profiles if the sRGB handling is enabled.  The
    613 # PNG_sRGB_PROFILE_CHECKS setting controls how much work is done during the
    614 # check:
    615 #
    616 # -1: Don't do any sRGB profile checking.
    617 #
    618 #  0: Just validate the profile MD5 signature if present, otherwise use
    619 #     the checks in option 1.
    620 #
    621 #  1: Additionally check the length, intent and adler32 checksum of the
    622 #     actual data.   If enabled this will reject known profiles that have
    623 #     had the rendering intent in the header changed as well as other edits
    624 #     done without updating the checksum.  See the discussion below.
    625 #
    626 #  2: Additionally checksum all the data using the ethernet CRC32 algorithm.
    627 #     This makes it more difficult to fake profiles and makes it less likely
    628 #     to get a false positive on profiles with no signature, but is probably
    629 #     just a waste of time since all currently approved ICC sRGB profiles have
    630 #     a secure MD5 signature.
    631 #
    632 # The rendering intent.  An ICC profile stores an intended rendering intent,
    633 # but does not include the value in the signature.  The intent is documented
    634 # as the intent that should be used when combining two profiles.  The sRGB
    635 # profile is intended, however, to be used with any of the four defined intents.
    636 # For this reason the sRGB chunk includes an 'intent' to be used when displaying
    637 # the image (intent is really a property of the image not the profile.)
    638 #
    639 # Unfortunately the iCCP chunk does not.  It may therefore be that some
    640 # applications modify the intent in profiles (including sRGB profiles) to work
    641 # round this problem.  Selecting an option other than option '0' will cause such
    642 # modified profiles to be rejected.
    643 #
    644 # Security.  The use of Adler32 and CRC32 checksums does not help significantly
    645 # with any security issues.  It is relatively easy to produce arbitrary profiles
    646 # with the required checksums on current computer systems.  Nevertheless
    647 # security does not seem to be an issue because the only consequence of a false
    648 # positive is a false assertion that the profile is an sRGB profile.  This might
    649 # be used to hide data from libpng using applications, but it doesn't seem
    650 # possible to damage them.
    651 
    652 setting sRGB_PROFILE_CHECKS default 2
    653 
    654 # Artificially align memory - the code typically aligns to 8 byte
    655 # boundaries if this is switched on, it's a small waste of space
    656 # but can help (in theory) on some architectures.  Only affects
    657 # internal structures.  Added at libpng 1.4.0
    658 
    659 option ALIGNED_MEMORY
    660 
    661 # Buggy compilers (e.g., gcc 2.7.2.2) need PNG_NO_POINTER_INDEXING
    662 # See png[wr]util.c, normally this should always be *on*
    663 
    664 option POINTER_INDEXING
    665 
    666 # Other defines for things like memory and the like can go here.
    667 
    668 # BUILD TIME SETTINGS
    669 # Like build time options these do not affect the API, but they
    670 # may be useful to applications because they record details of
    671 # how the API will behave particularly with regard to overall
    672 # accuracy.
    673 
    674 # This controls how fine the quantizing gets.  As this allocates
    675 # a largish chunk of memory (32K), those who are not as concerned
    676 # with quantizing quality can decrease some or all of these.
    677 
    678 setting QUANTIZE_RED_BITS default 5
    679 setting QUANTIZE_GREEN_BITS default 5
    680 setting QUANTIZE_BLUE_BITS default 5
    681 
    682 # This controls how fine the gamma correction becomes when you
    683 # are only interested in 8 bits anyway.  Increasing this value
    684 # results in more memory being used, and more pow() functions
    685 # being called to fill in the gamma tables.  Don't set this value
    686 # less than 8, and even that may not work (I haven't tested it).
    687 
    688 setting MAX_GAMMA_8 default 11
    689 
    690 # This controls how much a difference in gamma we can tolerate before
    691 # we actually start doing gamma conversion, it's a fixed point value,
    692 # so the default below is 0.05, meaning libpng ignores corrections in
    693 # the range 0.95 to 1.05
    694 
    695 setting GAMMA_THRESHOLD_FIXED default 5000
    696 
    697 # Precision to use when converting a floating point value to a PNG
    698 # extension format string in an sCAL chunk (only relevant if the
    699 # floating point API is enabled)
    700 
    701 setting sCAL_PRECISION default 5
    702 
    703 # This is the size of the compression buffer, and thus the size of
    704 # an IDAT chunk.  Make this whatever size you feel is best for your
    705 # machine.  One of these will be allocated per png_struct.  When this
    706 # is full, it writes the data to the disk, and does some other
    707 # calculations.  Making this an extremely small size may slow
    708 # the library down, but you may want to experiment to determine
    709 # where it becomes significant, if you are concerned with memory
    710 # usage.  Note that zlib allocates at least 32Kb also.  For readers,
    711 # this describes the size of the buffer available to read the data in.
    712 # Unless this gets smaller than the size of a row (compressed),
    713 # it should not make much difference how big this is.
    714 
    715 setting ZBUF_SIZE default 8192
    716 
    717 # This is the size of the decompression buffer used when counting or checking
    718 # the decompressed size of an LZ stream from a compressed ancilliary chunk; the
    719 # decompressed data is never used so a different size may be optimal.  This size
    720 # was determined using contrib/libtests/timepng.c with compressed zTXt data
    721 # around 11MByte in size.  Slight speed improvements (up to about 14% in
    722 # timepng) can be achieved by very large increases (to 32kbyte) on regular data,
    723 # but highly compressible data shows only around 2% improvement.   The size is
    724 # chosen to minimize the effects of DoS attacks based on using very large
    725 # amounts of highly compressible data.
    726 
    727 setting INFLATE_BUF_SIZE default 1024
    728 
    729 # This is the maximum amount of IDAT data that the sequential reader will
    730 # process at one time.  The setting does not affect the size of IDAT chunks
    731 # read, just the amount read at once.  Neither does it affect the progressive
    732 # reader, which processes just the amount of data the application gives it.
    733 # The sequential reader is currently unable to process more than one IDAT at
    734 # once - it has to read and process each one in turn.  There is no point setting
    735 # this to a value larger than the IDAT chunks typically encountered (it would
    736 # just waste memory) but there may be some point in reducing it below the value
    737 # of ZBUF_SIZE (the size of IDAT chunks written by libpng.)
    738 
    739 setting IDAT_READ_SIZE default PNG_ZBUF_SIZE
    740 
    741 # Ancillary chunks
    742 chunk bKGD
    743 chunk cHRM enables COLORSPACE
    744 chunk eXIf
    745 chunk gAMA enables GAMMA
    746 chunk hIST
    747 chunk iCCP enables COLORSPACE, GAMMA
    748 chunk iTXt enables TEXT
    749 chunk oFFs
    750 chunk pCAL
    751 chunk pHYs
    752 chunk sBIT
    753 chunk sCAL
    754 chunk sPLT
    755 chunk sRGB enables COLORSPACE, GAMMA, SET_OPTION
    756 chunk tEXt requires TEXT
    757 chunk tIME
    758 chunk tRNS
    759 chunk zTXt enables TEXT
    760 
    761 # This only affects support of the optional PLTE chunk in RGB and RGBA
    762 # images.  Notice that READ_ANCILLARY_CHUNKS therefore disables part
    763 # of the regular chunk reading too.
    764 
    765 option READ_OPT_PLTE requires READ_ANCILLARY_CHUNKS
    766 
    767 # Unknown chunk handling
    768 #
    769 # 'UNKNOWN_CHUNKS' is a global option to disable all unknown chunk handling on
    770 # read or write; everything else below requires it (directly or indirectly).
    771 option UNKNOWN_CHUNKS
    772 
    773 # There are three main options to control the ability to read and write unknown
    774 # chunks.  If either read option is turned on then unknown chunks will be read,
    775 # otherwise they are skipped.  If the write option is turned on unknown chunks
    776 # set by png_set_unknown_chunks will be written otherwise it is an error to call
    777 # that API on a write struct.
    778 option WRITE_UNKNOWN_CHUNKS requires WRITE requires UNKNOWN_CHUNKS
    779 option WRITE_UNKNOWN_CHUNKS enables STORE_UNKNOWN_CHUNKS
    780 
    781 # The first way to read user chunks is to have libpng save them for a later call
    782 # to png_get_unknown_chunks, the application must call
    783 # png_set_keep_unknown_chunks to cause this to actually happen (see png.h)
    784 option SAVE_UNKNOWN_CHUNKS requires READ requires SET_UNKNOWN_CHUNKS
    785 option SAVE_UNKNOWN_CHUNKS enables READ_UNKNOWN_CHUNKS, STORE_UNKNOWN_CHUNKS
    786 
    787 # The second approach is to use an application provided callback to process the
    788 # chunks, the callback can either handle the chunk entirely itself or request
    789 # that libpng store the chunk for later retrieval via png_get_unknown_chunks.
    790 #
    791 # NOTE: If STORE_UNKNOWN_CHUNKS is not enabled (which is the default if
    792 # both SAVE_UNKNOWN_CHUNKS and WRITE_UNKNOWN_CHUNKS are disabled) then a
    793 # 0 result from the callback will be ignored because no support for saving
    794 # unknown chunks has been compiled in.  The normal symptom is that your app
    795 # fails to compile because png_get_unknown_chunks is no longer defined in png.h.
    796 # If you encounter this issue simply enable STORE_UNKNOWN_CHUNKS in your build.
    797 #
    798 # Note that there is no 'WRITE_USER_CHUNKS' so the USER_CHUNKS option is always
    799 # the same as READ_USER_CHUNKS at present
    800 option READ_USER_CHUNKS requires READ, UNKNOWN_CHUNKS
    801 option READ_USER_CHUNKS enables READ_UNKNOWN_CHUNKS, USER_CHUNKS
    802 
    803 # Two further options are provided to allow detailed control of the handling.
    804 # The first enables png_set_keep_unknown_chunks; this allows the default to be
    805 # changed from discarding unknown chunks and allows per-chunk control.  This is
    806 # required to use the SAVE_UNKNOWN_CHUNKS option.  If enabled this option also
    807 # applies to write (see png.h), otherwise the write API simply writes all the
    808 # chunks it is given.
    809 #
    810 # The second option extends the unknown handling to allow known chunks to be
    811 # handled as though they were unknown.  This option doesn't change any APIs, it
    812 # merely turns on the code to check known as well as unknown chunks.
    813 #
    814 # This option no longer affects the write code.  It can be safely disabled and
    815 # will prevent applications stopping libpng reading known chunks.
    816 option SET_UNKNOWN_CHUNKS requires UNKNOWN_CHUNKS
    817 option HANDLE_AS_UNKNOWN requires SET_UNKNOWN_CHUNKS
    818 
    819 # The following options are derived from the above and should not be turned on
    820 # explicitly.
    821 option READ_UNKNOWN_CHUNKS requires UNKNOWN_CHUNKS disabled
    822 option STORE_UNKNOWN_CHUNKS requires UNKNOWN_CHUNKS disabled
    823 
    824 option CONVERT_tIME requires WRITE_ANCILLARY_CHUNKS
    825 # The "tm" structure is not supported on WindowsCE
    826 
    827 @#ifdef _WIN32_WCE
    828 @#   define PNG_NO_CONVERT_tIME
    829 @#endif
    830 
    831 option WRITE_FILTER requires WRITE
    832 
    833 option SAVE_INT_32 disabled
    834 # png_save_int_32 is required internally for writing the ancillary chunks oFFs
    835 # and pCAL and for both reading and writing iCCP (for the generation/checking of
    836 # the corresponding cHRM/gAMA chunks) if full ICC is supported.
    837 
    838 # added at libpng-1.5.4
    839 
    840 option WRITE_OPTIMIZE_CMF requires WRITE
    841 
    842 option READ_COMPRESSED_TEXT disabled
    843 option READ_iCCP enables READ_COMPRESSED_TEXT
    844 option READ_iTXt enables READ_COMPRESSED_TEXT
    845 option READ_zTXt enables READ_COMPRESSED_TEXT
    846 
    847 option WRITE_oFFs enables SAVE_INT_32
    848 option WRITE_pCAL enables SAVE_INT_32
    849 option WRITE_cHRM enables SAVE_INT_32
    850 
    851 option WRITE_COMPRESSED_TEXT disabled
    852 option WRITE_iCCP enables WRITE_COMPRESSED_TEXT
    853 option WRITE_iTXt enables WRITE_COMPRESSED_TEXT
    854 option WRITE_zTXt enables WRITE_COMPRESSED_TEXT
    855 
    856 # Turn this off to disable png_read_png() and png_write_png() and
    857 # leave the row_pointers member out of the info structure.
    858 
    859 option INFO_IMAGE
    860 
    861 # added at libpng-1.5.10
    862 # Turn this off to disable warning about invalid palette index and
    863 # leave the num_palette_max member out of the png structure.
    864 
    865 option CHECK_FOR_INVALID_INDEX enables READ_CHECK_FOR_INVALID_INDEX
    866 option CHECK_FOR_INVALID_INDEX enables WRITE_CHECK_FOR_INVALID_INDEX
    867 option READ_CHECK_FOR_INVALID_INDEX requires READ, CHECK_FOR_INVALID_INDEX
    868 option WRITE_CHECK_FOR_INVALID_INDEX requires WRITE, CHECK_FOR_INVALID_INDEX
    869 
    870 # added at libpng-1.5.15
    871 option GET_PALETTE_MAX enables READ_GET_PALETTE_MAX WRITE_GET_PALETTE_MAX
    872 option READ_GET_PALETTE_MAX requires READ_CHECK_FOR_INVALID_INDEX disabled
    873 option WRITE_GET_PALETTE_MAX requires WRITE_CHECK_FOR_INVALID_INDEX disabled
    874 
    875 # Simplified API options (added at libpng-1.6.0)
    876 #  In libpng 1.6.8 the handling of these options was changed to used 'requires'
    877 #  throughout, so that disabling some of the low level support always disables
    878 #  the base simplified read/write API.  This much simplifies the handling and
    879 #  makes 'everything = off' work in a more intuitive way.  It eliminates a
    880 #  previously reported feature that APIs previously enabled by the simplified
    881 #  API couldn't be turned off without explicitly turning off the simplified
    882 #  APIs.
    883 #
    884 # Read:
    885 option SIMPLIFIED_READ,
    886    requires SEQUENTIAL_READ, READ_TRANSFORMS, SETJMP, BENIGN_ERRORS,
    887       READ_EXPAND, READ_16BIT, READ_EXPAND_16, READ_SCALE_16_TO_8,
    888       READ_RGB_TO_GRAY, READ_ALPHA_MODE, READ_BACKGROUND, READ_STRIP_ALPHA,
    889       READ_FILLER, READ_SWAP, READ_PACK, READ_GRAY_TO_RGB, READ_GAMMA,
    890       READ_tRNS, READ_bKGD, READ_gAMA, READ_cHRM, READ_sRGB, READ_sBIT
    891 
    892 # AFIRST and BGR read options:
    893 #  Prior to libpng 1.6.8 these were disabled but switched on if the low level
    894 #  libpng routines that do the swaps were enabled.  This worked but was
    895 #  confusing.  In libpng 1.6.8 the options were changed to simple 'requires'
    896 #  and are enabled by default.  This should work the same way in practice.
    897 option SIMPLIFIED_READ_AFIRST enables FORMAT_AFIRST,
    898    requires SIMPLIFIED_READ READ_SWAP_ALPHA
    899 
    900 option SIMPLIFIED_READ_BGR enables FORMAT_BGR,
    901    requires SIMPLIFIED_READ READ_BGR
    902 
    903 # Write:
    904 option SIMPLIFIED_WRITE,
    905    requires WRITE, SETJMP, WRITE_SWAP, WRITE_PACK,
    906       WRITE_tRNS, WRITE_gAMA, WRITE_sRGB, WRITE_cHRM
    907 
    908 # 1.6.22: allow simplified write without stdio support:
    909 option SIMPLIFIED_WRITE_STDIO requires SIMPLIFIED_WRITE STDIO
    910 
    911 option SIMPLIFIED_WRITE_AFIRST enables FORMAT_AFIRST,
    912    requires SIMPLIFIED_WRITE WRITE_SWAP_ALPHA
    913 
    914 option SIMPLIFIED_WRITE_BGR enables FORMAT_BGR,
    915    requires SIMPLIFIED_WRITE WRITE_BGR
    916 
    917 # Formats:
    918 option FORMAT_AFIRST disabled
    919 option FORMAT_BGR disabled
    920