From 93d76fd37627a3594f52afda32092fa3858f28dc Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Mon, 31 Jul 2023 05:05:43 +0800 Subject: Add a check and warning about signaling NaN support to 'configure.ac' Add a check of the '__SUPPORT_SNAN__' predefined macro and print a warning message if the compiler defines it. The warning is not printed with '--enable-debug' specified as we assume users know what they are doing. :) Signed-off-by: Kang-Che Sung --- configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 07c3ee85..c05f4d62 100644 --- a/configure.ac +++ b/configure.ac @@ -758,6 +758,22 @@ AC_ARG_ENABLE([debug], [enable_debug=no]) if test "x$enable_debug" != xyes; then AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG" + + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([[ +#ifdef __SUPPORT_SNAN__ +#error "signaling NaN support not recommended" +#endif + ]])], + :, + [warning_msg="signaling NaN support is enabled; not recommended for htop" + case "$CC" in + *gcc*) + warning_msg="$warning_msg (use '-fno-signaling-nans' compiler flag to disable)" + ;; + esac + AC_MSG_WARN([$warning_msg]) + ]) else AM_CPPFLAGS="$AM_CPPFLAGS -ggdb3" fi -- cgit v1.2.3