Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use HAVE_C99_MATH instead of _WIN32_ and __ANSI__ #647

Merged
merged 1 commit into from
Nov 11, 2017

Conversation

kbevers
Copy link
Member

@kbevers kbevers commented Nov 7, 2017

HAVE_C99_MATH was recently added to the build system as a safer way to
determine if non-ansi math functions are available on the current
system. Previously different combinations of tests including _WIN32_ and
__ANSI__ have been in use, but cases where that strategy has failed is
known. Hence this change to a hopefully more robust check of math
function availability.

See also #547 and #555

@kbevers
Copy link
Member Author

kbevers commented Nov 9, 2017

@cffk just to be on the safe side, I am using this as intended, right?

@cffk
Copy link
Contributor

cffk commented Nov 9, 2017

cmake + autoconf set HAVE_C99_MATH to 0 or 1. So my preferred idiom is

Near the top...

#if !defined(HAVE_C99_MATH)
#define HAVE_C99_MATH 0
#endif

then

#if HAVE_C99_MATH
...
#endif

Alternatively

#if !(defined(HAVE_C99_MATH) && HAVE_C99_MATH)
...
#endif

Also, in general, you might need to check that hypot is one of the
functions tested in CMakeLists.txt + configure.ac. (It is!)

HAVE_C99_MATH was recently added to the build system as a safer way to
determine if non-ansi math functions are available on the current
system. Previously different combinations of tests including _WIN32_ and
__ANSI__ have been in use, but cases where that strategy has failed is
known. Hence this change to a hopefully more robust check of math
function availability.
@kbevers kbevers merged commit fecc6c7 into OSGeo:master Nov 11, 2017
@kbevers kbevers deleted the use_have_c99_math branch February 1, 2018 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants