THRIFT-847 Test Framework harmonization across all languages
THRIFT-2946 Enhance usability of cross test framework

Patch: Nobuaki Sukegawa

This closes: #358
diff --git a/test/php/Makefile.am b/test/php/Makefile.am
index 1625903..11974da 100755
--- a/test/php/Makefile.am
+++ b/test/php/Makefile.am
@@ -17,12 +17,14 @@
 # under the License.
 #
 
-THRIFT = $(top_srcdir)/compiler/cpp/thrift
+THRIFT = $(top_builddir)/compiler/cpp/thrift
 
 stubs: ../ThriftTest.thrift
 	$(THRIFT) --gen php ../ThriftTest.thrift
 	$(THRIFT) --gen php:inlined ../ThriftTest.thrift
 
+precross: stubs
+
 check: stubs
 
 clean-local:
diff --git a/test/php/TestClient.php b/test/php/TestClient.php
index ea17435..4ec4eab 100755
--- a/test/php/TestClient.php
+++ b/test/php/TestClient.php
@@ -60,6 +60,14 @@
   $host = $argv[1];
 }
 
+foreach ($argv as $arg) {
+  if (substr($arg, 0, 7) == '--port=') {
+    $port = substr($arg, 7);
+  } else if (substr($arg, 0, 11) == '--transport=') {
+    $MODE = substr($arg, 11);
+  }
+}
+
 $hosts = array('localhost');
 
 $socket = new TSocket($host, $port);