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