changed some problems with math.h inside the configure script

origin
stpohle 18 years ago
parent d422192969
commit 6970ccfa1b

@ -120,74 +120,105 @@ else
fi fi
dnl Checks for library functions. dnl Checks for library functions.
dnl Check for rintf and functions like that dnl Check for rintf and functions like that
AC_MSG_CHECKING(for rintf) AC_MSG_CHECKING(for rintf)
have_rintf=no have_rintf=no
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <math.h>
],[ ],[
int i; float f; i = rintf (f); int i; float f; i = rintf (f);
],[ ],[
have_rintf=yes have_rintf=yes
]) ])
AC_MSG_RESULT($have_rintf) AC_MSG_RESULT($have_rintf)
if test x$have_rintf = xyes; then if test x$have_rintf = xno; then
AC_CHECK_LIB(m, rintf, have_rintf=yes, have_rintf=no , ) AC_CHECK_LIB(m, rintf, have_rintf=yes, have_rintf=no , )
fi
if test x$have_rintf = xyes; then if test x$have_rintf = xyes; then
AC_DEFINE(HAVE_RINTF, [1], [if rintf is working here]) AC_DEFINE(HAVE_RINTF, [1], [if rintf is working here])
fi fi
fi
dnl Checks for library functions.
dnl Check for rintf and functions like that dnl Check for rintf and functions like that
AC_MSG_CHECKING(for rint) AC_MSG_CHECKING(for rint)
have_rint=no have_rint=no
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <math.h>
],[ ],[
int i; double f; i = rint (f); int i; double f; i = rint (f);
],[ ],[
have_rint=yes have_rint=yes
]) ])
AC_MSG_RESULT($have_rint) AC_MSG_RESULT($have_rint)
if test x$have_rint = xyes; then if test x$have_rint = xno; then
AC_CHECK_LIB(m, rint, have_rint=yes, have_rint=no , ) AC_CHECK_LIB(m, rint, have_rint=yes, have_rint=no , )
fi
if test x$have_rint = xyes; then if test x$have_rint = xyes; then
AC_DEFINE(HAVE_RINT, [1], [if rint is working here]) AC_DEFINE(HAVE_RINT, [1], [if rint is working here])
fi fi
dnl Check for powf and functions like that
AC_MSG_CHECKING(for powf)
have_powf=no
AC_TRY_COMPILE([
#include <math.h>
],[
float i; float f = 2; float j = 2; i = powf (f,j);
],[
have_powf=yes
])
AC_MSG_RESULT($have_powf)
if test x$have_powf = xno; then
AC_CHECK_LIB(m, powf, have_powf=yes, have_powf=no , )
fi fi
dnl Check for floorf and functions like that if test x$have_powf = xyes; then
AC_MSG_CHECKING(for floorf) AC_DEFINE(HAVE_POWF, [1], [if powf is working here])
have_floorf=no fi
dnl Check for sqrtf and functions like that
AC_MSG_CHECKING(for sqrtf)
have_sqrtf=no
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <math.h>
],[ ],[
int i; float f; i = floorf (f); float i; float f = 2; i = sqrtf (f);
],[ ],[
have_floorf=yes have_sqrtf=yes
]) ])
AC_MSG_RESULT($have_floorf) AC_MSG_RESULT($have_sqrtf)
if test x$have_floorf = xyes; then if test x$have_sqrtf = xno; then
AC_CHECK_LIB(m, floorf, have_floorf=yes, have_floorf=no , ) AC_CHECK_LIB(m, sqrtf, have_sqrtf=yes, have_sqrtf=no , )
if test x$have_floorf = xyes; then
AC_DEFINE(HAVE_FLOORF, [1], [if floorf is working here])
fi fi
if test x$have_sqrtf = xyes; then
AC_DEFINE(HAVE_SQRTF, [1], [if sqrtf is working here])
fi fi
dnl Check for floorf and functions like that dnl Check for floorf and functions like that
AC_MSG_CHECKING(for floor) AC_MSG_CHECKING(for floorf)
have_floor=no have_floorf=no
AC_TRY_COMPILE([ AC_TRY_COMPILE([
#include <math.h>
],[ ],[
int i; double f; i = floor (f); int i; float f; i = floorf (f);
],[ ],[
have_floor=yes have_floorf=yes
]) ])
AC_MSG_RESULT($have_floor) AC_MSG_RESULT($have_floorf)
if test x$have_floor = xyes; then if test x$have_floorf = xno; then
AC_CHECK_LIB(m, floor, have_floor=yes, have_floor=no , ) AC_CHECK_LIB(m, floorf, have_floorf=yes, have_floorf=no , )
if test x$have_floor = xyes; then
AC_DEFINE(HAVE_FLOOR, [1], [if floor is working here])
fi fi
if test x$have_floorf = xyes; then
AC_DEFINE(HAVE_FLOORF, [1], [if floorf is working here])
fi fi

