Skip to content

Commit 77240aa

Browse files
committed
Using --with-uv[=DIR] configure line
1 parent b06dac0 commit 77240aa

File tree

1 file changed

+36
-16
lines changed

1 file changed

+36
-16
lines changed

config.m4

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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])
33

44
PHP_ARG_ENABLE(httpparser, Whether to enable the "httpparser" module,
55
[ --enable-httpparser Enable "httpparser" module support])
@@ -53,23 +53,43 @@ if test $PHP_UV != "no"; then
5353
if test $PHP_HTTPPARSER != "no"; then
5454
PHP_ADD_INCLUDE([$ext_srcdir/http-parser])
5555
fi
56-
PHP_ADD_INCLUDE([$ext_srcdir/libuv/include])
5756

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"
57+
SEARCH_PATH="/usr/local /usr"
58+
SEARCH_FOR="/include/uv.h"
59+
if test -r $PHP_UV/$SEARCH_FOR; then # path given as parameter
60+
UV_DIR=$PHP_UV
61+
else # search default path list
62+
AC_MSG_CHECKING([for libuv files in default path])
63+
for i in $SEARCH_PATH ; do
64+
if test -r $i/$SEARCH_FOR; then
65+
UV_DIR=$i
66+
AC_MSG_RESULT(found in $i)
67+
fi
68+
done
69+
fi
5970

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)
71+
PHP_ADD_INCLUDE($UV_DIR/include)
6672

67-
CFLAGS="$CFLAGS -framework CoreServices -framework Carbon"
68-
;;
69-
*linux*)
70-
CFLAGS="$CFLAGS -lrt"
71-
esac
73+
PHP_CHECK_LIBRARY(uv, uv_version,
74+
[
75+
PHP_ADD_LIBRARY_WITH_PATH(uv, $UV_DIR/lib, UV_SHARED_LIBADD)
76+
AC_DEFINE(HAVE_UVLIB,1,[ ])
77+
],[
78+
AC_MSG_ERROR([wrong uv library version or library not found])
79+
],[
80+
-L$UV_DIR/lib -lm
81+
])
7282

7383
PHP_SUBST(UV_SHARED_LIBADD)
74-
PHP_SUBST([CFLAGS])
84+
85+
# CFLAGS=" $CFLAGS -Wunused-variable -Wpointer-sign -Wimplicit-function-declaration -Winline -Wunused-macros -Wredundant-decls -Wstrict-aliasing=2 -Wswitch-enum -Wdeclaration-after-statement"
86+
87+
# case $host in
88+
# *darwin*)
89+
# ;;
90+
# *linux*)
91+
# CFLAGS="$CFLAGS -lrt"
92+
# esac
93+
94+
# PHP_SUBST([CFLAGS])
7595
fi

0 commit comments

Comments
 (0)