Commits

rickysu  committed 6053d66 Merge

Merge remote-tracking branch 'upstream/master'

  • Participants
  • Parent commits dd9163c, b144305

Comments (0)

Files changed (6)

 
 	# make install
 
+##NOTES
+
+Methods of the Event extension accept different types of resources containing a
+file descriptor: a castable PHP stream, socket resource, or just a number(the
+file descriptor itself). If you don't have _sockets_ extension installed, or
+just don't plan to use the standard PHP sockets, then configure Event with
+`--disable-event-sockets` option, or choose `n`("No") when the PEAR installer
+asks whether `sockets` support is required.
+
 
 FINALLY
-------
+-------
 
 In <php.ini>, or some other configuration like
 </usr/local/etc/php/conf.d/ev.ini> write:
 dnl | Author: Ruslan Osmanov <osmanov@php.net>                             |
 dnl +----------------------------------------------------------------------+
 
-PHP_ARG_WITH(event-core, for event core support,
+PHP_ARG_WITH(event-core, for Event core support,
 [  --with-event-core        Include core libevent support])
 
-PHP_ARG_WITH(event-pthreads, for event thread safety support,
-[  --with-event-pthreads    Include libevent's pthreads library and enable thread safety support in event], no, no)
+PHP_ARG_WITH(event-pthreads, for Event thread safety support,
+[  --with-event-pthreads    Include libevent's pthreads library and enable thread safety support in Event], no, no)
 
-PHP_ARG_WITH(event-extra, for event extra functionality support,
+PHP_ARG_WITH(event-extra, for Event extra functionality support,
 [  --with-event-extra       Include libevent protocol-specific functionality support including HTTP, DNS, and RPC], yes, no)
 
 PHP_ARG_WITH(event-openssl, for OpenSSL support in event,
 [  --with-event-libevent-dir[=DIR] Event: libevent installation prefix], no, no)
 
 PHP_ARG_ENABLE(event-debug, whether Event debugging support enabled,
-[  --enable-event-debug     Enable debug support in event], no, no)
+[  --enable-event-debug     Enable debug support in Event], no, no)
+
+PHP_ARG_ENABLE(event-sockets, whether to enable sockets support in Event,
+[  --enable-event-sockets Enable sockets support in Event], yes, no)
 
 if test "$PHP_EVENT_CORE" != "no"; then
   dnl {{{ Check for PHP version
     EVENT_LIBS="-L$EVENT_DIR/$PHP_LIBDIR"
     EVENT_LIBDIR=$EVENT_DIR/$PHP_LIBDIR
   fi
-  LDFLAGS="$EVENT_LIBS -levent_core $LDFLAGS"
+  LDFLAGS="$EVENT_LIBS $LDFLAGS"
+  LIBS="$LIBS -levent_core"
 
   dnl {{{ event_core
 	AC_CHECK_LIB(event_core, event_free, [
   PHP_ADD_INCLUDE($ext_builddir/src)
   PHP_ADD_INCLUDE($ext_builddir/classes)
   PHP_ADD_INCLUDE($ext_builddir)
-  PHP_ADD_EXTENSION_DEP(event, sockets, true)
   PHP_SUBST(EVENT_SHARED_LIBADD)
   PHP_SUBST(CFLAGS)
   PHP_SUBST(LDLAGS)
+  PHP_SUBST(LIBS)
+
+  dnl This works with static building only
+  dnl test -z $PHP_SOCKETS && PHP_SOCKETS="no"
+
+  if test "$PHP_EVENT_SOCKETS" != "no"; then
+    AC_CHECK_HEADERS([$phpincludedir/ext/sockets/php_sockets.h], ,
+      [
+        AC_MSG_ERROR([Couldn't find $phpincludedir/sockets/php_sockets.h. Please check if sockets extension installed])
+      ]
+    )
+    PHP_ADD_EXTENSION_DEP(event, sockets)
+    AC_DEFINE(PHP_EVENT_SOCKETS, 1, [Whether sockets extension is required])
+    dnl Hack for distroes installing sockets separately
+    AC_DEFINE(HAVE_SOCKETS, 1, [Whether sockets extension is enabled])
+  fi
+
+  PHP_ADD_MAKEFILE_FRAGMENT
 fi
 
 dnl vim: ft=m4.sh fdm=marker cms=dnl\ %s
     <email>osmanov@php.net</email>
     <active>yes</active>
   </lead>
-  <date>2013-08-14</date>
+  <date>2013-09-08</date>
   <!--{{{ Current version -->
   <version>
-    <release>1.7.4</release>
+    <release>1.7.7</release>
     <api>1.7.0</api>
   </version>
   <stability>
   </stability>
   <license uri="http://www.php.net/license">PHP</license>
   <notes><![CDATA[
-  Fix: Segmentation fault caused by direct access to the zend object properties' hash table
+  Fix: incorrect handling of sockets extension dependency
+  (a hack for distros installing sockets separately)
   ]]></notes>
   <!--}}}-->
   <!--{{{ Contents -->
   </dependencies>
   <providesextension>event</providesextension>
   <extsrcrelease>
-    <configureoption default="no" name="enable-event-debug" prompt="Enable internal debugging in event"/>
+    <configureoption default="no" name="enable-event-debug" prompt="Enable internal debugging in Event"/>
+    <configureoption default="yes" name="enable-event-sockets" prompt="Enable sockets support in Event"/>
     <configureoption default="/usr" name="with-event-libevent-dir" prompt="libevent installation prefix"/>
-    <configureoption default="no" name="with-event-pthreads" prompt="Include libevent's pthreads library and enable thread safety support in event"/>
+    <configureoption default="no" name="with-event-pthreads" prompt="Include libevent's pthreads library and enable thread safety support in Event"/>
     <configureoption default="yes" name="with-event-extra" prompt="Include libevent protocol-specific functionality support including HTTP, DNS, and RPC"/>
     <configureoption default="yes" name="with-event-openssl" prompt="Include libevent OpenSSL support"/>
     <configureoption default="no" name="with-openssl-dir" prompt="openssl installation prefix"/>
   </extsrcrelease>
   <!--{{{ changelog-->
   <changelog>
+    <!--{{{ 1.7.7 -->
+    <release>
+      <version>
+        <release>1.7.7</release>
+        <api>1.7.0</api>
+      </version>
+      <stability>
+        <release>stable</release>
+        <api>stable</api>
+      </stability>
+      <license uri="http://www.php.net/license">PHP</license>
+      <notes><![CDATA[
+  Fix: incorrect handling of sockets extension dependency
+  (a hack for distros installing sockets separately)
+  ]]></notes>
+    </release>
+    <!--}}}-->
+    <!--{{{ 1.7.6 -->
+    <release>
+      <version>
+        <release>1.7.6</release>
+        <api>1.7.0</api>
+      </version>
+      <stability>
+        <release>stable</release>
+        <api>stable</api>
+      </stability>
+      <license uri="http://www.php.net/license">PHP</license>
+      <notes><![CDATA[
+  Change: sockets extension is now required(see bug #65597). The user can still
+  turn off this requirement off explicitly with --disable-event-sockets configure
+  option
+  ]]></notes>
+    </release>
+    <!--}}}-->
+    <!--{{{ 1.7.5 -->
+    <release>
+      <version>
+        <release>1.7.5</release>
+        <api>1.7.0</api>
+      </version>
+      <stability>
+        <release>stable</release>
+        <api>stable</api>
+      </stability>
+      <license uri="http://www.php.net/license">PHP</license>
+      <notes><![CDATA[
+  Fix: build error with custom libevent installation prefixes like /lib(John Wamer)
+  ]]></notes>
+    </release>
+    <!--}}}-->
     <!--{{{ 1.7.4 -->
     <release>
       <version>
 static zend_object_handlers object_handlers;
 
 static const zend_module_dep event_deps[] = {
-	ZEND_MOD_OPTIONAL("sockets")
+#ifdef PHP_EVENT_SOCKETS_SUPPORT
+	ZEND_MOD_REQUIRED("sockets")
+#endif
 	{NULL, NULL, NULL}
 };
 
 PHP_MINFO_FUNCTION(event)
 {
 	php_info_print_table_start();
-	php_info_print_table_header(2, "event support", "enabled");
+	php_info_print_table_header(2, "Event support", "enabled");
+#ifdef PHP_EVENT_SOCKETS_SUPPORT
+	php_info_print_table_header(2, "Sockets support", "enabled");
+#else
+	php_info_print_table_header(2, "Sockets support", "disabled");
+#endif
 #ifdef PHP_EVENT_DEBUG 
 	php_info_print_table_row(2, "Debug support", "enabled");
 #else
 #ifndef PHP_EVENT_H
 #define PHP_EVENT_H
 
-#define PHP_EVENT_VERSION "1.7.4"
+#define PHP_EVENT_VERSION "1.7.7"
 
 #define PHP_EVENT_SUN_PREFIX "unix:"
 

File src/common.h

 
 #include <signal.h>
 
-#if PHP_VERSION_ID >= 50301 && (HAVE_SOCKETS || defined(COMPILE_DL_SOCKETS))
-# include <ext/sockets/php_sockets.h>
+#ifdef PHP_EVENT_SOCKETS
+# include "ext/sockets/php_sockets.h"
 # define PHP_EVENT_SOCKETS_SUPPORT
 #endif