2 dnl $Id: config.m4,v 3.30 2007/12/26 22:31:20 rasmus Exp $
5 AC_MSG_CHECKING(whether apc needs to get compiler flags from apxs)
7 [ --with-apxs[=FILE] Get compiler flags from apxs -q. Provide the
8 pathname to the Apache apxs tool; defaults to "apxs".],[
9 if test "$withval" != "no"; then
10 if test "$withval" = "yes"; then
12 $APXS -q CFLAGS >/dev/null 2>&1
13 if test "$?" != "0" && test -x /usr/sbin/apxs; then #SUSE 6.x
15 elif test -x /usr/bin/apxs2; then
17 elif test -x /usr/sbin/apxs2; then
21 PHP_EXPAND_PATH($withval, APXS)
24 $APXS -q CFLAGS >/dev/null 2>&1
25 if test "$?" != "0"; then
28 AC_MSG_RESULT([Sorry, I was not able to successfully run APXS. Possible reasons:])
30 AC_MSG_RESULT([1. Perl is not installed;])
31 AC_MSG_RESULT([2. Apache was not compiled with DSO support (--enable-module=so);])
32 AC_MSG_RESULT([3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs])
33 AC_MSG_RESULT([The output of $APXS follows])
35 AC_MSG_ERROR([Aborting])
38 APC_CFLAGS=`$APXS -q CFLAGS`
47 PHP_ARG_ENABLE(apc, whether to enable APC support,
48 [ --enable-apc Enable APC support])
50 AC_MSG_CHECKING(Checking whether we should enable cache request file info)
51 AC_ARG_ENABLE(apc-filehits,
52 [ --enable-apc-filehits Enable per request file info about files used from the APC cache (ie: apc_cache_info('filehits')) ],
54 PHP_APC_FILEHITS=$enableval
55 AC_MSG_RESULT($enableval)
64 AC_MSG_CHECKING(Checking whether we should use mmap)
65 AC_ARG_ENABLE(apc-mmap,
67 Disable mmap support and use IPC shm instead],
69 PHP_APC_MMAP=$enableval
70 AC_MSG_RESULT($enableval)
76 AC_MSG_CHECKING(Checking whether we should use semaphore locking instead of fcntl)
77 AC_ARG_ENABLE(apc-sem,
79 Enable semaphore locks instead of fcntl],
81 PHP_APC_SEM=$enableval
82 AC_MSG_RESULT($enableval)
88 AC_MSG_CHECKING(Checking whether we should use futex locking)
89 AC_ARG_ENABLE(apc-futex,
91 Enable linux futex based locks EXPERIMENTAL ],
93 PHP_APC_FUTEX=$enableval
94 AC_MSG_RESULT($enableval)
101 if test "$PHP_APC_FUTEX" != "no"; then
102 AC_CHECK_HEADER(linux/futex.h, , [ AC_MSG_ERROR([futex.h not found. Please verify you that are running a 2.5 or older linux kernel and that futex support is enabled.]); ] )
105 AC_MSG_CHECKING(Checking whether we should use pthread mutex locking)
106 AC_ARG_ENABLE(apc-pthreadmutex,
107 [ --disable-apc-pthreadmutex
108 Disable pthread mutex locking ],
110 PHP_APC_PTHREADMUTEX=no
114 PHP_APC_PTHREADMUTEX=yes
117 if test "$PHP_APC_PTHREADMUTEX" != "no"; then
119 LIBS="$LIBS -lpthread"
122 #include <sys/types.h>
125 pthread_mutex_t mutex;
126 pthread_mutexattr_t attr;
128 if(pthread_mutexattr_init(&attr)) {
129 puts("Unable to initialize pthread attributes (pthread_mutexattr_init).");
132 if(pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) {
133 puts("Unable to set PTHREAD_PROCESS_SHARED (pthread_mutexattr_setpshared), your system may not support shared mutex's.");
136 if(pthread_mutex_init(&mutex, &attr)) {
137 puts("Unable to initialize the mutex (pthread_mutex_init).");
140 if(pthread_mutexattr_destroy(&attr)) {
141 puts("Unable to destroy mutex attributes (pthread_mutexattr_destroy).");
144 if(pthread_mutex_destroy(&mutex)) {
145 puts("Unable to destroy mutex (pthread_mutex_destroy).");
149 puts("pthread mutex's are supported!");
154 PHP_ADD_LIBRARY(pthread)
157 AC_MSG_WARN([It doesn't appear that pthread mutex's are supported on your system])
158 PHP_APC_PTHREADMUTEX=no
161 PHP_ADD_LIBRARY(pthread)
167 AC_MSG_CHECKING(Checking whether we should use spin locks)
168 AC_ARG_ENABLE(apc-spinlocks,
169 [ --enable-apc-spinlocks
170 Enable spin locks EXPERIMENTAL ],
172 PHP_APC_SPINLOCKS=$enableval
173 AC_MSG_RESULT($enableval)
180 if test "$PHP_APC" != "no"; then
181 test "$PHP_APC_MMAP" != "no" && AC_DEFINE(APC_MMAP, 1, [ ])
182 test "$PHP_APC_FILEHITS" != "no" && AC_DEFINE(APC_FILEHITS, 1, [ ])
184 if test "$PHP_APC_SEM" != "no"; then
185 AC_DEFINE(APC_SEM_LOCKS, 1, [ ])
186 elif test "$PHP_APC_FUTEX" != "no"; then
187 AC_DEFINE(APC_FUTEX_LOCKS, 1, [ ])
188 elif test "$PHP_APC_SPINLOCKS" != "no"; then
189 AC_DEFINE(APC_SPIN_LOCKS, 1, [ ])
190 elif test "$PHP_APC_PTHREADMUTEX" != "no"; then
191 AC_DEFINE(APC_PTHREADMUTEX_LOCKS, 1, [ ])
194 AC_CHECK_FUNCS(sigaction)
195 AC_CACHE_CHECK(for union semun, php_cv_semun,
198 #include <sys/types.h>
201 ], [union semun x;], [
207 if test "$php_cv_semun" = "yes"; then
208 AC_DEFINE(HAVE_SEMUN, 1, [ ])
210 AC_DEFINE(HAVE_SEMUN, 0, [ ])
213 apc_sources="apc.c php_apc.c \
232 PHP_CHECK_LIBRARY(rt, shm_open, [PHP_ADD_LIBRARY(rt,,APC_SHARED_LIBADD)])
233 PHP_NEW_EXTENSION(apc, $apc_sources, $ext_shared,, \\$(APC_CFLAGS))
234 PHP_SUBST(APC_SHARED_LIBADD)
235 PHP_SUBST(APC_CFLAGS)
236 AC_DEFINE(HAVE_APC, 1, [ ])