diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 0fc33ecc..f505aa0c 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -138,6 +138,119 @@ CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}" | |||
138 | LT_INIT([win32-dll]) | 138 | LT_INIT([win32-dll]) |
139 | LT_LANG([Windows Resource]) | 139 | LT_LANG([Windows Resource]) |
140 | 140 | ||
141 | AC_ARG_ENABLE([compact-code], | ||
142 | [AS_HELP_STRING([[--enable-compact-code]], | ||
143 | [enable use of a reduced size version of the code, resulting in smaller ] | ||
144 | [binaries with a slight performance hit [auto]])], | ||
145 | [], [enable_compact_code=auto]) | ||
146 | AS_IF([test "x${enable_compact_code}" = "x"], [enable_compact_code="auto"]) | ||
147 | AH_TEMPLATE([[MHD_FAVOR_SMALL_CODE]], [Define to '1' to use compact code version]) | ||
148 | AH_TEMPLATE([[MHD_FAVOR_FAST_CODE]], [Define to '1' to use fast (and larger) code version]) | ||
149 | AS_UNSET([compact_code_MSG]) | ||
150 | AS_CASE([${enable_compact_code}], [auto], | ||
151 | [ | ||
152 | # Parameter not set. | ||
153 | # Check preprocessor macros | ||
154 | AC_CHECK_DECL([MHD_FAVOR_SMALL_CODE], | ||
155 | [ | ||
156 | enable_compact_code="yes" | ||
157 | compact_code_MSG="enabled by preprocessor macro" | ||
158 | ], | ||
159 | [],[/* no includes */] | ||
160 | ) | ||
161 | AC_CHECK_DECL([MHD_FAVOR_FAST_CODE], | ||
162 | [ | ||
163 | AS_VAR_IF([enable_compact_code],["yes"], | ||
164 | [AC_MSG_ERROR([Both MHD_FAVOR_SMALL_CODE and MHD_FAVOR_FAST_CODE macros are defined])] | ||
165 | ) | ||
166 | enable_compact_code="no" | ||
167 | compact_code_MSG="set by preprocessor macro" | ||
168 | ],[],[/* no includes */] | ||
169 | ) | ||
170 | |||
171 | AS_VAR_IF([enable_compact_code], ["auto"], | ||
172 | [ | ||
173 | # No preference by preprocessor macros | ||
174 | AC_CACHE_CHECK([whether compiler is configured to optimize for size], | ||
175 | [mhd_cv_cc_optim_size], | ||
176 | [ | ||
177 | AC_COMPILE_IFELSE( | ||
178 | [ | ||
179 | AC_LANG_PROGRAM([[ | ||
180 | #ifndef __OPTIMIZE_SIZE__ | ||
181 | #error Looks like compiler does not optimize for size | ||
182 | choke me now | ||
183 | #endif | ||
184 | ]],[]) | ||
185 | ], | ||
186 | [mhd_cv_cc_optim_size="yes"],[mhd_cv_cc_optim_size="no"] | ||
187 | ) | ||
188 | ] | ||
189 | ) | ||
190 | AS_VAR_IF([mhd_cv_cc_optim_size], ["yes"], | ||
191 | [ | ||
192 | enable_compact_code="yes" | ||
193 | compact_code_MSG="enabled automatically as compiler optimizes for size" | ||
194 | AC_DEFINE([MHD_FAVOR_SMALL_CODE],[1]) | ||
195 | ] | ||
196 | ) | ||
197 | ] | ||
198 | ) | ||
199 | |||
200 | AS_VAR_IF([enable_compact_code], ["auto"], | ||
201 | [ | ||
202 | # No preference by preprocessor macros and compiler flags | ||
203 | AS_CASE([${enable_build_type}],[*-compact], | ||
204 | [ | ||
205 | enable_compact_code="yes" | ||
206 | compact_code_MSG="enabled by build type ${enable_build_type}" | ||
207 | AC_DEFINE([MHD_FAVOR_SMALL_CODE],[1]) | ||
208 | ] | ||
209 | ) | ||
210 | ] | ||
211 | ) | ||
212 | |||
213 | AS_VAR_IF([enable_compact_code], ["auto"], | ||
214 | [ | ||
215 | # No preference | ||
216 | enable_compact_code="no" | ||
217 | compact_code_MSG="by default" | ||
218 | AC_DEFINE([MHD_FAVOR_FAST_CODE],[1]) | ||
219 | ] | ||
220 | ) | ||
221 | ], | ||
222 | [yes], | ||
223 | [ | ||
224 | compact_code_MSG="enabled by configure parameter" | ||
225 | AC_CHECK_DECL([MHD_FAVOR_SMALL_CODE], | ||
226 | [], | ||
227 | [AC_DEFINE([MHD_FAVOR_SMALL_CODE],[1])],[/* no includes */] | ||
228 | ) | ||
229 | AC_CHECK_DECL([MHD_FAVOR_FAST_CODE], | ||
230 | [AC_MSG_ERROR([MHD_FAVOR_FAST_CODE macro is defined, --enable-compact-code could not be used]) | ||
231 | ], | ||
232 | [],[/* no includes */] | ||
233 | ) | ||
234 | ], | ||
235 | [no], | ||
236 | [ | ||
237 | compact_code_MSG="disabled by configure parameter" | ||
238 | AC_CHECK_DECL([MHD_FAVOR_FAST_CODE], | ||
239 | [], | ||
240 | [AC_DEFINE([MHD_FAVOR_FAST_CODE],[1])],[/* no includes */] | ||
241 | ) | ||
242 | AC_CHECK_DECL([MHD_FAVOR_SMALL_CODE], | ||
243 | [AC_MSG_ERROR([MHD_FAVOR_SMALL_CODE macro is defined, --disable-compact-code could not be used]) | ||
244 | ], | ||
245 | [],[/* no includes */] | ||
246 | ) | ||
247 | ], | ||
248 | [AC_MSG_ERROR([[Unknown parameter value: --enable-compact-code=${enable_compact_code}]])] | ||
249 | ) | ||
250 | |||
251 | AC_MSG_CHECKING([whether to use a reduced size version of the code]) | ||
252 | AC_MSG_RESULT([${enable_compact_code} (${compact_code_MSG})]) | ||
253 | |||
141 | 254 | ||
142 | CFLAGS="${user_CFLAGS}" | 255 | CFLAGS="${user_CFLAGS}" |
143 | # Compiler options to always enable (if supported) | 256 | # Compiler options to always enable (if supported) |
@@ -3824,6 +3937,7 @@ AC_MSG_NOTICE([GNU libmicrohttpd ${PACKAGE_VERSION} Configuration Summary: | |||
3824 | HTTPS support: ${MSG_HTTPS} | 3937 | HTTPS support: ${MSG_HTTPS} |
3825 | Threading lib: ${USE_THREADS} | 3938 | Threading lib: ${USE_THREADS} |
3826 | Use thread names: ${enable_thread_names} | 3939 | Use thread names: ${enable_thread_names} |
3940 | Compact code: ${enable_compact_code} (${compact_code_MSG}) | ||
3827 | Use debug asserts: ${enable_asserts} | 3941 | Use debug asserts: ${enable_asserts} |
3828 | Use sanitizers: ${enabled_sanitizers:=no} | 3942 | Use sanitizers: ${enabled_sanitizers:=no} |
3829 | Messages: ${enable_messages} | 3943 | Messages: ${enable_messages} |