Skip to content

Commit

Permalink
Add a check and warning about signaling NaN support to 'configure.ac'
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Explorer09 authored and BenBE committed Aug 18, 2023
1 parent b416433 commit 93d76fd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 93d76fd

Please sign in to comment.