This repository has been archived by the owner on Dec 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.m4
99 lines (77 loc) · 3.77 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
94
95
96
97
98
99
dnl $Id$
dnl config.m4 for extension openswoole_postgresql
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(openswoole_postgresql, openswoole_postgresql support,
[ --enable-swoole_postgresql Enable swoole_postgresql support], [enable_swoole_postgresql="yes"])
PHP_ARG_ENABLE(asan, whether to enable asan,
[ --enable-asan Enable asan], no, no)
PHP_ARG_WITH(libpq_dir, dir of libpq,
[ --with-libpq-dir[=DIR] Include libpq support (requires libpq >= 9.5)], no, no)
PHP_ARG_WITH(openssl_dir, dir of openssl,
[ --with-openssl-dir[=DIR] Include OpenSSL support (requires OpenSSL >= 0.9.6)], 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_OPENSWOOLE_POSTGRESQL" != "no"; then
PHP_ADD_LIBRARY(pthread)
PHP_SUBST(OPENSWOOLE_POSTGRESQL_SHARED_LIBADD)
AC_CHECK_LIB(pq, PQconnectdb, AC_DEFINE(HAVE_POSTGRESQL, 1, [have postgresql]))
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
if test "$PHP_LIBPQ" != "no" || test "$PHP_LIBPQ_DIR" != "no"; then
if test "$PHP_LIBPQ_DIR" != "no"; then
AC_DEFINE(HAVE_LIBPQ, 1, [have libpq])
AC_MSG_RESULT(libpq include success)
PHP_ADD_INCLUDE("${PHP_LIBPQ_DIR}/include")
PHP_ADD_LIBRARY_WITH_PATH(pq, "${PHP_LIBPQ_DIR}/${PHP_LIBDIR}")
PGSQL_INCLUDE=$PHP_LIBPQ_DIR/include
fi
AC_DEFINE(SW_USE_POSTGRESQL, 1, [enable coroutine-postgresql support])
PHP_ADD_LIBRARY(pq, 1, OPENSWOOLE_POSTGRESQL_SHARED_LIBADD)
fi
if test "$PHP_OPENSSL" != "no" || test "$PHP_OPENSSL_DIR" != "no"; then
if test "$PHP_OPENSSL_DIR" != "no"; then
AC_DEFINE(SW_USE_OPENSSL, 1, [have openssl])
PHP_ADD_INCLUDE("${PHP_OPENSSL_DIR}/include")
fi
fi
CFLAGS="-Wall -pthread $CFLAGS"
LDFLAGS="$LDFLAGS -lpthread"
PHP_ADD_LIBRARY(pthread, 1, OPENSWOOLE_POSTGRESQL_SHARED_LIBADD)
swoole_source_file="openswoole_postgresql.cc"
PHP_NEW_EXTENSION(openswoole_postgresql, $swoole_source_file, $ext_shared,,, cxx)
PHP_ADD_INCLUDE([$ext_srcdir])
PHP_ADD_INCLUDE([$ext_srcdir/include])
PHP_ADD_INCLUDE([$phpincludedir/ext/openswoole])
PHP_ADD_INCLUDE([$phpincludedir/ext/openswoole/include])
PHP_ADD_EXTENSION_DEP(openswoole_postgresql, openswoole)
PHP_REQUIRE_CXX()
CXXFLAGS="$CXXFLAGS -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11"
fi