summaryrefslogtreecommitdiffhomepage
path: root/auto/modules/php/conf
blob: 445baa2918ffc1cec236475b3bec77c5ad7d17b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

# Copyright (C) Max Romanov
# Copyright (C) NGINX, Inc.


$echo -n "checking for PHP ..."
$echo "checking for PHP ..." >> $NXT_AUTOCONF_ERR

nxt_found=no

NXT_PHP_CONFIG="${NXT_PHP}-config"

if /bin/sh -c "${NXT_PHP_CONFIG} --version"  >> $NXT_AUTOCONF_ERR 2>&1; then

    $echo " found"

    NXT_PHP_VERSION="`${NXT_PHP_CONFIG} --version`"
    $echo " + PHP version: ${NXT_PHP_VERSION}"
    $echo " + PHP SAPI: [`${NXT_PHP_CONFIG} --php-sapis`]"

    NXT_PHP_INCLUDE="`${NXT_PHP_CONFIG} --includes`"
    NXT_PHP_LIB="-lphp${NXT_PHP_VERSION%%.*}"
    # "php-config --ldflags" does not contain path to libphp.

    nxt_feature="PHP embed SAPI"
    nxt_feature_name=NXT_HAVE_PHP
    nxt_feature_run=no
    nxt_feature_incs="${NXT_PHP_INCLUDE}"
    nxt_feature_libs="${NXT_PHP_LIB} ${NXT_PHP_LDFLAGS}"
    nxt_feature_test="
        #include <php.h>
        #include <php_main.h>

        int main() {
            php_request_startup();
            return 0;
        }"

    . auto/feature
fi

if [ $nxt_found = no ]; then
    $echo
    $echo $0: error: no PHP embed SAPI found.
    $echo
    exit 1;
fi

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_LDFLAGS"