Changeset 73

Show
Ignore:
Timestamp:
05/05/05 10:53:05 (3 years ago)
Author:
zoeloelip
Message:

This patch fixes some stuff concerning configuration. With this patch some parts that are forgotten with the
code split are fixed. They are also needed to compile eA with VC.
The other stuff make it possible to compile eA as a static module for php.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/config.m4

    r64 r73  
     1AC_DEFUN([EA_REMOVE_IPC_TEST], [ 
     2  # for cygwin ipc error 
     3  if test -f conftest* ; then 
     4    echo $ECHO_N "Wait for conftest* to exit$ECHO_C" 
     5    while ! rm -f conftest* 2>/dev/null ; do 
     6      echo $ECHO_N ".$ECHO_C" 
     7      sleep 1 
     8    done 
     9    echo 
     10  fi 
     11]) 
     12 
    113AC_ARG_WITH(eaccelerator,[],[enable_eaccelerator=$withval]) 
    214 
     
    148160#define MM_SHM_IPC 
    149161#define MM_TEST_SHM 
    150 #include "mm.c" 
     162#include "$ext_srcdir/mm.c" 
    151163],dnl 
    152164    mm_shm_ipc=yes 
    153165    msg=yes,msg=no,msg=no) 
    154166  AC_MSG_RESULT([$msg]) 
     167  EA_REMOVE_IPC_TEST() 
    155168 
    156169  AC_MSG_CHECKING(for mmap shared memory support) 
     
    158171#define MM_SHM_MMAP_FILE 
    159172#define MM_TEST_SHM 
    160 #include "mm.c" 
     173#include "$ext_srcdir/mm.c" 
    161174],dnl 
    162175    mm_shm_mmap_file=yes 
     
    168181#define MM_SHM_MMAP_ZERO 
    169182#define MM_TEST_SHM 
    170 #include "mm.c" 
     183#include "$ext_srcdir/mm.c" 
    171184],dnl 
    172185    mm_shm_mmap_zero=yes 
     
    178191#define MM_SHM_MMAP_ANON 
    179192#define MM_TEST_SHM 
    180 #include "mm.c" 
     193#include "$ext_srcdir/mm.c" 
    181194],dnl 
    182195    mm_shm_mmap_anon=yes 
     
    188201#define MM_SHM_MMAP_POSIX 
    189202#define MM_TEST_SHM 
    190 #include "mm.c" 
     203#include "$ext_srcdir/mm.c" 
    191204],dnl 
    192205    mm_shm_mmap_posix=yes 
     
    210223    AC_DEFINE(MM_SHM_MMAP_FILE, 1, [Define if you like to use mmap on temporary file shared memory]) 
    211224    msg="mmap" 
    212   fi 
    213   AC_MSG_RESULT([$msg]) 
     225  else 
     226    msg="no" 
     227  fi 
     228  AC_MSG_RESULT([$msg]) 
     229  if test "$msg" = "no" ; then 
     230    AC_MSG_WARN([eaccelerator cannot detect shared memory type, which is required]) 
     231  fi 
    214232 
    215233  AC_MSG_CHECKING(for spinlock semaphores support) 
    216234  AC_TRY_RUN([#define MM_SEM_SPINLOCK 
    217235#define MM_TEST_SEM 
    218 #include "mm.c" 
     236#include "$ext_srcdir/mm.c" 
    219237],dnl 
    220238    mm_sem_spinlock=yes 
     
    225243  AC_TRY_RUN([#define MM_SEM_PTHREAD 
    226244#define MM_TEST_SEM 
    227 #include "mm.c" 
     245#include "$ext_srcdir/mm.c" 
    228246],dnl 
    229247    mm_sem_pthread=yes 
     
    234252  AC_TRY_RUN([#define MM_SEM_POSIX 
    235253#define MM_TEST_SEM 
    236 #include "mm.c" 
     254#include "$ext_srcdir/mm.c" 
    237255],dnl 
    238256    mm_sem_posix=yes 
     
    243261  AC_TRY_RUN([#define MM_SEM_IPC 
    244262#define MM_TEST_SEM 
    245 #include "mm.c" 
     263#include "$ext_srcdir/mm.c" 
    246264],dnl 
    247265    mm_sem_ipc=yes 
    248266    msg=yes,msg=no,msg=no) 
    249267  AC_MSG_RESULT([$msg]) 
     268  EA_REMOVE_IPC_TEST() 
    250269 
    251270  AC_MSG_CHECKING(for fcntl semaphores support) 
    252271  AC_TRY_RUN([#define MM_SEM_FCNTL 
    253272#define MM_TEST_SEM 
    254 #include "mm.c" 
     273#include "$ext_srcdir/mm.c" 
    255274],dnl 
    256275    mm_sem_fcntl=yes 
     
    261280  AC_TRY_RUN([#define MM_SEM_FLOCK 
    262281#define MM_TEST_SEM 
    263 #include "mm.c" 
     282#include "$ext_srcdir/mm.c" 
    264283],dnl 
    265284    mm_sem_flock=yes 
     
    286305    AC_DEFINE(MM_SEM_POSIX, 1, [Define if you like to use posix based semaphores]) 
    287306    msg="posix" 
    288   fi 
    289   AC_MSG_RESULT([$msg]) 
     307  else 
     308    msg="no" 
     309  fi 
     310  AC_MSG_RESULT([$msg]) 
     311  if test "$msg" = "no" ; then 
     312    AC_MSG_WARN([eaccelerator cannot semaphores type, which is required]) 
     313  fi 
    290314 
    291315  AC_CHECK_FUNC(sched_yield,[ 
     
    298322 
    299323  old_cppflags="$CPPFLAGS" 
    300   CPPFLAGS="$CPPFLAGS $INCLUDES
     324  CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir
    301325  AC_MSG_CHECKING(for ext/session/php_session.h) 
    302326  AC_TRY_CPP([#include "ext/session/php_session.h"],msg="yes",msg="no") 
  • eaccelerator/trunk/eaccelerator.c

    r71 r73  
    7070*/ 
    7171 
    72 #ifdef ZEND_WIN32 
    73 #  include <process.h> 
    74 #  ifndef S_ISREG 
    75 #    define S_ISREG(mode) (((mode)&S_IFMT) & S_IFREG) 
    76 #  endif 
    77 #  ifndef S_IRUSR 
    78 #    define S_IRUSR S_IREAD 
    79 #  endif 
    80 #  ifndef S_IWUSR 
    81 #    define S_IWUSR S_IWRITE 
    82 #  endif 
    83 #else 
    84 #  include <dirent.h> 
    85 #endif 
    86  
    8772#include "php.h" 
    8873#include "php_ini.h" 
     
    120105static int eaccelerator_is_extension      = 0; 
    121106static zend_extension* ZendOptimizer = NULL; 
    122 #ifdef ZTS 
    123 static MUTEX_T mm_mutex; 
    124 #endif 
    125107 
    126108static HashTable eaccelerator_global_function_table; 
     
    142124/* external declarations */ 
    143125PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC); 
    144 PHPAPI char *php_get_uname(); 
    145126 
    146127ZEND_DLEXPORT zend_op_array* eaccelerator_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC); 
     
    950931  return ret; 
    951932} 
    952  
    953 typedef union align_union { 
    954   double d; 
    955   void *v; 
    956   int (*func)(int); 
    957   long l; 
    958 } align_union; 
    959  
    960 #if (defined (__GNUC__) && __GNUC__ >= 2) 
    961 #define EACCELERATOR_PLATFORM_ALIGNMENT (__alignof__ (align_test)) 
    962 #else 
    963 #define EACCELERATOR_PLATFORM_ALIGNMENT (sizeof(align_union)) 
    964 #endif 
    965  
    966 #define EACCELERATOR_ALIGN(n) (n) = (void*)((((size_t)(n)-1) & ~(EACCELERATOR_PLATFORM_ALIGNMENT-1)) + EACCELERATOR_PLATFORM_ALIGNMENT) 
    967933 
    968934/******************************************************************************/ 
  • eaccelerator/trunk/eaccelerator.h

    r64 r73  
    4545#endif 
    4646 
    47 #ifndef ZEND_WIN32 
     47#if !defined(ZEND_WIN32) && defined(HAVE_CONFIG_H) 
    4848#  if ZEND_MODULE_API_NO >= 20001222 
    4949#    include "config.h" 
     
    5151#    include "php_config.h" 
    5252#  endif 
     53#endif 
     54 
     55/* needed to compile eA as a static php module */ 
     56extern zend_module_entry eaccelerator_module_entry; 
     57#define phpext_eaccelerator_ptr &eaccelerator_module_entry 
     58 
     59/* fixes compile errors on php5.1 */ 
     60#ifdef STR_EMPTY_ALLOC 
     61#define empty_string STR_EMPTY_ALLOC() 
    5362#endif 
    5463 
     
    8998#  ifndef ZEND_WIN32 
    9099#    ifdef HAVE_FLOCK 
     100#          include <sys/file.h> 
    91101#      define EACCELERATOR_FLOCK(FILE,OP) flock((FILE),(OP)) 
    92102#    else 
     
    119129#endif 
    120130 
     131#ifdef ZEND_WIN32 
     132#  include <process.h> 
     133#  ifndef S_ISREG 
     134#    define S_ISREG(mode) (((mode)&S_IFMT) & S_IFREG) 
     135#  endif 
     136#  ifndef S_IRUSR 
     137#    define S_IRUSR S_IREAD 
     138#  endif 
     139#  ifndef S_IWUSR 
     140#    define S_IWUSR S_IWRITE 
     141#  endif 
     142#else 
     143#  include <dirent.h> 
     144#endif 
     145 
    121146#ifdef ZTS 
    122147#  define ZTS_LOCK()    tsrm_mutex_lock(mm_mutex) 
     
    164189#define MAX_DUP_STR_LEN 256 
    165190 
    166 #define offsetof(str,fld) ((size_t)&(((str*)NULL)->fld)) 
     191#ifndef offsetof 
     192#  define offsetof(str,fld) ((size_t)&(((str*)NULL)->fld)) 
     193#endif 
    167194 
    168195#define EACCELERATOR_EXTENSION_NAME "eAccelerator" 
     
    377404} mm_cond_entry; 
    378405 
     406typedef union align_union { 
     407  double d; 
     408  void *v; 
     409  int (*func)(int); 
     410  long l; 
     411} align_union; 
     412 
    379413/******************************************************************************/ 
     414 
     415#ifdef ZTS 
     416MUTEX_T mm_mutex; 
     417#endif 
    380418 
    381419void format_size (char *s, unsigned int size, int legend); 
  • eaccelerator/trunk/mm.c

    r63 r73  
    11/* libmm replacement */ 
    22 
    3 #ifdef HAVE_CONFIG_H 
     3#if !defined(MM_TEST_SHM) && !defined(MM_TEST_SEM) 
     4# ifdef HAVE_CONFIG_H 
    45#  include "config.h" 
     6# endif 
     7# include "php.h" 
    58#endif 
    69 
     
    580583 
    581584#define MM_SHM_TYPE "sysvipc" 
     585 
     586#ifndef SHM_R 
     587# define SHM_R 0444 /* read permission */ 
     588#endif 
     589#ifndef SHM_W 
     590# define SHM_W 0222 /* write permission */ 
     591#endif 
    582592 
    583593static MM* mm_create_shm(const char* key, size_t size) { 
  • eaccelerator/trunk/webui.c

    r64 r73  
    6161 
    6262extern eaccelerator_mm *eaccelerator_mm_instance; 
     63PHPAPI char *php_get_uname(); 
    6364 
    6465/******************************************************************************/ 
     
    283284}; 
    284285 
    285 static char *color (int num) 
     286static char const *color (int num) 
    286287{ 
    287288        return color_list[num % (sizeof (color_list) / sizeof (char *))];