1 /*
2   Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
3   dedicated to making software imaging solutions freely available.
4 
5   You may not use this file except in compliance with the License.  You may
6   obtain a copy of the License at
7 
8     https://imagemagick.org/script/license.php
9 
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15 
16   MagickConfig not autogenerated (fixed stuff)
17 */
18 #ifndef MAGICKCORE_MAGICK_CONFIG_H
19 #define MAGICKCORE_MAGICK_CONFIG_H
20 
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24 
25 #include "MagickCore/magick-baseconfig.h"
26 
27 #define MAGICKCORE_STRING_QUOTE(str) #str
28 #define MAGICKCORE_STRING_XQUOTE(str) MAGICKCORE_STRING_QUOTE(str)
29 
30 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
31 # if defined(__GNUC__) || defined(__clang__)
32 #  define MAGICK_COMPILER_WARNING(w) _Pragma(MAGICKCORE_STRING_QUOTE(GCC warning w))
33 # elif defined(_MSC_VER)
34 #  define MAGICK_COMPILER_WARNING(w) _Pragma(MAGICKCORE_STRING_QUOTE(message(w)))
35 # endif
36 #endif
37 
38 #ifndef MAGICK_COMPILER_WARNING
39 # define MAGICK_COMPILER_WARNING(w)
40 #endif
41 
42 #ifdef MAGICKCORE__FILE_OFFSET_BITS
43 # ifdef _FILE_OFFSET_BITS
44 #  if _FILE_OFFSET_BITS != MAGICKCORE__FILE_OFFSET_BITS
45     MAGICK_COMPILER_WARNING("_FILE_OFFSET_BITS is already defined, but does not match MAGICKCORE__FILE_OFFSET_BITS")
46 #  else
47 #   undef _FILE_OFFSET_BITS
48 #  endif
49 # endif
50 # ifndef _FILE_OFFSET_BITS
51 #  if MAGICKCORE__FILE_OFFSET_BITS == 64
52 #   define _FILE_OFFSET_BITS 64
53 #  elif MAGICKCORE__FILE_OFFSET_BITS == 32
54 #   define _FILE_OFFSET_BITS 32
55 #  else
56 #   define _FILE_OFFSET_BITS MAGICKCORE__FILE_OFFSET_BITS
57 #  endif
58 # endif
59 #endif
60 
61 /* Compatibility block */
62 #if !defined(MAGICKCORE_QUANTUM_DEPTH) && defined(MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H)
63 # warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
64 # warning "this is an obsolete behavior please fix your makefile"
65 # define MAGICKCORE_QUANTUM_DEPTH MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H
66 #endif
67 
68 /* Number of bits in a pixel Quantum (8/16/32/64) */
69 #ifndef MAGICKCORE_QUANTUM_DEPTH
70 # error "you should set MAGICKCORE_QUANTUM_DEPTH"
71 #endif
72 
73 /* check values */
74 #if MAGICKCORE_QUANTUM_DEPTH != 8
75 # if MAGICKCORE_QUANTUM_DEPTH != 16
76 #  if MAGICKCORE_QUANTUM_DEPTH != 32
77 #   if MAGICKCORE_QUANTUM_DEPTH != 64
78 #    error "MAGICKCORE_QUANTUM_DEPTH is not 8/16/32/64 bits"
79 #   endif
80 #  endif
81 # endif
82 #endif
83 
84 
85 #if !defined(MAGICKCORE_HDRI_ENABLE) && defined(MAGICKCORE_HDRI_ENABLE_OBSOLETE_IN_H)
86 # warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
87 # warning "this is an obsolete behavior please fix yours makefile"
88 # define MAGICKCORE_HDRI_ENABLE MAGICKCORE_HDRI_ENABLE_OBSOLETE_IN_H
89 #endif
90 
91 /* whether HDRI is enable */
92 #if !defined(MAGICKCORE_HDRI_ENABLE)
93 # error "you should set MAGICKCORE_HDRI_ENABLE"
94 #endif
95 
96 #if MAGICKCORE_HDRI_ENABLE
97 # define MAGICKCORE_HDRI_SUPPORT 1
98 #endif
99 
100 /* Compatibility block */
101 #if !defined(MAGICKCORE_QUANTUM_DEPTH) && defined(MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H)
102 # warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
103 # warning "this is an obsolete behavior please fix yours makefile"
104 # define MAGICKCORE_QUANTUM_DEPTH MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H
105 #endif
106 
107 /* Number of bits in a pixel Quantum (8/16/32/64) */
108 #ifndef MAGICKCORE_QUANTUM_DEPTH
109 # error "you should set MAGICKCORE_QUANTUM_DEPTH"
110 #endif
111 
112 /* check values */
113 #if MAGICKCORE_QUANTUM_DEPTH != 8
114 # if MAGICKCORE_QUANTUM_DEPTH != 16
115 #  if MAGICKCORE_QUANTUM_DEPTH != 32
116 #   if MAGICKCORE_QUANTUM_DEPTH != 64
117 #    error "MAGICKCORE_QUANTUM_DEPTH is not 8/16/32/64 bits"
118 #   endif
119 #  endif
120 # endif
121 #endif
122 
123 
124 #if !defined(MAGICKCORE_HDRI_ENABLE) && defined(MAGICKCORE_HDRI_ENABLE_OBSOLETE_IN_H)
125 # warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
126 # warning "this is an obsolete behavior please fix yours makefile"
127 # define MAGICKCORE_HDRI_ENABLE MAGICKCORE_HDRI_ENABLE_OBSOLETE_IN_H
128 #endif
129 
130 /* whether HDRI is enable */
131 #if !defined(MAGICKCORE_HDRI_ENABLE)
132 # error "you should set MAGICKCORE_HDRI_ENABLE"
133 #endif
134 
135 #if MAGICKCORE_HDRI_ENABLE
136 # define MAGICKCORE_HDRI_SUPPORT 1
137 #endif
138 
139 #if defined __CYGWIN32__ && !defined __CYGWIN__
140    /* For backwards compatibility with Cygwin b19 and
141       earlier, we define __CYGWIN__ here, so that
142       we can rely on checking just for that macro. */
143 #  define __CYGWIN__  __CYGWIN32__
144 #endif
145 
146 /*  ABI SUFFIX */
147 #ifndef MAGICKCORE_HDRI_SUPPORT
148 #define MAGICKCORE_ABI_SUFFIX  "Q" MAGICKCORE_STRING_XQUOTE(MAGICKCORE_QUANTUM_DEPTH)
149 #else
150 #define MAGICKCORE_ABI_SUFFIX "Q" MAGICKCORE_STRING_XQUOTE(MAGICKCORE_QUANTUM_DEPTH) "HDRI"
151 #endif
152 
153 /* some path game */
154 #if !defined __CYGWIN__
155 # if defined (_WIN32) || defined (_WIN64) || defined (__MSDOS__) || defined (__DJGPP__) || defined (__OS2__)
156    /* Use Windows separators on all _WIN32 defining
157       environments, except Cygwin. */
158 #  define MAGICKCORE_DIR_SEPARATOR_CHAR		'\\'
159 #  define MAGICKCORE_DIR_SEPARATOR		"\\"
160 #  define MAGICKCORE_PATH_SEPARATOR_CHAR	';'
161 #  define MAGICKCORE_PATH_SEPARATOR		";"
162 # endif
163 #endif
164 
165 /* posix */
166 #ifndef MAGICKCORE_DIR_SEPARATOR_CHAR
167    /* Assume that not having this is an indicator that all
168       are missing. */
169 #  define MAGICKCORE_DIR_SEPARATOR_CHAR		'/'
170 #  define MAGICKCORE_DIR_SEPARATOR		"/"
171 #  define MAGICKCORE_PATH_SEPARATOR_CHAR	':'
172 #  define MAGICKCORE_PATH_SEPARATOR		":"
173 #endif /* !DIR_SEPARATOR_CHAR */
174 
175 # if defined(MAGICKCORE_POSIX_SUPPORT) || defined(__MINGW32__)
176 
177 /* module dir */
178 #ifndef MAGICKCORE_MODULES_DIRNAME
179 # define MAGICKCORE_MODULES_DIRNAME MAGICKCORE_MODULES_BASEDIRNAME "-" MAGICKCORE_ABI_SUFFIX
180 #endif
181 
182 #ifndef MAGICKCORE_MODULES_PATH
183 #  define MAGICKCORE_MODULES_PATH MAGICKCORE_LIBRARY_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_MODULES_DIRNAME
184 #endif
185 
186 #ifndef MAGICKCORE_MODULES_RELATIVE_PATH
187 #define MAGICKCORE_MODULES_RELATIVE_PATH MAGICKCORE_LIBRARY_RELATIVE_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_MODULES_DIRNAME
188 #endif
189 
190 /* Subdirectory under lib to place ImageMagick coder module files */
191 #ifndef MAGICKCORE_CODER_PATH
192 # if defined(vms)
193 #  define MAGICKCORE_CODER_PATH "sys$login:"
194 # else
195 #  define MAGICKCORE_CODER_PATH MAGICKCORE_MODULES_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_CODER_DIRNAME
196 # endif
197 #endif
198 
199 #ifndef MAGICKCORE_CODER_RELATIVE_PATH
200 # define MAGICKCORE_CODER_RELATIVE_PATH MAGICKCORE_MODULES_RELATIVE_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_CODER_DIRNAME
201 #endif
202 
203 /* subdirectory under lib to place ImageMagick filter module files */
204 #ifndef MAGICKCORE_FILTER_PATH
205 # if defined(vms)
206 #  define MAGICKCORE_FILTER_PATH  "sys$login:"
207 # else
208 #  define MAGICKCORE_FILTER_PATH MAGICKCORE_MODULES_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_FILTER_DIRNAME
209 # endif
210 #endif
211 
212 #ifndef MAGICKCORE_FILTER_RELATIVE_PATH
213 # define MAGICKCORE_FILTER_RELATIVE_PATH MAGICKCORE_MODULES_RELATIVE_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_FILTER_DIRNAME
214 #endif
215 
216 /* sharearch dir */
217 #ifndef MAGICKCORE_SHAREARCH_DIRNAME
218 # define MAGICKCORE_SHAREARCH_DIRNAME MAGICKCORE_SHAREARCH_BASEDIRNAME "-" MAGICKCORE_ABI_SUFFIX
219 #endif
220 
221 #ifndef MAGICKCORE_SHAREARCH_PATH
222 #  define MAGICKCORE_SHAREARCH_PATH MAGICKCORE_LIBRARY_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_SHAREARCH_DIRNAME MAGICKCORE_DIR_SEPARATOR
223 #endif
224 
225 #ifndef MAGICKCORE_SHAREARCH_RELATIVE_PATH
226 #define MAGICKCORE_SHAREARCH_RELATIVE_PATH MAGICKCORE_LIBRARY_RELATIVE_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_SHAREARCH_DIRNAME
227 #endif
228 
229 #endif
230 
231 /* for Clang compatibility */
232 #ifndef __has_builtin
233 #  define __has_builtin(x) 0
234 #endif
235 
236 #if defined(__GNUC__) && !defined(__clang__)
237 # define MAGICKCORE_DIAGNOSTIC_PUSH() \
238    _Pragma("GCC diagnostic push")
239 # define MAGICKCORE_DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED() \
240    _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
241 # define MAGICKCORE_DIAGNOSTIC_POP() \
242    _Pragma("GCC diagnostic pop")
243 #else
244 # define MAGICKCORE_DIAGNOSTIC_PUSH()
245 # define MAGICKCORE_DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED()
246 # define MAGICKCORE_DIAGNOSTIC_POP()
247 #endif
248 
249 #define MAGICKCORE_BITS_BELOW(power_of_2) \
250   ((power_of_2)-1)
251 
252 #define MAGICKCORE_MAX_ALIGNMENT_PADDING(power_of_2) \
253   MAGICKCORE_BITS_BELOW(power_of_2)
254 
255 #define MAGICKCORE_IS_NOT_ALIGNED(n, power_of_2) \
256   ((n) & MAGICKCORE_BITS_BELOW(power_of_2))
257 
258 #define MAGICKCORE_IS_NOT_POWER_OF_2(n) \
259   MAGICKCORE_IS_NOT_ALIGNED((n), (n))
260 
261 #define MAGICKCORE_ALIGN_DOWN(n, power_of_2) \
262   ((n) & ~MAGICKCORE_BITS_BELOW(power_of_2))
263 
264 #define MAGICKCORE_ALIGN_UP(n, power_of_2) \
265   MAGICKCORE_ALIGN_DOWN((n) + MAGICKCORE_MAX_ALIGNMENT_PADDING(power_of_2),power_of_2)
266 
267 #if defined(__cplusplus) || defined(c_plusplus)
268 }
269 #endif
270 
271 #endif
272