diff options
author | Stig S. Bakken <stig@php.net> | 1999-09-06 16:14:08 +0000 |
---|---|---|
committer | Stig S. Bakken <stig@php.net> | 1999-09-06 16:14:08 +0000 |
commit | 009025e00d073e70a9107183068bba31525c2159 (patch) | |
tree | b051cae4f99d5b1692a4850f6ea2840808c6023c | |
parent | 4d5491e2857f80ad758716e6b0964cac3a514ac7 (diff) | |
download | php-git-009025e00d073e70a9107183068bba31525c2159.tar.gz |
* header file cleanup
* fixed --enable-thread-safety build for UNIX
I don't have a Win32 environment available, could someone please try
compiling on Win32 to see if I got all the header file stuff right there?
-rw-r--r-- | Zend/Makefile.am | 6 | ||||
-rw-r--r-- | Zend/acconfig.h | 70 | ||||
-rw-r--r-- | Zend/acinclude.m4 | 8 | ||||
-rw-r--r-- | Zend/config.unix.h | 59 | ||||
-rw-r--r-- | Zend/configure.in | 46 | ||||
-rw-r--r-- | Zend/zend-scanner.l | 19 | ||||
-rw-r--r-- | Zend/zend.h | 29 | ||||
-rw-r--r-- | Zend/zend_API.c | 4 | ||||
-rw-r--r-- | Zend/zend_alloc.c | 10 | ||||
-rw-r--r-- | Zend/zend_compile.h | 8 | ||||
-rw-r--r-- | Zend/zend_config.w32.h (renamed from Zend/config.w32.h) | 12 | ||||
-rw-r--r-- | Zend/zend_execute.c | 4 | ||||
-rw-r--r-- | Zend/zend_hash.c | 11 | ||||
-rw-r--r-- | Zend/zend_list.c | 1 | ||||
-rw-r--r-- | Zend/zend_ptr_stack.c | 5 | ||||
-rw-r--r-- | Zend/zend_sprintf.c | 4 |
16 files changed, 157 insertions, 139 deletions
diff --git a/Zend/Makefile.am b/Zend/Makefile.am index de43d27348..54759105cd 100644 --- a/Zend/Makefile.am +++ b/Zend/Makefile.am @@ -12,8 +12,14 @@ libzend_a_SOURCES=\ 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 diff --git a/Zend/acconfig.h b/Zend/acconfig.h index 7a80526f55..424af6f84d 100644 --- a/Zend/acconfig.h +++ b/Zend/acconfig.h @@ -1,3 +1,21 @@ +#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 @@ -11,19 +29,6 @@ /* 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 @@ -32,9 +37,6 @@ #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 */ @@ -48,3 +50,39 @@ /* 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: + */ diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 index 9b1421eb6e..f8a1eb75d8 100644 --- a/Zend/acinclude.m4 +++ b/Zend/acinclude.m4 @@ -5,16 +5,16 @@ dnl This file contains local autoconf functions. 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) ]) ]) diff --git a/Zend/config.unix.h b/Zend/config.unix.h deleted file mode 100644 index 149d75f018..0000000000 --- a/Zend/config.unix.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | 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 */ diff --git a/Zend/configure.in b/Zend/configure.in index 8f3c3fad1c..a947b35a2a 100644 --- a/Zend/configure.in +++ b/Zend/configure.in @@ -24,6 +24,7 @@ else AC_MSG_RESULT($1.$2 (ok)) fi AC_PROG_CC +AC_PROG_CXX AC_PROG_RANLIB AC_PROG_CC_C_O AM_PROG_LEX @@ -56,25 +57,20 @@ AC_CHECK_LIB(c, dlopen, [ 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 ) @@ -82,11 +78,10 @@ AC_CHECK_TYPE( ulong, unsigned long ) 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, @@ -129,22 +124,35 @@ AC_ARG_ENABLE(memory-limit, ]) +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: diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l index 6d32518077..d113c3d520 100644 --- a/Zend/zend-scanner.l +++ b/Zend/zend-scanner.l @@ -51,7 +51,12 @@ #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 @@ -59,12 +64,12 @@ # 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 @@ -224,7 +229,7 @@ ZEND_API inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC) 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: @@ -234,7 +239,7 @@ ZEND_API inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC) 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; } diff --git a/Zend/zend.h b/Zend/zend.h index c43c31805b..5e29d56977 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -23,8 +23,6 @@ #define ZEND_VERSION "0.90" -#include <stdarg.h> - #ifdef __cplusplus #define BEGIN_EXTERN_C() extern "C" { #define END_EXTERN_C() } @@ -33,18 +31,26 @@ #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 @@ -84,7 +90,7 @@ typedef unsigned char zend_bool; #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" @@ -287,3 +293,10 @@ extern zend_utility_values zend_uv; #define ZEND_MAX_RESERVED_RESOURCES 1 #endif /* _ZEND_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ diff --git a/Zend/zend_API.c b/Zend/zend_API.c index d324d877d8..23db2b88f1 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -26,8 +26,8 @@ #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 */ diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 29aa3bca69..97cc8801b1 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -23,11 +23,11 @@ #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 @@ -124,7 +124,7 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) 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); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 291390f41b..7b9a642191 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -23,8 +23,8 @@ #include "zend.h" -#if HAVE_STDARG_H -#include <stdarg.h> +#ifdef HAVE_STDARG_H +# include <stdarg.h> #endif #include "zend_llist.h" @@ -34,9 +34,9 @@ #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); diff --git a/Zend/config.w32.h b/Zend/zend_config.w32.h index 6fe160e72a..b4184b241e 100644 --- a/Zend/config.w32.h +++ b/Zend/zend_config.w32.h @@ -31,10 +31,14 @@ typedef unsigned int uint; #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 diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index a55313f95d..d4696ccd94 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -21,8 +21,8 @@ #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" diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index db14bdf770..19e45a47ef 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -18,12 +18,17 @@ */ +#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; \ diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 0aade1c525..21555cacea 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -25,7 +25,6 @@ #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) diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c index 3048d99c2a..17ed0a4b1f 100644 --- a/Zend/zend_ptr_stack.c +++ b/Zend/zend_ptr_stack.c @@ -20,11 +20,10 @@ #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); diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c index 1094451cec..878ba32d28 100644 --- a/Zend/zend_sprintf.c +++ b/Zend/zend_sprintf.c @@ -22,8 +22,8 @@ #include "zend.h" -#if HAVE_STDARG_H -#include <stdarg.h> +#ifdef HAVE_STDARG_H +# include <stdarg.h> #endif #if BROKEN_SPRINTF |