From: Marcus Boerger Date: Mon, 12 Aug 2002 13:59:01 +0000 (+0000) Subject: check for fabsf and floorf in config.m4 X-Git-Tag: php-4.3.0dev_zend2_alpha3~125 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2df2e24a54472b099d228cd3a846b2c59bd8920e;p=php check for fabsf and floorf in config.m4 msvc.6 needs a define, msvc.net needs special treatment --- diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index 87d92a05fc..3c9c5ce9cf 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -240,6 +240,9 @@ if test "$PHP_GD" = "php"; then PHP_NEW_EXTENSION(gd, gd.c gdttf.c $sources, $ext_shared,, \\$(GDLIB_CFLAGS)) PHP_ADD_BUILD_DIR($ext_builddir/libgd) +dnl check for fabsf and floorf which are available since C99 + AC_CHECK_FUNCS(fabsf floorf) + dnl PNG is required by GD library test "$PHP_PNG_DIR" = "no" && PHP_PNG_DIR=yes diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index fd36cb382c..6210a8bcaa 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -2,25 +2,42 @@ #include #include #include -#include #include "gd.h" #include "gdhelpers.h" -#ifdef _OSD_POSIX /* BS2000 uses the EBCDIC char set instead of ASCII */ -#define CHARSET_EBCDIC -#define __attribute__(any) /*nothing */ -#endif -/*_OSD_POSIX*/ +#include "php_config.h" #ifdef _MSC_VER -#if _MSC_VER < 1300 -/* following functions are available since MSVC.NET, emulate for earlier versions */ +# if _MSC_VER >= 1300 +/* in MSVC.NET the these are available but only for __cplusplus and not _MSC_EXTENSIONS */ +# ifdef _MSC_EXTENSIONS +# define HAVE_FABSF 1 +extern float fabsf(float x); +# define HAVE_FLOORF 1 +extern float floorf(float x); +# endif /*MSVC.NET */ +# endif /* MSC */ +#endif +#ifndef HAVE_FABSF +# define HAVE_FABSF 0 +#endif +#ifndef HAVE_FLOORF +# define HAVE_FLOORF 0 +#endif +#if HAVE_FABSF == 0 /* float fabsf(float x); */ -#define fabsf(x) ((float)(abs(x))) +# define fabsf(x) ((float)(abs(x))) +#endif +#if HAVE_FLOORF == 0 /* float floorf(float x);*/ #define floorf(x) ((float)(floor(x))) #endif + +#ifdef _OSD_POSIX /* BS2000 uses the EBCDIC char set instead of ASCII */ +#define CHARSET_EBCDIC +#define __attribute__(any) /*nothing */ #endif +/*_OSD_POSIX*/ #ifndef CHARSET_EBCDIC #define ASC(ch) ch