summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TSRM/configure.in22
-rw-r--r--TSRM/tsrm.m425
-rw-r--r--Zend/Makefile.am2
-rw-r--r--Zend/acinclude.m47
-rw-r--r--Zend/configure.in181
-rw-r--r--Zend/libzend.m4210
6 files changed, 253 insertions, 194 deletions
diff --git a/TSRM/configure.in b/TSRM/configure.in
index ded8166948..43171d8f5d 100644
--- a/TSRM/configure.in
+++ b/TSRM/configure.in
@@ -7,27 +7,15 @@ AC_INIT(TSRM.c)
AM_INIT_AUTOMAKE(TSRM, 1.0)
AM_CONFIG_HEADER(tsrm_config.h)
-AC_PROG_CC
-AM_PROG_CC_STDC
-AC_PROG_CC_C_O
-AC_PROG_RANLIB
-
+sinclude(tsrm.m4)
+
+TSRM_BASIC_CHECKS
+
AM_PROG_LIBTOOL
if test "$enable_debug" != "yes"; then
AM_SET_LIBTOOL_VARIABLE([--silent])
fi
-AC_CHECK_LIB(c_r, pthread_kill)
-AC_CHECK_LIB(pthread, pthread_kill)
-
-AC_CHECK_FUNCS(pthread_kill)
-
-if test "$ac_cv_func_pthread_kill" != "yes"; then
- AC_MSG_ERROR(You need pthreads to build TSRM.)
-fi
-
-AC_DEFINE(PTHREADS)
-
-AC_CHECK_HEADERS(stdarg.h)
+TSRM_PTHREAD
AC_OUTPUT(Makefile)
diff --git a/TSRM/tsrm.m4 b/TSRM/tsrm.m4
new file mode 100644
index 0000000000..352b4654e1
--- /dev/null
+++ b/TSRM/tsrm.m4
@@ -0,0 +1,25 @@
+
+AC_DEFUN(TSRM_BASIC_CHECKS,[
+
+AC_REQUIRE([AC_PROG_CC])dnl
+dnl AC_REQUIRE([AM_PROG_CC_STDC])dnl
+AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AC_PROG_RANLIB])dnl
+
+AC_CHECK_HEADERS(stdarg.h)
+
+])
+
+AC_DEFUN(TSRM_PTHREAD,[
+
+AC_CHECK_LIB(c_r, pthread_kill)
+AC_CHECK_LIB(pthread, pthread_kill)
+
+AC_CHECK_FUNCS(pthread_kill)
+
+if test "$ac_cv_func_pthread_kill" != "yes"; then
+ AC_MSG_ERROR(You need pthreads to build TSRM.)
+fi
+
+AC_DEFINE(PTHREADS, [], Whether to use Pthreads)
+])
diff --git a/Zend/Makefile.am b/Zend/Makefile.am
index 3a0c970714..0db31fe826 100644
--- a/Zend/Makefile.am
+++ b/Zend/Makefile.am
@@ -2,7 +2,7 @@
#CLEANFILES = zend-parser.c zend-parser.h zend-scanner.c zend-parser.output
-ZEND_SCANNER = @ZEND_SCANNER@
+ZEND_SCANNER = libzend_$(ZEND_SCANNER_TYPE).la
AUTOMAKE_OPTIONS=foreign
EXTRA_LTLIBRARIES=libzend_cc.la libzend_c.la
diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4
index 3202fc7207..558f1605af 100644
--- a/Zend/acinclude.m4
+++ b/Zend/acinclude.m4
@@ -8,15 +8,16 @@ dnl
AC_DEFUN(AC_ZEND_BROKEN_SPRINTF,[
AC_MSG_CHECKING([for broken sprintf])
AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[
- AC_DEFINE(ZEND_BROKEN_SPRINTF,0)
+ broken=0
AC_MSG_RESULT(ok)
],[
- AC_DEFINE(ZEND_BROKEN_SPRINTF,1)
+ broken=1
AC_MSG_RESULT(broken)
],[
- AC_DEFINE(ZEND_BROKEN_SPRINTF,0)
+ broken=0
AC_MSG_RESULT(cannot check, guessing ok)
])
+ AC_DEFINE(ZEND_BROKEN_SPRINTF, $broken, [Whether sprintf is broken])
])
AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
diff --git a/Zend/configure.in b/Zend/configure.in
index ad8b78a370..411659dfbd 100644
--- a/Zend/configure.in
+++ b/Zend/configure.in
@@ -6,48 +6,22 @@ AM_INIT_AUTOMAKE(zend, 0.80A)
AM_CONFIG_HEADER(zend_config.h)
AM_SANITY_CHECK
AM_MAINTAINER_MODE
+AC_PROG_CC
+AM_PROG_LEX
+AM_PROG_CC_STDC
ZEND_VERSION=$VERSION
dnl We want this one before the checks, so the checks can modify CFLAGS.
test -z "$CFLAGS" && auto_cflags=1
-dnl Checks for programs.
-AC_PROG_YACC
-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)
- set `bison --version| sed -e 's/^GNU Bison version //' -e 's/\./ /'`
- if test "$1" = "1" -a "$2" -lt "25"; then
- AC_MSG_WARN(You will need bison 1.25 if you want to regenerate the Zend parser (found $1.$2).)
- fi
- AC_MSG_RESULT($1.$2 (ok))
-fi
-AC_PROG_CC
-if test "$enable_thread_safety" = "yes" ; then
-AC_PROG_CXX
-fi
-AC_PROG_CC_C_O
-AM_PROG_LEX
+sinclude(libzend.m4)
+
+LIBZEND_BASIC_CHECKS
AM_PROG_LIBTOOL
if test "$enable_debug" != "yes"; then
AM_SET_LIBTOOL_VARIABLE([--silent])
fi
-AM_PROG_CC_STDC
-AC_C_INLINE
-
-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
-
-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
dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
@@ -58,147 +32,8 @@ if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
fi
-AC_CHECK_LIB(c, dlopen, [
- # fake it
- AC_DEFINE(HAVE_LIBDL) ], [
- AC_CHECK_LIB(dl, dlopen, [
- LIBS="-ldl $LIBS"
- AC_DEFINE(HAVE_LIBDL) ], []) ])
-
-dnl Checks for header files.
-AC_HEADER_STDC
-
-dnl QNX requires unix.h to allow functions in libunix to work properly
-AC_CHECK_HEADERS(limits.h malloc.h string.h unistd.h stdarg.h sys/types.h signal.h unix.h dlfcn.h)
-
-if test "$enable_thread_safety" = "yes" ; then
-dnl C++ specific header files
-AC_LANG_CPLUSPLUS
-AC_CHECK_HEADER(stdiostream.h, [ AC_DEFINE(HAVE_STDIOSTREAM_H) ])
-AC_LANG_C
-fi
-
-dnl Checks for types
-AC_TYPE_SIZE_T
-AC_TYPE_SIGNAL
-
-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
-AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol)
-AC_ZEND_BROKEN_SPRINTF
-
-AC_MSG_CHECKING(whether to include debugging symbols)
-AC_ARG_ENABLE(debug,
-[ --disable-debug Compile without debugging symbols],
-[
- if test "$enableval" = "yes"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(ZEND_DEBUG,1)
- DEBUG_CFLAGS="-g"
- 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
- AC_MSG_RESULT(no)
- AC_DEFINE(ZEND_DEBUG,0)
- DEBUG_CFLAGS=""
- fi
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(ZEND_DEBUG,1)
- DEBUG_CFLAGS="-g"
-])
-AC_SUBST(DEBUG_CFLAGS)
-CFLAGS="$CFLAGS $DEBUG_CFLAGS"
-
-RESULT=yes
-AC_MSG_CHECKING(whether to enable inline)
-AC_ARG_ENABLE(inline,
-[ --disable-inline Disable the inline specifier],
-[
- if test "$enableval" = "no"; then
- RESULT=no
- fi
-])
-AC_MSG_RESULT($RESULT)
-
-if test "$RESULT" = "yes"; then
- AC_C_INLINE
-else
- AC_DEFINE(inline, [])
-fi
-
-AC_MSG_CHECKING(whether to enable a memory limit)
-AC_ARG_ENABLE(memory-limit,
-[ --enable-memory-limit Compile with memory limit support. ],
-[
- if test "$enableval" = "yes"; then
- AC_DEFINE(MEMORY_LIMIT, 1)
- AC_MSG_RESULT(yes)
- else
- AC_DEFINE(MEMORY_LIMIT, 0)
- AC_MSG_RESULT(no)
- fi
-],[
- AC_DEFINE(MEMORY_LIMIT, 0)
- AC_MSG_RESULT(no)
-])
-
-
-ZEND_SCANNER_TYPE=c
-dnl Sigh. This will probably break automake's automatic dependencies..
-AC_MSG_CHECKING(whether to build Zend thread-safe)
-AC_ARG_ENABLE(thread-safety,
-[ --enable-thread-safety Whether to build Zend thread-safe.],[
- if test "$enableval" = "yes"; then
- AC_DEFINE(ZTS)
- ZEND_SCANNER_TYPE=cc
- CPPFLAGS="$CPPFLAGS -I../TSRM"
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(TSRM_DIR)
-AC_SUBST(TSRM_LIB)
-ZEND_SCANNER="libzend_${ZEND_SCANNER_TYPE}.la"
-AC_SUBST(ZEND_SCANNER)
-
-if test "$enable_thread_safety" = "yes" ; then
-AC_CHECK_LIB(C, cin)
-AC_CHECK_LIB(g++, cin)
-AC_CHECK_LIB(stdc++, cin)
-dnl Digital Unix 4.0
-AC_CHECK_LIB(cxx, cin)
-AC_CHECK_LIB(cxxstd, __array_delete)
-
-AC_LANG_SAVE
-AC_LANG_CPLUSPLUS
-AC_MSG_CHECKING(for class istdiostream)
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <unistd.h>
-#include <fstream.h>
-#include <stdiostream.h>
-],[
-istdiostream *foo = new istdiostream((FILE *) 0);
-],[
- AC_DEFINE(HAVE_CLASS_ISTDIOSTREAM, 1)
- AC_MSG_RESULT(yes)
-],[
- AC_MSG_RESULT(no)
-])
-AC_LANG_RESTORE
-
-fi
+LIBZEND_ENABLE_DEBUG
+LIBZEND_OTHER_CHECKS
EXTRA_LIBS="$LIBS"
LIBS=""
diff --git a/Zend/libzend.m4 b/Zend/libzend.m4
new file mode 100644
index 0000000000..916f7e2dbd
--- /dev/null
+++ b/Zend/libzend.m4
@@ -0,0 +1,210 @@
+
+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)
+ set `bison --version| sed -e 's/^GNU Bison version //' -e 's/\./ /'`
+ if test "${1}" = "1" -a "${2}" -lt "25"; then
+ AC_MSG_WARN(You will need bison 1.25 if you want to regenerate the Zend parser (found ${1}.${2}).)
+ 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])
+AC_REQUIRE([AM_PROG_LEX])
+AC_REQUIRE([AC_C_INLINE])
+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 \
+signal.h \
+unix.h \
+dlfcn.h)
+
+AC_TYPE_SIZE_T
+AC_TYPE_SIGNAL
+
+AC_CHECK_LIB(c, dlopen, [
+ # fake it
+ AC_DEFINE(HAVE_LIBDL) ], [
+ AC_CHECK_LIB(dl, dlopen, [
+ LIBS="-ldl $LIBS"
+ AC_DEFINE(HAVE_LIBDL) ], []) ])
+
+
+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
+AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol)
+AC_ZEND_BROKEN_SPRINTF
+
+AC_SUBST(ZEND_SCANNER_TYPE)
+
+])
+
+
+
+
+
+AC_DEFUN(LIBZEND_ENABLE_DEBUG,[
+
+AC_ARG_ENABLE(debug,
+[ --disable-debug Compile without debugging symbols],[
+ ZEND_DEBUG=$enableval
+],[
+ ZEND_DEBUG=yes
+])
+
+])
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+AC_DEFUN(LIBZEND_OTHER_CHECKS,[
+
+AC_ARG_ENABLE(experimental-zts,
+[ --enable-experimental-zts This will most likely break your build],[
+ ZEND_EXPERIMENTAL_ZTS=$enableval
+],[
+ ZEND_EXPERIMENTAL_ZTS=no
+])
+
+AC_ARG_ENABLE(inline,
+[ --disable-inline Disable the inline specifier],[
+ ZEND_INLINE=$enableval
+],[
+ ZEND_INLINE=yes
+])
+
+AC_ARG_ENABLE(memory-limit,
+[ --enable-memory-limit Compile with memory limit support. ], [
+ ZEND_MEMORY_LIMIT=$enableval
+],[
+ ZEND_MEMORY_LIMIT=no
+])
+
+AC_MSG_CHECKING(whether to enable experimental ZTS)
+AC_MSG_RESULT($ZEND_EXPERIMENTAL_ZTS)
+
+AC_MSG_CHECKING(whether to enable inline)
+AC_MSG_RESULT($ZEND_INLINE)
+
+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)
+
+if test "$ZEND_DEBUG" = "yes"; then
+ AC_DEFINE(ZEND_DEBUG,1)
+ DEBUG_CFLAGS="-g"
+ 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
+ AC_DEFINE(ZEND_DEBUG,0)
+fi
+
+test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
+
+if test "$ZEND_EXPERIMENTAL_ZTS" = "yes"; then
+ AC_DEFINE(ZTS)
+ ZEND_SCANNER_TYPE=cc
+ CPPFLAGS="$CPPFLAGS -I../TSRM"
+ LIBZEND_CPLUSPLUS_CHECKS
+else
+ ZEND_SCANNER_TYPE=c
+fi
+
+if test "$ZEND_MEMORY_LIMIT" = "yes"; then
+ AC_DEFINE(MEMORY_LIMIT, 1, [Memory limit])
+else
+ AC_DEFINE(MEMORY_LIMIT, 0, [Memory limit])
+fi
+
+if test "$ZEND_INLINE" != "yes"; then
+ AC_DEFINE(inline, [])
+fi
+
+
+])
+
+
+AC_DEFUN(LIBZEND_CPLUSPLUS_CHECKS,[
+
+dnl extra check to avoid C++ preprocessor testing if in non-ZTS mode
+
+if test "$ZEND_EXPERIMENTAL_ZTS" = "yes"; then
+AC_PROG_CXX
+AC_LANG_CPLUSPLUS
+AC_CHECK_HEADER(stdiostream.h, [ AC_DEFINE(HAVE_STDIOSTREAM_H, [], Whether you have stdiostream.h) ])
+
+AC_CHECK_LIB(C, cin)
+AC_CHECK_LIB(g++, cin)
+AC_CHECK_LIB(stdc++, cin)
+dnl Digital Unix 4.0
+AC_CHECK_LIB(cxx, cin)
+AC_CHECK_LIB(cxxstd, __array_delete)
+
+AC_MSG_CHECKING(for class istdiostream)
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <unistd.h>
+#include <fstream.h>
+#include <stdiostream.h>
+],[
+istdiostream *foo = new istdiostream((FILE *) 0);
+],[
+ AC_DEFINE(HAVE_CLASS_ISTDIOSTREAM, 1, [Whether you have class istdiostream])
+ AC_MSG_RESULT(yes)
+],[
+ AC_MSG_RESULT(no)
+])
+AC_LANG_C
+fi
+])
+