isnan() and isinf() checks

Alexander Neundorf neundorf at kde.org
Thu Apr 12 18:26:06 BST 2007


On Thursday 12 April 2007 01:31, Hasso Tepper wrote:
> The C99 standard says that isinf and isnan are macros, but reality is
> more complex. These might be functions in some systems (glibc has even
> both!) and might require -lm. At the moment we only check whether
> function exists and in the trunk we don't use -lm for check either.
>
> Attached are patches to fix the problem for both KDE3 and KDE4. As a
> side effect it also fixes detecting (_)finite in KDE4 for platforms
> where it requires -lm.

Using "-lm" is no good idea, as Christian already stated.

Please take a look at kdelibs/cmake/modules/MacroPushRequiredVars.cmake, it 
offers two macros:

# Usage:
# MACRO_PUSH_REQUIRED_VARS()
# SET(CMAKE_REQUIRED_DEFINITIONS
      ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
# CHECK_FUNCTION_EXISTS(...)
# MACRO_POP_REQUIRED_VARS()

> Patches are tested on Linux and DragonFlyBSD. If noone objects, I will
> commit tomorrow.

Can you please check whether check_symbol_exists() (from  
Modules/CheckSymbolExists.cmake) does what you need instead of using 
check_c_source_compiles() directly ?

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net




More information about the kde-core-devel mailing list