summaryrefslogtreecommitdiffhomepage
path: root/auto
diff options
context:
space:
mode:
Diffstat (limited to 'auto')
-rw-r--r--auto/make4
-rw-r--r--auto/modules/conf4
-rw-r--r--auto/modules/php/conf43
-rw-r--r--auto/modules/php/make24
-rw-r--r--auto/options5
5 files changed, 80 insertions, 0 deletions
diff --git a/auto/make b/auto/make
index c34b2a71..328107d5 100644
--- a/auto/make
+++ b/auto/make
@@ -231,6 +231,10 @@ if [ $NXT_PYTHON_MODULE != NO ]; then
. auto/modules/python/make
fi
+if [ $NXT_PHP_MODULE != NO ]; then
+ . auto/modules/php/make
+fi
+
# Makefile.
# *.dSYM is MacOSX Clang debug information.
diff --git a/auto/modules/conf b/auto/modules/conf
index f060bdeb..f73be1e6 100644
--- a/auto/modules/conf
+++ b/auto/modules/conf
@@ -11,6 +11,10 @@ if [ $NXT_PYTHON_MODULE != NO ]; then
. auto/modules/python/conf
fi
+if [ $NXT_PHP_MODULE != NO ]; then
+ . auto/modules/php/conf
+fi
+
NXT_MODULES_SRC=$NXT_BUILD_DIR/nxt_modules.c
diff --git a/auto/modules/php/conf b/auto/modules/php/conf
new file mode 100644
index 00000000..9eef65fb
--- /dev/null
+++ b/auto/modules/php/conf
@@ -0,0 +1,43 @@
+
+# Copyright (C) Max Romanov
+# Copyright (C) NGINX, Inc.
+
+
+NXT_PHP_CONFIG="${NXT_PHP}-config"
+NXT_PHP_VERSION="`${NXT_PHP_CONFIG} --version`"
+NXT_PHP_INCLUDE="`${NXT_PHP_CONFIG} --includes`"
+NXT_PHP_LIB="-lphp${NXT_PHP_VERSION%%.*}"
+NXT_PHP_LIBS="`${NXT_PHP_CONFIG} --ldflags`"
+
+nxt_feature="PHP"
+nxt_feature_name=NXT_HAVE_PHP
+nxt_feature_run=no
+nxt_feature_incs="${NXT_PHP_INCLUDE}"
+nxt_feature_libs="${NXT_PHP_LIB} ${NXT_PHP_LIBS}"
+nxt_feature_test="#include <php.h>
+ #include <php_main.h>
+
+ int main() {
+ php_request_startup();
+ return 0;
+ }"
+
+. auto/feature
+
+if [ $nxt_found = no ]; then
+ $echo
+ $echo $0: error: no php found.
+ $echo
+ exit 1;
+fi
+
+$echo " + php version: ${NXT_PHP_VERSION}"
+
+NXT_PHP_MODULE_SRCS=" \
+ src/nxt_php_sapi.c \
+"
+
+NXT_MODULES_INIT="$NXT_MODULES_INIT nxt_php_sapi_init"
+NXT_MODULES_SRCS="$NXT_MODULES_SRCS $NXT_PHP_MODULE_SRCS"
+
+NXT_LIB_AUX_LIBS="$NXT_LIB_AUX_LIBS $NXT_PHP_LIB $NXT_PHP_LIBS"
diff --git a/auto/modules/php/make b/auto/modules/php/make
new file mode 100644
index 00000000..f4bd7f97
--- /dev/null
+++ b/auto/modules/php/make
@@ -0,0 +1,24 @@
+
+# Copyright (C) Max Romanov
+# Copyright (C) NGINX, Inc.
+
+
+$echo >> $NXT_MAKEFILE
+$echo >> $NXT_MAKEFILE
+
+
+# The php module object files.
+
+for nxt_src in $NXT_PHP_MODULE_SRCS
+do
+ nxt_obj=`$echo $nxt_src | sed -e "s/\.c$/\.o/"`
+ cat << END >> $NXT_MAKEFILE
+
+$NXT_BUILD_DIR/$nxt_obj: $nxt_src
+ \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_PHP_INCLUDE \\
+ $NXT_LIB_AUX_CFLAGS \\
+ -o $NXT_BUILD_DIR/$nxt_obj \\
+ $nxt_src
+END
+
+done
diff --git a/auto/options b/auto/options
index e4b4d72d..36215198 100644
--- a/auto/options
+++ b/auto/options
@@ -44,6 +44,8 @@ NXT_LIB_UNIT_TEST=NO
NXT_PYTHON=python
NXT_PYTHON_MODULE=NO
+NXT_PHP=php
+NXT_PHP_MODULE=NO
for nxt_option
do
@@ -93,6 +95,9 @@ do
--with-python=*) NXT_PYTHON="$value" ;;
--with-python_module) NXT_PYTHON_MODULE=YES ;;
+ --with-php=*) NXT_PHP="$value" ;;
+ --with-php_module) NXT_PHP_MODULE=YES ;;
+
*)
$echo
$echo "$0: error: invalid option \"$nxt_option\"".