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 #include "magick/magick-baseconfig.h"
22 
23 #if defined(__cplusplus) || defined(c_plusplus)
24 extern "C" {
25 #endif
26 
27 /* Compatibility block */
28 #if !defined(MAGICKCORE_QUANTUM_DEPTH) && defined(MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H)
29 # warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
30 # warning "this is an obsolete behavior please fix your makefile"
31 # define MAGICKCORE_QUANTUM_DEPTH MAGICKCORE_QUANTUM_DEPTH_OBSOLETE_IN_H
32 #endif
33 
34 /* Number of bits in a pixel Quantum (8/16/32/64) */
35 #ifndef MAGICKCORE_QUANTUM_DEPTH
36 # error "you should set MAGICKCORE_QUANTUM_DEPTH"
37 #endif
38 
39 /* check values */
40 #if MAGICKCORE_QUANTUM_DEPTH != 8
41 # if MAGICKCORE_QUANTUM_DEPTH != 16
42 #  if MAGICKCORE_QUANTUM_DEPTH != 32
43 #   if MAGICKCORE_QUANTUM_DEPTH != 64
44 #    error "MAGICKCORE_QUANTUM_DEPTH is not 8/16/32/64 bits"
45 #   endif
46 #  endif
47 # endif
48 #endif
49 
50 
51 #if !defined(MAGICKCORE_HDRI_ENABLE) && defined(MAGICKCORE_HDRI_ENABLE_OBSOLETE_IN_H)
52 # warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
53 # warning "this is an obsolete behavior please fix yours makefile"
54 # define MAGICKCORE_HDRI_ENABLE MAGICKCORE_HDRI_ENABLE_OBSOLETE_IN_H
55 #endif
56 
57 /* whether HDRI is enable */
58 #if !defined(MAGICKCORE_HDRI_ENABLE)
59 # error "you should set MAGICKCORE_HDRI_ENABLE"
60 #endif
61 
62 #if MAGICKCORE_HDRI_ENABLE
63 # define MAGICKCORE_HDRI_SUPPORT 1
64 #endif
65 
66 #if defined __CYGWIN32__ && !defined __CYGWIN__
67    /* For backwards compatibility with Cygwin b19 and
68       earlier, we define __CYGWIN__ here, so that
69       we can rely on checking just for that macro. */
70 #  define __CYGWIN__  __CYGWIN32__
71 #endif
72 
73 /*! stringify */
74 #define MAGICKCORE_STRING_QUOTE(str) #str
75 #define MAGICKCORE_STRING_XQUOTE(str) MAGICKCORE_STRING_QUOTE(str)
76 
77 /*  ABI SUFFIX */
78 #ifndef MAGICKCORE_HDRI_SUPPORT
79 #define MAGICKCORE_ABI_SUFFIX  "Q" MAGICKCORE_STRING_XQUOTE(MAGICKCORE_QUANTUM_DEPTH)
80 #else
81 #define MAGICKCORE_ABI_SUFFIX "Q" MAGICKCORE_STRING_XQUOTE(MAGICKCORE_QUANTUM_DEPTH) "HDRI"
82 #endif
83 
84 /* some path game */
85 #if !defined __CYGWIN__
86 # if defined (_WIN32) || defined (_WIN64) || defined (__MSDOS__) || defined (__DJGPP__) || defined (__OS2__)
87    /* Use Windows separators on all _WIN32 defining
88       environments, except Cygwin. */
89 #  define MAGICKCORE_DIR_SEPARATOR_CHAR		'\\'
90 #  define MAGICKCORE_DIR_SEPARATOR		"\\"
91 #  define MAGICKCORE_PATH_SEPARATOR_CHAR	';'
92 #  define MAGICKCORE_PATH_SEPARATOR		";"
93 # endif
94 #endif
95 
96 /* posix */
97 #ifndef MAGICKCORE_DIR_SEPARATOR_CHAR
98    /* Assume that not having this is an indicator that all
99       are missing. */
100 #  define MAGICKCORE_DIR_SEPARATOR_CHAR		'/'
101 #  define MAGICKCORE_DIR_SEPARATOR		"/"
102 #  define MAGICKCORE_PATH_SEPARATOR_CHAR	':'
103 #  define MAGICKCORE_PATH_SEPARATOR		":"
104 #endif /* !DIR_SEPARATOR_CHAR */
105 
106 # if defined(MAGICKCORE_POSIX_SUPPORT) || defined(__MINGW32__)
107 
108 /* module dir */
109 #ifndef MAGICKCORE_MODULES_DIRNAME
110 # define MAGICKCORE_MODULES_DIRNAME MAGICKCORE_MODULES_BASEDIRNAME "-" MAGICKCORE_ABI_SUFFIX
111 #endif
112 
113 #ifndef MAGICKCORE_MODULES_PATH
114 #  define MAGICKCORE_MODULES_PATH MAGICKCORE_LIBRARY_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_MODULES_DIRNAME
115 #endif
116 
117 #ifndef MAGICKCORE_MODULES_RELATIVE_PATH
118 #define MAGICKCORE_MODULES_RELATIVE_PATH MAGICKCORE_LIBRARY_RELATIVE_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_MODULES_DIRNAME
119 #endif
120 
121 /* Subdirectory under lib to place ImageMagick coder module files */
122 #ifndef MAGICKCORE_CODER_PATH
123 # if defined(vms)
124 #  define MAGICKCORE_CODER_PATH "sys$login:"
125 # else
126 #  define MAGICKCORE_CODER_PATH MAGICKCORE_MODULES_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_CODER_DIRNAME
127 # endif
128 #endif
129 
130 #ifndef MAGICKCORE_CODER_RELATIVE_PATH
131 # define MAGICKCORE_CODER_RELATIVE_PATH MAGICKCORE_MODULES_RELATIVE_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_CODER_DIRNAME
132 #endif
133 
134 /* subdirectory under lib to place ImageMagick filter module files */
135 #ifndef MAGICKCORE_FILTER_PATH
136 # if defined(vms)
137 #  define MAGICKCORE_FILTER_PATH  "sys$login:"
138 # else
139 #  define MAGICKCORE_FILTER_PATH MAGICKCORE_MODULES_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_FILTER_DIRNAME
140 # endif
141 #endif
142 
143 #ifndef MAGICKCORE_FILTER_RELATIVE_PATH
144 # define MAGICKCORE_FILTER_RELATIVE_PATH MAGICKCORE_MODULES_RELATIVE_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_FILTER_DIRNAME
145 #endif
146 
147 /* sharearch dir */
148 #ifndef MAGICKCORE_SHAREARCH_DIRNAME
149 # define MAGICKCORE_SHAREARCH_DIRNAME MAGICKCORE_SHAREARCH_BASEDIRNAME "-" MAGICKCORE_ABI_SUFFIX
150 #endif
151 
152 #ifndef MAGICKCORE_SHAREARCH_PATH
153 #  define MAGICKCORE_SHAREARCH_PATH MAGICKCORE_LIBRARY_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_SHAREARCH_DIRNAME MAGICKCORE_DIR_SEPARATOR
154 #endif
155 
156 #ifndef MAGICKCORE_SHAREARCH_RELATIVE_PATH
157 #define MAGICKCORE_SHAREARCH_RELATIVE_PATH MAGICKCORE_LIBRARY_RELATIVE_PATH MAGICKCORE_DIR_SEPARATOR MAGICKCORE_SHAREARCH_DIRNAME
158 #endif
159 
160 /* for Clang compatibility */
161 #ifndef __has_builtin
162 #  define __has_builtin(x) 0
163 #endif
164 
165 #if defined(__GNUC__) && !defined(__clang__)
166 # define MAGICKCORE_DIAGNOSTIC_PUSH() \
167    _Pragma("GCC diagnostic push")
168 # define MAGICKCORE_DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED() \
169    _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
170 # define MAGICKCORE_DIAGNOSTIC_POP() \
171    _Pragma("GCC diagnostic pop")
172 #else
173 # define MAGICKCORE_DIAGNOSTIC_PUSH()
174 # define MAGICKCORE_DIAGNOSTIC_IGNORE_MAYBE_UNINITIALIZED()
175 # define MAGICKCORE_DIAGNOSTIC_POP()
176 #endif
177 
178 #define MAGICKCORE_BITS_BELOW(power_of_2) \
179   ((power_of_2)-1)
180 
181 #define MAGICKCORE_MAX_ALIGNMENT_PADDING(power_of_2) \
182   MAGICKCORE_BITS_BELOW(power_of_2)
183 
184 #define MAGICKCORE_IS_NOT_ALIGNED(n, power_of_2) \
185   ((n) & MAGICKCORE_BITS_BELOW(power_of_2))
186 
187 #define MAGICKCORE_IS_NOT_POWER_OF_2(n) \
188   MAGICKCORE_IS_NOT_ALIGNED((n), (n))
189 
190 #define MAGICKCORE_ALIGN_DOWN(n, power_of_2) \
191   ((n) & ~MAGICKCORE_BITS_BELOW(power_of_2))
192 
193 #define MAGICKCORE_ALIGN_UP(n, power_of_2) \
194   MAGICKCORE_ALIGN_DOWN((n) + MAGICKCORE_MAX_ALIGNMENT_PADDING(power_of_2),power_of_2)
195 
196 #endif
197 
198 #if defined(__cplusplus) || defined(c_plusplus)
199 }
200 #endif
201 
202 #endif
203