2001-12-11 17:17:38 +08:00
|
|
|
dnl
|
|
|
|
dnl $Id$
|
|
|
|
dnl
|
|
|
|
dnl This file contains Zend specific autoconf functions.
|
|
|
|
dnl
|
1999-12-17 21:36:15 +08:00
|
|
|
|
|
|
|
AC_DEFUN(LIBZEND_BISON_CHECK,[
|
|
|
|
|
|
|
|
if test "$YACC" != "bison -y"; then
|
|
|
|
AC_MSG_WARN(You will need bison if you want to regenerate the Zend parser.)
|
|
|
|
else
|
|
|
|
AC_MSG_CHECKING(bison version)
|
2003-10-08 06:39:54 +08:00
|
|
|
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /' | tr -d 'a-z'`
|
2000-10-31 22:54:16 +08:00
|
|
|
if test "${1}" = "1" -a "${2}" -lt "28"; then
|
|
|
|
AC_MSG_WARN(You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)
|
1999-12-17 21:36:15 +08:00
|
|
|
fi
|
|
|
|
AC_MSG_RESULT(${1}.${2} (ok))
|
|
|
|
fi
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(LIBZEND_BASIC_CHECKS,[
|
|
|
|
|
|
|
|
AC_REQUIRE([AC_PROG_YACC])
|
|
|
|
AC_REQUIRE([AC_PROG_CC])
|
|
|
|
AC_REQUIRE([AC_PROG_CC_C_O])
|
2001-03-07 00:59:28 +08:00
|
|
|
AC_REQUIRE([AC_PROG_LEX])
|
1999-12-17 21:36:15 +08:00
|
|
|
AC_REQUIRE([AC_HEADER_STDC])
|
|
|
|
|
|
|
|
LIBZEND_BISON_CHECK
|
|
|
|
|
|
|
|
dnl Ugly hack to get around a problem with gcc on AIX.
|
|
|
|
if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
|
|
|
|
"`uname -sv`" = "AIX 4"; then
|
|
|
|
CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
|
|
|
|
fi
|
|
|
|
|
|
|
|
dnl Hack to work around a Mac OS X cpp problem
|
|
|
|
dnl Known versions needing this workaround are 5.3 and 5.4
|
|
|
|
if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
|
|
|
|
CPPFLAGS="$CPPFLAGS -traditional-cpp"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CHECK_HEADERS(
|
|
|
|
limits.h \
|
|
|
|
malloc.h \
|
|
|
|
string.h \
|
|
|
|
unistd.h \
|
|
|
|
stdarg.h \
|
|
|
|
sys/types.h \
|
2001-05-30 16:23:15 +08:00
|
|
|
sys/time.h \
|
1999-12-17 21:36:15 +08:00
|
|
|
signal.h \
|
|
|
|
unix.h \
|
2003-03-21 01:41:40 +08:00
|
|
|
stdlib.h \
|
2003-09-07 21:49:15 +08:00
|
|
|
mach-o/dyld.h \
|
1999-12-17 21:36:15 +08:00
|
|
|
dlfcn.h)
|
|
|
|
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_TYPE_SIGNAL
|
|
|
|
|
2002-11-15 22:30:40 +08:00
|
|
|
AC_DEFUN(LIBZEND_LIBDL_CHECKS,[
|
2000-05-05 20:17:41 +08:00
|
|
|
AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"])
|
|
|
|
AC_CHECK_FUNC(dlopen,[AC_DEFINE(HAVE_LIBDL, 1,[ ])])
|
2002-11-15 22:30:40 +08:00
|
|
|
])
|
1999-12-17 21:36:15 +08:00
|
|
|
|
2002-11-15 22:30:40 +08:00
|
|
|
AC_DEFUN(LIBZEND_DLSYM_CHECK,[
|
2001-08-26 23:25:55 +08:00
|
|
|
dnl
|
|
|
|
dnl Ugly hack to check if dlsym() requires a leading underscore in symbol name.
|
|
|
|
dnl
|
2001-11-30 19:42:30 +08:00
|
|
|
AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names])
|
2001-08-26 23:25:55 +08:00
|
|
|
_LT_AC_TRY_DLOPEN_SELF([
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(yes)
|
2001-11-30 19:42:30 +08:00
|
|
|
AC_DEFINE(DLSYM_NEEDS_UNDERSCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ])
|
2001-08-26 23:25:55 +08:00
|
|
|
], [
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
], [])
|
2002-11-15 22:30:40 +08:00
|
|
|
])
|
2001-08-26 23:25:55 +08:00
|
|
|
|
1999-12-17 21:36:15 +08:00
|
|
|
dnl This is required for QNX and may be some BSD derived systems
|
|
|
|
AC_CHECK_TYPE( uint, unsigned int )
|
|
|
|
AC_CHECK_TYPE( ulong, unsigned long )
|
|
|
|
|
|
|
|
dnl Checks for library functions.
|
|
|
|
AC_FUNC_VPRINTF
|
|
|
|
AC_FUNC_MEMCMP
|
|
|
|
AC_FUNC_ALLOCA
|
2001-03-12 03:35:26 +08:00
|
|
|
AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol finite fpclass)
|
1999-12-17 21:36:15 +08:00
|
|
|
AC_ZEND_BROKEN_SPRINTF
|
2000-06-19 00:33:15 +08:00
|
|
|
|
|
|
|
AC_CHECK_FUNCS(finite isfinite isinf isnan)
|
|
|
|
|
2000-06-19 00:51:42 +08:00
|
|
|
ZEND_FP_EXCEPT
|
|
|
|
|
1999-12-17 21:36:15 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(LIBZEND_ENABLE_DEBUG,[
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(debug,
|
2003-10-03 13:24:33 +08:00
|
|
|
[ --enable-debug Compile with debugging symbols],[
|
1999-12-17 21:36:15 +08:00
|
|
|
ZEND_DEBUG=$enableval
|
|
|
|
],[
|
2000-05-29 01:39:30 +08:00
|
|
|
ZEND_DEBUG=no
|
1999-12-17 21:36:15 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN(LIBZEND_OTHER_CHECKS,[
|
|
|
|
|
2004-10-05 03:54:35 +08:00
|
|
|
PHP_ARG_WITH(zend-vm,[virtual machine dispatch method],
|
|
|
|
[ --with-zend-vm=TYPE Sets virtual machine dispatch methos. Type is
|
|
|
|
one of "CALL" (default), "SWITCH" or "GOTO"], CALL, no)
|
|
|
|
|
|
|
|
case $PHP_ZEND_VM in
|
|
|
|
SWITCH)
|
|
|
|
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_SWITCH,[virtual machine dispatch method])
|
|
|
|
;;
|
|
|
|
GOTO)
|
|
|
|
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_GOTO,[virtual machine dispatch method])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_CALL,[virtual machine dispatch method])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2003-01-20 05:37:40 +08:00
|
|
|
AC_ARG_ENABLE(maintainer-zts,
|
2003-10-03 13:24:33 +08:00
|
|
|
[ --enable-maintainer-zts Enable thread safety - for code maintainers only],[
|
2003-01-20 05:37:40 +08:00
|
|
|
ZEND_MAINTAINER_ZTS=$enableval
|
1999-12-17 21:36:15 +08:00
|
|
|
],[
|
2003-01-20 05:37:40 +08:00
|
|
|
ZEND_MAINTAINER_ZTS=no
|
1999-12-17 21:36:15 +08:00
|
|
|
])
|
1999-12-23 21:29:26 +08:00
|
|
|
|
1999-12-24 01:48:56 +08:00
|
|
|
AC_ARG_ENABLE(inline-optimization,
|
2003-10-03 13:24:33 +08:00
|
|
|
[ --disable-inline-optimization
|
|
|
|
If building zend_execute.lo fails, try this switch.],[
|
1999-12-23 21:29:26 +08:00
|
|
|
ZEND_INLINE_OPTIMIZATION=$enableval
|
1999-12-17 21:36:15 +08:00
|
|
|
],[
|
2002-04-22 19:06:22 +08:00
|
|
|
ZEND_INLINE_OPTIMIZATION=yes
|
1999-12-17 21:36:15 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(memory-limit,
|
|
|
|
[ --enable-memory-limit Compile with memory limit support. ], [
|
|
|
|
ZEND_MEMORY_LIMIT=$enableval
|
|
|
|
],[
|
|
|
|
ZEND_MEMORY_LIMIT=no
|
|
|
|
])
|
|
|
|
|
2003-08-11 13:24:42 +08:00
|
|
|
AC_ARG_ENABLE(zend-multibyte,
|
2003-10-03 13:24:33 +08:00
|
|
|
[ --enable-zend-multibyte Compile with zend multibyte support. ], [
|
2003-08-11 13:24:42 +08:00
|
|
|
ZEND_MULTIBYTE=$enableval
|
|
|
|
],[
|
|
|
|
ZEND_MULTIBYTE=no
|
|
|
|
])
|
|
|
|
|
2002-06-25 00:10:33 +08:00
|
|
|
AC_MSG_CHECKING(whether to enable thread-safety)
|
2003-01-20 05:37:40 +08:00
|
|
|
AC_MSG_RESULT($ZEND_MAINTAINER_ZTS)
|
1999-12-17 21:36:15 +08:00
|
|
|
|
1999-12-23 21:29:26 +08:00
|
|
|
AC_MSG_CHECKING(whether to enable inline optimization for GCC)
|
|
|
|
AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
|
1999-12-17 21:36:15 +08:00
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to enable a memory limit)
|
|
|
|
AC_MSG_RESULT($ZEND_MEMORY_LIMIT)
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to enable Zend debugging)
|
|
|
|
AC_MSG_RESULT($ZEND_DEBUG)
|
2003-08-11 13:24:42 +08:00
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to enable Zend multibyte)
|
|
|
|
AC_MSG_RESULT($ZEND_MULTIBYTE)
|
1999-12-17 21:36:15 +08:00
|
|
|
|
|
|
|
if test "$ZEND_DEBUG" = "yes"; then
|
2000-06-08 14:12:26 +08:00
|
|
|
AC_DEFINE(ZEND_DEBUG,1,[ ])
|
1999-12-23 05:04:34 +08:00
|
|
|
echo " $CFLAGS" | grep ' -g' >/dev/null || DEBUG_CFLAGS="-g"
|
2000-09-07 02:37:39 +08:00
|
|
|
if test "$CFLAGS" = "-g -O2"; then
|
|
|
|
CFLAGS=-g
|
|
|
|
fi
|
1999-12-17 21:36:15 +08:00
|
|
|
test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
|
|
|
|
test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
|
|
|
|
DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
|
|
|
|
else
|
2000-06-08 14:12:26 +08:00
|
|
|
AC_DEFINE(ZEND_DEBUG,0,[ ])
|
1999-12-17 21:36:15 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
|
|
|
|
|
2003-01-20 05:37:40 +08:00
|
|
|
if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
|
2000-06-08 14:12:26 +08:00
|
|
|
AC_DEFINE(ZTS,1,[ ])
|
2001-08-06 21:48:51 +08:00
|
|
|
CFLAGS="$CFLAGS -DZTS"
|
1999-12-17 21:36:15 +08:00
|
|
|
LIBZEND_CPLUSPLUS_CHECKS
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$ZEND_MEMORY_LIMIT" = "yes"; then
|
|
|
|
AC_DEFINE(MEMORY_LIMIT, 1, [Memory limit])
|
|
|
|
else
|
|
|
|
AC_DEFINE(MEMORY_LIMIT, 0, [Memory limit])
|
|
|
|
fi
|
|
|
|
|
2003-08-11 13:24:42 +08:00
|
|
|
if test "$ZEND_MULTIBYTE" = "yes"; then
|
|
|
|
AC_DEFINE(ZEND_MULTIBYTE, 1, [ ])
|
|
|
|
fi
|
2001-05-12 02:16:41 +08:00
|
|
|
|
1999-12-23 21:29:26 +08:00
|
|
|
changequote({,})
|
|
|
|
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
|
2001-03-04 02:07:52 +08:00
|
|
|
INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
|
1999-12-18 01:50:14 +08:00
|
|
|
else
|
1999-12-23 21:29:26 +08:00
|
|
|
INLINE_CFLAGS="$CFLAGS"
|
1999-12-17 21:36:15 +08:00
|
|
|
fi
|
1999-12-23 21:29:26 +08:00
|
|
|
changequote([,])
|
|
|
|
|
|
|
|
AC_C_INLINE
|
1999-12-17 21:36:15 +08:00
|
|
|
|
1999-12-23 21:29:26 +08:00
|
|
|
AC_SUBST(INLINE_CFLAGS)
|
1999-12-17 21:36:15 +08:00
|
|
|
|
2004-11-04 07:05:18 +08:00
|
|
|
AC_MSG_CHECKING(target system is Darwin)
|
2004-11-04 07:25:33 +08:00
|
|
|
if echo "$target" | grep "darwin" > /dev/null; then
|
2004-11-04 07:05:18 +08:00
|
|
|
AC_DEFINE([DARWIN], 1, [Define if the target system is darwin])
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
1999-12-17 21:36:15 +08:00
|
|
|
|
2002-07-25 01:04:11 +08:00
|
|
|
dnl test and set the alignment define for ZEND_MM
|
|
|
|
dnl this also does the logarithmic test for ZEND_MM.
|
|
|
|
AC_MSG_CHECKING(for MM alignment and log values)
|
|
|
|
|
2002-07-26 07:55:06 +08:00
|
|
|
AC_TRY_RUN([
|
|
|
|
#include <stdio.h>
|
2002-07-25 01:04:11 +08:00
|
|
|
|
|
|
|
typedef union _mm_align_test {
|
|
|
|
void *ptr;
|
|
|
|
double dbl;
|
|
|
|
long lng;
|
|
|
|
} mm_align_test;
|
|
|
|
|
|
|
|
#if (defined (__GNUC__) && __GNUC__ >= 2)
|
|
|
|
#define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test))
|
|
|
|
#else
|
|
|
|
#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test))
|
|
|
|
#endif
|
|
|
|
|
2002-07-26 07:55:06 +08:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int i = ZEND_MM_ALIGNMENT;
|
|
|
|
int zeros = 0;
|
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
while (i & ~0x1) {
|
|
|
|
zeros++;
|
|
|
|
i = i >> 1;
|
|
|
|
}
|
2002-07-25 01:04:11 +08:00
|
|
|
|
2002-07-26 07:55:06 +08:00
|
|
|
fp = fopen("conftest.zend", "w");
|
2002-08-24 06:11:10 +08:00
|
|
|
fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
|
2002-07-26 07:55:06 +08:00
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
exit(0);
|
2002-07-25 01:04:11 +08:00
|
|
|
}
|
2002-07-26 07:55:06 +08:00
|
|
|
], [
|
|
|
|
LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
|
|
|
|
LIBZEND_MM_ALIGN_LOG2=`cat conftest.zend | cut -d ' ' -f 2`
|
|
|
|
AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT, $LIBZEND_MM_ALIGN, [ ])
|
|
|
|
AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT_LOG2, $LIBZEND_MM_ALIGN_LOG2, [ ])
|
|
|
|
])
|
2002-07-25 01:04:11 +08:00
|
|
|
|
2002-07-26 07:55:06 +08:00
|
|
|
AC_MSG_RESULT(done)
|
2002-07-25 01:04:11 +08:00
|
|
|
|
2002-07-26 07:55:06 +08:00
|
|
|
])
|
2002-07-25 01:04:11 +08:00
|
|
|
|
|
|
|
|
2002-07-26 07:55:06 +08:00
|
|
|
AC_DEFUN(LIBZEND_CPLUSPLUS_CHECKS,[
|
2002-07-25 01:04:11 +08:00
|
|
|
|
2002-07-26 07:55:06 +08:00
|
|
|
])
|
2002-07-25 01:04:11 +08:00
|
|
|
|