1 #!/bin/bash 2 # Copyright 2015 gRPC authors. 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 set -e 16 default_extension_dir=$(php-config --extension-dir) 17 if [ ! -e $default_extension_dir/grpc.so ]; then 18 # the grpc extension is not found in the default PHP extension dir 19 # try the source modules directory 20 module_dir=$(pwd)/../ext/grpc/modules 21 if [ ! -e $module_dir/grpc.so ]; then 22 echo "Please run 'phpize && ./configure && make' from ext/grpc first" 23 exit 1 24 fi 25 # sym-link in system supplied extensions 26 for f in $default_extension_dir/*.so; do 27 ln -s $f $module_dir/$(basename $f) &> /dev/null || true 28 done 29 extension_dir="-d extension_dir=${module_dir} -d extension=grpc.so" 30 else 31 extension_dir="-d extension=grpc.so" 32 fi 33