-
Notifications
You must be signed in to change notification settings - Fork 12
/
config.m4
93 lines (73 loc) · 2.18 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
dnl $Id$
dnl config.m4 for extension jsonnet
dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary. This file will not work
dnl without editing.
dnl If your extension references something external, use with:
PHP_ARG_WITH(jsonnet, for jsonnet support,
dnl Make sure that the comment is aligned:
[ --with-jsonnet Include jsonnet support])
dnl Otherwise use enable:
dnl PHP_ARG_ENABLE(jsonnet, whether to enable jsonnet support,
dnl Make sure that the comment is aligned:
dnl [ --enable-jsonnet Enable jsonnet support])
AC_DEFUN([AC_JSONNET_EPOLL],
[
AC_MSG_CHECKING([for epoll])
AC_TRY_COMPILE(
[
#include <sys/epoll.h>
], [
int epollfd;
struct epoll_event e;
epollfd = epoll_create(1);
if (epollfd < 0) {
return 1;
}
e.events = EPOLLIN | EPOLLET;
e.data.fd = 0;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, 0, &e) == -1) {
return 1;
}
e.events = 0;
if (epoll_wait(epollfd, &e, 1, 1) < 0) {
return 1;
}
], [
AC_DEFINE([HAVE_EPOLL], 1, [do we have epoll?])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
])
if test "$PHP_JSONNET" != "no"; then
THIS_DIR=`dirname $0`
MAKE_LIB_JSONNET=`cd ${THIS_DIR}/libjsonnet && make libjsonnet.so`
# --with-jsonnet -> check with-path
SEARCH_PATH="/usr/local/lib"
SEARCH_FOR="libjsonnet.h"
if test -r $PHP_JSONNET/$SEARCH_FOR; then # path given as parameter
JSONNET_DIR=$PHP_JSONNET
else # search default path list
AC_MSG_CHECKING([for jsonnet files in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
JSONNET_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
if test -z "$JSONNET_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the jsonnet distribution])
fi
# --with-jsonnet -> add include path
PHP_ADD_INCLUDE($JSONNET_DIR)
# --with-jsonnet -> check for lib and symbol presence
PHP_ADD_INCLUDE($JSONNET_DIR)
PHP_EVAL_LIBLINE($JSONNET_DIR, JSONNET_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(jsonnet, $JSONNET_DIR, JSONNET_SHARED_LIBADD)
AC_JSONNET_EPOLL()
PHP_SUBST(JSONNET_SHARED_LIBADD)
PHP_NEW_EXTENSION(jsonnet, jsonnet.c, $ext_shared)
fi