]> granicus.if.org Git - php/commitdiff
check for fabsf and floorf in config.m4
authorMarcus Boerger <helly@php.net>
Mon, 12 Aug 2002 13:59:01 +0000 (13:59 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 12 Aug 2002 13:59:01 +0000 (13:59 +0000)
msvc.6 needs a define, msvc.net needs special treatment

ext/gd/config.m4
ext/gd/libgd/gd.c

index 87d92a05fcbfad75241ae772dac3d58707904117..3c9c5ce9cfb9914d1ddb7b30e35096aa1710ce9d 100644 (file)
@@ -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
       
index fd36cb382c92e42b9de7171771cfc57078e6a4b8..6210a8bcaa7beb4c766174ace4af616f5cab4357 100644 (file)
@@ -2,25 +2,42 @@
 #include <math.h>
 #include <string.h>
 #include <stdlib.h>
-#include <zlib.h>
 #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