[Ffmpeg-devel] roundf on solaris
Niki Waibel
niki.waibel
Wed Nov 9 16:36:16 CET 2005
On 09-Nov-2005 Benjamin Larsson wrote:
> Hi,
>
> Niki Waibel wrote:
>
>>there is a problem when compiling ffmpeg on solaris.
>>solaris up to (incl) 9 does NOT have:
>> roundf()
>>
>>i work around that issue by using:
>> echo "#define roundf(a) ((fmod(a,1)<0.5)?floor(a):ceil(a))" >> config.h
>>after i've run configure.
>>
>>could you include a test in configure for roundf()?
>>
>>niki
>>
>>
> please send a patch.
it is pretty hard to support a non-std-autoconf configure script.
i do is the following (after configure):
if test "x`uname -s`" = "xSunOS"
then
echo "#define roundf(a) ((fmod(a,1)<0.5)?floor(a):ceil(a))" \
>> config.h # SunOS (there is no roundf())
fi
but that might be wrong on the next versions of solaris...
so a clean test if roundf() is available is necessary.
it seems that gcc implements roundf() internally somehow.
compiling
===
#define _ISOC9X_SOURCE 1
#include <stdio.h>
#include <math.h>
int main( void ) {
printf("%f\n", roundf(-3.5f));
return(0);
}
===
using
gcc -std=c89 -Wall -o c c.c
warning: implicit declaration of function 'roundf'
warning: format '%f' expects type 'double', but argument 2 has type 'int'
/var/tmp//ccQolXHT.o: In function `main':
c.c:(.text+0x18): undefined reference to `roundf'
collect2: ld returned 1 exit status
fails. using
gcc -std=c99 -Wall -o c c.c
warning: implicit declaration of function 'roundf'
warning: incompatible implicit declaration of built-in function 'roundf'
is (almost) ok.
More information about the ffmpeg-devel
mailing list