-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.m4
90 lines (73 loc) · 2.93 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
dnl Licensed to the Apache Software Foundation (ASF) under one or more
dnl contributor license agreements. See the NOTICE file distributed with
dnl this work for additional information regarding copyright ownership.
dnl The ASF licenses this file to You under the Apache License, Version 2.0
dnl (the "License"); you may not use this file except in compliance with
dnl the License. You may obtain a copy of the License at
dnl
dnl http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
PHP_ARG_ENABLE([skywalking_agent],
[whether to enable skywalking_agent support],
[AS_HELP_STRING([--enable-skywalking_agent],
[Enable skywalking_agent support])],
[no])
PHP_ARG_ENABLE([cargo_debug], [whether to enable cargo debug mode],
[ --enable-cargo-debug Enable cargo debug], no, no)
PHP_ARG_ENABLE([kafka_reporter], [whether to enable kafka reporter],
[ --enable-kafka-reporter Enable kafka reporter], no, no)
if test "$PHP_THREAD_SAFETY" == "yes"; then
AC_MSG_ERROR([skywalking_agent does not support ZTS])
fi
if test "$PHP_SKYWALKING_AGENT" != "no"; then
AC_PATH_PROG(CARGO, cargo, no)
if ! test -x "$CARGO"; then
AC_MSG_ERROR([cargo command missing, please reinstall the cargo distribution])
fi
AC_PATH_PROG(PROTOC, protoc, no)
if ! test -x "$PROTOC"; then
AC_MSG_ERROR([protoc command missing, please reinstall the protoc distribution])
fi
AC_DEFINE(HAVE_SKYWALKING_AGENT, 1, [ Have skywalking_agent support ])
PHP_NEW_EXTENSION(skywalking_agent, [ ], $ext_shared)
CARGO_MODE_FLAGS="--release"
CARGO_MODE_DIR="release"
CARGO_FEATURES_FLAGS=""
if test "$PHP_CARGO_DEBUG" != "no"; then
CARGO_MODE_FLAGS=""
CARGO_MODE_DIR="debug"
fi
if test "$PHP_KAFKA_REPORTER" != "no"; then
CARGO_FEATURES_FLAGS="--features kafka-reporter"
fi
cat >>Makefile.objects<< EOF
all: cargo_build
clean: cargo_clean
cargo_build:
PHP_CONFIG=$PHP_PHP_CONFIG cargo build $CARGO_MODE_FLAGS $CARGO_FEATURES_FLAGS
if [[ -f ./target/$CARGO_MODE_DIR/libskywalking_agent.dylib ]] ; then \\
cp ./target/$CARGO_MODE_DIR/libskywalking_agent.dylib ./modules/skywalking_agent.so ; fi
if [[ -f ./target/$CARGO_MODE_DIR/libskywalking_agent.so ]] ; then \\
cp ./target/$CARGO_MODE_DIR/libskywalking_agent.so ./modules/skywalking_agent.so ; fi
cargo_clean:
cargo clean
.PHONY: cargo_build cargo_clean
EOF
AC_CONFIG_LINKS([ \
.rustfmt.toml:.rustfmt.toml \
Cargo.lock:Cargo.lock \
Cargo.toml:Cargo.toml \
build.rs:build.rs \
docker-compose.yml:docker-compose.yml \
rust-toolchain.toml:rust-toolchain.toml \
scripts:scripts \
src:src \
tests:tests \
worker:worker \
])
fi