forked from SkyAPM/SkyAPM-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.m4
179 lines (155 loc) · 7.94 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
PHP_REQUIRE_CXX()
CXXFLAGS="$CXXFLAGS -Wall -std=c++11 -Wno-deprecated-register"
PHP_ARG_ENABLE([skywalking],
[whether to enable skywalking support],
[AS_HELP_STRING([--enable-skywalking],
[Enable skywalking support])],
[yes])
PHP_ARG_WITH([grpc],,
[AS_HELP_STRING([[--with-grpc[=DIR]]],
[gRPC: gPRC support])],
[no],
[no])
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
dnl grpc
if test "$PHP_GRPC" == "no"; then
AC_MSG_ERROR([skywalking extension requires gRPC extension, add --with-grpc=[DIR]])
fi
SEARCH_GRPC_FOR="libgrpc.a libgpr.a libgrpc++.a libupb.a libaddress_sorting.a third_party/protobuf/libprotobuf.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/re2/libre2.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/strings/libabsl_strings.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/strings/libabsl_str_format_internal.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/numeric/libabsl_int128.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/types/libabsl_bad_optional_access.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/base/libabsl_base.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/base/libabsl_throw_delegate.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/base/libabsl_raw_logging_internal.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/time/libabsl_time.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/abseil-cpp/absl/time/libabsl_time_zone.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/cares/cares/lib/libcares.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/boringssl-with-bazel/libssl.a"
SEARCH_GRPC_FOR="$SEARCH_GRPC_FOR third_party/boringssl-with-bazel/libcrypto.a"
AC_MSG_CHECKING([for grpc files in $PHP_GRPC path])
for i in $SEARCH_GRPC_FOR ; do
target=$PHP_GRPC/cmake/build/$i
if test -r $target; then
AC_MSG_RESULT(found in $target)
else
AC_MSG_ERROR([not found $target])
fi
done
PHP_ADD_INCLUDE($PHP_GRPC/include)
PHP_ADD_INCLUDE($PHP_GRPC/third_party/protobuf/src)
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/libgrpc++.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/libgrpc.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/libgpr.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/libupb.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/libaddress_sorting.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/protobuf/libprotobuf.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/re2/libre2.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/strings/libabsl_strings.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/strings/libabsl_str_format_internal.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/numeric/libabsl_int128.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/types/libabsl_bad_optional_access.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/base/libabsl_base.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/base/libabsl_throw_delegate.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/base/libabsl_raw_logging_internal.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/time/libabsl_time.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/abseil-cpp/absl/time/libabsl_time_zone.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/cares/cares/lib/libcares.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/boringssl-with-bazel/libssl.a"
SKYWALKING_EXTRA_LDFLAGS="$SKYWALKING_EXTRA_LDFLAGS $PHP_GRPC/cmake/build/third_party/boringssl-with-bazel/libcrypto.a"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SKYWALKING_EXTRA_LDFLAGS"
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
AC_PATH_PROG(PROTOC, protoc, no, $PHP_GRPC/cmake/build/third_party/protobuf)
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, $PHP_GRPC/cmake/build)
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
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