zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \
zend_list.c zend_indent.c
+# taken from automake 1.4
+CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+
# automake isn't too clever about "non-standard" use of lex and yacc
+zend-scanner.o: @ZEND_SCANNER_SRC@
+ @ZEND_SCANNER_COMPILE@
+
zend-scanner.c: zend-scanner.l
$(LEX) -Pzend -ozend-scanner.c -i $(srcdir)/zend-scanner.l
+#define ZEND_API
+
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifdef HAVE_STRING_H
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+
+@TOP@
+
/* This is the default configuration file to read */
#define USE_CONFIG_FILE 1
/* define ulong by configure if it is missed (most probably is) */
#undef ulong
-/* type check for in_addr_t */
-#undef in_addr_t
-
-/* Define if you have dirent.h but opendir() resides in libc rather than in libdir */
-/* This will cause HAVE_DIRENT_H defined twice sometimes, but it should be problem */
-#define HAVE_DIRENT_H 0
-
-/* Define if you have struct flock */
-#define HAVE_STRUCT_FLOCK 0
-
-/* Define if you have the resolv library (-lresolv). */
-#define HAVE_LIBRESOLV 0
-
/* Undefine if you want stricter XML/SGML compliance by default */
/* (this disables "<?expression?>" by default) */
#define T_DEFAULT_SHORT_OPEN_TAG 1
#define REGEX 0
#define HSREGEX 0
-/* Define if you have libdl (used for dynamic linking) */
-#define HAVE_LIBDL 0
-
#undef ZEND_DEBUG
/* Define if you want to enable bc style precision math support */
/* Define to compile Zend thread safe */
#undef ZTS
+
+@BOTTOM@
+
+/* Define if you have stdiostream.h */
+#undef HAVE_STDIOSTREAM_H
+
+#ifdef HAVE_LIBDL
+# ifdef HAVE_DLFCN_H
+# include <dlfcn.h>
+# endif
+# define DL_LOAD(libname) dlopen(libname, RTLD_NOW)
+# define DL_UNLOAD dlclose
+# define DL_FETCH_SYMBOL dlsym
+# define DL_HANDLE void *
+# define ZEND_EXTENSIONS_SUPPORT 1
+#else
+# define DL_HANDLE void *
+# define ZEND_EXTENSIONS_SUPPORT 0
+#endif
+
+#if ZEND_BROKEN_SPRINTF
+int zend_sprintf(char *buffer, const char *format, ...);
+#else
+# define zend_sprintf sprintf
+#endif
+
+#if ZEND_DEBUG
+# define inline
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
dnl
dnl Check for broken sprintf()
dnl
-AC_DEFUN(AC_BROKEN_SPRINTF,[
+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(BROKEN_SPRINTF,0)
+ AC_DEFINE(ZEND_BROKEN_SPRINTF,0)
AC_MSG_RESULT(ok)
],[
- AC_DEFINE(BROKEN_SPRINTF,1)
+ AC_DEFINE(ZEND_BROKEN_SPRINTF,1)
AC_MSG_RESULT(broken)
],[
- AC_DEFINE(BROKEN_SPRINTF,0)
+ AC_DEFINE(ZEND_BROKEN_SPRINTF,0)
AC_MSG_RESULT(cannot check, guessing ok)
])
])
+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _CONFIG_UNIX_H
-#define _CONFIG_UNIX_H
-
-#define ZEND_API
-
-#include <stdlib.h>
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#if HAVE_LIBDL
-# include <dlfcn.h>
-# define DL_LOAD(libname) dlopen(libname, RTLD_NOW)
-# define DL_UNLOAD dlclose
-# define DL_FETCH_SYMBOL dlsym
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 1
-#else
-# define DL_HANDLE void *
-# define ZEND_EXTENSIONS_SUPPORT 0
-#endif
-
-#if BROKEN_SPRINTF
-int zend_sprintf(char *buffer, const char *format, ...);
-#else
-# define zend_sprintf sprintf
-#endif
-
-#if ZEND_DEBUG
-# define inline
-#endif
-
-#endif /* _CONFIG_UNIX_H */
AC_MSG_RESULT($1.$2 (ok))
fi
AC_PROG_CC
+AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_CC_C_O
AM_PROG_LEX
LIBS="-ldl $LIBS"
AC_DEFINE(HAVE_LIBDL) ], []) ])
-dnl The sin may be in a library which need not be specifed
-dnl as well as res_search resides in libsocket
-AC_CHECK_LIB(c, sin, [:], [
- AC_CHECK_LIB(m, sin) ])
-
dnl Checks for header files.
AC_HEADER_STDC
-dnl In QNX opendir resides in libc but dirent.h is still required
-if test "`uname -s 2>/dev/null`" != "QNX"; then
- AC_HEADER_DIRENT
-else
- AC_CHECK_HEADERS(dirent.h)
-fi
dnl QNX requires unix.h to allow functions in libunix to work properly
-AC_CHECK_HEADERS(fcntl.h unistd.h crypt.h sys/file.h memory.h pwd.h grp.h sys/socket.h sys/wait.h syslog.h string.h sys/varargs.h stdarg.h sys/resource.h sys/time.h signal.h netinet/in.h dlfcn.h limits.h sys/types.h sys/statvfs.h sys/statfs.h unix.h db.h ndbm.h)
+AC_CHECK_HEADERS(limits.h malloc.h string.h unistd.h stdarg.h sys/types.h signal.h unix.h dlfcn.h)
+
+dnl C++ specific header files
+AC_LANG_CPLUSPLUS
+AC_CHECK_HEADER(stdiostream.h, [ AC_DEFINE(HAVE_STDIOSTREAM_H) ])
+AC_LANG_C
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 )
dnl Checks for library functions.
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(memcpy memmove strdup strerror strcasecmp strstr flock lockf putenv tempnam usleep setlocale gettimeofday setvbuf srand48 lrand48 srandom random link symlink regcomp getlogin cuserid vsnprintf snprintf gcvt utime crypt setitimer rint unsetenv strftime setsockopt tzset statvfs statfs inet_aton getpid kill)
-AC_FUNC_UTIME_NULL
+AC_FUNC_MEMCMP
AC_FUNC_ALLOCA
-AC_BROKEN_SPRINTF
-AC_REPLACE_FUNCS(getopt)
+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,
])
+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.],[
- AC_DEFINE(ZTS)
- AC_MSG_RESULT(yes)
+ if test "$enableval" = "yes"; then
+ AC_DEFINE(ZTS)
+ ZEND_SCANNER_SRC=zend-scanner.cc
+ ZEND_SCANNER_COMPILE='$(CXXCOMPILE) -c $< -o $@'
+ AC_MSG_RESULT(yes)
+ else
+ ZEND_SCANNER_SRC=zend-scanner.c
+ ZEND_SCANNER_COMPILE='$(COMPILE) -c $<'
+ AC_MSG_RESULT(no)
+ fi
],[
+ ZEND_SCANNER_SRC=zend-scanner.c
+ ZEND_SCANNER_COMPILE='$(COMPILE) -c $<'
AC_MSG_RESULT(no)
])
AC_SUBST(TSRM_DIR)
AC_SUBST(TSRM_LIB)
+AC_SUBST(ZEND_SCANNER_SRC)
+AC_SUBST(ZEND_SCANNER_COMPILE)
AC_SUBST(CFLAGS_SHLIB)
AC_SUBST(LDFLAGS_SHLIB)
AC_SUBST(LDFLAGS_SHLIB_EXPORT)
-AC_OUTPUT(Makefile, [], [])
+AC_OUTPUT(Makefile)
# Local Variables:
#ifdef ZTS
# include <fstream.h>
-# include <stdiostr.h>
+# ifdef HAVE_STDIOSTR_H
+# include <stdiostr.h>
+# endif
+# ifdef HAVE_STDIOSTREAM_H
+# include <stdiostream.h>
+# endif
# if WIN32||WINNT
# include <strstrea.h>
# else
# endif
#endif
-#if HAVE_STDARG_H
-#include <stdarg.h>
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
#endif
#ifdef ZTS
if (!file_handle->handle.fp) {
return FAILURE;
}
- file_handle->handle.is = new stdiostream(file_handle->handle.fp);
+ file_handle->handle.is = new istdiostream(file_handle->handle.fp);
break;
}
case ZEND_HANDLE_FP:
if (!file_handle->handle.fp) {
return FAILURE;
}
- file_handle->handle.is = new stdiostream(file_handle->handle.fp);
+ file_handle->handle.is = new istdiostream(file_handle->handle.fp);
}
break;
}
#define ZEND_VERSION "0.90"
-#include <stdarg.h>
-
#ifdef __cplusplus
#define BEGIN_EXTERN_C() extern "C" {
#define END_EXTERN_C() }
#define END_EXTERN_C()
#endif
-
#include <stdio.h>
/*
* general definitions
*/
-#if WINNT||WIN32
-#include "config.w32.h"
+#if (defined(WINNT) && WINNT) || (defined(WIN32) && WIN32)
+# include "zend_config.w32.h"
#else
-#include "zend_config.h"
-#include "config.unix.h"
+# include "zend_config.h"
+#endif
+
+/* all HAVE_XXX test have to be after the include of zend_config above */
+
+#ifdef HAVE_UNIX_H
+# include <unix.h>
+#endif
+
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
#endif
#if ZEND_DEBUG
#undef SUCCESS
#undef FAILURE
#define SUCCESS 0
-#define FAILURE -1 /* this MUST stay a negative number, or it may effect functions! */
+#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */
#include "zend_hash.h"
#define ZEND_MAX_RESERVED_RESOURCES 1
#endif /* _ZEND_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
#include "zend_constants.h"
#include "zend_operators.h"
-#if HAVE_STDARG_H
-#include <stdarg.h>
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
#endif
/* these variables are true statics/globals, and have to be mutex'ed on every access */
#include "zend.h"
#include "zend_alloc.h"
#include "zend_globals.h"
-#if HAVE_SIGNAL_H
-#include <signal.h>
+#ifdef HAVE_SIGNAL_H
+# include <signal.h>
#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
#endif
#ifndef ZTS
if (!p) {
fprintf(stderr,"FATAL: emalloc(): Unable to allocate %ld bytes\n", (long) size);
-#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
+#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
kill(getpid(), SIGSEGV);
#else
exit(1);
#include "zend.h"
-#if HAVE_STDARG_H
-#include <stdarg.h>
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
#endif
#include "zend_llist.h"
#define DEBUG_ZEND 0
#ifndef ZTS
-#define SUPPORT_INTERACTIVE 1
+# define SUPPORT_INTERACTIVE 1
#else
-#define SUPPORT_INTERACTIVE 0
+# define SUPPORT_INTERACTIVE 0
#endif
#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
#define HAVE_ALLOCA 1
#include <malloc.h>
-#define HAVE_DIRENT_H 0
-
-#define HAVE_KILL 0
-#define HAVE_GETPID 1
+#undef HAVE_KILL
+#define HAVE_GETPID 1
+#define HAVE_ALLOCA_H 1
+#define HAVE_MEMCPY 1
+#define HAVE_STRDUP 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_STDIOSTR_H 1
+#define istdiostream stdiostream
#ifdef inline
#undef inline
#include <stdio.h>
#include <signal.h>
-#if (HAVE_ALLOCA && HAVE_ALLOCA_H)
-#include <alloca.h>
+#if defined(HAVE_ALLOCA) && defined(HAVE_ALLOCA_H)
+# include <alloca.h>
#endif
#include "zend.h"
*/
+#include "zend.h"
+
#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include "zend.h"
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
#define HANDLE_NUMERIC(key,length,func) { \
register char *tmp=key; \
#include "zend_API.h"
#include "zend_globals.h"
-
ZEND_API int le_index_ptr;
static inline int zend_list_do_insert(HashTable *list,void *ptr, int type)
#include "zend.h"
#include "zend_ptr_stack.h"
-#if HAVE_STDARG_H
-#include <stdarg.h>
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
#endif
-
ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack)
{
stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE);
#include "zend.h"
-#if HAVE_STDARG_H
-#include <stdarg.h>
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
#endif
#if BROKEN_SPRINTF