aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-03-03 11:25:35 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2023-03-03 11:25:35 +0300
commit23b4be2f66a8f4d67e5ff85228b0fabe87a95290 (patch)
treeee64e89c0d9cbdc4df2314c1e3304592ef9174a3
parent7b22ec1c0b08b780c665a3507513d971732220ac (diff)
downloadlibmicrohttpd-23b4be2f66a8f4d67e5ff85228b0fabe87a95290.tar.gz
libmicrohttpd-23b4be2f66a8f4d67e5ff85228b0fabe87a95290.zip
configure: reordered checks for compiler flags
-rw-r--r--configure.ac71
1 files changed, 49 insertions, 22 deletions
diff --git a/configure.ac b/configure.ac
index e224cd88..0787464b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -281,6 +281,7 @@ MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-fno-strict-aliasing], [-qnoansialias])
281# '-qlonglong' is XLC option for C89, not used with C99 or later 281# '-qlonglong' is XLC option for C89, not used with C99 or later
282MHD_CHECK_ADD_CC_CFLAG([-qlonglong], [CFLAGS_ac]) 282MHD_CHECK_ADD_CC_CFLAG([-qlonglong], [CFLAGS_ac])
283 283
284# Set basic optimisation flags
284AS_VAR_IF([enable_build_type],["neutral"],[], 285AS_VAR_IF([enable_build_type],["neutral"],[],
285 [ # Any non-neutral build types 286 [ # Any non-neutral build types
286 AC_CACHE_CHECK([whether workarounds for clang or clang-based compiler are required], 287 AC_CACHE_CHECK([whether workarounds for clang or clang-based compiler are required],
@@ -298,14 +299,6 @@ choke me now
298 ) 299 )
299 ] 300 ]
300 ) 301 )
301 MHD_CHECK_ADD_CC_CFLAGS([-Wall -fdelete-null-pointer-checks -Wnull-dereference], [CFLAGS_ac])
302 MHD_CHECK_ADD_CC_CFLAGS([-Wdeclaration-after-statement -Wimplicit -Wnested-externs], [CFLAGS_ac])
303 MHD_CHECK_ADD_CC_CFLAGS([-Wredundant-decls -Wtrampolines -Wunsafe-loop-optimizations], [CFLAGS_ac])
304 MHD_CHECK_ADD_CC_CFLAGS([-Wpoison-system-directories], [CFLAGS_ac])
305 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
306 LDFLAGS="${user_LDFLAGS}"
307 MHD_CHECK_ADD_CC_LDFLAG([-Wl,--warn-common], [LDFLAGS_ac])
308 LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
309 ] 302 ]
310) 303)
311AS_CASE([${enable_build_type}],[debug|debugger], 304AS_CASE([${enable_build_type}],[debug|debugger],
@@ -321,6 +314,53 @@ AS_CASE([${enable_build_type}],[debug|debugger],
321 ], 314 ],
322 [MHD_CHECK_ADD_CC_CFLAG([-O0], [CFLAGS_ac])] 315 [MHD_CHECK_ADD_CC_CFLAG([-O0], [CFLAGS_ac])]
323 ) 316 )
317 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
318 ]
319)
320AS_CASE([${enable_build_type}],[release|release-*],
321 [ # All release types
322 AS_VAR_IF([enable_build_type],["release-compact"],
323 [
324 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
325 AC_CHECK_DECL([MHD_FAVOR_SMALL_CODE],[],
326 [AC_CHECK_DECL([MHD_FAVOR_FAST_CODE],[],
327 [MHD_APPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-DMHD_FAVOR_SMALL_CODE=1])],
328 [/* no includes */])],[/* no includes */])
329 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
330 CFLAGS="${user_CFLAGS}"
331 MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-Oz], [-Os], [-O])
332 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
333 ],
334 [ # All non-compact release types
335 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
336 AC_CHECK_DECL([MHD_FAVOR_SMALL_CODE],[],
337 [AC_CHECK_DECL([MHD_FAVOR_FAST_CODE],[],
338 [MHD_APPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-DMHD_FAVOR_FAST_CODE=1])],
339 [/* no includes */])],[/* no includes */])
340 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
341 CFLAGS="${user_CFLAGS}"
342 MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-O2], [-O])
343 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
344 ]
345 )
346 ]
347)
348
349AS_VAR_IF([enable_build_type],["neutral"],[],
350 [ # Any non-neutral build types
351 MHD_CHECK_ADD_CC_CFLAGS([-Wall -Wnull-dereference], [CFLAGS_ac])
352 MHD_CHECK_ADD_CC_CFLAGS([-Wdeclaration-after-statement -Wimplicit -Wnested-externs], [CFLAGS_ac])
353 MHD_CHECK_ADD_CC_CFLAGS([-Wredundant-decls -Wtrampolines -Wunsafe-loop-optimizations], [CFLAGS_ac])
354 MHD_CHECK_ADD_CC_CFLAGS([-Wpoison-system-directories], [CFLAGS_ac])
355 CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
356 LDFLAGS="${user_LDFLAGS}"
357 MHD_CHECK_ADD_CC_LDFLAG([-Wl,--warn-common], [LDFLAGS_ac])
358 LDFLAGS="${LDFLAGS_ac} ${user_LDFLAGS}"
359 ]
360)
361AS_CASE([${enable_build_type}],[debug|debugger],
362 [ # Debug build or build for walking with debugger
363 CFLAGS="${user_CFLAGS}"
324 MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-ggdb3], [-g3], [-ggdb], [-g]) 364 MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-ggdb3], [-g3], [-ggdb], [-g])
325 MHD_CHECK_ADD_CC_CFLAGS([-Wextra -Wdouble-promotion], [CFLAGS_ac]) 365 MHD_CHECK_ADD_CC_CFLAGS([-Wextra -Wdouble-promotion], [CFLAGS_ac])
326 MHD_FIND_ADD_CC_CFLAG_IFELSE( 366 MHD_FIND_ADD_CC_CFLAG_IFELSE(
@@ -407,21 +447,8 @@ AS_CASE([${enable_build_type}],[release|release-*],
407 [ # All release types 447 [ # All release types
408 CFLAGS="${user_CFLAGS}" 448 CFLAGS="${user_CFLAGS}"
409 AS_VAR_IF([enable_build_type],["release-compact"], 449 AS_VAR_IF([enable_build_type],["release-compact"],
410 [ 450 [],
411 AC_CHECK_DECL([MHD_FAVOR_SMALL_CODE],[],
412 [AC_CHECK_DECL([MHD_FAVOR_FAST_CODE],[],
413 [MHD_APPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-DMHD_FAVOR_SMALL_CODE=1])],
414 [/* no includes */])],[/* no includes */])
415 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
416 MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-Oz], [-Os], [-O])
417 ],
418 [ # All non-compact release types 451 [ # All non-compact release types
419 AC_CHECK_DECL([MHD_FAVOR_SMALL_CODE],[],
420 [AC_CHECK_DECL([MHD_FAVOR_FAST_CODE],[],
421 [MHD_APPEND_FLAG_TO_VAR([CPPFLAGS_ac],[-DMHD_FAVOR_FAST_CODE=1])],
422 [/* no includes */])],[/* no includes */])
423 CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
424 MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-O2], [-O])
425 MHD_CHECK_ADD_CC_CFLAGS([-fsched-pressure -fira-loop-pressure -fmerge-all-constants], [CFLAGS_ac]) # These flags may improve size, recheck with LTO and linker garbage collection 452 MHD_CHECK_ADD_CC_CFLAGS([-fsched-pressure -fira-loop-pressure -fmerge-all-constants], [CFLAGS_ac]) # These flags may improve size, recheck with LTO and linker garbage collection
426 MHD_CHECK_ADD_CC_CFLAGS([-ftree-partial-pre -fgcse-after-reload -fipa-pta], [CFLAGS_ac]) 453 MHD_CHECK_ADD_CC_CFLAGS([-ftree-partial-pre -fgcse-after-reload -fipa-pta], [CFLAGS_ac])
427 MHD_CHECK_ADD_CC_CFLAGS([-fisolate-erroneous-paths-attribute -ffinite-loops -floop-nest-optimize], [CFLAGS_ac]) 454 MHD_CHECK_ADD_CC_CFLAGS([-fisolate-erroneous-paths-attribute -ffinite-loops -floop-nest-optimize], [CFLAGS_ac])