Commits

Ruslan Osmanov committed 3058950

Fixed #7: static building was not supported(Tim)

Comments (0)

Files changed (3)

 [  --enable-ev-debug       Enable ev debug support], no, no)
 
 if test "$PHP_EV" != "no"; then
-  export OLD_CPPFLAGS="$CPPFLAGS"
-  export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_EV"
-  AC_MSG_CHECKING(PHP version)
-  AC_TRY_COMPILE([#include <php_version.h>], [
-#if PHP_VERSION_ID < 50400
-#error  this extension requires at least PHP version 5.4.0
-#endif
-],
-[AC_MSG_RESULT(ok)],
-[AC_MSG_ERROR([need at least PHP 5.4.0])])
-  export CPPFLAGS="$OLD_CPPFLAGS"
+  AC_MSG_CHECKING(whether Ev supports the current PHP version)
+  tmp_php_version=$PHP_VERSION
+  if test -z "$tmp_php_version"; then
+    if test -z "$PHP_CONFIG"; then
+      AC_MSG_ERROR([php-config not found])
+    fi
+    PHP_EV_VERSION_ORIG=`$PHP_CONFIG --version`;
+  else
+    PHP_EV_VERSION_ORIG=$tmp_php_version
+  fi
+
+  if test -z $PHP_EV_VERSION_ORIG; then
+    AC_MSG_ERROR([failed to detect PHP version, please file a bug])
+  fi
+
+  PHP_EV_VERSION_MASK=`echo ${PHP_EV_VERSION_ORIG} | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
+  if test $PHP_EV_VERSION_MASK -lt 5004000; then
+    AC_MSG_ERROR([need at least PHP 5.4.0])
+  else
+    AC_MSG_RESULT([ok])
+  fi
 
   if test "$PHP_EV_DEBUG" != "no"; then
-    CFLAGS="$CFLAGS -Wall -g -ggdb -O0"
+    PHP_EV_CFLAGS="$PHP_EV_CFLAGS -Wall -g -ggdb -O0"
     AC_DEFINE(PHP_EV_DEBUG, 1, [Enable ev debug support])
   else
     AC_DEFINE(NDEBUG, 1, [With NDEBUG defined assert generates no code])
 
   AC_DEFINE(EV_H, "embed.h", [Wrapper for libev/ev.h])
   AC_DEFINE(HAVE_EV, 1, [ ])
-  m4_include([libev/libev.m4])
 
-  LDFLAGS="$LDFLAGS -lpthread"
+  if test "$ext_shared" != "yes" && test "$ext_shared" != "shared"; then
+    PHP_EV_CONFIG_H='\"main/php_config.h\"'
+    AC_DEFINE(EV_CONFIG_H, "main/php_config.h", [Overide config.h included in libev/ev.c])
+    PHP_EV_CFLAGS="$PHP_EV_CFLAGS -DEV_CONFIG_H="$PHP_EV_CONFIG_H
+    define('PHP_EV_STATIC', 1)
+  fi
+
+  m4_include(ifdef('PHP_EV_STATIC',PHP_EXT_BUILDDIR(ev)[/],)[libev/libev.m4])
+
+  LIBS="$LIBS -lpthread"
   PHP_ADD_LIBRARY(pthread)
 
+  PHP_EV_CFLAGS="-I@ext_srcdir@/libev $PHP_EV_CFLAGS"
+
   ev_src="libev/ev.c util.c ev.c watcher.c fe.c pe.c"
-  PHP_NEW_EXTENSION(ev, $ev_src, $ext_shared,,$CFLAGS)
+  PHP_NEW_EXTENSION(ev, $ev_src, $ext_shared,,$PHP_EV_CFLAGS)
+
+  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-16</date>
+  <date>2013-08-23</date>
   <!--{{{ Current version -->
   <version>
-    <release>0.2.10</release>
+    <release>0.2.11</release>
     <api>0.2.0</api>
   </version>
   <stability>
   </stability>
   <license uri="http://www.php.net/license">PHP</license>
   <notes><![CDATA[
-  Fix: segmentation fault after watcher restart(Frank Mayer)
-  Fix: missing get_gc property handler
-  Fix: operators applied to uninitialized EvWatcher::data property caused unexpected results
+  Fixed #7: static building was not supported(Tim)
   ]]></notes>
   <!--}}}-->
   <!--{{{ Contents -->
   </extsrcrelease>
   <!--{{{ changelog-->
   <changelog>
+    <!--{{{ 0.2.11 -->
+    <release>
+      <version>
+        <release>0.2.11</release>
+        <api>0.2.0</api>
+      </version>
+      <stability>
+        <release>stable</release>
+        <api>stable</api>
+      </stability>
+      <license uri="http://www.php.net/license">PHP</license>
+      <notes><![CDATA[
+  Fixed #7: static building was not supported(Tim)
+  ]]></notes>
+    </release>
+    <!--}}}-->
     <!--{{{ 0.2.10 -->
     <release>
       <version>
 extern zend_module_entry ev_module_entry;
 #define phpext_ev_ptr &ev_module_entry
 
-#define PHP_EV_VERSION "0.2.10"
+#define PHP_EV_VERSION "0.2.11"
 
 #endif /* PHP_EV_H */
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.