config.m4 3.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
dnl $Id$
dnl config.m4 for extension skywalking

dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary. This file will not work
dnl without editing.

dnl If your extension references something external, use with:

dnl PHP_ARG_WITH(skywalking, for skywalking support,
dnl Make sure that the comment is aligned:
dnl [  --with-skywalking             Include skywalking support])

dnl Otherwise use enable:

dnl PHP_ARG_ENABLE(skywalking, whether to enable skywalking support,
dnl Make sure that the comment is aligned:
dnl [  --enable-skywalking           Enable skywalking support])


PHP_ARG_ENABLE(skywalking, whether to enable skywalking support,
[  --enable-skywalking           Enable skywalking support])

H
heyanlong 已提交
24 25 26 27 28 29 30
if test -z "$PHP_DEBUG"; then
    AC_ARG_ENABLE(debug,
        [--enable-debug compile with debugging system],
        [PHP_DEBUG=$enableval], [PHP_DEBUG=no]
    )
fi

31 32
if test "$PHP_SKYWALKING" != "no"; then

33
  CXXFLAGS+=" -std=c++11 -Isrc/report/deps/boost -DDEBUG"
S
songzhian 已提交
34
  PHP_REQUIRE_CXX()
35

H
heyanlong 已提交
36
  KYWALKING_LIBS=`pkg-config --cflags --libs protobuf grpc++ grpc`
H
heyanlong 已提交
37
  KYWALKING_LIBS+=" -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -ldl "
S
songzhian 已提交
38

H
heyanlong 已提交
39 40 41 42 43 44 45
  AC_OUTPUT_COMMANDS(
    protoc -I ./src/protocol-6 --cpp_out=./src/grpc ./src/protocol-6/common/*.proto
    protoc -I ./src/protocol-6 --cpp_out=./src/grpc ./src/protocol-6/register/*.proto
    protoc -I ./src/protocol-6 --cpp_out=./src/grpc ./src/protocol-6/language-agent-v2/*.proto
    protoc -I ./src/protocol-6 --grpc_out=./src/grpc --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./src/protocol-6/common/*.proto
    protoc -I ./src/protocol-6 --grpc_out=./src/grpc --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./src/protocol-6/register/*.proto
    protoc -I ./src/protocol-6 --grpc_out=./src/grpc --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./src/protocol-6/language-agent-v2/*.proto
S
songzhian 已提交
46
  )
H
heyanlong 已提交
47

S
songzhian 已提交
48
  AC_OUTPUT_COMMANDS(
H
heyanlong 已提交
49 50
   mv src/grpc/common/common.grpc.pb.cc src/grpc/common/common-grpc.pb.cc
   mv src/grpc/register/Register.grpc.pb.cc src/grpc/register/Register-grpc.pb.cc
G
goerzh 已提交
51 52 53
   mv src/grpc/language-agent-v2/trace.grpc.pb.cc src/grpc/language-agent-v2/trace-grpc.pb.cc
   mv src/grpc/register/InstancePing.grpc.pb.cc src/grpc/register/InstancePing-grpc.pb.cc
   mv src/grpc/common/trace-common.grpc.pb.cc src/grpc/common/trace-common-grpc.pb.cc
S
songzhian 已提交
54 55 56 57 58 59 60
  )

  PHP_EVAL_LIBLINE($KYWALKING_LIBS, SKYWALKING_SHARED_LIBADD)


  PHP_NEW_EXTENSION(skywalking, \
      skywalking.c \
H
report  
heyanlong 已提交
61
      src/greeter_client.cc \
G
goerzh 已提交
62 63
      src/decode.c \
      src/encode.c \
H
heyanlong 已提交
64 65 66 67
      src/grpc/common/common-grpc.pb.cc \
      src/grpc/common/common.pb.cc \
      src/grpc/register/Register-grpc.pb.cc \
      src/grpc/register/Register.pb.cc \
G
goerzh 已提交
68 69 70 71 72 73
      src/grpc/language-agent-v2/trace-grpc.pb.cc \
      src/grpc/language-agent-v2/trace.pb.cc \
      src/grpc/register/InstancePing-grpc.pb.cc \
      src/grpc/register/InstancePing.pb.cc \
      src/grpc/common/trace-common-grpc.pb.cc \
      src/grpc/common/trace-common.pb.cc \
H
heyanlong 已提交
74
  , $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
S
songzhian 已提交
75

H
heyanlong 已提交
76 77
  PHP_ADD_BUILD_DIR($ext_builddir/src/grpc)
  PHP_ADD_LIBRARY(stdc++, 1, SKYWALKING_SHARED_LIBADD)
H
heyanlong 已提交
78
  PHP_ADD_INCLUDE("src/grpc")
G
goerzh 已提交
79
  PHP_ADD_INCLUDE("src")
S
songzhian 已提交
80
  PHP_SUBST(SKYWALKING_SHARED_LIBADD)
81
fi