#!/bin/sh

# Copyright (C) 2010-2013 Alibaba Group Holding Limited


ngx_soext='.so'
CC=cc
CFLAGS=' -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -fstack-protector -DNDK_SET_VAR -fPIC'
CPP='cc -E'
LINK='$(CC) -rdynamic  -fPIC  -shared  '

NGX_INCLUDE_PATH=/DBA/tengine/2.0.0/include


CORE_LIBS='-Wl,-E  -lpthread -ldl -lcrypt -L/DBA/lua/5.1.5/lib -llua -lm -lpcre ./openssl-1.0.1f/.openssl/lib/libssl.a ./openssl-1.0.1f/.openssl/lib/libcrypto.a -ldl -lz -lgd'
CORE_LINK=''

NGX_LD_OPT=''
NGX_PREFIX=/DBA/tengine/2.0.0

NGX_RPATH=NO

ngx_regex_dirsep='\/'
ngx_cont=' \
	'
ngx_cc='$(CC) -c $(CFLAGS) $(CORE_INCS) $(HTTP_INCS)'
ngx_tab=' \
		'
ngx_objout='-o '
NGX_AUX=''
ngx_long_regex_cont=' \\\
	'
ngx_dirsep='/'
ngx_binext=''
ngx_long_start=''
ngx_long_cont=' \
	'
ngx_rcc=''
ngx_spacer='
'
ngx_objext='o'
ngx_regex_cont=' \\\
	'
ngx_include_opt='-I '
ngx_binout='-o '
NGX_DSO_PATH=modules/
NGX_AUTOCONF_ERR=autoconf.err
NGX_AUTOTEST=autotest
NGX_AUTO_CONFIG_H='objs/ngx_shared_config.h'
NGX_CONFIGURE=" --prefix=/DBA/tengine/2.0.0 --with-openssl=./openssl-1.0.1f --with-rtsig_module --with-select_module --with-poll_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=./lua-nginx-module-master --add-module=./nginx-upload-progress --add-module=./ngx_cache_purge --add-module=./ngx_log_if --add-module=./nginx_accept_language_module --with-imap --with-file-aio --with-http_spdy_module --with-http_gunzip_module --with-md5=/usr --with-sha1=/usr --add-module=./ngx_slowfs_cache-master --with-cc-opt='-fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -fstack-protector'"
ngx_feature_file='
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.


echo $ngx_n "checking for $ngx_feature ...$ngx_c"

cat << END >> $NGX_AUTOCONF_ERR

----------------------------------------
checking for $ngx_feature

END

ngx_found=no

