summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kokot <peterkokot@gmail.com>2019-04-21 00:21:14 +0200
committerPeter Kokot <peterkokot@gmail.com>2019-04-21 15:53:19 +0200
commitb1d3509e8c22f1ae12b6462e7732baddedde9bdd (patch)
tree126cbc1a049fbaeba3c339406b8171e64d86ec09
parent1c94aac89e0d7dfbd5efc15ec1862214b22603d1 (diff)
downloadphp-git-b1d3509e8c22f1ae12b6462e7732baddedde9bdd.tar.gz
Refactor Zend/acinclude.m4 local macro
There is now only a single M4 macro in the legacy acinclude.m4 file. A separate acinclude file was once used with a standalone Zend engine building but with current build system this can be simplified a bit.
-rw-r--r--Zend/Zend.m4114
-rw-r--r--Zend/acinclude.m4115
-rwxr-xr-xbuildconf2
-rw-r--r--configure.ac4
4 files changed, 115 insertions, 120 deletions
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4
index 0d10dbaae7..08f000dd2b 100644
--- a/Zend/Zend.m4
+++ b/Zend/Zend.m4
@@ -2,6 +2,120 @@ dnl
dnl This file contains Zend specific autoconf functions.
dnl
+dnl x87 floating point internal precision control checks
+dnl See: http://wiki.php.net/rfc/rounding
+AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
+ AC_MSG_CHECKING([for usable _FPU_SETCW])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <fpu_control.h>
+ ]],[[
+ fpu_control_t fpu_oldcw, fpu_cw;
+ volatile double result;
+ double a = 2877.0;
+ volatile double b = 1000000.0;
+
+ _FPU_GETCW(fpu_oldcw);
+ fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_SINGLE) | _FPU_DOUBLE;
+ _FPU_SETCW(fpu_cw);
+ result = a / b;
+ _FPU_SETCW(fpu_oldcw);
+ ]])],[ac_cfp_have__fpu_setcw=yes],[ac_cfp_have__fpu_setcw=no])
+ if test "$ac_cfp_have__fpu_setcw" = "yes" ; then
+ AC_DEFINE(HAVE__FPU_SETCW, 1, [whether _FPU_SETCW is present and usable])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ AC_MSG_CHECKING([for usable fpsetprec])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <machine/ieeefp.h>
+ ]],[[
+ fp_prec_t fpu_oldprec;
+ volatile double result;
+ double a = 2877.0;
+ volatile double b = 1000000.0;
+
+ fpu_oldprec = fpgetprec();
+ fpsetprec(FP_PD);
+ result = a / b;
+ fpsetprec(fpu_oldprec);
+ ]])], [ac_cfp_have_fpsetprec=yes], [ac_cfp_have_fpsetprec=no])
+ if test "$ac_cfp_have_fpsetprec" = "yes" ; then
+ AC_DEFINE(HAVE_FPSETPREC, 1, [whether fpsetprec is present and usable])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ AC_MSG_CHECKING([for usable _controlfp])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <float.h>
+ ]],[[
+ unsigned int fpu_oldcw;
+ volatile double result;
+ double a = 2877.0;
+ volatile double b = 1000000.0;
+
+ fpu_oldcw = _controlfp(0, 0);
+ _controlfp(_PC_53, _MCW_PC);
+ result = a / b;
+ _controlfp(fpu_oldcw, _MCW_PC);
+ ]])], [ac_cfp_have__controlfp=yes], [ac_cfp_have__controlfp=no])
+ if test "$ac_cfp_have__controlfp" = "yes" ; then
+ AC_DEFINE(HAVE__CONTROLFP, 1, [whether _controlfp is present usable])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ AC_MSG_CHECKING([for usable _controlfp_s])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <float.h>
+ ]],[[
+ unsigned int fpu_oldcw, fpu_cw;
+ volatile double result;
+ double a = 2877.0;
+ volatile double b = 1000000.0;
+
+ _controlfp_s(&fpu_cw, 0, 0);
+ fpu_oldcw = fpu_cw;
+ _controlfp_s(&fpu_cw, _PC_53, _MCW_PC);
+ result = a / b;
+ _controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
+ ]])], [ac_cfp_have__controlfp_s=yes], [ac_cfp_have__controlfp_s=no])
+ if test "$ac_cfp_have__controlfp_s" = "yes" ; then
+ AC_DEFINE(HAVE__CONTROLFP_S, 1, [whether _controlfp_s is present and usable])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ AC_MSG_CHECKING([whether FPU control word can be manipulated by inline assembler])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ /* nothing */
+ ]],[[
+ unsigned int oldcw, cw;
+ volatile double result;
+ double a = 2877.0;
+ volatile double b = 1000000.0;
+
+ __asm__ __volatile__ ("fnstcw %0" : "=m" (*&oldcw));
+ cw = (oldcw & ~0x0 & ~0x300) | 0x200;
+ __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw));
+
+ result = a / b;
+
+ __asm__ __volatile__ ("fldcw %0" : : "m" (*&oldcw));
+ ]])], [ac_cfp_have_fpu_inline_asm_x86=yes], [ac_cfp_have_fpu_inline_asm_x86=no])
+ if test "$ac_cfp_have_fpu_inline_asm_x86" = "yes" ; then
+ AC_DEFINE(HAVE_FPU_INLINE_ASM_X86, 1, [whether FPU control word can be manipulated by inline assembler])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+])
+
AC_DEFUN([LIBZEND_BASIC_CHECKS],[
AC_REQUIRE([AC_PROG_CC])
diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4
deleted file mode 100644
index a2930b62cd..0000000000
--- a/Zend/acinclude.m4
+++ /dev/null
@@ -1,115 +0,0 @@
-dnl This file contains local autoconf functions.
-
-dnl x87 floating point internal precision control checks
-dnl See: http://wiki.php.net/rfc/rounding
-AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
- AC_MSG_CHECKING([for usable _FPU_SETCW])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #include <fpu_control.h>
- ]],[[
- fpu_control_t fpu_oldcw, fpu_cw;
- volatile double result;
- double a = 2877.0;
- volatile double b = 1000000.0;
-
- _FPU_GETCW(fpu_oldcw);
- fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_SINGLE) | _FPU_DOUBLE;
- _FPU_SETCW(fpu_cw);
- result = a / b;
- _FPU_SETCW(fpu_oldcw);
- ]])],[ac_cfp_have__fpu_setcw=yes],[ac_cfp_have__fpu_setcw=no])
- if test "$ac_cfp_have__fpu_setcw" = "yes" ; then
- AC_DEFINE(HAVE__FPU_SETCW, 1, [whether _FPU_SETCW is present and usable])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-
- AC_MSG_CHECKING([for usable fpsetprec])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #include <machine/ieeefp.h>
- ]],[[
- fp_prec_t fpu_oldprec;
- volatile double result;
- double a = 2877.0;
- volatile double b = 1000000.0;
-
- fpu_oldprec = fpgetprec();
- fpsetprec(FP_PD);
- result = a / b;
- fpsetprec(fpu_oldprec);
- ]])], [ac_cfp_have_fpsetprec=yes], [ac_cfp_have_fpsetprec=no])
- if test "$ac_cfp_have_fpsetprec" = "yes" ; then
- AC_DEFINE(HAVE_FPSETPREC, 1, [whether fpsetprec is present and usable])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-
- AC_MSG_CHECKING([for usable _controlfp])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #include <float.h>
- ]],[[
- unsigned int fpu_oldcw;
- volatile double result;
- double a = 2877.0;
- volatile double b = 1000000.0;
-
- fpu_oldcw = _controlfp(0, 0);
- _controlfp(_PC_53, _MCW_PC);
- result = a / b;
- _controlfp(fpu_oldcw, _MCW_PC);
- ]])], [ac_cfp_have__controlfp=yes], [ac_cfp_have__controlfp=no])
- if test "$ac_cfp_have__controlfp" = "yes" ; then
- AC_DEFINE(HAVE__CONTROLFP, 1, [whether _controlfp is present usable])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-
- AC_MSG_CHECKING([for usable _controlfp_s])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #include <float.h>
- ]],[[
- unsigned int fpu_oldcw, fpu_cw;
- volatile double result;
- double a = 2877.0;
- volatile double b = 1000000.0;
-
- _controlfp_s(&fpu_cw, 0, 0);
- fpu_oldcw = fpu_cw;
- _controlfp_s(&fpu_cw, _PC_53, _MCW_PC);
- result = a / b;
- _controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
- ]])], [ac_cfp_have__controlfp_s=yes], [ac_cfp_have__controlfp_s=no])
- if test "$ac_cfp_have__controlfp_s" = "yes" ; then
- AC_DEFINE(HAVE__CONTROLFP_S, 1, [whether _controlfp_s is present and usable])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-
- AC_MSG_CHECKING([whether FPU control word can be manipulated by inline assembler])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- /* nothing */
- ]],[[
- unsigned int oldcw, cw;
- volatile double result;
- double a = 2877.0;
- volatile double b = 1000000.0;
-
- __asm__ __volatile__ ("fnstcw %0" : "=m" (*&oldcw));
- cw = (oldcw & ~0x0 & ~0x300) | 0x200;
- __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw));
-
- result = a / b;
-
- __asm__ __volatile__ ("fldcw %0" : : "m" (*&oldcw));
- ]])], [ac_cfp_have_fpu_inline_asm_x86=yes], [ac_cfp_have_fpu_inline_asm_x86=no])
- if test "$ac_cfp_have_fpu_inline_asm_x86" = "yes" ; then
- AC_DEFINE(HAVE_FPU_INLINE_ASM_X86, 1, [whether FPU control word can be manipulated by inline assembler])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-])
diff --git a/buildconf b/buildconf
index 7d3aaedc6b..6e644df4b8 100755
--- a/buildconf
+++ b/buildconf
@@ -103,4 +103,4 @@ $MAKE -s -f build/build.mk \
PHP_AUTOCONF="$PHP_AUTOCONF" \
PHP_AUTOHEADER="$PHP_AUTOHEADER" \
PHP_AUTOCONF_FLAGS="$autoconf_flags" \
- PHP_M4_FILES="$(echo TSRM/*.m4 Zend/*.m4 ext/*/config*.m4 sapi/*/config*.m4)"
+ PHP_M4_FILES="$(echo TSRM/*.m4 Zend/Zend.m4 ext/*/config*.m4 sapi/*/config*.m4)"
diff --git a/configure.ac b/configure.ac
index 293c5fc33f..ec3f28c768 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,9 +1,5 @@
dnl ## Process this file with autoconf to produce a configure script.
-dnl include Zend specific macro definitions first
-dnl -------------------------------------------------------------------------
-sinclude(Zend/acinclude.m4)
-
dnl Basic autoconf initialization, generation of config.nice.
dnl -------------------------------------------------------------------------