1PHP_ARG_WITH(uv, Whether to include "uv" support, 2[ --with-uv[=DIR] Include "uv" support]) 3 4PHP_ARG_ENABLE(uv-debug, for uv debug support, 5 [ --enable-uv-debug Enable enable uv debug support], no, no) 6 7PHP_ARG_ENABLE(dtrace, Whether to enable the "dtrace" debug, 8 [ --enable-dtrace Enable "dtrace" support], no, no) 9 10 11if test -z "$PHP_DEBUG"; then 12 AC_ARG_ENABLE(debug, 13 [ --enable-debug compile with debugging symbols],[ 14 PHP_DEBUG=$enableval 15 ],[ PHP_DEBUG=no 16 ]) 17fi 18 19if test "$PHP_UV_DEBUG" != "no"; then 20 CFLAGS="$CFLAGS -Wall -g -ggdb -O0 -DPHP_UV_DEBUG=1" 21 AC_DEFINE(PHP_UV_DEBUG, 1, [Enable uv debug support]) 22fi 23 24if test "$PHP_DTRACE" != "no"; then 25 dnl TODO: we should move this line to Makefile.frag or somewhere. 26 case $host in 27 *darwin*) 28 dtrace -h -s phpuv_dtrace.d 29 UV_SHARED_DEPENDENCIES=phpuv_dtrace.h 30 PHP_ADD_LIBRARY(dtrace, UV_SHARED_LIBADD) 31 AC_DEFINE(PHP_UV_DTRACE, 1, [Enable uv dtrace support]) 32 PHP_SUBST(UV_SHARED_DEPENDENCIES) 33 PHP_ADD_MAKEFILE_FRAGMENT 34 ;; 35 *linux*) 36 echo "dtrace does not support this machine. currently OSX only" 37 esac 38fi 39 40if test $PHP_UV != "no"; then 41 SOURCES="" 42 43 PHP_NEW_EXTENSION(uv, php_uv.c uv.c $SOURCES, $ext_shared) 44 45 PHP_ADD_EXTENSION_DEP(uv, sockets, true) 46 47 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 48 49 AC_MSG_CHECKING(for libuv) 50 51 if test $PHP_UV == "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libuv; then 52 if $PKG_CONFIG libuv --atleast-version 1.0.0; then 53 LIBUV_INCLINE=`$PKG_CONFIG libuv --cflags` 54 LIBUV_LIBLINE=`$PKG_CONFIG libuv --libs` 55 LIBUV_VERSION=`$PKG_CONFIG libuv --modversion` 56 AC_MSG_RESULT(from pkgconfig: found version $LIBUV_VERSION) 57 AC_DEFINE(HAVE_UVLIB,1,[ ]) 58 else 59 AC_MSG_ERROR(system libuv must be upgraded to version >= 1.0.0) 60 fi 61 PHP_EVAL_LIBLINE($LIBUV_LIBLINE, UV_SHARED_LIBADD) 62 PHP_EVAL_INCLINE($LIBUV_INCLINE) 63 64 else 65 SEARCH_PATH="/usr/local /usr" 66 SEARCH_FOR="/include/uv.h" 67 if test -r $PHP_UV/$SEARCH_FOR; then # path given as parameter 68 UV_DIR=$PHP_UV 69 AC_MSG_RESULT(from option: found in $UV_DIR) 70 else # search default path list 71 for i in $SEARCH_PATH ; do 72 if test -r $i/$SEARCH_FOR; then 73 UV_DIR=$i 74 AC_MSG_RESULT(from default path: found in $i) 75 fi 76 done 77 fi 78 PHP_ADD_INCLUDE($UV_DIR/include) 79 PHP_CHECK_LIBRARY(uv, uv_version, 80 [ 81 PHP_ADD_LIBRARY_WITH_PATH(uv, $UV_DIR/$PHP_LIBDIR, UV_SHARED_LIBADD) 82 AC_DEFINE(HAVE_UVLIB,1,[ ]) 83 ],[ 84 AC_MSG_ERROR([wrong uv library version or library not found]) 85 ],[ 86 -L$UV_DIR/$PHP_LIBDIR -lm 87 ]) 88 case $host in 89 *linux*) 90 CFLAGS="$CFLAGS -lrt" 91 esac 92 fi 93 94 PHP_SUBST([CFLAGS]) 95 PHP_SUBST(UV_SHARED_LIBADD) 96fi 97