if test -n "$ngx_feature_name"; then
    ngx_have_feature=`echo $ngx_feature_name \
                   | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
fi

if test -n "$ngx_feature_path"; then
    for ngx_temp in $ngx_feature_path; do
        ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp"
    done
fi

cat << END > $NGX_AUTOTEST.c

#include <sys/types.h>
$NGX_INCLUDE_UNISTD_H
$ngx_feature_incs

int main() {
    $ngx_feature_test;
    return 0;
}

END


ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"

ngx_feature_inc_path=

eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1"


if [ -x $NGX_AUTOTEST ]; then

    case "$ngx_feature_run" in

        yes)
            # /bin/sh is used to intercept "Killed" or "Abort trap" messages
            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
                echo " found"
                ngx_found=yes

                if test -n "$ngx_feature_name"; then
                    have=$ngx_have_feature . auto/have
                fi

            else
                echo " found but is not working"
            fi
        ;;

        value)
            # /bin/sh is used to intercept "Killed" or "Abort trap" messages
            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
                echo " found"
                ngx_found=yes

                cat << END >> $NGX_AUTO_CONFIG_H

#ifndef $ngx_feature_name
#define $ngx_feature_name  `$NGX_AUTOTEST`
#endif

END
            else
                echo " found but is not working"
            fi
        ;;

        bug)
            # /bin/sh is used to intercept "Killed" or "Abort trap" messages
            if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
                echo " not found"

            else
                echo " found"
                ngx_found=yes

                if test -n "$ngx_feature_name"; then
                    have=$ngx_have_feature . auto/have
                fi
            fi
        ;;

        *)
            echo " found"
            ngx_found=yes

            if test -n "$ngx_feature_name"; then
                have=$ngx_have_feature . auto/have
            fi
        ;;

    esac

else
    echo " not found"

    echo "----------"    >> $NGX_AUTOCONF_ERR
    cat $NGX_AUTOTEST.c  >> $NGX_AUTOCONF_ERR
    echo "----------"    >> $NGX_AUTOCONF_ERR
    echo $ngx_test       >> $NGX_AUTOCONF_ERR
    echo "----------"    >> $NGX_AUTOCONF_ERR
fi

rm $NGX_AUTOTEST*'
ngx_have_file='
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.


cat << END >> $NGX_AUTO_CONFIG_H

#ifndef $have
#define $have  1
#endif

END'

DSO_CORE_DEPS=' /DBA/tengine/2.0.0/include/nginx.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_config.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_core.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_log.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_palloc.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_array.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_list.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_hash.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_buf.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_queue.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_string.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_parse.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_inet.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_file.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_crc.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_crc32.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_murmurhash.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_md5.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_sha1.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_rbtree.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_trie.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_segment_tree.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_radix_tree.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_slab.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_times.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_shmtx.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_connection.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_cycle.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_conf_file.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_resolver.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_open_file_cache.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_crypt.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_event.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_event_timer.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_event_posted.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_event_busy_lock.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_event_connect.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_event_pipe.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_time.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_errno.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_alloc.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_files.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_channel.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_shmem.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_process.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_setaffinity.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_setproctitle.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_atomic.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_gcc_atomic_x86.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_thread.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_socket.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_os.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_user.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_pipe.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_sysinfo.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_process_cycle.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_linux_config.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_linux.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_syslog.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_proc.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_event_openssl.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_regex.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ssl.h /DBA/tengine/2.0.0/include/ /DBA/tengine/2.0.0/include/ngx_auto_config.h'
DSO_HTTP_DEPS=' ngx_http.h  ngx_http_request.h  ngx_http_config.h  ngx_http_core_module.h  ngx_http_cache.h  ngx_http_variables.h  ngx_http_script.h  ngx_http_upstream.h  ngx_http_upstream_round_robin.h  ngx_http_busy_lock.h  ngx_http_ssi_filter_module.h  ngx_http_spdy.h  ngx_http_spdy_module.h  ngx_http_ssl_module.h'
DSO_ALL_INCS='      -I/DBA/lua/5.1.5/include  -I./lua-nginx-module-master/src/api  -I./openssl-1.0.1f/.openssl/include  -Iobjs   '


ALL_INCS=
CORE_INCS=
HTTP_INCS=
CORE_DEPS=
HTTP_DEPS=

NGX_OBJS=objs

opt=
help=no

for option
do
    opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"

    case "$option" in
        -*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;;
           *) value="" ;;
    esac

    case "$option" in
        --help)                          help=yes                       ;;
        -h)                              help=yes                       ;;

        --dst=)                          NGX_DSO_PREFIX="!"             ;;
        --dst=*)                         NGX_DSO_PREFIX="$value"        ;;
        -d=*)                            NGX_DSO_PREFIX="$value"        ;;

        --add-module=*)                  NGX_DSO_ADDONS="$NGX_DSO_ADDONS $value" ;;
        -a=*)                            NGX_DSO_ADDONS="$NGX_DSO_ADDONS $value" ;;

        --nginx-include=*)               NGX_INCLUDE_PATH="$value"       ;;
        -s=*)                            NGX_INCLUDE_PATH="$value"       ;;

        *)
            echo "$0: error: invalid option \"$option\""
            exit 1
        ;;
    esac
done


if ! test -n "$option" ; then
    help=yes
fi


if [ $help = yes ]; then

cat << END

    -h, --help                 display this help and exit
    -d, --dst=PATH             set module installation path
    -a, --add-module=PATH      external module which will be compiled(absolute path)
    -s, --nginx-include=SOURCE set nginx include path(absolute path)

END

    exit 1
fi



# arg1 is addon dir
# arg2 is addon deps
# arg3 is addon src

generate_make () {
    # mkdir build temp
    cd $1
    dso_binout=$ngx_addon_name
    NGX_DSO_MAKEFILE=objs/Makefile
    NGX_ADDON_DEPS=$2

    cat << END                                                     > $NGX_DSO_MAKEFILE

CC = $CC
CFLAGS = $CFLAGS
CPP = $CPP
LINK = $LINK


CORE_LIBS = $CORE_LIBS
CORE_INCS = $CORE_INCS
HTTP_INCS = $HTTP_INCS

CORE_LINK = $CORE_LINK
NGX_LD_OPT = $NGX_LD_OPT

END


    cat << END                                                     >> $NGX_DSO_MAKEFILE

ALL_INCS = $ALL_INCS

CORE_DEPS = $CORE_DEPS

HTTP_DEPS = $HTTP_DEPS

ADDON_DEPS = \$(CORE_DEPS) $NGX_ADDON_DEPS

END


    if test -n "$NGX_LD_OPT$CORE_LIBS"; then
        ngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \
            | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
    fi

    for ngx_src in $NGX_ADDON_SRCS
    do
        ngx_obj="objs/src/`basename \`dirname $ngx_src\``"

        test -d $ngx_obj || mkdir -p $ngx_obj

        ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` | sed -e "s/\//$ngx_regex_dirsep/g"`

        ngx_obj=`echo $ngx_obj \
            | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
                  -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
                  -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
                  -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`

        ngx_dso_all_objs="$ngx_dso_all_objs $ngx_obj"

    done

    ngx_deps=`echo $ngx_dso_all_objs $ngx_res $LINK_DEPS \
        | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
              -e "s/\//$ngx_regex_dirsep/g"`

    ngx_objs=`echo $ngx_dso_all_objs \
        | sed -e "s/  *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
              -e "s/\//$ngx_regex_dirsep/g"`

    ngx_link=${CORE_LINK:+`echo $CORE_LINK \
        | sed -e "s/\//$ngx_regex_dirsep%%/g" -e "s/^/$ngx_long_regex_cont/"`}

    cat << END                                                    >> $NGX_DSO_MAKEFILE

