File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / acinclude.m4
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:36 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_17p0, HEAD
php 5.4.3+patches

    1: dnl $Id: acinclude.m4,v 1.1.1.2 2012/05/29 12:34:36 misho Exp $
    2: dnl
    3: dnl This file contains local autoconf functions.
    4: 
    5: AC_DEFUN([LIBZEND_BISON_CHECK],[
    6:   # we only support certain bison versions
    7:   bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5"
    8: 
    9:   # for standalone build of Zend Engine
   10:   test -z "$SED" && SED=sed
   11: 
   12:   bison_version=none
   13:   if test "$YACC"; then
   14:     AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
   15:       bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
   16:       php_cv_bison_version=invalid
   17:       if test -n "$bison_version_vars"; then
   18:         set $bison_version_vars
   19:         bison_version="${1}.${2}"
   20:         for bison_check_version in $bison_version_list; do
   21:           if test "$bison_version" = "$bison_check_version"; then
   22:             php_cv_bison_version="$bison_check_version (ok)"
   23:             break
   24:           fi
   25:         done
   26:       fi
   27:     ])
   28:   fi
   29:   case $php_cv_bison_version in
   30:     ""|invalid[)]
   31:       bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)."
   32:       AC_MSG_WARN([$bison_msg])
   33:       YACC="exit 0;"
   34:       ;;
   35:   esac
   36: ])
   37: 
   38: AC_DEFUN([ZEND_FP_EXCEPT],[
   39:   AC_CACHE_CHECK(whether fp_except is defined, ac_cv_type_fp_except,[
   40:     AC_TRY_COMPILE([
   41: #include <floatingpoint.h>
   42: ],[
   43: fp_except x = (fp_except) 0;
   44: ],[
   45:      ac_cv_type_fp_except=yes
   46: ],[
   47:      ac_cv_type_fp_except=no
   48: ],[
   49:      ac_cv_type_fp_except=no
   50: ])])
   51:   if test "$ac_cv_type_fp_except" = "yes"; then
   52:     AC_DEFINE(HAVE_FP_EXCEPT, 1, [whether floatingpoint.h defines fp_except])
   53:   fi
   54: ])
   55: 
   56: dnl
   57: dnl Check for broken sprintf()
   58: dnl
   59: AC_DEFUN([AC_ZEND_BROKEN_SPRINTF],[
   60:   AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
   61:     AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
   62:       ac_cv_broken_sprintf=no
   63:     ],[
   64:       ac_cv_broken_sprintf=yes
   65:     ],[
   66:       ac_cv_broken_sprintf=no
   67:     ])
   68:   ])
   69:   if test "$ac_cv_broken_sprintf" = "yes"; then
   70:     ac_result=1
   71:   else
   72:     ac_result=0
   73:   fi
   74:   AC_DEFINE_UNQUOTED(ZEND_BROKEN_SPRINTF, $ac_result, [Whether sprintf is broken])
   75: ])
   76: 
   77: dnl
   78: dnl AC_ZEND_C_BIGENDIAN
   79: dnl Replacement macro for AC_C_BIGENDIAN
   80: dnl
   81: AC_DEFUN([AC_ZEND_C_BIGENDIAN],
   82: [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
   83:  [
   84:   ac_cv_c_bigendian_php=unknown
   85:   AC_TRY_RUN(
   86:   [
   87: int main(void)
   88: {
   89:         short one = 1;
   90:         char *cp = (char *)&one;
   91: 
   92:         if (*cp == 0) {
   93:                 return(0);
   94:         } else {
   95:                 return(1);
   96:         }
   97: }
   98:   ], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
   99:  ])
  100:  if test $ac_cv_c_bigendian_php = yes; then
  101:    AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
  102:  fi
  103: ])
  104: 
  105: AC_DEFUN([AM_SET_LIBTOOL_VARIABLE],[
  106:   LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
  107: ])
  108: 
  109: dnl x87 floating point internal precision control checks
  110: dnl See: http://wiki.php.net/rfc/rounding
  111: AC_DEFUN([ZEND_CHECK_FLOAT_PRECISION],[
  112:   AC_MSG_CHECKING([for usable _FPU_SETCW])
  113:   AC_TRY_LINK([
  114:     #include <fpu_control.h>
  115:   ],[
  116:     fpu_control_t fpu_oldcw, fpu_cw;
  117:     volatile double result;
  118:     double a = 2877.0;
  119:     volatile double b = 1000000.0;
  120: 
  121:     _FPU_GETCW(fpu_oldcw);
  122:     fpu_cw = (fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_SINGLE) | _FPU_DOUBLE;
  123:     _FPU_SETCW(fpu_cw);
  124:     result = a / b;
  125:     _FPU_SETCW(fpu_oldcw);
  126:   ], [ac_cfp_have__fpu_setcw=yes], [ac_cfp_have__fpu_setcw=no])
  127:   if test "$ac_cfp_have__fpu_setcw" = "yes" ; then
  128:     AC_DEFINE(HAVE__FPU_SETCW, 1, [whether _FPU_SETCW is present and usable])
  129:     AC_MSG_RESULT(yes)
  130:   else
  131:     AC_MSG_RESULT(no)
  132:   fi
  133:   
  134:   AC_MSG_CHECKING([for usable fpsetprec])
  135:   AC_TRY_LINK([
  136:     #include <machine/ieeefp.h>
  137:   ],[
  138:     fp_prec_t fpu_oldprec;
  139:     volatile double result;
  140:     double a = 2877.0;
  141:     volatile double b = 1000000.0;
  142: 
  143:     fpu_oldprec = fpgetprec();
  144:     fpsetprec(FP_PD);
  145:     result = a / b;
  146:     fpsetprec(fpu_oldprec);
  147:   ], [ac_cfp_have_fpsetprec=yes], [ac_cfp_have_fpsetprec=no])
  148:   if test "$ac_cfp_have_fpsetprec" = "yes" ; then
  149:     AC_DEFINE(HAVE_FPSETPREC, 1, [whether fpsetprec is present and usable])
  150:     AC_MSG_RESULT(yes)
  151:   else
  152:     AC_MSG_RESULT(no)
  153:   fi
  154: 
  155:   AC_MSG_CHECKING([for usable _controlfp])
  156:   AC_TRY_LINK([
  157:     #include <float.h>
  158:   ],[
  159:     unsigned int fpu_oldcw;
  160:     volatile double result;
  161:     double a = 2877.0;
  162:     volatile double b = 1000000.0;
  163: 
  164:     fpu_oldcw = _controlfp(0, 0);
  165:     _controlfp(_PC_53, _MCW_PC);
  166:     result = a / b;
  167:     _controlfp(fpu_oldcw, _MCW_PC);
  168:   ], [ac_cfp_have__controlfp=yes], [ac_cfp_have__controlfp=no])
  169:   if test "$ac_cfp_have__controlfp" = "yes" ; then
  170:     AC_DEFINE(HAVE__CONTROLFP, 1, [whether _controlfp is present usable])
  171:     AC_MSG_RESULT(yes)
  172:   else
  173:     AC_MSG_RESULT(no)
  174:   fi
  175: 
  176:   AC_MSG_CHECKING([for usable _controlfp_s])
  177:   AC_TRY_LINK([
  178:    #include <float.h>
  179:   ],[
  180:     unsigned int fpu_oldcw, fpu_cw;
  181:     volatile double result;
  182:     double a = 2877.0;
  183:     volatile double b = 1000000.0;
  184: 
  185:     _controlfp_s(&fpu_cw, 0, 0);
  186:     fpu_oldcw = fpu_cw;
  187:     _controlfp_s(&fpu_cw, _PC_53, _MCW_PC);
  188:     result = a / b;
  189:     _controlfp_s(&fpu_cw, fpu_oldcw, _MCW_PC);
  190:   ], [ac_cfp_have__controlfp_s=yes], [ac_cfp_have__controlfp_s=no])
  191:   if test "$ac_cfp_have__controlfp_s" = "yes" ; then
  192:     AC_DEFINE(HAVE__CONTROLFP_S, 1, [whether _controlfp_s is present and usable])
  193:     AC_MSG_RESULT(yes)
  194:   else
  195:     AC_MSG_RESULT(no)
  196:   fi
  197: 
  198:   AC_MSG_CHECKING([whether FPU control word can be manipulated by inline assembler])
  199:   AC_TRY_LINK([
  200:     /* nothing */
  201:   ],[
  202:     unsigned int oldcw, cw;
  203:     volatile double result;
  204:     double a = 2877.0;
  205:     volatile double b = 1000000.0;
  206: 
  207:     __asm__ __volatile__ ("fnstcw %0" : "=m" (*&oldcw));
  208:     cw = (oldcw & ~0x0 & ~0x300) | 0x200;
  209:     __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw));
  210: 
  211:     result = a / b;
  212: 
  213:     __asm__ __volatile__ ("fldcw %0" : : "m" (*&oldcw));
  214:   ], [ac_cfp_have_fpu_inline_asm_x86=yes], [ac_cfp_have_fpu_inline_asm_x86=no])
  215:   if test "$ac_cfp_have_fpu_inline_asm_x86" = "yes" ; then
  216:     AC_DEFINE(HAVE_FPU_INLINE_ASM_X86, 1, [whether FPU control word can be manipulated by inline assembler])
  217:     AC_MSG_RESULT(yes)
  218:   else
  219:     AC_MSG_RESULT(no)
  220:   fi
  221: ])

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>