forked from php/pecl-event-libevent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
52 lines (43 loc) · 1.3 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
dnl $Id$
PHP_ARG_WITH(libevent, for libevent support,
[ --with-libevent Include libevent support])
if test "$PHP_LIBEVENT" != "no"; then
SEARCH_PATH="/usr /usr/local"
SEARCH_FOR="/include/event.h"
if test "$PHP_LIBEVENT" = "yes"; then
AC_MSG_CHECKING([for libevent headers in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
LIBEVENT_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
else
AC_MSG_CHECKING([for libevent headers in $PHP_LIBEVENT])
if test -r $PHP_LIBEVENT/$SEARCH_FOR; then
LIBEVENT_DIR=$PHP_LIBEVENT
AC_MSG_RESULT([found])
fi
fi
if test -z "$LIBEVENT_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Cannot find libevent headers])
fi
PHP_ADD_INCLUDE($LIBEVENT_DIR/include)
LIBNAME=event
LIBSYMBOL=event_base_new
if test "x$PHP_LIBDIR" = "x"; then
PHP_LIBDIR=lib
fi
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
[
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $LIBEVENT_DIR/$PHP_LIBDIR, LIBEVENT_SHARED_LIBADD)
],[
AC_MSG_ERROR([wrong libevent version {1.4.+ is required} or lib not found])
],[
-L$LIBEVENT_DIR/$PHP_LIBDIR
])
PHP_ADD_EXTENSION_DEP(libevent, sockets, true)
PHP_SUBST(LIBEVENT_SHARED_LIBADD)
PHP_NEW_EXTENSION(libevent, libevent.c, $ext_shared)
fi