$NGX_OBJS${ngx_dirsep}${dso_binout}${ngx_soext}:	$ngx_deps$ngx_spacer
	\$(LINK) ${ngx_long_start}${ngx_binout} $NGX_OBJS${ngx_dirsep}${dso_binout}${ngx_soext}$ngx_long_cont$ngx_objs$ngx_libs$ngx_link
	$ngx_rcc
${ngx_long_end}
END

    for ngx_src in $NGX_ADDON_SRCS
    do
        ngx_obj="objs/src/`basename \`dirname $ngx_src\``"

        test -d $ngx_obj || mkdir -p $ngx_obj

        ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` | sed -e "s#/#$ngx_regex_dirsep#g"`

        ngx_obj=`echo $ngx_obj \
            | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
                  -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
                  -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
                  -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`

        ngx_src=`echo $ngx_src | sed -e "s#/#$ngx_regex_dirsep#g"`


        cat << END                                            >> $NGX_DSO_MAKEFILE

$ngx_obj:	\$(ADDON_DEPS)$ngx_cont$ngx_src
	$ngx_cc\$(ALL_INCS)$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX

END

     done

    make -f $NGX_DSO_MAKEFILE
    if test -n "$NGX_DSO_PREFIX"; then
        test ! -f $NGX_DSO_PREFIX${dso_binout}${ngx_soext} \
            || unlink $NGX_DSO_PREFIX${dso_binout}${ngx_soext}
        echo copying $NGX_OBJS${ngx_dirsep}${dso_binout}${ngx_soext} to $NGX_DSO_PREFIX
        cp $NGX_OBJS${ngx_dirsep}${dso_binout}${ngx_soext} $NGX_DSO_PREFIX
    else
        test ! -f $NGX_PREFIX${ngx_dirsep}$NGX_DSO_PATH${ngx_dirsep}${dso_binout}${ngx_soext} \
            || unlink $NGX_PREFIX${ngx_dirsep}$NGX_DSO_PATH${ngx_dirsep}${dso_binout}${ngx_soext}
        echo copying $NGX_OBJS${ngx_dirsep}${dso_binout}${ngx_soext} to $NGX_PREFIX${ngx_dirsep}$NGX_DSO_PATH
        cp $NGX_OBJS${ngx_dirsep}${dso_binout}${ngx_soext} $NGX_PREFIX/$NGX_DSO_PATH
    fi
}


