-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.m4
91 lines (72 loc) · 2.99 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
dnl $Id$
dnl config.m4 for extension swoole_async
dnl +----------------------------------------------------------------------+
dnl | Swoole |
dnl +----------------------------------------------------------------------+
dnl | This source file is subject to version 2.0 of the Apache license, |
dnl | that is bundled with this package in the file LICENSE, and is |
dnl | available through the world-wide-web at the following url: |
dnl | http://www.apache.org/licenses/LICENSE-2.0.html |
dnl | If you did not receive a copy of the Apache2.0 license and are unable|
dnl | to obtain it through the world-wide-web, please send a note to |
dnl | [email protected] so we can mail you a copy immediately. |
dnl +----------------------------------------------------------------------+
dnl | Author: Tianfeng Han <[email protected]> |
dnl +----------------------------------------------------------------------+
PHP_ARG_ENABLE(swoole_async, swoole_async support,
[ --enable-swoole_async Enable swoole_async support], [enable_swoole_async="yes"])
PHP_ARG_ENABLE(asan, whether to enable asan,
[ --enable-asan Enable asan], no, no)
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[CLANG=yes], [CLANG=no]
)
AC_MSG_RESULT([$CLANG])
if test "$CLANG" = "yes"; then
CFLAGS="$CFLAGS -std=gnu89"
fi
if test "$PHP_SWOOLE_ASYNC" != "no"; then
PHP_ADD_LIBRARY(pthread)
PHP_SUBST(SWOOLE_ASYNC_SHARED_LIBADD)
AC_ARG_ENABLE(debug,
[ --enable-debug, compile with debug symbols],
[PHP_DEBUG=$enableval],
[PHP_DEBUG=0]
)
if test "$PHP_DEBUG_LOG" != "no"; then
AC_DEFINE(SW_DEBUG, 1, [do we enable swoole debug])
PHP_DEBUG=1
fi
if test "$PHP_ASAN" != "no"; then
PHP_DEBUG=1
CFLAGS="$CFLAGS -fsanitize=address -fno-omit-frame-pointer"
fi
if test "$PHP_TRACE_LOG" != "no"; then
AC_DEFINE(SW_LOG_TRACE_OPEN, 1, [enable trace log])
fi
CFLAGS="-Wall -pthread $CFLAGS"
LDFLAGS="$LDFLAGS -lpthread"
PHP_ADD_LIBRARY(pthread, 1, SWOOLE_SHARED_LIBADD)
swoole_source_file="swoole_async.cc \
swoole_mysql.c \
swoole_redis.c \
swoole_msgqueue.c \
swoole_ringqueue.c \
swoole_channel.c \
swoole_mmap.c \
swoole_memory_pool.c \
swoole_http_client.c"
PHP_NEW_EXTENSION(swoole_async, $swoole_source_file, $ext_shared,,, cxx)
PHP_ADD_INCLUDE([$ext_srcdir])
PHP_ADD_INCLUDE([$ext_srcdir/include])
PHP_ADD_INCLUDE([$phpincludedir/ext/swoole])
PHP_ADD_INCLUDE([$phpincludedir/ext/swoole/include])
PHP_ADD_EXTENSION_DEP(swoole_async, swoole)
PHP_REQUIRE_CXX()
CXXFLAGS="$CXXFLAGS -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11"
fi