|
1 | | -PHP_ARG_ENABLE(uv, Whether to enable the "uv" extension, |
2 | | -[ --enable-uv Enable "uv" extension support]) |
| 1 | +PHP_ARG_WITH(uv, Whether to include "uv" support, |
| 2 | +[ --with-uv[=DIR] Include "uv" support]) |
3 | 3 |
|
4 | 4 | PHP_ARG_ENABLE(httpparser, Whether to enable the "httpparser" module, |
5 | | - [ --enable-httpparser Enable "httpparser" module support]) |
| 5 | + [ --enable-httpparser Enable "httpparser" module support], no, no) |
6 | 6 |
|
7 | 7 | PHP_ARG_ENABLE(uv-debug, for uv debug support, |
8 | | - [ --enable-uv-debug Enable enable uv deubg support], no, no) |
| 8 | + [ --enable-uv-debug Enable enable uv debug support], no, no) |
9 | 9 |
|
10 | 10 | PHP_ARG_ENABLE(dtrace, Whether to enable the "dtrace" debug, |
11 | 11 | [ --enable-dtrace Enable "dtrace" support], no, no) |
@@ -44,32 +44,49 @@ if test $PHP_UV != "no"; then |
44 | 44 | SOURCES="" |
45 | 45 |
|
46 | 46 | if test $PHP_HTTPPARSER != "no"; then |
47 | | - SOURCES=" http-parser/http_parser.c" |
| 47 | + SOURCES=" uv_http_parser.c http-parser/http_parser.c" |
48 | 48 | AC_DEFINE([ENABLE_HTTPPARSER], [1], [ Enable http parser]) |
49 | 49 | fi |
50 | 50 |
|
51 | 51 | PHP_NEW_EXTENSION(uv, php_uv.c uv.c $SOURCES, $ext_shared) |
52 | 52 |
|
| 53 | + PHP_ADD_EXTENSION_DEP(uv, sockets) |
| 54 | + |
53 | 55 | if test $PHP_HTTPPARSER != "no"; then |
54 | 56 | PHP_ADD_INCLUDE([$ext_srcdir/http-parser]) |
55 | 57 | fi |
56 | | - PHP_ADD_INCLUDE([$ext_srcdir/libuv/include]) |
57 | 58 |
|
58 | | - CFLAGS=" $CFLAGS -Wunused-variable -Wpointer-sign -Wimplicit-function-declaration -Winline -Wunused-macros -Wredundant-decls -Wstrict-aliasing=2 -Wswitch-enum -Wdeclaration-after-statement -Wl,libuv/libuv.a" |
| 59 | + SEARCH_PATH="/usr/local /usr" |
| 60 | + SEARCH_FOR="/include/uv.h" |
| 61 | + if test -r $PHP_UV/$SEARCH_FOR; then # path given as parameter |
| 62 | + UV_DIR=$PHP_UV |
| 63 | + else # search default path list |
| 64 | + AC_MSG_CHECKING([for libuv files in default path]) |
| 65 | + for i in $SEARCH_PATH ; do |
| 66 | + if test -r $i/$SEARCH_FOR; then |
| 67 | + UV_DIR=$i |
| 68 | + AC_MSG_RESULT(found in $i) |
| 69 | + fi |
| 70 | + done |
| 71 | + fi |
59 | 72 |
|
60 | | - case $host in |
61 | | - *darwin*) |
62 | | - dnl these macro does not work. why? |
63 | | - dnl |
64 | | - dnl PHP_ADD_FRAMEWORK(CoreServices) |
65 | | - dnl PHP_ADD_FRAMEWORK(Carbon) |
| 73 | + PHP_ADD_INCLUDE($UV_DIR/include) |
66 | 74 |
|
67 | | - CFLAGS="$CFLAGS -framework CoreServices -framework Carbon" |
68 | | - ;; |
| 75 | + PHP_CHECK_LIBRARY(uv, uv_version, |
| 76 | + [ |
| 77 | + PHP_ADD_LIBRARY_WITH_PATH(uv, $UV_DIR/lib, UV_SHARED_LIBADD) |
| 78 | + AC_DEFINE(HAVE_UVLIB,1,[ ]) |
| 79 | + ],[ |
| 80 | + AC_MSG_ERROR([wrong uv library version or library not found]) |
| 81 | + ],[ |
| 82 | + -L$UV_DIR/lib -lm |
| 83 | + ]) |
| 84 | + |
| 85 | + case $host in |
69 | 86 | *linux*) |
70 | 87 | CFLAGS="$CFLAGS -lrt" |
71 | 88 | esac |
72 | 89 |
|
| 90 | + PHP_SUBST([CFLAGS]) |
73 | 91 | PHP_SUBST(UV_SHARED_LIBADD) |
74 | | - PHP_SUBST([CFLAGS]) |
75 | 92 | fi |
0 commit comments