[MPlayer-dev-eng] libvo/gtf.c error: static declaration of 'round' follows non-static declaration
Steven M. Schultz
sms at 2BSD.COM
Mon May 9 04:39:35 CEST 2005
Hi -
It's going slow but MPlayer is getting closer to building on OS/X 10.4
round() is defined in <math.h> so the static version in libvo/gtf.c
triggers the error:
gmake -C libvo
cc -c -I../libvo -I../../libvo -I/usr/X11R6/include -O4 -faltivec -pipe -ffast-math -fomit-frame-pointer -mdynamic-no-pic -falign-loops=16 -DSYS_DARWIN -DCONFIG_DARWIN -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I. -I.. -I../osdep -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/local/include/SDL -D_THREAD_SAFE -I/usr/X11R6/include -DMPG12PLAY -o gtf.o gtf.c
gtf.c:28: error: static declaration of 'round' follows non-static declaration
gmake[1]: *** [gtf.o] Error 1
gmake: *** [libvo/libvo.a] Error 2
The attached patch adds a check to ./configure for round() and
if round() is found adds 'HAVE_ROUND' to config.h (this is the same
logic used for lrintf). Then in libvo/gtf.c a "#include config.h"
is added and the new HAVE_ROUND used appropriately.
Cheers,
Steven Schultz
-------------- next part --------------
--- configure.dist 2005-05-07 22:00:39.000000000 -0700
+++ configure 2005-05-08 18:57:27.000000000 -0700
@@ -2404,6 +2404,19 @@
fi
echores "$_lrintf"
+echocheck "round"
+cat > $TMPC << EOF
+#include <math.h>
+int main(void) { (void) round(0.0); return 0; }
+EOF
+_round=no
+cc_check $_ld_lm && _round=yes
+if test "$_round" = yes ; then
+ _def_round="#define HAVE_ROUND 1"
+else
+ _def_round="#undef HAVE_ROUND"
+fi
+echores "$_round"
echocheck "nanosleep"
# also check for nanosleep
@@ -7396,6 +7409,9 @@
/* C99 lrintf function available */
$_def_lrintf
+/* round function available in -lm */
+$_def_round
+
/* yes, we have inttypes.h */
#define HAVE_INTTYPES_H 1
--- libvo/gtf.c.dist 2002-08-22 16:03:50.000000000 -0700
+++ libvo/gtf.c 2005-05-08 19:13:12.000000000 -0700
@@ -9,6 +9,7 @@
*/
//Version 0.4
+#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -24,10 +25,12 @@
static GTF_constants GTF_given_constants = { 3.0,550.0,1,8,1.8,8,40,20,128,600 };
+#ifndef HAVE_ROUND
static double round(double v)
{
return floor(v + 0.5);
}
+#endif
static void GetRoundedConstants(GTF_constants *c)
{
More information about the MPlayer-dev-eng
mailing list