~clint-fewbar/ubuntu/precise/php5/php5-5.4-merge

« back to all changes in this revision

Viewing changes to sapi/fpm/config.m4

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-02-22 09:46:37 UTC
  • mfrom: (1.1.20) (0.3.18 sid)
  • Revision ID: package-import@ubuntu.com-20110222094637-nlu2tvb7oqgaarl0
Tags: 5.3.5-1ubuntu1
* Merge from debian/unstable. Remaining changes:
 - debian/control:
    * Dropped firebird2.1-dev, libc-client-dev, libmcrypt-dev as it is in universe.
    * Dropped libmysqlclient15-dev, build against mysql 5.1.
    * Dropped libcurl-dev not in the archive.
    * Suggest php5-suhosin rather than recommends.
    * Dropped php5-imap, php5-interbase, php5-mcrypt since we have versions 
      already in universe.
    * Dropped libonig-dev and libqgdbm since its in universe. (will be re-added in lucid+1)
    * Dropped locales-all.
  - modulelist: Drop imap, interbase, sybase, and mcrypt.
  - debian/rules:
    * Dropped building of mcrypt, imap, and interbase.
    * Install apport hook for php5.
    * stop mysql instance on clean just in case we failed in tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
dnl $Id$
3
3
dnl
4
4
 
5
 
fpm_version="0.6.5"
6
 
minimum_libevent_version="1.4.11"
7
 
 
8
5
PHP_ARG_ENABLE(fpm,,
9
6
[  --enable-fpm              EXPERIMENTAL: Enable building of the fpm SAPI executable], no, no)
10
7
 
11
 
