Red Hat Bugzilla – Bug 113852
mess with signbit function in octave source rpm
Last modified: 2007-11-30 17:07:00 EST
Description of problem:
There is some mess in octave package with signbit functon. At first,
EL3.0 have signbit function defined in math.h for __USE_ISOC99
compilation (by default any C++, but not C), but configure isnât able to
checking for copysign... yes
checking for signbit... no
checking for acosh... yes
The problem is that configure looks for signbit function body, but on
linux signbit is a macro, that uses internal __signbit function. So
configure assumes there is no signbit function and so lo_ieee_signbit
macro in lo-ieee.h becomes hardcoded 0, that is not pretty good.
Now letâs imagine configure would detect signbit properly. Another
problem with it that gccâs header <cmath> moves definition of signbit to
the std namespace, after including <cmath>, ::signbit is undefined
symbol, but std::signbit is a template function. Therefore in C++
sources that use <cmath> you must use std::signbit, not signbit. There
is such error in Cmatrix.cc, dMatrix.cc, pr-output.cc. Probably macro
lo_ieee_signbit should be changed to use std::signbit on systems with
gcc3.2 default compiler.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Build octave in usual way on Enterprise Linux 3.0 by gcc3.2
signbit isn't detected during configure and lo_ieee_signbit is hardcoded
When you'll fix the bug with signbit detection, you get the compile-time
error about undefined identifier "signbit"
octave with really working lo_ieee_signbit
Created attachment 101360 [details]
Include math.h in lo_ieee.h
This should fix the problem with respect to signbit being defined as 0. By
including math.h, signbit will be defined and lo_ieee_signbit() will thus be
defined to signbit().
Patch fails test.
Created attachment 101380 [details]
Include math.h and define _GNU_SOURCE to get signbit definition
This patch causes inclusion of math.h in lo-ieee.h if signbit and
HAVE_SIGNBIT/HAVE_COPYSIGN aren't defined, with _GNU_SOURCE defined so that
signbit gets defined on platforms which support the _GNU_SOURCE macro.
If signbit is not defined, the build stops. (This isn't necessary, nor
desirable, for upstream use, but can be useful to detect this problem in the
Typo. s/GUN/GNU/g in the patch.