diff --git a/configure.in b/configure.in index f783ed1..1ca159a 100644 --- a/configure.in +++ b/configure.in @@ -47,8 +47,8 @@ case "$target" in MINGW32=yes ;; *solaris* ) - CFLAGS="$CFLAGS" - LIBS="$LIBS -lsocket -lnsl -lm" + CFLAGS="$CFLAGS" + LIBS="$LIBS -lsocket -lnsl -lm" AC_PATH_X AC_PATH_XTRA if test x$have_x = xyes; then @@ -120,74 +120,105 @@ else fi + dnl Checks for library functions. dnl Check for rintf and functions like that AC_MSG_CHECKING(for rintf) have_rintf=no AC_TRY_COMPILE([ +#include ],[ int i; float f; i = rintf (f); ],[ have_rintf=yes ]) 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 , ) - if test x$have_rintf = xyes; then +fi + +if test x$have_rintf = xyes; then AC_DEFINE(HAVE_RINTF, [1], [if rintf is working here]) - fi fi +dnl Checks for library functions. dnl Check for rintf and functions like that AC_MSG_CHECKING(for rint) have_rint=no AC_TRY_COMPILE([ +#include ],[ int i; double f; i = rint (f); ],[ have_rint=yes ]) 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 , ) - if test x$have_rint = xyes; then +fi + +if test x$have_rint = xyes; then 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 +],[ +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 + +if test x$have_powf = xyes; then + AC_DEFINE(HAVE_POWF, [1], [if powf is working here]) +fi + +dnl Check for sqrtf and functions like that +AC_MSG_CHECKING(for sqrtf) +have_sqrtf=no +AC_TRY_COMPILE([ +#include +],[ +float i; float f = 2; i = sqrtf (f); +],[ +have_sqrtf=yes +]) +AC_MSG_RESULT($have_sqrtf) +if test x$have_sqrtf = xno; then + AC_CHECK_LIB(m, sqrtf, have_sqrtf=yes, have_sqrtf=no , ) +fi + +if test x$have_sqrtf = xyes; then + AC_DEFINE(HAVE_SQRTF, [1], [if sqrtf is working here]) +fi + + dnl Check for floorf and functions like that AC_MSG_CHECKING(for floorf) have_floorf=no AC_TRY_COMPILE([ +#include ],[ int i; float f; i = floorf (f); ],[ have_floorf=yes ]) AC_MSG_RESULT($have_floorf) -if test x$have_floorf = xyes; then +if test x$have_floorf = xno; then AC_CHECK_LIB(m, floorf, have_floorf=yes, have_floorf=no , ) - if test x$have_floorf = xyes; then - AC_DEFINE(HAVE_FLOORF, [1], [if floorf is working here]) - fi fi - -dnl Check for floorf and functions like that -AC_MSG_CHECKING(for floor) -have_floor=no -AC_TRY_COMPILE([ -],[ -int i; double f; i = floor (f); -],[ -have_floor=yes -]) -AC_MSG_RESULT($have_floor) -if test x$have_floor = xyes; then - AC_CHECK_LIB(m, floor, have_floor=yes, have_floor=no , ) - if test x$have_floor = xyes; then - AC_DEFINE(HAVE_FLOOR, [1], [if floor is working here]) - fi +if test x$have_floorf = xyes; then + AC_DEFINE(HAVE_FLOORF, [1], [if floorf is working here]) fi diff --git a/include/sysfunc.h b/include/sysfunc.h index 145b093..a502764 100644 --- a/include/sysfunc.h +++ b/include/sysfunc.h @@ -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 */ #ifndef _SYSFUNC_H_ @@ -6,6 +6,8 @@ #define MAX_DIRENTRYS 1024 +#include + enum _dirflags { DF_dir = 1, DF_file = 2 @@ -38,20 +40,24 @@ extern inline Sint32 s_swap32 (Sint32 i); extern _direntry *s_getdir (char *path); 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_RINT - extern inline float rintf (float f); - #else - #define rintf(__x) ((float)rint(double)__x) - #endif + #ifndef HAVE_RINT + extern inline float rintf (float f); + #else + #define rintf(__x) ((float)rint(double)__x) + #endif #endif #ifndef HAVE_FLOORF - #ifndef HAVE_FLOOR - #define floorf(__x) ((float)((int)__x)) - #else - #define floorf(__x) ((float)floor((double)__x)) - #endif + #define floorf(__x) ((float)floor((double)__x)) #endif /* diff --git a/src/Makefile.am b/src/Makefile.am index 1ef7bab..02341cd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -51,7 +51,7 @@ bomberclone_LDADD = bc-res.o 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 rm bomberclone.ico endif diff --git a/src/sysfunc.c b/src/sysfunc.c index f497158..24f3700 100644 --- a/src/sysfunc.c +++ b/src/sysfunc.c @@ -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.. like d_delay */ @@ -52,6 +52,18 @@ s_random (int maxnr) #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]; char * @@ -233,15 +245,6 @@ inline Sint32 s_swap32 (Sint32 i) { 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; @@ -329,3 +332,6 @@ float absol(float f) { if (f<0) f*=-1; return f; } + + +