-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathconfig.m4
More file actions
49 lines (40 loc) · 1.27 KB
/
config.m4
File metadata and controls
49 lines (40 loc) · 1.27 KB
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
dnl $Id$
dnl config.m4 for extension sync
PHP_ARG_ENABLE(sync, whether to enable synchronization object support (--enable-sync),
[ --enable-sync Enable synchronization object support])
if test "$PHP_SYNC" != "no"; then
dnl # Check for shm_open() support.
AC_MSG_CHECKING([for shm_open in -pthread -lrt])
SAVED_LIBS="$LIBS"
LIBS="$LIBS -pthread -lrt"
AC_TRY_LINK([
#include <fcntl.h>
#include <sys/mman.h>
], [
int fp = shm_open("", O_RDWR | O_CREAT | O_EXCL, 0666);
], [
have_shm_open=yes
AC_MSG_RESULT([yes])
PHP_ADD_LIBRARY(rt,,SYNC_SHARED_LIBADD)
PHP_SUBST(SYNC_SHARED_LIBADD)
], [
AC_MSG_RESULT([no (attempting fallback)])
dnl # Fallback attempt to link without -lrt.
AC_MSG_CHECKING([for shm_open in -pthread])
LIBS="$SAVED_LIBS -pthread"
AC_TRY_LINK([
#include <fcntl.h>
#include <sys/mman.h>
], [
int fp = shm_open("", O_RDWR | O_CREAT | O_EXCL, 0666);
], [
have_shm_open=yes
AC_MSG_RESULT([yes])
], [
AC_MSG_ERROR([shm_open() is not available on this platform])
])
])
dnl # Finish defining the basic extension support.
AC_DEFINE(HAVE_SYNC, 1, [Whether you have synchronization object support])
PHP_NEW_EXTENSION(sync, sync.c, $ext_shared)
fi