forked from chuan-yun/Molten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
192 lines (168 loc) · 6.13 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
PHP_ARG_ENABLE(molten, whether to enable molten support,
[ --enable-molten Enable molten support])
PHP_ARG_ENABLE(zipkin-header, whether to enable zipkin B3 header,
[ --enable-zipkin-header Enable zipkin header support], no, no)
PHP_ARG_ENABLE(level-id, whether to enable level span id,
[ --enable-level-id Enable level span id], no, no)
if test "$PHP_PRACING" != "no"; then
dnl check ZTS support
if test "$PHP_THREAD_SAFETY" == "yes"; then
AC_MSG_ERROR([molten does not support ZTS])
fi
dnl check mmap functions
AC_CHECK_FUNCS(mmap)
AC_CHECK_FUNCS(munmap)
dnl check support zipkin b3 header
if test "$PHP_ZIPKIN_HEADER" != "no"; then
AC_DEFINE(USE_ZIPKIN_HEADER, 1, [Enable zipkin header support])
fi
dnl check support level span id
if test "$PHP_LEVEL_ID" != "no"; then
AC_DEFINE(USE_LEVEL_ID, 1, [Enable level span id])
fi
dnl check for php json
AC_MSG_CHECKING([check for php json])
json_inc_path=""
if test -f "$abs_srcdir/include/php/ext/json/php_json.h"; then
json_inc_path="$abs_srcdir/include/php"
elif test -f "$abs_srcdir/ext/json/php_json.h"; then
json_inc_path="$abs_srcdir"
elif test -f "$phpincludedir/ext/json/php_json.h"; then
json_inc_path="$phpincludedir"
else
for i in php php4 php5 php6 php7; do
if test -f "$prefix/include/$i/ext/json/php_json.h"; then
json_inc_path="$prefix/include/$i"
fi
done
fi
if test "$json_inc_path" = ""; then
AC_MSG_ERROR([cano not find php_json.h])
else
AC_MSG_RESULT([has found php json include file])
fi
dnl check for mysqlnd
AC_MSG_CHECKING([check for mysqlnd])
mysqlnd_inc_path=""
if test -f "$abs_srcdir/include/php/ext/mysqlnd/mysqlnd_structs.h"; then
mysqlnd_inc_path="$abs_srcdir/include/php"
elif test -f "$abs_srcdir/ext/mysqlnd/mysqlnd_structs.h""; then
mysqlnd_inc_path="$abs_srcdir"
elif test -f "$phpincludedir/ext/mysqlnd/mysqlnd_structs.h""; then
mysqlnd_inc_path="$phpincludedir"
else
for i in php php4 php5 php6 php7; do
if test -f "$prefix/include/$i/ext/mysqlnd/mysqlnd_structs.h"; then
mysqlnd_inc_path="$prefix/include/$i"
fi
done
fi
if test "$mysqlnd_inc_path" = ""; then
AC_MSG_RESULT([mysqlnd not found, mysqli support will not complete])
else
dnl check for mysqli use mysqlnd or not
build_options=`$prefix/bin/php-config --configure-options`
has_mysqlnd="0"
if echo "$build_options" | grep " \-\-with\-mysqli "; then
has_mysqlnd="1"
fi
if echo "$build_options" | grep " \-\-with\-mysqli=mysqlnd "; then
has_mysqlnd="1"
fi
if test "$has_mysqlnd" = "1"; then
AC_MSG_RESULT([has found mysqlnd include file])
AC_DEFINE(HAS_MYSQLND, 1, [we have mysqlnd to support mysqli])
AC_DEFINE(MYSQLI_USE_MYSQLND, 1, [we define MYSQLI_USER_MYSQLND use mysqlnd to support mysqli])
else
AC_MSG_RESULT([mysqlnd not found, mysqli support will not complete])
fi
fi
dnl check for pdo
AC_MSG_CHECKING([check for pdo])
pdo_inc_path=""
if test -f "$abs_srcdir/include/php/ext/pdo/php_pdo_driver.h"; then
pdo_inc_path="$abs_srcdir/include/php"
elif test -f "$abs_srcdir/ext/pdo/php_pdo_driver.h"; then
pdo_inc_path="$abs_srcdir"
elif test -f "$phpincludedir/ext/pdo/php_pdo_driver.h"; then
pdo_inc_path="$phpincludedir"
else
for i in php php4 php5 php6 php7; do
if test -f "$prefix/include/$i/ext/pdo/php_pdo_driver.h"; then
pdo_inc_path="$prefix/include/$i"
fi
done
fi
if test "$pdo_inc_path" = ""; then
AC_MSG_RESULT([pdo not found, pdo support will not complete])
else
AC_MSG_RESULT([has found pdo include file])
AC_DEFINE(HAS_PDO, 1, [we support pdo])
fi
dnl check for curl
AC_MSG_CHECKING([for curl-config])
CURL_CONFIG="curl-config"
CURL_CONFIG_PATH=`$php_shtool path $CURL_CONFIG`
dnl for curl-config
if test -f "$CURL_CONFIG_PATH" && test -x "$CURL_CONFIG_PATH" && $CURL_CONFIG_PATH --version > /dev/null 2>&1; then
AC_MSG_RESULT([$CURL_CONFIG_PATH])
CURL_LIB_NAME=curl
dnl CURL_INCLUDE=`$CURL_CONFIG_PATH --prefix`/include/curl
PHP_CHECK_LIBRARY($CURL_LIB_NAME, curl_easy_init, [
dnl add curl include dir, the lib dir in general path
dnl PHP_EVAL_INCLINE($CURL_INCLUDE)
PHP_ADD_LIBRARY($CURL_LIB_NAME,1,CURL_SHARED_LIBADD)
PHP_SUBST(CURL_SHARED_LIBADD)
AC_DEFINE(HAS_CURL, 1, [we have curl to execute curl])
] ,[
AC_MSG_ERROR([libcurl not found])
])
else
AC_MSG_ERROR([The libcurl-devel were not found. Please install it.
On Debian: sudo apt-get install libcurl4-openssl-dev
On Redhat: sudo yum install libcurl-devel])
fi
dnl check librdkafka
KAFKA_SEARCH_PATH="/usr/local /usr"
KAFKA_SEARCH_FOR="/include/librdkafka/rdkafka.h"
AC_MSG_CHECKING([for librdkafka/rdkafka.h])
for i in $KAFKA_SEARCH_PATH; do
if test -r $i/$KAFKA_SEARCH_FOR; then
KAFKA_DIR=$i
AC_MSG_RESULT(found in $i)
PHP_ADD_INCLUDE($KAFKA_DIR/include)
LIBNAME=rdkafka
LIBSYMBOL=rd_kafka_new
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,[
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $KAFKA_DIR/$PHP_LIBDIR, KAFKA_SHARED_LIBADD)
AC_DEFINE(HAS_KAFKA, 1, [we have kafka to execute])
PHP_SUBST(KAFKA_SHARED_LIBADD)
], [
AC_MSG_ERROR([wrong rdkafka lib not found])
], [
-L$KAFKA_DIR/$PHP_LIBDIR -lm
])
fi
done
PHP_MOLTEN_SOURCE_FILES="\
molten.c \
molten_log.c \
molten_intercept.c \
molten_ctrl.c \
common/molten_shm.c \
common/molten_stack.c \
common/molten_lock.c \
common/molten_slog.c \
molten_util.c \
molten_span.c \
molten_status.c \
molten_report.c \
molten_chain.c"
dnl $ext_srcdir available after PHP_NEW_EXTENSION
PHP_NEW_EXTENSION(molten, $PHP_MOLTEN_SOURCE_FILES, $ext_shared)
dnl add common include path
PHP_ADD_INCLUDE($ext_srcdir)
PHP_ADD_INCLUDE($ext_srcdir/common)
dnl PHP_ADD_INCLUDE($ext_srcdir/deps)
dnl PHP_ADD_MAKEFILE_FRAGMENT
fi