fix php artifact name and update config.m4 template
diff --git a/templates/config.m4.template b/templates/config.m4.template
index 1f8c1d9..dbc1218 100644
--- a/templates/config.m4.template
+++ b/templates/config.m4.template
@@ -11,8 +11,22 @@
     PHP_ADD_INCLUDE(../../grpc/src/php/ext/grpc)
     PHP_ADD_INCLUDE(../../grpc/third_party/boringssl/include)
 
+    LIBS="-lpthread $LIBS"
+
+    GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
     PHP_ADD_LIBRARY(pthread)
 
+    PHP_ADD_LIBRARY(dl,,GRPC_SHARED_LIBADD)
+    PHP_ADD_LIBRARY(dl)
+
+    case $host in
+      *darwin*) ;;
+      *)
+        PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
+        PHP_ADD_LIBRARY(rt)
+        ;;
+    esac
+
     PHP_NEW_EXTENSION(grpc,
       % for source in php_config_m4.src:
       ${source} ${"\\"}