@ -1,4 +1,4 @@
/* $Id: sysfunc.h,v 1.8 2006/08/08 19:49:39 stpohle Exp $ */ /* $Id: sysfunc.h,v 1.9 2007/12/09 22:13:03 stpohle Exp $ */
/* include some system near functions */ /* include some system near functions */
#ifndef _SYSFUNC_H_ #ifndef _SYSFUNC_H_
@ -6,6 +6,8 @@
#define MAX_DIRENTRYS 1024 #define MAX_DIRENTRYS 1024
#include <math.h>
enum _dirflags { enum _dirflags {
DF_dir = 1, DF_dir = 1,
DF_file = 2 DF_file = 2
@ -38,6 +40,14 @@ extern inline Sint32 s_swap32 (Sint32 i);
extern _direntry *s_getdir (char *path); extern _direntry *s_getdir (char *path);
extern _direntry *s_dirfilter (_direntry *dirstart, signed char dirflags); extern _direntry *s_dirfilter (_direntry *dirstart, signed char dirflags);
#ifndef HAVE_POWF
#define powf(__x,__y) ((float)pow((double)__x,(double)__y))
#endif
#ifndef HAVE_SQRTF
#define sqrtf(__x) ((float)sqrt((double)__x))
#endif
#ifndef HAVE_RINTF #ifndef HAVE_RINTF
#ifndef HAVE_RINT #ifndef HAVE_RINT
extern inline float rintf (float f); extern inline float rintf (float f);
@ -47,12 +57,8 @@ extern _direntry *s_dirfilter (_direntry *dirstart, signed char dirflags);
#endif #endif
#ifndef HAVE_FLOORF #ifndef HAVE_FLOORF
#ifndef HAVE_FLOOR
#define floorf(__x) ((float)((int)__x))
#else
#define floorf(__x) ((float)floor((double)__x)) #define floorf(__x) ((float)floor((double)__x))
#endif #endif
#endif
/* /*
* somehow this works.. * somehow this works..

@ -51,7 +51,7 @@ bomberclone_LDADD = bc-res.o
bc-res.o: bc-res.rc bc-res.o: bc-res.rc
ln -s ../data/pixmaps/bomberclone.ico ./ ln -sf ../data/pixmaps/bomberclone.ico ./
windres -i bc-res.rc -o bc-res.o windres -i bc-res.rc -o bc-res.o
rm bomberclone.ico rm bomberclone.ico
endif endif

@ -1,4 +1,4 @@
/* $Id: sysfunc.c,v 1.25 2005/08/07 17:46:22 stpohle Exp $ /* $Id: sysfunc.c,v 1.26 2007/12/09 22:13:03 stpohle Exp $
sysfunc.c - this file hold some routines for the system functions.. sysfunc.c - this file hold some routines for the system functions..
like d_delay like d_delay
*/ */
@ -52,6 +52,18 @@ s_random (int maxnr)
#endif #endif
}; };
#if !defined(HAVE_RINTF) && !defined(HAVE_RINT)
inline float rintf (float f) {
if (CUTINT (f) < 0.5f)
return (floorf (f));
else
return (floorf (f + 1.0f));
};
#endif
static char homedir[255]; static char homedir[255];
char * char *
@ -233,15 +245,6 @@ inline Sint32 s_swap32 (Sint32 i) {
return r; return r;
}; };
#if !defined(HAVE_RINTF) && !defined(HAVE_RINT)
inline float rintf (float f) {
if (CUTINT (f) < 0.5f)
return (floorf (f));
else
return (floorf (f + 1.0f));
};
#endif
extern Uint32 game_timediff, game_timediff1; extern Uint32 game_timediff, game_timediff1;
@ -329,3 +332,6 @@ float absol(float f) {
if (f<0) f*=-1; if (f<0) f*=-1;
return f; return f;
} }

Loading…
Cancel
Save