THRIFT-854. php: Provide configure option and make rules to build/install php extension

This patch adds a make target in lib/php that builds the php extension. By default configure will attempt to build this, but it can be disabled with --without-php_extension.

Patch: Anthony Molinaro

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@989226 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/php/Makefile.am b/lib/php/Makefile.am
index b8d7e93..02cd184 100644
--- a/lib/php/Makefile.am
+++ b/lib/php/Makefile.am
@@ -17,17 +17,23 @@
 # under the License.
 #
 
+%.so:
+	cd src/ext/thrift_protocol/ \
+	  && $(MAKE)
+
+if WITH_PHP_EXTENSION
+phpconfdir=$(PHP_CONFIG_PREFIX)
+phpconf_DATA=thrift_protocol.ini
+
+phpmoduledir = `php-config --extension-dir`
+phpmodule_SCRIPTS = src/ext/thrift_protocol/modules/thrift_protocol.so
+endif
+
 phpdir = $(PHP_PREFIX)
 php_DATA =  \
   src/autoload.php \
   src/Thrift.php
 
-phpextdir = $(phpdir)/ext/thrift_protocol
-phpext_DATA = \
-  src/ext/thrift_protocol/config.m4 \
-  src/ext/thrift_protocol/php_thrift_protocol.cpp \
-  src/ext/thrift_protocol/php_thrift_protocol.h
-
 phpprotocoldir = $(phpdir)/protocol
 phpprotocol_DATA = \
   src/protocol/TBinaryProtocol.php \