fix for windows, because floorf and rintf didn't work there

origin
stpohle 22 years ago
parent 3cc3492d51
commit e8fe2d48cc

@ -42,14 +42,11 @@ dnl Checks for typedefs, structures, and compiler characteristics.
case "$target" in case "$target" in
*cygwin* | *mingw32* | *mingw32msvc* ) *cygwin* | *mingw32* | *mingw32msvc* )
CFLAGS="$CFLAGS" CFLAGS="$CFLAGS"
LIBS="$LIBS -liberty -lwsock32" LIBS="$LIBS -liberty -lwsock32 -lm"
MATHLIB=""
SYS_GL_LIBS="-lopengl32 -lglu32"
;; ;;
*solaris* ) *solaris* )
CFLAGS="$CFLAGS" CFLAGS="$CFLAGS"
LIBS="$LIBS -lsocket -lnsl -lm" LIBS="$LIBS -lsocket -lnsl -lm"
MATHLIB="-lm"
AC_PATH_X AC_PATH_X
AC_PATH_XTRA AC_PATH_XTRA
if test x$have_x = xyes; then if test x$have_x = xyes; then
@ -60,49 +57,16 @@ case "$target" in
fi fi
;; ;;
*) *)
MATHLIB="-lm"
AC_PATH_X AC_PATH_X
AC_PATH_XTRA AC_PATH_XTRA
if test x$have_x = xyes; then if test x$have_x = xyes; then
CFLAGS="$CFLAGS $X_CFLAGS" CFLAGS="$CFLAGS $X_CFLAGS"
SYS_GL_LIBS="$X_LIBS -lGL -lGLU"
else
SYS_GL_LIBS="-lGL -lGLU"
fi fi
;; ;;
esac esac
CFLAGS="$CFLAGS -Wall" CFLAGS="$CFLAGS -Wall"
AC_SUBST(MATHLIB)
dnl Check for OpenGL ***********************+
dnl AC_MSG_CHECKING(for OpenGL support)
dnl have_opengl=no
dnl AC_TRY_COMPILE([
dnl #if defined(__APPLE__) && defined(__MACH__)
dnl #include <OpenGL/gl.h>
dnl #include <OpenGL/glu.h>
dnl #else
dnl #include <GL/gl.h>
dnl #include <GL/glu.h>
dnl #endif
dnl ],[
dnl ],[
dnl have_opengl=yes
dnl ])
dnl AC_MSG_RESULT($have_opengl)
dnl if test x$have_opengl = xyes; then
dnl CFLAGS="$CFLAGS"
dnl LIBS="$LIBS $SYS_GL_LIBS"
dnl AC_DEFINE(HAVE_OPENGL, [1], [OpenGL Headers found])
dnl else
dnl AC_MSG_WARN(Unable to find OpenGL headers and libraries)
dnl fi
dnl SDL_mixer ********************************** dnl SDL_mixer **********************************
AC_ARG_WITH(sdlmixer-prefix, [ --with-sdlmixer-prefix=PFX prefix where SDL_mixer library is installed], sdlmixer_prefix="$withval", sdlmixer_prefix="") AC_ARG_WITH(sdlmixer-prefix, [ --with-sdlmixer-prefix=PFX prefix where SDL_mixer library is installed], sdlmixer_prefix="$withval", sdlmixer_prefix="")
@ -126,6 +90,74 @@ fi
dnl Checks for library functions. dnl Checks for library functions.
dnl Check for rintf and functions like that
AC_MSG_CHECKING(for rintf)
have_rintf=no
AC_TRY_COMPILE([
],[
int i; float f; i = rintf (f);
],[
have_rintf=yes
])
AC_MSG_RESULT($have_rintf)
if test x$have_rintf = xyes; then
AC_CHECK_LIB(m, rintf, have_rintf=yes, have_rintf=no , )
if test x$have_rintf = xyes; then
AC_DEFINE(HAVE_RINTF, [1], [if rintf is working here])
fi
fi
dnl Check for rintf and functions like that
AC_MSG_CHECKING(for rint)
have_rint=no
AC_TRY_COMPILE([
],[
int i; double f; i = rint (f);
],[
have_rint=yes
])
AC_MSG_RESULT($have_rint)
if test x$have_rint = xyes; then
AC_CHECK_LIB(m, rint, have_rint=yes, have_rint=no , )
if test x$have_rint = xyes; then
AC_DEFINE(HAVE_RINT, [1], [if rint is working here])
fi
fi
dnl Check for floorf and functions like that
AC_MSG_CHECKING(for floorf)
have_floorf=no
AC_TRY_COMPILE([
],[
int i; float f; i = floorf (f);
],[
have_floorf=yes
])
AC_MSG_RESULT($have_floorf)
if test x$have_floorf = xyes; 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
fi
dnl Checks for Additional stuffs. dnl Checks for Additional stuffs.

@ -1,4 +1,4 @@
/* $Id: sysfunc.h,v 1.3 2003/09/23 20:28:24 stpohle Exp $ */ /* $Id: sysfunc.h,v 1.4 2003/11/09 16:35:10 stpohle Exp $ */
/* include some system near functions */ /* include some system near functions */
#ifndef _SYSFUNC_H_ #ifndef _SYSFUNC_H_
@ -29,4 +29,20 @@ 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_RINTF
#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
#endif
#endif #endif

@ -1,4 +1,4 @@
/* $Id: sysfunc.c,v 1.19 2003/09/11 19:44:32 stpohle Exp $ /* $Id: sysfunc.c,v 1.20 2003/11/09 16:35:10 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
*/ */
@ -222,3 +222,12 @@ 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

Loading…
Cancel
Save