if test -n "$NGX_DSO_ADDONS"; then

    echo configuring additional modules

    for dai in $DSO_ALL_INCS
    do
        ALL_INCS="$ALL_INCS $dai"
    done

    ALL_INCS="$ALL_INCS -I$NGX_INCLUDE_PATH"

    for dcd in $DSO_CORE_DEPS
    do
        if test -n "$dcd"; then
            case ".$dcd" in
                ./*)
                    CORE_DEPS="$CORE_DEPS $dcd"
                    ;;

                *)
                    CORE_DEPS="$CORE_DEPS $NGX_INCLUDE_PATH/$dcd"
                    ;;
            esac
        fi
    done

    for dhd in $DSO_HTTP_DEPS
    do
        if test -n "$dhd"; then
            case ".$dhd" in
                ./*)
                    HTTP_DEPS="$HTTP_DEPS $dhd"
                    ;;

                *)
                    HTTP_DEPS="$HTTP_DEPS $NGX_INCLUDE_PATH/$dhd"
                    ;;
            esac
        fi
    done

    for ngx_addon_dir in $NGX_DSO_ADDONS
    do
        echo "adding module in $ngx_addon_dir"
        if test -f $ngx_addon_dir/config; then
            NGX_ADDON_SRCS=
            NGX_ADDON_DEPS=

            CORE_LIBS_TEMP=$CORE_LIBS
            CORE_LIBS=

            cd $ngx_addon_dir

	    CORE_INCS_TEMP=$CORE_INCS
            HTTP_INCS_TEMP=$HTTP_INCS
            CORE_LIBS_TEMP=$CORE_LIBS
            CORE_INCS=
            HTTP_INCS=
            CORE_LIBS=

            if test -d $NGX_OBJS; then
                rm -rf $NGX_OBJS
            fi

            mkdir -p $NGX_OBJS/auto
            touch $NGX_AUTOCONF_ERR
            touch $NGX_AUTOTEST
            touch $NGX_AUTO_CONFIG_H

            cat << END                                            > $NGX_OBJS/auto/feature
            $ngx_feature_file
END

            cat << END                                            > $NGX_OBJS/auto/have
            $ngx_have_file
END
	    cd $NGX_OBJS
            . $ngx_addon_dir/config

	    dso_core_incs=`echo $CORE_INCS \
                | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
                -e "s/\//$ngx_regex_dirsep/g"`

            dso_http_incs=`echo $HTTP_INCS \
                | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
                -e "s/\//$ngx_regex_dirsep/g"`

            dso_core_libs=`echo $CORE_LIBS \
                | sed -e "s/\//$ngx_regex_dirsep/g"`

            if test -n "$dso_core_incs"; then
                CORE_INCS="$CORE_INCS_TEMP -I $dso_core_incs"
            else
                CORE_INCS=$CORE_INCS_TEMP
            fi

            if test -n "$dso_http_incs"; then
                HTTP_INCS="$HTTP_INCS_TEMP -I $dso_http_incs"
            else
                HTTP_INCS=$HTTP_INCS_TEMP
            fi

            if test -n "$dso_core_libs"; then
                CORE_LIBS="$CORE_LIBS_TEMP $dso_core_libs"
            else
                CORE_LIBS=$CORE_LIBS_TEMP
            fi

            cd -

            cd $ngx_addon_dir
            echo " + $ngx_addon_name will be compiled"
            generate_make $ngx_addon_dir $NGX_ADDON_DEPS $NGX_ADDON_SRCS $ngx_addon_name
        else
            echo "$0: error: no $ngx_addon_dir/config was found"
            exit 1
        fi
    done
else
    echo "please specify the module path"
    exit 1
fi

