| 1.1 | 20-Jul-2023 |
lukem | tools/compat: provide nb_check_cc_flag.m4
Implement m4 macro NB_CHECK_CC_FLAG(FLAG, [VAR=FLAG_DERIVED]) Determine if the C compiler supports FLAG, and sets output variable VAR to FLAG if FLAG is supported.
If VAR is not provided, default to FLAG_DERIVED, which is FLAG converted to upper-case and all special characters replaced with "_", and the result prepended with "CC_". FLAG_DERIVED is appended to the m4 macro NB_CHECK_CC_FLAG_VARS. E.g., if FLAG is "-Wexample=yes", FLAG_DERIVED is "CC_WEXAMPLE_YES".
This is implemented in separate buildaux/nb_check_cc_flag.m4, based on configure's NB_CC_FLAG(), but supports VAR override.
Adapt configure from internal NB_CC_FLAG() to NB_CHECK_CC_FLAG().
(Note: AX_CHECK_COMPILE_FLAG() from autoconf-archive could be enhanced to support the clang and gcc workarounds I've implemented here.)
|