forked from SkyAPM/SkyAPM-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.m4
176 lines (148 loc) · 5.35 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
PHP_REQUIRE_CXX()
CXXFLAGS="$CXXFLAGS -Wall -std=c++11 -Wno-deprecated-register"
PHP_ARG_ENABLE(skywalking, whether to enable skywalking support,
[ --enable-skywalking Enable skywalking support])
if test "$PHP_THREAD_SAFETY" == "yes"; then
AC_MSG_ERROR([skywalking does not support ZTS])
fi
AC_LANG_PUSH(C++)
AX_CHECK_COMPILE_FLAG([-std=c++0x], , [AC_MSG_ERROR([compiler not accept c++11])])
AC_LANG_POP()
AC_MSG_CHECKING([for php_json.h])
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 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([Could not fond php_json.h, please reinstall the php-json extension])
else
AC_MSG_RESULT([found in $json_inc_path])
fi
if test "$PHP_SKYWALKING" != "no"; then
SEARCH_PATH="/usr/local /usr"
SEARCH_GRPC_FOR="/include/grpc/grpc.h"
SEARCH_PROTOBUF_FOR="/include/google/protobuf/message.h"
AC_MSG_CHECKING([for grpc and protobuf files in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_GRPC_FOR; then
GRPC_DIR=$i
AC_MSG_RESULT(found in $i)
fi
if test -r $i/$SEARCH_PROTOBUF_FOR; then
PROTOBUF_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
if test -z "$GRPC_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the grpc distribution])
fi
if test -z "$PROTOBUF_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the protobuf distribution])
fi
PHP_ADD_INCLUDE($GRPC_DIR/include)
PHP_ADD_INCLUDE($PROTOBUF_DIR/include)
LIBS="-lpthread $LIBS"
SKYWALKING_SHARED_LIBADD="-lpthread $SKYWALKING_SHARED_LIBADD"
PHP_ADD_LIBRARY(pthread)
PHP_ADD_LIBRARY(dl,,SKYWALKING_SHARED_LIBADD)
PHP_ADD_LIBRARY(dl)
case $host in
*darwin*)
PHP_ADD_LIBRARY(c++,1,SKYWALKING_SHARED_LIBADD)
;;
*)
PHP_ADD_LIBRARY(rt,,SKYWALKING_SHARED_LIBADD)
PHP_ADD_LIBRARY(rt)
;;
esac
GRPC_LIBDIR=$GRPC_DIR/${GRPC_LIB_SUBDIR-lib}
PHP_ADD_LIBPATH($GRPC_LIBDIR)
PHP_CHECK_LIBRARY(gpr, gpr_now,
[
PHP_ADD_LIBRARY(gpr,, SKYWALKING_SHARED_LIBADD)
PHP_ADD_LIBRARY(gpr)
AC_DEFINE(HAVE_GPRLIB,1,[ ])
],[
AC_MSG_ERROR([wrong gpr lib version or lib not found])
],[
-L$GRPC_LIBDIR
])
PHP_CHECK_LIBRARY(grpc, grpc_channel_destroy,
[
PHP_ADD_LIBRARY(grpc,,SKYWALKING_SHARED_LIBADD)
PHP_ADD_LIBRARY(grpc++,,SKYWALKING_SHARED_LIBADD)
AC_DEFINE(HAVE_GRPCLIB,1,[ ])
],[
AC_MSG_ERROR([wrong grpc lib version or lib not found])
],[
-L$GRPC_LIBDIR
])
AC_PATH_PROG(PROTOC, protoc, no)
if ! test -x "$PROTOC"; then
AC_MSG_ERROR([protoc command missing, please reinstall the protobuf distribution])
fi
AC_PATH_PROG(GRPC_CPP_PLUGIN, grpc_cpp_plugin, no)
if ! test -x "$GRPC_CPP_PLUGIN"; then
AC_MSG_ERROR([grpc_cpp_plugin command missing, please reinstall the grpc distribution])
fi
mkdir -p src/network/v3
$PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/common/Common.proto
$PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/language-agent/*.proto
$PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/profile/*.proto
$PROTOC -I src/protocol/v3 --grpc_out=src/network/v3 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN --cpp_out=src/network/v3 src/protocol/v3/management/*.proto
find src -name "*.grpc.pb.cc" | while read id; do mv $id ${id/.grpc/_grpc}; done
PROTOBUF_LIBDIR=$PROTOBUF_DIR/${PROTOBUF_LIB_SUBDIR-lib}
PHP_ADD_LIBPATH($PROTOBUF_LIBDIR)
PHP_ADD_LIBRARY(protobuf,,SKYWALKING_SHARED_LIBADD)
AC_DEFINE(HAVE_PROTOBUFLIB,1,[ ])
PHP_SUBST(SKYWALKING_SHARED_LIBADD)
PHP_ADD_INCLUDE(src)
PHP_ADD_INCLUDE(src/network/v3)
PHP_NEW_EXTENSION(skywalking, \
skywalking.cc \
src/base64.cc \
src/cross_process_bag.cc \
src/manager.cc \
src/segment.cc \
src/segment_reference.cc \
src/sky_core_span_log.cc \
src/sky_execute.cc \
src/sky_grpc.cc \
src/sky_log.cc \
src/sky_module.cc \
src/sky_plugin_mysqli.cc \
src/sky_pdo.cc \
src/sky_plugin_curl.cc \
src/sky_plugin_error.cc \
src/sky_plugin_hyperf_guzzle.cc \
src/sky_plugin_predis.cc \
src/sky_plugin_rabbit_mq.cc \
src/sky_plugin_redis.cc \
src/sky_plugin_swoole_curl.cc \
src/sky_shm.cc \
src/sky_utils.cc \
src/span.cc \
src/tag.cc \
src/network/v3/common/Common_grpc.pb.cc \
src/network/v3/common/Common.pb.cc \
src/network/v3/language-agent/Tracing.pb.cc \
src/network/v3/language-agent/Tracing_grpc.pb.cc \
src/network/v3/management/Management_grpc.pb.cc \
src/network/v3/management/Management.pb.cc \
, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, cxx)
fi
if test -r $phpincludedir/ext/mysqli/mysqli_mysqlnd.h; then
AC_DEFINE([MYSQLI_USE_MYSQLND], 1, [Whether mysqlnd is enabled])
fi