summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap.sh1
-rw-r--r--configure.ac14
-rw-r--r--lib/php/Makefile.am18
-rw-r--r--lib/php/thrift_protocol.ini1
4 files changed, 28 insertions, 6 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index 74ecdb8d1..52d5a5173 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -20,6 +20,7 @@
#
./cleanup.sh
+(cd lib/php/src/ext/thrift_protocol && phpize)
autoscan || exit 1
aclocal -I ./aclocal || exit 1
diff --git a/configure.ac b/configure.ac
index 822fd1a12..3175a7be6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,13 @@ AC_ARG_VAR([PHP_PREFIX], [Prefix for installing PHP modules.
Default = "/usr/lib/php"])
AS_IF([test "x$PHP_PREFIX" = x], [PHP_PREFIX="/usr/lib/php"])
+AC_ARG_VAR([PHP_CONFIG_PREFIX],
+ [Prefix for installing PHP extension module .ini file.
+ (Normal --prefix is ignored for PHP because PHP has
+ different conventions.)
+ Default = "/etc/php.d"])
+AS_IF([test "x$PHP_CONFIG_PREFIX" = x], [PHP_CONFIG_PREFIX="/etc/php.d"])
+
AC_ARG_VAR([PERL_PREFIX], [Prefix for installing Perl modules.
(Normal --prefix is ignored for Perl because
Perl has different conventions.)
@@ -137,6 +144,13 @@ if test "$with_php" = "yes"; then
fi
AM_CONDITIONAL(WITH_PHP, [test -n "$PHP"])
+AX_THRIFT_LIB(php_extension, [PHP_EXTENSION], yes)
+if test "$with_php_extension" = "yes"; then
+ AC_PATH_PROG([PHP_CONFIG], [php-config])
+ AC_CONFIG_SUBDIRS([lib/php/src/ext/thrift_protocol])
+fi
+AM_CONDITIONAL(WITH_PHP_EXTENSION, [test -n "$PHP_CONFIG"])
+
AX_THRIFT_LIB(ruby, [Ruby], yes)
if test "$with_ruby" = "yes"; then
AC_PATH_PROG([RUBY], [ruby])
diff --git a/lib/php/Makefile.am b/lib/php/Makefile.am
index b8d7e930d..02cd184bf 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 \
diff --git a/lib/php/thrift_protocol.ini b/lib/php/thrift_protocol.ini
new file mode 100644
index 000000000..a260d83b0
--- /dev/null
+++ b/lib/php/thrift_protocol.ini
@@ -0,0 +1 @@
+extension=thrift_protocol.so