1 dnl Copyright © 1997-2016, The AROS Development Team. All rights reserved.
4 dnl Desc: Autoconf source for target compiler feature detection
7 # Note: After file changes, generate features anew and commit _both_ files.
8 -------------------------
12 AC_CONFIG_AUX_DIR(../scripts/autoconf)
14 AROS_BUILDDIR=`${PWDCMD-pwd}`
15 AROS_BUILDDIR_UNIX=${PWD}
17 srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
20 NOLINKFLAGS="-nostdlib -nostartfiles"
22 # The first step is to find the binaries.
25 AC_MSG_CHECKING([target config location])
26 AC_ARG_WITH(config-dir,AC_HELP_STRING([--with-config-dir=VERSION],[Location of generated target config files]),targetcfg_dir="$withval",targetcfg_dir="")
27 if test "$targetcfg_dir" = ""; then
28 AC_MSG_ERROR([missing config directory!])
30 aros_targetcfg_dir="$targetcfg_dir"
32 AC_MSG_RESULT($aros_targetcfg_dir)
34 #-----------------------------------------------------------------------------
36 # Check if the target compiler supports some features:
48 # -finline-small-functions
51 AC_MSG_CHECKING([whether ${CC} accepts -fexceptions])
53 AC_TRY_COMPILE(,, aros_exceptions="yes", aros_exceptions="no")
54 AC_MSG_RESULT($aros_exceptions)
55 if test "x-$aros_exceptions" = "x-yes" ; then
56 aros_cflags_exceptions=-fexceptions
59 AC_MSG_CHECKING([whether ${CC} accepts -fpermissive])
61 AC_TRY_COMPILE(,, aros_permissive="yes", aros_permissive="no")
62 AC_MSG_RESULT($aros_permissive)
63 if test "x-$aros_permissive" = "x-yes" ; then
64 aros_cflags_permissive=-fpermissive
67 AC_MSG_CHECKING([whether ${CC} accepts -ffast-math])
69 AC_TRY_COMPILE(,, aros_fast_math="yes", aros_fast_math="no")
70 AC_MSG_RESULT($aros_fast_math)
71 if test "x-$aros_fast_math" = "x-yes" ; then
72 aros_cflags_fast_math=-ffast-math
75 AC_MSG_CHECKING([whether ${CC} accepts -fno-builtin-floor])
76 CFLAGS=-fno-builtin-floor
77 AC_TRY_COMPILE(,, aros_no_builtin_floor="yes", aros_no_builtin_floor="no")
78 AC_MSG_RESULT($aros_no_builtin_floor)
79 if test "x-$aros_no_builtin_floor" = "x-yes" ; then
80 aros_cflags_no_builtin_floor=-fno-builtin-floor
83 AC_MSG_CHECKING([whether ${CC} accepts -flto])
85 AC_TRY_COMPILE(,, aros_lto="yes", aros_lto="no")
86 AC_MSG_RESULT($aros_lto)
87 if test "x-$aros_lto" = "x-yes" ; then
89 aros_cflags_nolto=-fno-lto
91 AC_MSG_CHECKING([whether ${CC} accepts -fwhole-program])
92 CFLAGS=-fwhole-program
93 AC_TRY_COMPILE(,, aros_whole_program="yes", aros_whole_program="no")
94 AC_MSG_RESULT($aros_whole_program)
95 if test "x-$aros_whole_program" = "x-yes" ; then
96 aros_cflags_whole_program=-fwhole-program
99 AC_MSG_CHECKING([whether ${CC} accepts -floop-block])
101 AC_TRY_COMPILE(,, aros_loop_block="yes", aros_loop_block="no")
102 AC_MSG_RESULT($aros_loop_block)
103 if test "x-$aros_loop_block" = "x-yes" ; then
104 aros_cflags_loop_block=-floop-block
107 AC_MSG_CHECKING([whether ${CC} accepts -floop-interchange])
108 CFLAGS=-floop-interchange
109 AC_TRY_COMPILE(,, aros_loop_interchange="yes", aros_loop_interchange="no")
110 AC_MSG_RESULT($aros_loop_interchange)
111 if test "x-$aros_loop_interchange" = "x-yes" ; then
112 aros_cflags_loop_interchange=-floop-interchange
115 AC_MSG_CHECKING([whether ${CC} accepts -floop-strip-mine])
116 CFLAGS=-floop-strip-mine
117 AC_TRY_COMPILE(,, aros_loop_strip_mine="yes", aros_loop_strip_mine="no")
118 AC_MSG_RESULT($aros_loop_strip_mine)
119 if test "x-$aros_loop_strip_mine" = "x-yes" ; then
120 aros_cflags_loop_strip_mine=-floop-strip-mine
124 AC_MSG_CHECKING([whether ${CC} accepts -fpeel-loops])
126 AC_TRY_COMPILE(,, aros_peel_loops="yes", aros_peel_loops="no")
127 AC_MSG_RESULT($aros_peel_loops)
128 if test "x-$aros_peel_loops" = "x-yes" ; then
129 aros_cflags_peel_loops=-fpeel-loops
132 AC_MSG_CHECKING([whether ${CC} accepts -funroll-loops])
133 CFLAGS=-funroll-loops
134 AC_TRY_COMPILE(,, aros_unroll_loops="yes", aros_unroll_loops="no")
135 AC_MSG_RESULT($aros_unroll_loops)
136 if test "x-$aros_unroll_loops" = "x-yes" ; then
137 aros_cflags_unroll_loops=-funroll-loops
140 AC_MSG_CHECKING([whether ${CC} accepts -fstrict-aliasing])
141 CFLAGS=-fstrict-aliasing
142 AC_TRY_COMPILE(,, aros_strict_aliasing="yes", aros_strict_aliasing="no")
143 AC_MSG_RESULT($aros_strict_aliasing)
144 if test "x-$aros_strict_aliasing" = "x-yes" ; then
145 aros_cflags_strictaliasing=-fstrict-aliasing
146 aros_cflags_nostrictaliasing=-fno-strict-aliasing
149 AC_MSG_CHECKING([whether ${CC} accepts -finline-small-functions])
150 CFLAGS=-finline-small-functions
151 AC_TRY_COMPILE(,, aros_inline_small_functions="yes", aros_inline_small_functions="no")
152 AC_MSG_RESULT($aros_inline_small_functions)
153 if test "x-$aros_inline_small_functions" = "x-yes" ; then
154 aros_cflags_inlinesmallfunctions=-finline-small-functions
155 aros_cflags_noinlinesmallfunctions=-fno-inline-small-functions
158 AC_MSG_CHECKING([whether ${CC} accepts -iquote])
160 AC_TRY_COMPILE(,, has_iquote="yes", has_iquote="no")
161 AC_MSG_RESULT($has_iquote)
162 if test "x-$has_iquote" = "x-yes" ; then
163 aros_cflags_iquote=-iquote
164 aros_cflags_iquote_end=
166 aros_cflags_iquote=-I
167 aros_cflags_iquote_end=-I-
170 #-----------------------------------------------------------------------------
172 # Check if the target compiler supports some options:
175 AC_MSG_CHECKING([whether ${CC} accepts -mno-red-zone])
177 AC_TRY_COMPILE(,, aros_no_red_zone="yes", aros_no_red_zone="no")
178 AC_MSG_RESULT($aros_no_red_zone)
179 if test "x-$aros_no_red_zone" = "x-yes" ; then
180 aros_cflags_no_red_zone=-mno-red-zone
183 #-----------------------------------------------------------------------------
185 # Check if the target compiler supports some options used for de-linting:
187 # -Wunused-command-line-argument
188 # -Wunknown-warning-option
189 # -Wunused-but-set-variable
193 # -Wstrict-prototypes
196 # -Wmisleading-indentation
205 # -Wmaybe-uninitialized
206 # -Wimplicit-function-declaration
211 # -Wformat-contains-nul
213 # -Waggressive-loop-optimizations
216 # -Wdiscarded-qualifiers
219 # -Wdiscarded-array-qualifiers
221 # -Wint-to-pointer-cast
222 # -Wpointer-to-int-cast
223 # -Wunused-const-variable
226 # -Wincompatible-pointer-types
228 # -Wlogical-not-parentheses
232 # -Wdeprecated-declarations
236 # -Wunused-local-typedefs
240 # -Wvolatile-register-var
241 # -Wsizeof-pointer-memaccess
243 # -Wformat-zero-length
244 # -Wlto-type-mismatch
245 # -Wtautological-compare
248 AC_MSG_CHECKING([whether ${CC} accepts -Werror])
250 AC_TRY_COMPILE(,, aros_error="yes", aros_error="no")
251 AC_MSG_RESULT($aros_error)
252 if test "x-$aros_error" = "x-yes" ; then
253 aros_warnflags_error=-Werror
254 aros_nowarnflags_error=-Wno-error
257 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-command-line-argument])
258 CFLAGS=-Wunused-command-line-argument
259 AC_TRY_COMPILE(,, aros_unused_command_line_argument="yes", aros_unused_command_line_argument="no")
260 AC_MSG_RESULT($aros_unused_command_line_argument)
261 if test "x-$aros_unused_command_line_argument" = "x-yes" ; then
262 aros_warnflags_unused_command_line_argument=-Wunused-command-line-argument
263 aros_nowarnflags_unused_command_line_argument=-Wno-unused-command-line-argument
266 AC_MSG_CHECKING([whether ${CC} accepts -Wunknown-warning-option])
267 CFLAGS=-Wunknown-warning-option
268 AC_TRY_COMPILE(,, aros_unknown_warning_option="yes", aros_unknown_warning_option="no")
269 AC_MSG_RESULT($aros_unknown_warning_option)
270 if test "x-$aros_unknown_warning_option" = "x-yes" ; then
271 aros_warnflags_unknown_warning_option=-Wunknown-warning-option
272 aros_nowarnflags_unknown_warning_option=-Wno-unknown-warning-option
275 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-but-set-variable])
276 CFLAGS=-Wunused-but-set-variable
277 AC_TRY_COMPILE(,, aros_unused_but_set_variable="yes", aros_unused_but_set_variable="no")
278 AC_MSG_RESULT($aros_unused_but_set_variable)
279 if test "x-$aros_unused_but_set_variable" = "x-yes" ; then
280 aros_warnflags_unused_but_set_variable=-Wunused-but-set-variable
281 aros_nowarnflags_unused_but_set_variable=-Wno-unused-but-set-variable
284 AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-aliasing])
285 CFLAGS=-Wstrict-aliasing
286 AC_TRY_COMPILE(,, aros_strict_aliasing="yes", aros_strict_aliasing="no")
287 AC_MSG_RESULT($aros_strict_aliasing)
288 if test "x-$aros_strict_aliasing" = "x-yes" ; then
289 aros_warnflags_strict_aliasing=-Wstrict-aliasing
290 aros_nowarnflags_strict_aliasing=-Wno-strict-aliasing
293 AC_MSG_CHECKING([whether ${CC} accepts -Warray-bounds])
294 CFLAGS=-Warray-bounds
295 AC_TRY_COMPILE(,, aros_array_bounds="yes", aros_array_bounds="no")
296 AC_MSG_RESULT($aros_array_bounds)
297 if test "x-$aros_array_bounds" = "x-yes" ; then
298 aros_warnflags_array_bounds=-Warray-bounds
299 aros_nowarnflags_array_bounds=-Wno-array-bounds
302 AC_MSG_CHECKING([whether ${CC} accepts -Wenum-compare])
303 CFLAGS=-Wenum-compare
304 AC_TRY_COMPILE(,, aros_enum_compare="yes", aros_enum_compare="no")
305 AC_MSG_RESULT($aros_enum_compare)
306 if test "x-$aros_enum_compare" = "x-yes" ; then
307 aros_warnflags_enum_compare=-Wenum-compare
308 aros_nowarnflags_enum_compare=-Wno-enum-compare
311 AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-prototypes])
312 CFLAGS=-Wstrict-prototypes
313 AC_TRY_COMPILE(,, aros_strict_prototypes="yes", aros_strict_prototypes="no")
314 AC_MSG_RESULT($aros_strict_prototypes)
315 if test "x-$aros_strict_prototypes" = "x-yes" ; then
316 aros_warnflags_strict_prototypes=-Wstrict-prototypes
317 aros_nowarnflags_strict_prototypes=-Wno-strict-prototypes
320 AC_MSG_CHECKING([whether ${CC} accepts -Wstrict-overflow])
321 CFLAGS=-Wstrict-overflow
322 AC_TRY_COMPILE(,, aros_strict_overflow="yes", aros_strict_overflow="no")
323 AC_MSG_RESULT($aros_strict_overflow)
324 if test "x-$aros_strict_overflow" = "x-yes" ; then
325 aros_warnflags_strict_overflow=-Wstrict-overflow
326 aros_nowarnflags_strict_overflow=-Wno-strict-overflow
329 AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security])
330 CFLAGS=-Wformat-security
331 AC_TRY_COMPILE(,, aros_format_security="yes", aros_format_security="no")
332 AC_MSG_RESULT($aros_format_security)
333 if test "x-$aros_format_security" = "x-yes" ; then
334 aros_warnflags_format_security=-Wformat-security
335 aros_nowarnflags_format_security=-Wno-format-security
338 AC_MSG_CHECKING([whether ${CC} accepts -Wmisleading-indentation])
339 CFLAGS=-Wmisleading-indentation
340 AC_TRY_COMPILE(,, aros_misleading_indentation="yes", aros_misleading_indentation="no")
341 AC_MSG_RESULT($aros_misleading_indentation)
342 if test "x-$aros_misleading_indentation" = "x-yes" ; then
343 aros_warnflags_misleading_indentation=-Wmisleading-indentation
344 aros_nowarnflags_misleading_indentation=-Wno-misleading-indentation
347 AC_MSG_CHECKING([whether ${CC} accepts -Wnonnull-compare])
348 CFLAGS=-Wnonnull-compare
349 AC_TRY_COMPILE(,, aros_nonnull_compare="yes", aros_nonnull_compare="no")
350 AC_MSG_RESULT($aros_nonnull_compare)
351 if test "x-$aros_nonnull_compare" = "x-yes" ; then
352 aros_warnflags_nonnull_compare=-Wnonnull-compare
353 aros_nowarnflags_nonnull_compare=-Wno-nonnull-compare
356 AC_MSG_CHECKING([whether ${CC} accepts -Wunused])
358 AC_TRY_COMPILE(,, aros_unused="yes", aros_unused="no")
359 AC_MSG_RESULT($aros_unused)
360 if test "x-$aros_unused" = "x-yes" ; then
361 aros_warnflags_unused=-Wunused
362 aros_nowarnflags_unused=-Wno-unused
365 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-label])
366 CFLAGS=-Wunused-label
367 AC_TRY_COMPILE(,, aros_unused_label="yes", aros_unused_label="no")
368 AC_MSG_RESULT($aros_unused_label)
369 if test "x-$aros_unused_label" = "x-yes" ; then
370 aros_warnflags_unused_label=-Wunused-label
371 aros_nowarnflags_unused_label=-Wno-unused-label
374 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-value])
375 CFLAGS=-Wunused-value
376 AC_TRY_COMPILE(,, aros_unused_value="yes", aros_unused_value="no")
377 AC_MSG_RESULT($aros_unused_value)
378 if test "x-$aros_unused_value" = "x-yes" ; then
379 aros_warnflags_unused_value=-Wunused-value
380 aros_nowarnflags_unused_value=-Wno-unused-value
383 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-variable])
384 CFLAGS=-Wunused-variable
385 AC_TRY_COMPILE(,, aros_unused_variable="yes", aros_unused_variable="no")
386 AC_MSG_RESULT($aros_unused_variable)
387 if test "x-$aros_unused_variable" = "x-yes" ; then
388 aros_warnflags_unused_variable=-Wunused-variable
389 aros_nowarnflags_unused_variable=-Wno-unused-variable
392 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-function])
393 CFLAGS=-Wunused-function
394 AC_TRY_COMPILE(,, aros_unused_function="yes", aros_unused_function="no")
395 AC_MSG_RESULT($aros_unused_function)
396 if test "x-$aros_unused_function" = "x-yes" ; then
397 aros_warnflags_unused_function=-Wunused-function
398 aros_nowarnflags_unused_function=-Wno-unused-function
401 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-parameter])
402 CFLAGS=-Wunused-parameter
403 AC_TRY_COMPILE(,, aros_unused_parameter="yes", aros_unused_parameter="no")
404 AC_MSG_RESULT($aros_unused_parameter)
405 if test "x-$aros_unused_parameter" = "x-yes" ; then
406 aros_warnflags_unused_parameter=-Wunused-parameter
407 aros_nowarnflags_unused_parameter=-Wno-unused-parameter
410 AC_MSG_CHECKING([whether ${CC} accepts -Wuninitialized])
411 CFLAGS=-Wuninitialized
412 AC_TRY_COMPILE(,, aros_uninitialized="yes", aros_uninitialized="no")
413 AC_MSG_RESULT($aros_uninitialized)
414 if test "x-$aros_uninitialized" = "x-yes" ; then
415 aros_warnflags_uninitialized=-Wuninitialized
416 aros_nowarnflags_uninitialized=-Wno-uninitialized
419 AC_MSG_CHECKING([whether ${CC} accepts -Wmaybe-uninitialized])
420 CFLAGS=-Wmaybe-uninitialized
421 AC_TRY_COMPILE(,, aros_maybe_uninitialized="yes", aros_maybe_uninitialized="no")
422 AC_MSG_RESULT($aros_maybe_uninitialized)
423 if test "x-$aros_maybe_uninitialized" = "x-yes" ; then
424 aros_warnflags_maybe_uninitialized=-Wmaybe-uninitialized
425 aros_nowarnflags_maybe_uninitialized=-Wno-maybe-uninitialized
427 aros_warnflags_maybe_uninitialized=$aros_warnflags_uninitialized
428 aros_nowarnflags_maybe_uninitialized=$aros_nowarnflags_uninitialized
431 AC_MSG_CHECKING([whether ${CC} accepts -Wimplicit-function-declaration])
432 CFLAGS=-Wimplicit-function-declaration
433 AC_TRY_COMPILE(,, aros_implicit_function_declaration="yes", aros_implicit_function_declaration="no")
434 AC_MSG_RESULT($aros_implicit_function_declaration)
435 if test "x-$aros_implicit_function_declaration" = "x-yes" ; then
436 aros_warnflags_implicit_function_declaration=-Wimplicit-function-declaration
437 aros_nowarnflags_implicit_function_declaration=-Wno-implicit-function-declaration
440 AC_MSG_CHECKING([whether ${CC} accepts -Wformat])
442 AC_TRY_COMPILE(,, aros_format="yes", aros_format="no")
443 AC_MSG_RESULT($aros_format)
444 if test "x-$aros_format" = "x-yes" ; then
445 aros_warnflags_format=-Wformat
446 aros_nowarnflags_format=-Wno-format
449 AC_MSG_CHECKING([whether ${CC} accepts -Wparentheses])
451 AC_TRY_COMPILE(,, aros_parentheses="yes", aros_parentheses="no")
452 AC_MSG_RESULT($aros_parentheses)
453 if test "x-$aros_parentheses" = "x-yes" ; then
454 aros_warnflags_parentheses=-Wparentheses
455 aros_nowarnflags_parentheses=-Wno-parentheses
458 AC_MSG_CHECKING([whether ${CC} accepts -Wchar-subscripts])
459 CFLAGS=-Wchar-subscripts
460 AC_TRY_COMPILE(,, aros_char_subscripts="yes", aros_char_subscripts="no")
461 AC_MSG_RESULT($aros_char_subscripts)
462 if test "x-$aros_char_subscripts" = "x-yes" ; then
463 aros_warnflags_char_subscripts=-Wchar-subscripts
464 aros_nowarnflags_char_subscripts=-Wno-char-subscripts
467 AC_MSG_CHECKING([whether ${CC} accepts -Wendif-labels])
468 CFLAGS=-Wendif-labels
469 AC_TRY_COMPILE(,, aros_endif_labels="yes", aros_endif_labels="no")
470 AC_MSG_RESULT($aros_endif_labels)
471 if test "x-$aros_endif_labels" = "x-yes" ; then
472 aros_warnflags_endif_labels=-Wendif-labels
473 aros_nowarnflags_endif_labels=-Wno-endif-labels
476 AC_MSG_CHECKING([whether ${CC} accepts -Wformat-contains-nul])
477 CFLAGS=-Wformat-contains-nul
478 AC_TRY_COMPILE(,, aros_format_contains_nul="yes", aros_format_contains_nul="no")
479 AC_MSG_RESULT($aros_format_contains_nul)
480 if test "x-$aros_format_contains_nul" = "x-yes" ; then
481 aros_warnflags_format_contains_nul=-Wformat-contains-nul
482 aros_nowarnflags_format_contains_nul=-Wno-format-contains-nul
485 AC_MSG_CHECKING([whether ${CC} accepts -Wimplicit-int])
486 CFLAGS=-Wimplicit-int
487 AC_TRY_COMPILE(,, aros_implicit_int="yes", aros_implicit_int="no")
488 AC_MSG_RESULT($aros_implicit_int)
489 if test "x-$aros_implicit_int" = "x-yes" ; then
490 aros_warnflags_implicit_int=-Wimplicit-int
491 aros_nowarnflags_implicit_int=-Wno-implicit-int
494 AC_MSG_CHECKING([whether ${CC} accepts -Waggressive-loop-optimizations])
495 CFLAGS=-Waggressive-loop-optimizations
496 AC_TRY_COMPILE(,, aros_aggressive_loop_optimizations="yes", aros_aggressive_loop_optimizations="no")
497 AC_MSG_RESULT($aros_aggressive_loop_optimizations)
498 if test "x-$aros_aggressive_loop_optimizations" = "x-yes" ; then
499 aros_warnflags_aggressive_loop_optimizations=-Waggressive-loop-optimizations
500 aros_nowarnflags_aggressive_loop_optimizations=-Wno-aggressive-loop-optimizations
503 AC_MSG_CHECKING([whether ${CC} accepts -Wcpp])
505 AC_TRY_COMPILE(,, aros_cpp="yes", aros_cpp="no")
506 AC_MSG_RESULT($aros_cpp)
507 if test "x-$aros_cpp" = "x-yes" ; then
508 aros_warnflags_cpp=-Wcpp
509 aros_nowarnflags_cpp=-Wno-cpp
512 AC_MSG_CHECKING([whether ${CC} accepts -Wswitch])
514 AC_TRY_COMPILE(,, aros_switch="yes", aros_switch="no")
515 AC_MSG_RESULT($aros_switch)
516 if test "x-$aros_switch" = "x-yes" ; then
517 aros_warnflags_switch=-Wswitch
518 aros_nowarnflags_switch=-Wno-switch
521 AC_MSG_CHECKING([whether ${CC} accepts -Wdiscarded-qualifiers])
522 CFLAGS=-Wdiscarded-qualifiers
523 AC_TRY_COMPILE(,, aros_discarded_qualifiers="yes", aros_discarded_qualifiers="no")
524 AC_MSG_RESULT($aros_discarded_qualifiers)
525 if test "x-$aros_discarded_qualifiers" = "x-yes" ; then
526 aros_warnflags_discarded_qualifiers=-Wdiscarded-qualifiers
527 aros_nowarnflags_discarded_qualifiers=-Wno-discarded-qualifiers
530 AC_MSG_CHECKING([whether ${CC} accepts -Wsequence-point])
531 CFLAGS=-Wsequence-point
532 AC_TRY_COMPILE(,, aros_sequence_point="yes", aros_sequence_point="no")
533 AC_MSG_RESULT($aros_sequence_point)
534 if test "x-$aros_sequence_point" = "x-yes" ; then
535 aros_warnflags_sequence_point=-Wsequence-point
536 aros_nowarnflags_sequence_point=-Wno-sequence-point
539 AC_MSG_CHECKING([whether ${CC} accepts -Wunknown-pragmas])
540 CFLAGS=-Wunknown-pragmas
541 AC_TRY_COMPILE(,, aros_unknown_pragmas="yes", aros_unknown_pragmas="no")
542 AC_MSG_RESULT($aros_unknown_pragmas)
543 if test "x-$aros_unknown_pragmas" = "x-yes" ; then
544 aros_warnflags_unknown_pragmas=-Wunknown-pragmas
545 aros_nowarnflags_unknown_pragmas=-Wno-unknown-pragmas
548 AC_MSG_CHECKING([whether ${CC} accepts -Wdiscarded-array-qualifiers])
549 CFLAGS=-Wdiscarded-array-qualifiers
550 AC_TRY_COMPILE(,, aros_discarded_array_qualifiers="yes", aros_discarded_array_qualifiers="no")
551 AC_MSG_RESULT($aros_discarded_array_qualifiers)
552 if test "x-$aros_discarded_array_qualifiers" = "x-yes" ; then
553 aros_warnflags_discarded_array_qualifiers=-Wdiscarded-array-qualifiers
554 aros_nowarnflags_discarded_array_qualifiers=-Wno-discarded-array-qualifiers
557 AC_MSG_CHECKING([whether ${CC} accepts -Wint-conversion])
558 CFLAGS=-Wint-conversion
559 AC_TRY_COMPILE(,, aros_int_conversion="yes", aros_int_conversion="no")
560 AC_MSG_RESULT($aros_int_conversion)
561 if test "x-$aros_int_conversion" = "x-yes" ; then
562 aros_warnflags_int_conversion=-Wint-conversion
563 aros_nowarnflags_int_conversion=-Wno-int-conversion
566 AC_MSG_CHECKING([whether ${CC} accepts -Wint-to-pointer-cast])
567 CFLAGS=-Wint-to-pointer-cast
568 AC_TRY_COMPILE(,, aros_int_to_pointer_cast="yes", aros_int_to_pointer_cast="no")
569 AC_MSG_RESULT($aros_int_to_pointer_cast)
570 if test "x-$aros_int_to_pointer_cast" = "x-yes" ; then
571 aros_warnflags_int_to_pointer_cast=-Wint-to-pointer-cast
572 aros_nowarnflags_int_to_pointer_cast=-Wno-int-to-pointer-cast
575 AC_MSG_CHECKING([whether ${CC} accepts -Wpointer-to-int-cast])
576 CFLAGS=-Wpointer-to-int-cast
577 AC_TRY_COMPILE(,, aros_pointer_to_int_cast="yes", aros_pointer_to_int_cast="no")
578 AC_MSG_RESULT($aros_pointer_to_int_cast)
579 if test "x-$aros_pointer_to_int_cast" = "x-yes" ; then
580 aros_warnflags_pointer_to_int_cast=-Wpointer-to-int-cast
581 aros_nowarnflags_pointer_to_int_cast=-Wno-pointer-to-int-cast
584 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-const-variable])
585 CFLAGS=-Wunused-const-variable
586 AC_TRY_COMPILE(,, aros_unused_const_variable="yes", aros_unused_const_variable="no")
587 AC_MSG_RESULT($aros_unused_const_variable)
588 if test "x-$aros_unused_const_variable" = "x-yes" ; then
589 aros_warnflags_unused_const_variable=-Wunused-const-variable
590 aros_nowarnflags_unused_const_variable=-Wno-unused-const-variable
593 AC_MSG_CHECKING([whether ${CC} accepts -Wwrite-strings])
594 CFLAGS=-Wwrite-strings
595 AC_TRY_COMPILE(,, aros_write_strings="yes", aros_write_strings="no")
596 AC_MSG_RESULT($aros_write_strings)
597 if test "x-$aros_write_strings" = "x-yes" ; then
598 aros_warnflags_write_strings=-Wwrite-strings
599 aros_nowarnflags_write_strings=-Wno-write-strings
602 AC_MSG_CHECKING([whether ${CC} accepts -Wcomment])
604 AC_TRY_COMPILE(,, aros_comment="yes", aros_comment="no")
605 AC_MSG_RESULT($aros_comment)
606 if test "x-$aros_comment" = "x-yes" ; then
607 aros_warnflags_comment=-Wcomment
608 aros_nowarnflags_comment=-Wno-comment
611 AC_MSG_CHECKING([whether ${CC} accepts -Wincompatible-pointer-types])
612 CFLAGS=-Wincompatible-pointer-types
613 AC_TRY_COMPILE(,, aros_incompatible_pointer_types="yes", aros_incompatible_pointer_types="no")
614 AC_MSG_RESULT($aros_incompatible_pointer_types)
615 if test "x-$aros_incompatible_pointer_types" = "x-yes" ; then
616 aros_warnflags_incompatible_pointer_types=-Wincompatible-pointer-types
617 aros_nowarnflags_incompatible_pointer_types=-Wno-incompatible-pointer-types
620 AC_MSG_CHECKING([whether ${CC} accepts -Wbool-compare])
621 CFLAGS=-Wbool-compare
622 AC_TRY_COMPILE(,, aros_bool_compare="yes", aros_bool_compare="no")
623 AC_MSG_RESULT($aros_bool_compare)
624 if test "x-$aros_bool_compare" = "x-yes" ; then
625 aros_warnflags_bool_compare=-Wbool-compare
626 aros_nowarnflags_bool_compare=-Wno-bool-compare
629 AC_MSG_CHECKING([whether ${CC} accepts -Wlogical-not-parentheses])
630 CFLAGS=-Wlogical-not-parentheses
631 AC_TRY_COMPILE(,, aros_logical_not_parentheses="yes", aros_logical_not_parentheses="no")
632 AC_MSG_RESULT($aros_logical_not_parentheses)
633 if test "x-$aros_logical_not_parentheses" = "x-yes" ; then
634 aros_warnflags_logical_not_parentheses=-Wlogical-not-parentheses
635 aros_nowarnflags_logical_not_parentheses=-Wno-logical-not-parentheses
638 AC_MSG_CHECKING([whether ${CC} accepts -Wpointer-sign])
639 CFLAGS=-Wpointer-sign
640 AC_TRY_COMPILE(,, aros_pointer_sign="yes", aros_pointer_sign="no")
641 AC_MSG_RESULT($aros_pointer_sign)
642 if test "x-$aros_pointer_sign" = "x-yes" ; then
643 aros_warnflags_pointer_sign=-Wpointer-sign
644 aros_nowarnflags_pointer_sign=-Wno-pointer-sign
647 AC_MSG_CHECKING([whether ${CC} accepts -Wshift-overflow])
648 CFLAGS=-Wshift-overflow
649 AC_TRY_COMPILE(,, aros_shift_overflow="yes", aros_shift_overflow="no")
650 AC_MSG_RESULT($aros_shift_overflow)
651 if test "x-$aros_shift_overflow" = "x-yes" ; then
652 aros_warnflags_shift_overflow=-Wshift-overflow
653 aros_nowarnflags_shift_overflow=-Wno-shift-overflow
656 AC_MSG_CHECKING([whether ${CC} accepts -Wframe-address])
657 CFLAGS=-Wframe-address
658 AC_TRY_COMPILE(,, aros_frame_address="yes", aros_frame_address="no")
659 AC_MSG_RESULT($aros_frame_address)
660 if test "x-$aros_frame_address" = "x-yes" ; then
661 aros_warnflags_frame_address=-Wframe-address
662 aros_nowarnflags_frame_address=-Wno-frame-address
665 AC_MSG_CHECKING([whether ${CC} accepts -Wdeprecated-declarations])
666 CFLAGS=-Wdeprecated-declarations
667 AC_TRY_COMPILE(,, aros_deprecated_declarations="yes", aros_deprecated_declarations="no")
668 AC_MSG_RESULT($aros_deprecated_declarations)
669 if test "x-$aros_deprecated_declarations" = "x-yes" ; then
670 aros_warnflags_deprecated_declarations=-Wdeprecated-declarations
671 aros_nowarnflags_deprecated_declarations=-Wno-deprecated-declarations
674 AC_MSG_CHECKING([whether ${CC} accepts -Wsign-compare])
675 CFLAGS=-Wsign-compare
676 AC_TRY_COMPILE(,, aros_sign_compare="yes", aros_sign_compare="no")
677 AC_MSG_RESULT($aros_sign_compare)
678 if test "x-$aros_sign_compare" = "x-yes" ; then
679 aros_warnflags_sign_compare=-Wsign-compare
680 aros_nowarnflags_sign_compare=-Wno-sign-compare
683 AC_MSG_CHECKING([whether ${CC} accepts -Wattributes])
685 AC_TRY_COMPILE(,, aros_attributes="yes", aros_attributes="no")
686 AC_MSG_RESULT($aros_attributes)
687 if test "x-$aros_attributes" = "x-yes" ; then
688 aros_warnflags_attributes=-Wattributes
689 aros_nowarnflags_attributes=-Wno-attributes
692 AC_MSG_CHECKING([whether ${CC} accepts -Woverflow])
694 AC_TRY_COMPILE(,, aros_overflow="yes", aros_overflow="no")
695 AC_MSG_RESULT($aros_overflow)
696 if test "x-$aros_overflow" = "x-yes" ; then
697 aros_warnflags_overflow=-Woverflow
698 aros_nowarnflags_overflow=-Wno-overflow
701 AC_MSG_CHECKING([whether ${CC} accepts -Wunused-local-typedefs])
702 CFLAGS=-Wunused-local-typedefs
703 AC_TRY_COMPILE(,, aros_unused_local_typedefs="yes", aros_unused_local_typedefs="no")
704 AC_MSG_RESULT($aros_unused_local_typedefs)
705 if test "x-$aros_unused_local_typedefs" = "x-yes" ; then
706 aros_warnflags_unused_local_typedefs=-Wunused-local-typedefs
707 aros_nowarnflags_unused_local_typedefs=-Wno-unused-local-typedefs
710 AC_MSG_CHECKING([whether ${CC} accepts -Wmissing-braces])
711 CFLAGS=-Wmissing-braces
712 AC_TRY_COMPILE(,, aros_missing_braces="yes", aros_missing_braces="no")
713 AC_MSG_RESULT($aros_missing_braces)
714 if test "x-$aros_missing_braces" = "x-yes" ; then
715 aros_warnflags_missing_braces=-Wmissing-braces
716 aros_nowarnflags_missing_braces=-Wno-missing-braces
719 AC_MSG_CHECKING([whether ${CC} accepts -Wconversion-null])
720 CFLAGS=-Wconversion-null
721 AC_TRY_COMPILE(,, aros_conversion_null="yes", aros_conversion_null="no")
722 AC_MSG_RESULT($aros_conversion_null)
723 if test "x-$aros_conversion_null" = "x-yes" ; then
724 aros_warnflags_conversion_null=-Wconversion-null
725 aros_nowarnflags_conversion_null=-Wno-conversion-null
728 AC_MSG_CHECKING([whether ${CC} accepts -Wnarrowing])
730 AC_TRY_COMPILE(,, aros_narrowing="yes", aros_narrowing="no")
731 AC_MSG_RESULT($aros_narrowing)
732 if test "x-$aros_narrowing" = "x-yes" ; then
733 aros_warnflags_narrowing=-Wnarrowing
734 aros_nowarnflags_narrowing=-Wno-narrowing
737 AC_MSG_CHECKING([whether ${CC} accepts -Wvolatile-register-var])
738 CFLAGS=-Wvolatile-register-var
739 AC_TRY_COMPILE(,, aros_volatile_register_var="yes", aros_volatile_register_var="no")
740 AC_MSG_RESULT($aros_volatile_register_var)
741 if test "x-$aros_volatile_register_var" = "x-yes" ; then
742 aros_warnflags_volatile_register_var=-Wvolatile-register-var
743 aros_nowarnflags_volatile_register_var=-Wno-volatile-register-var
746 AC_MSG_CHECKING([whether ${CC} accepts -Wsizeof-pointer-memaccess])
747 CFLAGS=-Wsizeof-pointer-memaccess
748 AC_TRY_COMPILE(,, aros_sizeof_pointer_memaccess="yes", aros_sizeof_pointer_memaccess="no")
749 AC_MSG_RESULT($aros_sizeof_pointer_memaccess)
750 if test "x-$aros_sizeof_pointer_memaccess" = "x-yes" ; then
751 aros_warnflags_sizeof_pointer_memaccess=-Wsizeof-pointer-memaccess
752 aros_nowarnflags_sizeof_pointer_memaccess=-Wno-sizeof-pointer-memaccess
755 AC_MSG_CHECKING([whether ${CC} accepts -Wreturn-type])
757 AC_TRY_COMPILE(,, aros_return_type="yes", aros_return_type="no")
758 AC_MSG_RESULT($aros_return_type)
759 if test "x-$aros_return_type" = "x-yes" ; then
760 aros_warnflags_return_type=-Wreturn-type
761 aros_nowarnflags_return_type=-Wno-return-type
764 AC_MSG_CHECKING([whether ${CC} accepts -Wformat-zero-length])
765 CFLAGS=-Wformat-zero-length
766 AC_TRY_COMPILE(,, aros_format_zero_length="yes", aros_format_zero_length="no")
767 AC_MSG_RESULT($aros_format_zero_length)
768 if test "x-$aros_format_zero_length" = "x-yes" ; then
769 aros_warnflags_format_zero_length=-Wformat-zero-length
770 aros_nowarnflags_format_zero_length=-Wno-format-zero-length
773 AC_MSG_CHECKING([whether ${CC} accepts -Wlto-type-mismatch])
774 CFLAGS=-Wlto-type-mismatch
775 AC_TRY_COMPILE(,, aros_lto_type_mismatch="yes", aros_lto_type_mismatch="no")
776 AC_MSG_RESULT($aros_lto_type_mismatch)
777 if test "x-$aros_lto_type_mismatch" = "x-yes" ; then
778 aros_warnflags_lto_type_mismatch=-Wlto-type-mismatch
779 aros_nowarnflags_lto_type_mismatch=-Wno-lto-type-mismatch
782 AC_MSG_CHECKING([whether ${CC} accepts -Wtautological-compare])
783 CFLAGS=-Wtautological-compare
784 AC_TRY_COMPILE(,, aros_tautological_compare="yes", aros_tautological_compare="no")
785 AC_MSG_RESULT($aros_tautological_compare)
786 if test "x-$aros_tautological_compare" = "x-yes" ; then
787 aros_warnflags_tautological_compare=-Wtautological-compare
788 aros_nowarnflags_tautological_compare=-Wno-tautological-compare
791 AC_MSG_CHECKING([whether ${CC} accepts -Wempty-body])
793 AC_TRY_COMPILE(,, aros_empty_body="yes", aros_empty_body="no")
794 AC_MSG_RESULT($aros_empty_body)
795 if test "x-$aros_empty_body" = "x-yes" ; then
796 aros_warnflags_empty_body=-Wempty-body
797 aros_nowarnflags_empty_body=-Wno-empty-body
801 # export the feature flags...
803 AC_SUBST(aros_cflags_exceptions)
804 AC_SUBST(aros_cflags_permissive)
805 AC_SUBST(aros_cflags_fast_math)
806 AC_SUBST(aros_cflags_no_builtin_floor)
807 AC_SUBST(aros_cflags_lto)
808 AC_SUBST(aros_cflags_nolto)
809 AC_SUBST(aros_cflags_whole_program)
810 AC_SUBST(aros_cflags_loop_block)
811 AC_SUBST(aros_cflags_loop_interchange)
812 AC_SUBST(aros_cflags_loop_strip_mine)
813 AC_SUBST(aros_cflags_peel_loops)
814 AC_SUBST(aros_cflags_unroll_loops)
816 AC_SUBST(aros_cflags_strictaliasing)
817 AC_SUBST(aros_cflags_nostrictaliasing)
819 AC_SUBST(aros_cflags_inlinesmallfunctions)
820 AC_SUBST(aros_cflags_noinlinesmallfunctions)
822 AC_SUBST(aros_cflags_iquote)
823 AC_SUBST(aros_cflags_iquote_end)
826 # export the feature options...
828 AC_SUBST(aros_cflags_no_red_zone)
831 # ...and warning flags...
833 AC_SUBST(aros_warnflags_error)
834 AC_SUBST(aros_nowarnflags_error)
835 AC_SUBST(aros_warnflags_unused_command_line_argument)
836 AC_SUBST(aros_nowarnflags_unused_command_line_argument)
837 AC_SUBST(aros_warnflags_unknown_warning_option)
838 AC_SUBST(aros_nowarnflags_unknown_warning_option)
839 AC_SUBST(aros_warnflags_unused_but_set_variable)
840 AC_SUBST(aros_nowarnflags_unused_but_set_variable)
841 AC_SUBST(aros_warnflags_strict_aliasing)
842 AC_SUBST(aros_nowarnflags_strict_aliasing)
843 AC_SUBST(aros_warnflags_array_bounds)
844 AC_SUBST(aros_nowarnflags_array_bounds)
845 AC_SUBST(aros_warnflags_enum_compare)
846 AC_SUBST(aros_nowarnflags_enum_compare)
847 AC_SUBST(aros_warnflags_strict_prototypes)
848 AC_SUBST(aros_nowarnflags_strict_prototypes)
849 AC_SUBST(aros_warnflags_strict_overflow)
850 AC_SUBST(aros_nowarnflags_strict_overflow)
851 AC_SUBST(aros_warnflags_format_security)
852 AC_SUBST(aros_nowarnflags_format_security)
853 AC_SUBST(aros_warnflags_misleading_indentation)
854 AC_SUBST(aros_nowarnflags_misleading_indentation)
855 AC_SUBST(aros_warnflags_nonnull_compare)
856 AC_SUBST(aros_nowarnflags_nonnull_compare)
857 AC_SUBST(aros_warnflags_unused)
858 AC_SUBST(aros_nowarnflags_unused)
859 AC_SUBST(aros_warnflags_unused_label)
860 AC_SUBST(aros_nowarnflags_unused_label)
861 AC_SUBST(aros_warnflags_unused_value)
862 AC_SUBST(aros_nowarnflags_unused_value)
863 AC_SUBST(aros_warnflags_unused_variable)
864 AC_SUBST(aros_nowarnflags_unused_variable)
865 AC_SUBST(aros_warnflags_unused_function)
866 AC_SUBST(aros_nowarnflags_unused_function)
867 AC_SUBST(aros_warnflags_unused_parameter)
868 AC_SUBST(aros_nowarnflags_unused_parameter)
869 AC_SUBST(aros_warnflags_uninitialized)
870 AC_SUBST(aros_nowarnflags_uninitialized)
871 AC_SUBST(aros_warnflags_maybe_uninitialized)
872 AC_SUBST(aros_nowarnflags_maybe_uninitialized)
873 AC_SUBST(aros_warnflags_implicit_function_declaration)
874 AC_SUBST(aros_nowarnflags_implicit_function_declaration)
875 AC_SUBST(aros_warnflags_format)
876 AC_SUBST(aros_nowarnflags_format)
877 AC_SUBST(aros_warnflags_parentheses)
878 AC_SUBST(aros_nowarnflags_parentheses)
879 AC_SUBST(aros_warnflags_char_subscripts)
880 AC_SUBST(aros_nowarnflags_char_subscripts)
881 AC_SUBST(aros_warnflags_endif_labels)
882 AC_SUBST(aros_nowarnflags_endif_labels)
883 AC_SUBST(aros_warnflags_format_contains_nul)
884 AC_SUBST(aros_nowarnflags_format_contains_nul)
885 AC_SUBST(aros_warnflags_implicit_int)
886 AC_SUBST(aros_nowarnflags_implicit_int)
887 AC_SUBST(aros_warnflags_aggressive_loop_optimizations)
888 AC_SUBST(aros_nowarnflags_aggressive_loop_optimizations)
889 AC_SUBST(aros_warnflags_cpp)
890 AC_SUBST(aros_nowarnflags_cpp)
891 AC_SUBST(aros_warnflags_switch)
892 AC_SUBST(aros_nowarnflags_switch)
893 AC_SUBST(aros_warnflags_discarded_qualifiers)
894 AC_SUBST(aros_nowarnflags_discarded_qualifiers)
895 AC_SUBST(aros_warnflags_sequence_point)
896 AC_SUBST(aros_nowarnflags_sequence_point)
897 AC_SUBST(aros_warnflags_unknown_pragmas)
898 AC_SUBST(aros_nowarnflags_unknown_pragmas)
899 AC_SUBST(aros_warnflags_discarded_array_qualifiers)
900 AC_SUBST(aros_nowarnflags_discarded_array_qualifiers)
901 AC_SUBST(aros_warnflags_int_conversion)
902 AC_SUBST(aros_nowarnflags_int_conversion)
903 AC_SUBST(aros_warnflags_int_to_pointer_cast)
904 AC_SUBST(aros_nowarnflags_int_to_pointer_cast)
905 AC_SUBST(aros_warnflags_pointer_to_int_cast)
906 AC_SUBST(aros_nowarnflags_pointer_to_int_cast)
907 AC_SUBST(aros_warnflags_unused_const_variable)
908 AC_SUBST(aros_nowarnflags_unused_const_variable)
909 AC_SUBST(aros_warnflags_write_strings)
910 AC_SUBST(aros_nowarnflags_write_strings)
911 AC_SUBST(aros_warnflags_comment)
912 AC_SUBST(aros_nowarnflags_comment)
913 AC_SUBST(aros_warnflags_incompatible_pointer_types)
914 AC_SUBST(aros_nowarnflags_incompatible_pointer_types)
915 AC_SUBST(aros_warnflags_bool_compare)
916 AC_SUBST(aros_nowarnflags_bool_compare)
917 AC_SUBST(aros_warnflags_logical_not_parentheses)
918 AC_SUBST(aros_nowarnflags_logical_not_parentheses)
919 AC_SUBST(aros_warnflags_pointer_sign)
920 AC_SUBST(aros_nowarnflags_pointer_sign)
921 AC_SUBST(aros_warnflags_shift_overflow)
922 AC_SUBST(aros_nowarnflags_shift_overflow)
923 AC_SUBST(aros_warnflags_frame_address)
924 AC_SUBST(aros_nowarnflags_frame_address)
925 AC_SUBST(aros_warnflags_deprecated_declarations)
926 AC_SUBST(aros_nowarnflags_deprecated_declarations)
927 AC_SUBST(aros_warnflags_sign_compare)
928 AC_SUBST(aros_nowarnflags_sign_compare)
929 AC_SUBST(aros_warnflags_attributes)
930 AC_SUBST(aros_nowarnflags_attributes)
931 AC_SUBST(aros_warnflags_overflow)
932 AC_SUBST(aros_nowarnflags_overflow)
933 AC_SUBST(aros_warnflags_unused_local_typedefs)
934 AC_SUBST(aros_nowarnflags_unused_local_typedefs)
935 AC_SUBST(aros_warnflags_missing_braces)
936 AC_SUBST(aros_nowarnflags_missing_braces)
937 AC_SUBST(aros_warnflags_conversion_null)
938 AC_SUBST(aros_nowarnflags_conversion_null)
939 AC_SUBST(aros_warnflags_narrowing)
940 AC_SUBST(aros_nowarnflags_narrowing)
941 AC_SUBST(aros_warnflags_volatile_register_var)
942 AC_SUBST(aros_nowarnflags_volatile_register_var)
943 AC_SUBST(aros_warnflags_sizeof_pointer_memaccess)
944 AC_SUBST(aros_nowarnflags_sizeof_pointer_memaccess)
945 AC_SUBST(aros_warnflags_return_type)
946 AC_SUBST(aros_nowarnflags_return_type)
947 AC_SUBST(aros_warnflags_format_zero_length)
948 AC_SUBST(aros_nowarnflags_format_zero_length)
949 AC_SUBST(aros_warnflags_lto_type_mismatch)
950 AC_SUBST(aros_nowarnflags_lto_type_mismatch)
951 AC_SUBST(aros_warnflags_tautological_compare)
952 AC_SUBST(aros_nowarnflags_tautological_compare)
953 AC_SUBST(aros_warnflags_empty_body)
954 AC_SUBST(aros_nowarnflags_empty_body)
957 ${aros_targetcfg_dir}/compiler.cfg:compiler.cfg.in