dnl libevent check function {{{
12
 
dnl @synopsis AC_LIB_EVENT([MINIMUM-VERSION])
13
 
dnl
14
 
dnl Test for the libevent library of a particular version (or newer).
15
 
dnl Source: http://svn.apache.org/repos/asf/incubator/thrift/trunk/aclocal/ax_lib_event.m4
16
 
dnl Modified: This file was modified for autoconf-2.13 and the PHP_ARG_WITH macro.
17
 
dnl
18
 
dnl If no path to the installed libevent is given, the macro will first try
19
 
dnl using no -I or -L flags, then searches under /usr, /usr/local, /opt,
20
 
dnl and /opt/libevent.
21
 
dnl If these all fail, it will try the $LIBEVENT_ROOT environment variable.
22
 
dnl
23
 
dnl This macro requires that #include <sys/types.h> works and defines u_char.
24
 
dnl
25
 
dnl This macro calls:
26
 
dnl   AC_SUBST(LIBEVENT_CFLAGS)
27
 
dnl   AC_SUBST(LIBEVENT_LIBS)
28
 
dnl
29
 
dnl And (if libevent is found):
30
 
dnl   AC_DEFINE(HAVE_LIBEVENT)
31
 
dnl
32
 
dnl It also leaves the shell variables "success" and "ac_have_libevent"
33
 
dnl set to "yes" or "no".
34
 
dnl
35
 
dnl NOTE: This macro does not currently work for cross-compiling,
36
 
dnl       but it can be easily modified to allow it.  (grep "cross").
37
 
dnl
38
 
dnl @category InstalledPackages
39
 
dnl @category C
40
 
dnl @version 2007-09-12
41
 
dnl @license AllPermissive
42
 
dnl
43
 
dnl Copyright (C) 2009 David Reiss
44
 
dnl Copying and distribution of this file, with or without modification,
45
 
dnl are permitted in any medium without royalty provided the copyright
46
 
dnl notice and this notice are preserved.
47
 
 
48
 
AC_DEFUN([AC_LIB_EVENT_DO_CHECK],
49
 
[
50
 
# Save our flags.
51
 
CPPFLAGS_SAVED="$CPPFLAGS"
52
 
LDFLAGS_SAVED="$LDFLAGS"
53
 
LIBS_SAVED="$LIBS"
54
 
LD_LIBRARY_PATH_SAVED="$LD_LIBRARY_PATH"
55
 
 
56
 
# Set our flags if we are checking a specific directory.
57
 
if test -n "$ac_libevent_path" ; then
58
 
  LIBEVENT_CPPFLAGS="-I$ac_libevent_path/include"
59
 
 
60
 
  if test -z "$PHP_LIBDIR"; then
61
 
    LIBEVENT_LDFLAGS="-L$ac_libevent_path/lib"
62
 
  else 
63
 
    LIBEVENT_LDFLAGS="-L$ac_libevent_path/$PHP_LIBDIR"
64
 
  fi
65
 
 
66
 
  LD_LIBRARY_PATH="$ac_libevent_path/lib:$LD_LIBRARY_PATH"
67
 
else
68
 
  LIBEVENT_CPPFLAGS=""
69
 
  LIBEVENT_LDFLAGS=""
70
 
fi
71
 
 
72
 
# Required flag for libevent.
73
 
LIBEVENT_LIBS="-levent"
74
 
 
75
 
# Prepare the environment for compilation.
76
 
CPPFLAGS="$CPPFLAGS $LIBEVENT_CPPFLAGS"
77
 
LDFLAGS="$LDFLAGS $LIBEVENT_LDFLAGS"
78
 
LIBS="$LIBS $LIBEVENT_LIBS"
79
 
export CPPFLAGS
80
 
export LDFLAGS
81
 
export LIBS
82
 
export LD_LIBRARY_PATH
83
 
 
84
 
success=no
85
 
 
86
 
# Compile, link, and run the program.  This checks:
87
 
# - event.h is available for including.
88
 
# - event_get_version() is available for linking.
89
 
# - The event version string is lexicographically greater
90
 
#   than the required version.
91
 
AC_TRY_RUN([
92
 
#include <sys/types.h>
93
 
#include <event.h>
94
 
 
95
 
int main(int argc, char *argv[])
96
 
{
97
 
        const char* lib_version = event_get_version();
98
 
        const char* wnt_version = "$WANT_LIBEVENT_VERSION";
99
 
        for (;;) {
100
 
                /* If we reached the end of the want version.  We have it. */
101
 
                if (*wnt_version == '\0' || *wnt_version == '-') {
102
 
                        return 0;
103
 
                }
104
 
                /* If the want version continues but the lib version does not, */
105
 
                /* we are missing a letter.  We don't have it. */
106
 
                if (*lib_version == '\0' || *lib_version == '-') {
107
 
                        return 1;
108
 
                }
109
 
 
110
 
                /* In the 1.4 version numbering style, if there are more digits */
111
 
                /* in one version than the other, that one is higher. */
112
 
                int lib_digits;
113
 
                for (lib_digits = 0;
114
 
                lib_version[lib_digits] >= '0' &&
115
 
                lib_version[lib_digits] <= '9';
116
 
                lib_digits++)
117
 
                ;
118
 
                int wnt_digits;
119
 
                for (wnt_digits = 0;
120
 
                wnt_version[wnt_digits] >= '0' &&
121
 
                wnt_version[wnt_digits] <= '9';
122
 
                wnt_digits++)
123
 
                ;
124
 
                if (lib_digits > wnt_digits) {
125
 
                        return 0;
126
 
                }
127
 
                if (lib_digits < wnt_digits) {
128
 
                        return 1;
129
 
                }
130
 
                /* If we have greater than what we want.  We have it. */
131
 
                if (*lib_version > *wnt_version) {
132
 
                        return 0;
133
 
                }
134
 
                /* If we have less, we don't. */
135
 
                if (*lib_version < *wnt_version) {
136
 
                        return 1;
137
 
                }
138
 
                lib_version++;
139
 
                wnt_version++;
140
 
        }
141
 
        return 0;
142
 
}
143
 
],[
144
 
success=yes
145
 
])
146
 
 
147
 
# Restore flags.
148
 
CPPFLAGS="$CPPFLAGS_SAVED"
149
 
LDFLAGS="$LDFLAGS_SAVED"
150
 
LIBS="$LIBS_SAVED"
151
 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH_SAVED"
152
 
])
153
 
 
154
 
AC_DEFUN([AC_LIB_EVENT],
155
 
[
156
 
 
157
 
PHP_ARG_WITH(libevent-dir,,
158
 
[  --with-libevent-dir[=PATH]  libevent install prefix, for fpm SAPI. (default: /usr/local)], /usr/local, yes)
159
 
 
160
 
if test "$PHP_LIBEVENT_DIR" != "no"; then
161
 
  WANT_LIBEVENT_VERSION=ifelse([$1], ,1.2,$1)
162
 
 
163
 
  AC_MSG_CHECKING(for libevent >= $WANT_LIBEVENT_VERSION install prefix)
164
 
 
165
 
  libevent_prefix=$ac_default_prefix
166
 
  if test $prefix != "NONE" -a $prefix != "" -a $prefix != "no" ; then 
167
 
    libevent_prefix=$prefix
168
 
  fi
169
 
 
170
 
  if test "$PHP_LIBEVENT_DIR" = "yes"; then
171
 
    PHP_LIBEVENT_DIR=$libevent_prefix
172
 
  fi
173
 
 
174
 
  if test "$PHP_LIBEVENT_DIR" != "yes" && test "$PHP_LIBEVENT_DIR" != "/usr/local"; then
175
 
    dnl don't try to be too smart, check only $PHP_LIBEVENT_DIR if specified
176
 
    ac_libevent_path=$PHP_LIBEVENT_DIR
177
 
    AC_LIB_EVENT_DO_CHECK
178
 
    if test "$success" = "no"; then
179
 
      AC_MSG_ERROR([Could not find libevent >= $WANT_LIBEVENT_VERSION in $PHP_LIBEVENT_DIR])
180
 
    fi
181
 
   else 
182
 
    dnl check default prefixes then
183
 
    for ac_libevent_path in "" $PHP_LIBEVENT_DIR /usr /usr/local /opt /opt/local /opt/libevent ; do
184
 
      AC_LIB_EVENT_DO_CHECK
185
 
      if test "$success" = "yes"; then
186
 
        break;
187
 
      fi
188
 
    done
189
 
  fi
190
 
 
191
 
  if test "$success" != "yes" ; then
192
 
    AC_MSG_RESULT(no)
193
 
    ac_have_libevent=no
194
 
    AC_MSG_ERROR([libevent >= $WANT_LIBEVENT_VERSION could not be found])
195
 
  else
196
 
    AC_MSG_RESULT($ac_libevent_path)
197
 
    ac_have_libevent=yes
198
 
    AC_DEFINE(HAVE_LIBEVENT, 1, [define if libevent is available])
199
 
  fi
200
 
 
201
 
  LIBEVENT_LIBS="-levent"
202
 
 
203
 
  if test -n "$ac_libevent_path"; then
204
 
    LIBEVENT_CFLAGS="-I$ac_libevent_path/include"
205
 
    LIBEVENT_LIBS="-L$ac_libevent_path/$PHP_LIBDIR $LIBEVENT_LIBS"
206
 
    LIBEVENT_PATH="$ac_libevent_path/$PHP_LIBDIR"
207
 
  fi
208
 
 
209
 
  AC_SUBST(LIBEVENT_CFLAGS)
210
 
  AC_SUBST(LIBEVENT_LIBS)
211
 
  AC_SUBST(LIBEVENT_PATH)
212
 
 
213
 
else
214
 
  AC_MSG_ERROR([FPM requires libevent >= $WANT_LIBEVENT_VERSION. Please specify libevent install prefix with --with-libevent-dir=yes])
215
 
fi
216
 
 
217
 
])
218
 
dnl }}}
219
 
 
220
8
dnl configure checks {{{
221
9
AC_DEFUN([AC_FPM_STDLIBS],
222
10
[
223
 
  AC_CHECK_FUNCS(setenv clearenv)
 
11
  AC_CHECK_FUNCS(setenv clearenv setproctitle)
224
12
 
225
13
  AC_SEARCH_LIBS(socket, socket)
226
14
  AC_SEARCH_LIBS(inet_addr, nsl)
499
287
  fi
500
288
  
501
289
])
 
290
 
 
291
AC_DEFUN([AC_FPM_BUILTIN_ATOMIC],
 
292
[
 
293
  AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
 
294
  AC_TRY_LINK(,
 
295
  [
 
296
    int variable = 1;
 
297
    return (__sync_bool_compare_and_swap(&variable, 1, 2)
 
298
           && __sync_add_and_fetch(&variable, 1)) ? 1 : 0;
 
299
  ],
 
300
  [
 
301
    AC_MSG_RESULT([yes])
 
302
    AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() a.o.])
 
303
  ],
 
304
  [
 
305
    AC_MSG_RESULT([no])
 
306
  ])
 
307
])
 
308
 
 
309
AC_DEFUN([AC_FPM_LQ],
 
310
[
 
311
  have_lq=no
 
312
 
 
313
  AC_MSG_CHECKING([for TCP_INFO])
 
314
 
 
315
  AC_TRY_COMPILE([ #include <netinet/tcp.h> ], [struct tcp_info ti; int x = TCP_INFO;], [
 
316
    have_lq=tcp_info
 
317
    AC_MSG_RESULT([yes])
 
318
  ], [
 
319
    AC_MSG_RESULT([no])
 
320
  ])
 
321
 
 
322
  if test "$have_lq" = "tcp_info"; then
 
323
    AC_DEFINE([HAVE_LQ_TCP_INFO], 1, [do we have TCP_INFO?])
 
324
  fi
 
325
 
 
326
  if test "$have_lq" = "no" ; then
 
327
    AC_MSG_CHECKING([for SO_LISTENQLEN])
 
328
 
 
329
    AC_TRY_COMPILE([ #include <sys/socket.h> ], [int x = SO_LISTENQLIMIT; int y = SO_LISTENQLEN;], [
 
330
      have_lq=so_listenq
 
331
      AC_MSG_RESULT([yes])
 
332
    ], [
 
333
      AC_MSG_RESULT([no])
 
334
    ])
 
335
 
 
336
    if test "$have_lq" = "tcp_info"; then
 
337
      AC_DEFINE([HAVE_LQ_SO_LISTENQ], 1, [do we have SO_LISTENQxxx?])
 
338
    fi
 
339
  fi
 
340
])
502
341
dnl }}}
503
342
 
