ngx_addon_name=ngx_http_echo_module

ECHO_SRCS="                                                                 \
        $ngx_addon_dir/src/ngx_http_echo_module.c                           \
        $ngx_addon_dir/src/ngx_http_echo_util.c                             \
        $ngx_addon_dir/src/ngx_http_echo_timer.c                            \
        $ngx_addon_dir/src/ngx_http_echo_var.c                              \
        $ngx_addon_dir/src/ngx_http_echo_handler.c                          \
        $ngx_addon_dir/src/ngx_http_echo_filter.c                           \
        $ngx_addon_dir/src/ngx_http_echo_sleep.c                            \
        $ngx_addon_dir/src/ngx_http_echo_location.c                         \
        $ngx_addon_dir/src/ngx_http_echo_echo.c                             \
        $ngx_addon_dir/src/ngx_http_echo_request_info.c                     \
        $ngx_addon_dir/src/ngx_http_echo_subrequest.c                       \
        $ngx_addon_dir/src/ngx_http_echo_foreach.c                          \
        "

ECHO_DEPS="                                                                 \
        $ngx_addon_dir/src/ddebug.h                                         \
        $ngx_addon_dir/src/ngx_http_echo_module.h                           \
        $ngx_addon_dir/src/ngx_http_echo_handler.h                          \
        $ngx_addon_dir/src/ngx_http_echo_util.h                             \
        $ngx_addon_dir/src/ngx_http_echo_sleep.h                            \
        $ngx_addon_dir/src/ngx_http_echo_filter.h                           \
        $ngx_addon_dir/src/ngx_http_echo_var.h                              \
        $ngx_addon_dir/src/ngx_http_echo_location.h                         \
        $ngx_addon_dir/src/ngx_http_echo_echo.h                             \
        $ngx_addon_dir/src/ngx_http_echo_request_info.h                     \
        $ngx_addon_dir/src/ngx_http_echo_subrequest.h                       \
        $ngx_addon_dir/src/ngx_http_echo_foreach.h                          \
        "

# nginx 1.17.0+ unconditionally enables the postpone filter
if [ ! -z "$HTTP_POSTPONE" ]; then
    # nginx won't have HTTP_POSTPONE_FILTER_MODULE & HTTP_POSTPONE_FILTER_SRCS
    # defined since 1.9.11
    if [ -z "$HTTP_POSTPONE_FILTER_MODULE" ]; then
        HTTP_POSTPONE_FILTER_MODULE=ngx_http_postpone_filter_module
        HTTP_POSTPONE_FILTER_SRCS=src/http/ngx_http_postpone_filter_module.c
    fi

    # This module depends upon the postpone filter being activated
    if [ "$HTTP_POSTPONE" != YES ]; then
        HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_POSTPONE_FILTER_MODULE"
        HTTP_SRCS="$HTTP_SRCS $HTTP_POSTPONE_FILTER_SRCS"
        HTTP_POSTPONE=YES
    fi
fi

if [ -n "$ngx_module_link" ]; then
    ngx_module_type=HTTP_AUX_FILTER
    ngx_module_name=$ngx_addon_name
    ngx_module_incs=
    ngx_module_deps="$ECHO_DEPS"
    ngx_module_srcs="$ECHO_SRCS"
    ngx_module_libs=

    . auto/module
else
    HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name"
    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ECHO_SRCS"
    NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ECHO_DEPS"
fi
