Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 1 | %YAML 1.2 |
| 2 | --- | |
| 3 | PHP_ARG_ENABLE(grpc, whether to enable grpc support, |
| 4 | [ --enable-grpc Enable grpc support]) |
| 5 | |
| 6 | if test "$PHP_GRPC" != "no"; then |
| 7 | dnl Write more examples of tests here... |
| 8 | |
| 9 | dnl # --with-grpc -> add include path |
| 10 | PHP_ADD_INCLUDE(../../grpc/include) |
| 11 | PHP_ADD_INCLUDE(../../grpc/src/php/ext/grpc) |
| 12 | PHP_ADD_INCLUDE(../../grpc/third_party/boringssl/include) |
| 13 | |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 14 | LIBS="-lpthread $LIBS" |
| 15 | |
| 16 | GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 17 | PHP_ADD_LIBRARY(pthread) |
| 18 | |
Stanley Cheung | bf74d69 | 2016-02-23 22:39:25 -0800 | [diff] [blame] | 19 | PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD) |
| 20 | PHP_ADD_LIBRARY(dl) |
| 21 | |
| 22 | case $host in |
| 23 | *darwin*) ;; |
| 24 | *) |
| 25 | PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD) |
| 26 | PHP_ADD_LIBRARY(rt) |
| 27 | ;; |
| 28 | esac |
| 29 | |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 30 | PHP_NEW_EXTENSION(grpc, |
| 31 | % for source in php_config_m4.src: |
| 32 | ${source} ${"\\"} |
| 33 | % endfor |
| 34 | % for lib in libs: |
| 35 | % if lib.name in php_config_m4.get('deps', []): |
| 36 | % for source in lib.src: |
| 37 | ${source} ${"\\"} |
| 38 | % endfor |
| 39 | % endif |
| 40 | % endfor |
| 41 | , $ext_shared, , -Wall -Werror -std=c11 ${"\\"} |
| 42 | -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN ${"\\"} |
| 43 | -D_HAS_EXCEPTIONS=0 -DNOMINMAX) |
Stanley Cheung | 80db5be | 2016-02-24 21:35:56 -0800 | [diff] [blame^] | 44 | |
| 45 | PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc) |
| 46 | <% |
| 47 | dirs = {} |
| 48 | for lib in libs: |
| 49 | if lib.name in php_config_m4.get('deps', []): |
| 50 | for source in lib.src: |
| 51 | dirs[source[:source.rfind('/')]] = 1 |
| 52 | dirs = dirs.keys() |
| 53 | dirs.sort() |
| 54 | %> |
| 55 | % for dir in dirs: |
| 56 | PHP_ADD_BUILD_DIR($ext_builddir/${dir}) |
| 57 | % endfor |
Stanley Cheung | 5adb71f | 2016-02-13 00:03:02 -0800 | [diff] [blame] | 58 | fi |