504
343
AC_MSG_CHECKING(for FPM build)
505
344
if test "$PHP_FPM" != "no"; then
506
345
  AC_MSG_RESULT($PHP_FPM)
507
346
 
508
 
  AC_LIB_EVENT([$minimum_libevent_version])
509
 
 
510
 
  PHP_ADD_LIBRARY_WITH_PATH(event, $LIBEVENT_PATH)
511
 
 
512
 
  PHP_TEST_BUILD(event_init, [ ], [
513
 
    AC_MSG_RESULT(no)
514
 
    AC_MSG_ERROR([build test failed. Please check the config.log for details.])
515
 
  ], $LIBEVENT_LIBS)
516
 
 
517
347
  AC_FPM_STDLIBS
518
348
  AC_FPM_PRCTL
519
349
  AC_FPM_CLOCK
520
350
  AC_FPM_TRACE
 
351
  AC_FPM_BUILTIN_ATOMIC
 
352
  AC_FPM_LQ
521
353
 
522
354
  PHP_ARG_WITH(fpm-user,,
523
355
  [  --with-fpm-user[=USER]  Set the user for php-fpm to run as. (default: nobody)], nobody, no)
538
370
    php_fpm_group="$PHP_FPM_GROUP"
539
371
  fi
540
372
 
541
 
  PHP_SUBST_OLD(fpm_version)
