mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
use pkg-config when available
This commit is contained in:
parent
17619edebf
commit
2082929a82
74
config.m4
74
config.m4
@ -44,37 +44,53 @@ if test $PHP_UV != "no"; then
|
|||||||
|
|
||||||
PHP_ADD_EXTENSION_DEP(uv, sockets, true)
|
PHP_ADD_EXTENSION_DEP(uv, sockets, true)
|
||||||
|
|
||||||
SEARCH_PATH="/usr/local /usr"
|
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||||
SEARCH_FOR="/include/uv.h"
|
|
||||||
if test -r $PHP_UV/$SEARCH_FOR; then # path given as parameter
|
AC_MSG_CHECKING(for libuv)
|
||||||
UV_DIR=$PHP_UV
|
|
||||||
else # search default path list
|
if test $PHP_UV == "yes" && test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libuv; then
|
||||||
AC_MSG_CHECKING([for libuv files in default path])
|
if $PKG_CONFIG libuv --atleast-version 1.0.0; then
|
||||||
for i in $SEARCH_PATH ; do
|
LIBUV_INCLINE=`$PKG_CONFIG libuv --cflags`
|
||||||
if test -r $i/$SEARCH_FOR; then
|
LIBUV_LIBLINE=`$PKG_CONFIG libuv --libs`
|
||||||
UV_DIR=$i
|
LIBUV_VERSION=`$PKG_CONFIG libuv --modversion`
|
||||||
AC_MSG_RESULT(found in $i)
|
AC_MSG_RESULT(from pkgconfig: found version $LIBUV_VERSION)
|
||||||
fi
|
AC_DEFINE(HAVE_UVLIB,1,[ ])
|
||||||
done
|
else
|
||||||
|
AC_MSG_ERROR(system libuv must be upgraded to version >= 1.0.0)
|
||||||
|
fi
|
||||||
|
PHP_EVAL_LIBLINE($LIBUV_LIBLINE, UV_SHARED_LIBADD)
|
||||||
|
PHP_EVAL_INCLINE($LIBUV_INCLINE)
|
||||||
|
|
||||||
|
else
|
||||||
|
SEARCH_PATH="/usr/local /usr"
|
||||||
|
SEARCH_FOR="/include/uv.h"
|
||||||
|
if test -r $PHP_UV/$SEARCH_FOR; then # path given as parameter
|
||||||
|
UV_DIR=$PHP_UV
|
||||||
|
AC_MSG_RESULT(from option: found in $UV_DIR)
|
||||||
|
else # search default path list
|
||||||
|
for i in $SEARCH_PATH ; do
|
||||||
|
if test -r $i/$SEARCH_FOR; then
|
||||||
|
UV_DIR=$i
|
||||||
|
AC_MSG_RESULT(from default path: found in $i)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
PHP_ADD_INCLUDE($UV_DIR/include)
|
||||||
|
PHP_CHECK_LIBRARY(uv, uv_version,
|
||||||
|
[
|
||||||
|
PHP_ADD_LIBRARY_WITH_PATH(uv, $UV_DIR/$PHP_LIBDIR, UV_SHARED_LIBADD)
|
||||||
|
AC_DEFINE(HAVE_UVLIB,1,[ ])
|
||||||
|
],[
|
||||||
|
AC_MSG_ERROR([wrong uv library version or library not found])
|
||||||
|
],[
|
||||||
|
-L$UV_DIR/$PHP_LIBDIR -lm
|
||||||
|
])
|
||||||
|
case $host in
|
||||||
|
*linux*)
|
||||||
|
CFLAGS="$CFLAGS -lrt"
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PHP_ADD_INCLUDE($UV_DIR/include)
|
|
||||||
|
|
||||||
PHP_CHECK_LIBRARY(uv, uv_version,
|
|
||||||
[
|
|
||||||
PHP_ADD_LIBRARY_WITH_PATH(uv, $UV_DIR/$PHP_LIBDIR, UV_SHARED_LIBADD)
|
|
||||||
AC_DEFINE(HAVE_UVLIB,1,[ ])
|
|
||||||
],[
|
|
||||||
AC_MSG_ERROR([wrong uv library version or library not found])
|
|
||||||
],[
|
|
||||||
-L$UV_DIR/$PHP_LIBDIR -lm
|
|
||||||
])
|
|
||||||
|
|
||||||
case $host in
|
|
||||||
*linux*)
|
|
||||||
CFLAGS="$CFLAGS -lrt"
|
|
||||||
esac
|
|
||||||
|
|
||||||
PHP_SUBST([CFLAGS])
|
PHP_SUBST([CFLAGS])
|
||||||
PHP_SUBST(UV_SHARED_LIBADD)
|
PHP_SUBST(UV_SHARED_LIBADD)
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user