542
373
  PHP_SUBST_OLD(php_fpm_user)
543
374
  PHP_SUBST_OLD(php_fpm_group)
544
375
  php_fpm_sysconfdir=`eval echo $sysconfdir`
545
376
  PHP_SUBST_OLD(php_fpm_sysconfdir)
546
377
  php_fpm_localstatedir=`eval echo $localstatedir`
547
378
  PHP_SUBST_OLD(php_fpm_localstatedir)
 
379
  php_fpm_prefix=`eval echo $prefix`
 
380
  PHP_SUBST_OLD(php_fpm_prefix)
548
381
 
549
 
  AC_DEFINE_UNQUOTED(PHP_FPM_VERSION, "$fpm_version", [fpm version])
550
382
  AC_DEFINE_UNQUOTED(PHP_FPM_USER, "$php_fpm_user", [fpm user name])
551
383
  AC_DEFINE_UNQUOTED(PHP_FPM_GROUP, "$php_fpm_group", [fpm group name])
552
384
 
553
 
  PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.1)
 
385
  PHP_OUTPUT(sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.8)
554
386
  PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag], [$abs_srcdir/sapi/fpm], [sapi/fpm])
555
387
 
556
388
  SAPI_FPM_PATH=sapi/fpm/php-fpm
560
392
    PHP_FPM_TRACE_FILES="fpm/fpm_trace.c fpm/fpm_trace_$fpm_trace_type.c"
561
393
  fi
562
394
  
563
 
  PHP_FPM_CFLAGS="$LIBEVENT_CFLAGS -I$abs_srcdir/sapi/fpm"
564
 
 
565
 
  SAPI_EXTRA_LIBS="$LIBEVENT_LIBS"
566
 
  PHP_SUBST(SAPI_EXTRA_LIBS)
 
395
  PHP_FPM_CFLAGS="-I$abs_srcdir/sapi/fpm"
567
396
 
568
397
  INSTALL_IT=":"
569
398
  PHP_FPM_FILES="fpm/fastcgi.c \