mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
Dynamic modules.
The auto/module script is extended to understand ngx_module_link=DYNAMIC. When set, it links the module as a shared object rather than statically into nginx binary. The module can later be loaded using the "load_module" directive. New auto/module parameter ngx_module_order allows to define module loading order in complex cases. By default the order is set based on ngx_module_type. 3rd party modules can be compiled dynamically using the --add-dynamic-module configure option, which will preset ngx_module_link to "DYNAMIC" before calling the module config script. Win32 support is rudimentary, and only works when using MinGW gcc (which is able to handle exports/imports automatically). In collaboration with Ruslan Ermilov.
This commit is contained in:
22
auto/cc/conf
22
auto/cc/conf
@@ -5,12 +5,17 @@
|
||||
|
||||
LINK="\$(CC)"
|
||||
|
||||
MAIN_LINK=
|
||||
MODULE_LINK="-shared"
|
||||
|
||||
ngx_include_opt="-I "
|
||||
ngx_compile_opt="-c"
|
||||
ngx_pic_opt="-fPIC"
|
||||
ngx_objout="-o "
|
||||
ngx_binout="-o "
|
||||
ngx_objext="o"
|
||||
ngx_binext=
|
||||
ngx_modext=".so"
|
||||
|
||||
ngx_long_start=
|
||||
ngx_long_end=
|
||||
@@ -45,6 +50,9 @@ if test -n "$CFLAGS"; then
|
||||
|
||||
sunc)
|
||||
|
||||
MAIN_LINK=
|
||||
MODULE_LINK="-G"
|
||||
|
||||
case "$NGX_MACHINE" in
|
||||
|
||||
i86pc)
|
||||
@@ -156,6 +164,20 @@ if [ "$NGX_PLATFORM" != win32 ]; then
|
||||
fi
|
||||
|
||||
|
||||
ngx_feature="-Wl,-E switch"
|
||||
ngx_feature_name=
|
||||
ngx_feature_run=no
|
||||
ngx_feature_incs=
|
||||
ngx_feature_path=
|
||||
ngx_feature_libs=-Wl,-E
|
||||
ngx_feature_test=
|
||||
. auto/feature
|
||||
|
||||
if [ $ngx_found = yes ]; then
|
||||
MAIN_LINK="-Wl,-E"
|
||||
fi
|
||||
|
||||
|
||||
ngx_feature="gcc builtin atomic operations"
|
||||
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
|
||||
ngx_feature_run=yes
|
||||
|
||||
@@ -118,6 +118,12 @@ NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC"
|
||||
CORE_LINK="$NGX_RES $CORE_LINK"
|
||||
|
||||
|
||||
# dynamic modules
|
||||
#MAIN_LINK="-link -def:$NGX_OBJS/nginx.def"
|
||||
#MODULE_LINK="-LD $NGX_OBJS/nginx.lib"
|
||||
|
||||
|
||||
ngx_pic_opt=
|
||||
ngx_objout="-Fo"
|
||||
ngx_binout="-Fe"
|
||||
ngx_objext="obj"
|
||||
|
||||
@@ -57,6 +57,9 @@ case "$NGX_MACHINE" in
|
||||
|
||||
esac
|
||||
|
||||
MAIN_LINK=
|
||||
MODULE_LINK="-G"
|
||||
|
||||
|
||||
# optimizations
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
NGX_MAKEFILE=$NGX_OBJS/Makefile
|
||||
NGX_MODULES_C=$NGX_OBJS/ngx_modules.c
|
||||
NGX_MODULES=
|
||||
|
||||
NGX_AUTO_HEADERS_H=$NGX_OBJS/ngx_auto_headers.h
|
||||
NGX_AUTO_CONFIG_H=$NGX_OBJS/ngx_auto_config.h
|
||||
|
||||
24
auto/install
24
auto/install
@@ -26,6 +26,18 @@ case ".$NGX_SBIN_PATH" in
|
||||
esac
|
||||
|
||||
|
||||
case ".$NGX_MODULES_PATH" in
|
||||
./*)
|
||||
;;
|
||||
|
||||
*)
|
||||
NGX_MODULES_PATH=$NGX_PREFIX/$NGX_MODULES_PATH
|
||||
;;
|
||||
esac
|
||||
|
||||
NGX_MODULES_PATH=`dirname $NGX_MODULES_PATH/.`
|
||||
|
||||
|
||||
case ".$NGX_CONF_PATH" in
|
||||
./*)
|
||||
;;
|
||||
@@ -158,12 +170,24 @@ END
|
||||
fi
|
||||
|
||||
|
||||
if test -n "$NGX_MODULES"; then
|
||||
cat << END >> $NGX_MAKEFILE
|
||||
|
||||
test -d '\$(DESTDIR)$NGX_MODULES_PATH' \
|
||||
|| mkdir -p '\$(DESTDIR)$NGX_MODULES_PATH'
|
||||
cp $NGX_MODULES '\$(DESTDIR)$NGX_MODULES_PATH'
|
||||
END
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# create Makefile
|
||||
|
||||
cat << END >> Makefile
|
||||
|
||||
build:
|
||||
\$(MAKE) -f $NGX_MAKEFILE
|
||||
\$(MAKE) -f $NGX_MAKEFILE modules
|
||||
\$(MAKE) -f $NGX_MAKEFILE manpage
|
||||
|
||||
install:
|
||||
|
||||
@@ -58,11 +58,11 @@ if [ $USE_ZLIB = YES ]; then
|
||||
. auto/lib/zlib/conf
|
||||
fi
|
||||
|
||||
if [ $USE_LIBXSLT = YES ]; then
|
||||
if [ $USE_LIBXSLT != NO ]; then
|
||||
. auto/lib/libxslt/conf
|
||||
fi
|
||||
|
||||
if [ $USE_LIBGD = YES ]; then
|
||||
if [ $USE_LIBGD != NO ]; then
|
||||
. auto/lib/libgd/conf
|
||||
fi
|
||||
|
||||
@@ -70,7 +70,7 @@ if [ $USE_PERL = YES ]; then
|
||||
. auto/lib/perl/conf
|
||||
fi
|
||||
|
||||
if [ $HTTP_GEOIP = YES ]; then
|
||||
if [ $USE_GEOIP != NO ]; then
|
||||
. auto/lib/geoip/conf
|
||||
fi
|
||||
|
||||
|
||||
@@ -67,7 +67,12 @@ fi
|
||||
if [ $ngx_found = yes ]; then
|
||||
|
||||
CORE_INCS="$CORE_INCS $ngx_feature_path"
|
||||
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
|
||||
|
||||
if [ $USE_GEOIP = YES ]; then
|
||||
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
|
||||
fi
|
||||
|
||||
NGX_LIB_GEOIP=$ngx_feature_libs
|
||||
|
||||
if [ $NGX_IPV6 = YES ]; then
|
||||
ngx_feature="GeoIP IPv6 support"
|
||||
|
||||
@@ -67,7 +67,12 @@ fi
|
||||
if [ $ngx_found = yes ]; then
|
||||
|
||||
CORE_INCS="$CORE_INCS $ngx_feature_path"
|
||||
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
|
||||
|
||||
if [ $USE_LIBGD = YES ]; then
|
||||
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
|
||||
fi
|
||||
|
||||
NGX_LIB_LIBGD=$ngx_feature_libs
|
||||
|
||||
else
|
||||
|
||||
|
||||
@@ -76,7 +76,12 @@ fi
|
||||
if [ $ngx_found = yes ]; then
|
||||
|
||||
CORE_INCS="$CORE_INCS $ngx_feature_path"
|
||||
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
|
||||
|
||||
if [ $USE_LIBXSLT = YES ]; then
|
||||
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
|
||||
fi
|
||||
|
||||
NGX_LIB_LIBXSLT=$ngx_feature_libs
|
||||
|
||||
else
|
||||
|
||||
@@ -152,5 +157,9 @@ fi
|
||||
|
||||
|
||||
if [ $ngx_found = yes ]; then
|
||||
CORE_LIBS="$CORE_LIBS -lexslt"
|
||||
if [ $USE_LIBXSLT = YES ]; then
|
||||
CORE_LIBS="$CORE_LIBS -lexslt"
|
||||
fi
|
||||
|
||||
NGX_LIB_LIBXSLT="$NGX_LIB_LIBXSLT -lexslt"
|
||||
fi
|
||||
|
||||
203
auto/make
203
auto/make
@@ -98,9 +98,11 @@ fi
|
||||
|
||||
# the mail dependencies and include paths
|
||||
|
||||
if [ $MAIL = YES ]; then
|
||||
if [ $MAIL != NO ]; then
|
||||
|
||||
ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"
|
||||
if [ $MAIL = YES ]; then
|
||||
ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"
|
||||
fi
|
||||
|
||||
ngx_deps=`echo $MAIL_DEPS \
|
||||
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
|
||||
@@ -124,9 +126,11 @@ fi
|
||||
|
||||
# the stream dependencies and include paths
|
||||
|
||||
if [ $STREAM = YES ]; then
|
||||
if [ $STREAM != NO ]; then
|
||||
|
||||
ngx_all_srcs="$ngx_all_srcs $STREAM_SRCS"
|
||||
if [ $STREAM = YES ]; then
|
||||
ngx_all_srcs="$ngx_all_srcs $STREAM_SRCS"
|
||||
fi
|
||||
|
||||
ngx_deps=`echo $STREAM_DEPS \
|
||||
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
|
||||
@@ -204,6 +208,7 @@ ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \
|
||||
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
|
||||
-e "s/\//$ngx_regex_dirsep/g"`
|
||||
|
||||
ngx_libs=
|
||||
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/"`
|
||||
@@ -212,13 +217,18 @@ fi
|
||||
ngx_link=${CORE_LINK:+`echo $CORE_LINK \
|
||||
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
|
||||
|
||||
ngx_main_link=${MAIN_LINK:+`echo $MAIN_LINK \
|
||||
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
|
||||
|
||||
|
||||
cat << END >> $NGX_MAKEFILE
|
||||
|
||||
$NGX_OBJS${ngx_dirsep}nginx${ngx_binext}: $ngx_deps$ngx_spacer
|
||||
\$(LINK) ${ngx_long_start}${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link
|
||||
\$(LINK) ${ngx_long_start}${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_link
|
||||
$ngx_rcc
|
||||
${ngx_long_end}
|
||||
|
||||
modules:
|
||||
END
|
||||
|
||||
|
||||
@@ -472,3 +482,186 @@ $ngx_pch
|
||||
END
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# dynamic modules
|
||||
|
||||
if test -n "$NGX_PCH"; then
|
||||
ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
|
||||
else
|
||||
ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) \$(ALL_INCS)"
|
||||
fi
|
||||
|
||||
ngx_obj_deps="\$(CORE_DEPS)"
|
||||
if [ $HTTP != NO ]; then
|
||||
ngx_obj_deps="$ngx_obj_deps \$(HTTP_DEPS)"
|
||||
fi
|
||||
if [ $MAIL != NO ]; then
|
||||
ngx_obj_deps="$ngx_obj_deps \$(MAIL_DEPS)"
|
||||
fi
|
||||
if [ $STREAM != NO ]; then
|
||||
ngx_obj_deps="$ngx_obj_deps \$(STREAM_DEPS)"
|
||||
fi
|
||||
|
||||
for ngx_module in $DYNAMIC_MODULES
|
||||
do
|
||||
eval ngx_module_srcs="\$${ngx_module}_SRCS"
|
||||
eval eval ngx_module_libs="\\\"\$${ngx_module}_LIBS\\\""
|
||||
|
||||
eval ngx_module_modules="\$${ngx_module}_MODULES"
|
||||
eval ngx_module_order="\$${ngx_module}_ORDER"
|
||||
|
||||
ngx_modules_c=$NGX_OBJS/${ngx_module}_modules.c
|
||||
|
||||
cat << END > $ngx_modules_c
|
||||
|
||||
#include <ngx_config.h>
|
||||
#include <ngx_core.h>
|
||||
|
||||
END
|
||||
|
||||
for mod in $ngx_module_modules
|
||||
do
|
||||
echo "extern ngx_module_t $mod;" >> $ngx_modules_c
|
||||
done
|
||||
|
||||
echo >> $ngx_modules_c
|
||||
echo 'ngx_module_t *ngx_modules[] = {' >> $ngx_modules_c
|
||||
|
||||
for mod in $ngx_module_modules
|
||||
do
|
||||
echo " &$mod," >> $ngx_modules_c
|
||||
done
|
||||
|
||||
cat << END >> $ngx_modules_c
|
||||
NULL
|
||||
};
|
||||
|
||||
END
|
||||
|
||||
echo 'char *ngx_module_names[] = {' >> $ngx_modules_c
|
||||
|
||||
for mod in $ngx_module_modules
|
||||
do
|
||||
echo " \"$mod\"," >> $ngx_modules_c
|
||||
done
|
||||
|
||||
cat << END >> $ngx_modules_c
|
||||
NULL
|
||||
};
|
||||
|
||||
END
|
||||
|
||||
echo 'char *ngx_module_order[] = {' >> $ngx_modules_c
|
||||
|
||||
for mod in $ngx_module_order
|
||||
do
|
||||
echo " \"$mod\"," >> $ngx_modules_c
|
||||
done
|
||||
|
||||
cat << END >> $ngx_modules_c
|
||||
NULL
|
||||
};
|
||||
|
||||
END
|
||||
|
||||
ngx_modules_c=`echo $ngx_modules_c | sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||
|
||||
ngx_modules_obj=`echo $ngx_modules_c \
|
||||
| sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
|
||||
|
||||
ngx_module_objs=
|
||||
for ngx_src in $ngx_module_srcs
|
||||
do
|
||||
case "$ngx_src" in
|
||||
src/*)
|
||||
ngx_obj=$ngx_src
|
||||
;;
|
||||
*)
|
||||
ngx_obj="addon/`basename \`dirname $ngx_src\``"
|
||||
mkdir -p $NGX_OBJS/$ngx_obj
|
||||
ngx_obj="$ngx_obj/`basename $ngx_src`"
|
||||
;;
|
||||
esac
|
||||
|
||||
ngx_module_objs="$ngx_module_objs $ngx_obj"
|
||||
done
|
||||
|
||||
ngx_module_objs=`echo $ngx_module_objs \
|
||||
| sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
|
||||
-e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
|
||||
-e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
|
||||
-e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
|
||||
|
||||
ngx_deps=`echo $ngx_module_objs $ngx_modules_obj $LINK_DEPS \
|
||||
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
|
||||
-e "s/\//$ngx_regex_dirsep/g"`
|
||||
|
||||
ngx_objs=`echo $ngx_module_objs $ngx_modules_obj \
|
||||
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
|
||||
-e "s/\//$ngx_regex_dirsep/g"`
|
||||
|
||||
ngx_obj=$NGX_OBJS${ngx_dirsep}${ngx_module}${ngx_modext}
|
||||
|
||||
NGX_MODULES="$NGX_MODULES $ngx_obj"
|
||||
|
||||
if [ "$NGX_PLATFORM" = win32 ]; then
|
||||
ngx_module_libs="$CORE_LIBS $ngx_module_libs"
|
||||
fi
|
||||
|
||||
ngx_libs=
|
||||
if test -n "$NGX_LD_OPT$ngx_module_libs"; then
|
||||
ngx_libs=`echo $NGX_LD_OPT $ngx_module_libs \
|
||||
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
|
||||
fi
|
||||
|
||||
ngx_link=${CORE_LINK:+`echo $CORE_LINK \
|
||||
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
|
||||
|
||||
ngx_module_link=${MODULE_LINK:+`echo $MODULE_LINK \
|
||||
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
|
||||
|
||||
|
||||
cat << END >> $NGX_MAKEFILE
|
||||
|
||||
modules: $ngx_obj
|
||||
|
||||
$ngx_obj: $ngx_deps$ngx_spacer
|
||||
\$(LINK) $ngx_long_start$ngx_binout$ngx_obj$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_module_link
|
||||
$ngx_long_end
|
||||
|
||||
$ngx_modules_obj: \$(CORE_DEPS)$ngx_cont$ngx_modules_c
|
||||
$ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUX
|
||||
|
||||
END
|
||||
|
||||
for ngx_src in $ngx_module_srcs
|
||||
do
|
||||
case "$ngx_src" in
|
||||
src/*)
|
||||
ngx_obj=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||
;;
|
||||
*)
|
||||
ngx_obj="addon/`basename \`dirname $ngx_src\``"
|
||||
ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
|
||||
| sed -e "s/\//$ngx_regex_dirsep/g"`
|
||||
;;
|
||||
esac
|
||||
|
||||
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_MAKEFILE
|
||||
|
||||
$ngx_obj: $ngx_obj_deps$ngx_cont$ngx_src
|
||||
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
||||
|
||||
END
|
||||
|
||||
done
|
||||
done
|
||||
|
||||
53
auto/module
53
auto/module
@@ -9,7 +9,58 @@ case $ngx_module_type in
|
||||
esac
|
||||
|
||||
|
||||
if [ "$ngx_module_link" = YES ]; then
|
||||
if [ "$ngx_module_link" = DYNAMIC ]; then
|
||||
|
||||
for ngx_module in $ngx_module_name; do
|
||||
# extract the first name
|
||||
break
|
||||
done
|
||||
|
||||
DYNAMIC_MODULES="$DYNAMIC_MODULES $ngx_module"
|
||||
eval ${ngx_module}_SRCS=\"$ngx_module_srcs\"
|
||||
|
||||
eval ${ngx_module}_MODULES=\"$ngx_module_name\"
|
||||
|
||||
if [ -z "$ngx_module_order" -a \
|
||||
\( "$ngx_module_type" = "HTTP_FILTER" \
|
||||
-o "$ngx_module_type" = "HTTP_AUX_FILTER" \) ]
|
||||
then
|
||||
eval ${ngx_module}_ORDER=\"$ngx_module_name \
|
||||
ngx_http_copy_filter_module\"
|
||||
else
|
||||
eval ${ngx_module}_ORDER=\"$ngx_module_order\"
|
||||
fi
|
||||
|
||||
if test -n "$ngx_module_incs"; then
|
||||
CORE_INCS="$CORE_INCS $ngx_module_incs"
|
||||
fi
|
||||
|
||||
libs=
|
||||
for lib in $ngx_module_libs
|
||||
do
|
||||
case $lib in
|
||||
|
||||
LIBXSLT | LIBGD | GEOIP)
|
||||
libs="$libs \$NGX_LIB_$lib"
|
||||
|
||||
if eval [ "\$USE_${lib}" = NO ] ; then
|
||||
eval USE_${lib}=DYNAMIC
|
||||
fi
|
||||
;;
|
||||
|
||||
PCRE | OPENSSL | MD5 | SHA1 | ZLIB | PERL)
|
||||
eval USE_${lib}=YES
|
||||
;;
|
||||
|
||||
*)
|
||||
libs="$libs $lib"
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
eval ${ngx_module}_LIBS=\'$libs\'
|
||||
|
||||
elif [ "$ngx_module_link" = YES ]; then
|
||||
|
||||
eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \
|
||||
$ngx_module_name\"
|
||||
|
||||
127
auto/modules
127
auto/modules
@@ -159,6 +159,35 @@ fi
|
||||
ngx_module_type=HTTP_FILTER
|
||||
HTTP_FILTER_MODULES=
|
||||
|
||||
ngx_module_order="ngx_http_static_module \
|
||||
ngx_http_gzip_static_module \
|
||||
ngx_http_dav_module \
|
||||
ngx_http_autoindex_module \
|
||||
ngx_http_index_module \
|
||||
ngx_http_random_index_module \
|
||||
ngx_http_access_module \
|
||||
ngx_http_realip_module \
|
||||
ngx_http_write_filter_module \
|
||||
ngx_http_header_filter_module \
|
||||
ngx_http_chunked_filter_module \
|
||||
ngx_http_v2_filter_module \
|
||||
ngx_http_range_header_filter_module \
|
||||
ngx_http_gzip_filter_module \
|
||||
ngx_http_postpone_filter_module \
|
||||
ngx_http_ssi_filter_module \
|
||||
ngx_http_charset_filter_module \
|
||||
ngx_http_xslt_filter_module \
|
||||
ngx_http_image_filter_module \
|
||||
ngx_http_sub_filter_module \
|
||||
ngx_http_addition_filter_module \
|
||||
ngx_http_gunzip_filter_module \
|
||||
ngx_http_userid_filter_module \
|
||||
ngx_http_headers_filter_module \
|
||||
ngx_http_copy_filter_module \
|
||||
ngx_http_range_body_filter_module \
|
||||
ngx_http_not_modified_filter_module \
|
||||
ngx_http_slice_filter_module"
|
||||
|
||||
if :; then
|
||||
ngx_module_name=ngx_http_write_filter_module
|
||||
ngx_module_incs=
|
||||
@@ -263,7 +292,7 @@ if [ $HTTP_CHARSET = YES ]; then
|
||||
. auto/module
|
||||
fi
|
||||
|
||||
if [ $HTTP_XSLT = YES ]; then
|
||||
if [ $HTTP_XSLT != NO ]; then
|
||||
ngx_module_name=ngx_http_xslt_filter_module
|
||||
ngx_module_incs=
|
||||
ngx_module_deps=
|
||||
@@ -274,7 +303,7 @@ if [ $HTTP_XSLT = YES ]; then
|
||||
. auto/module
|
||||
fi
|
||||
|
||||
if [ $HTTP_IMAGE_FILTER = YES ]; then
|
||||
if [ $HTTP_IMAGE_FILTER != NO ]; then
|
||||
ngx_module_name=ngx_http_image_filter_module
|
||||
ngx_module_incs=
|
||||
ngx_module_deps=
|
||||
@@ -579,14 +608,14 @@ if [ $HTTP_GEO = YES ]; then
|
||||
. auto/module
|
||||
fi
|
||||
|
||||
if [ $HTTP_GEOIP = YES ]; then
|
||||
if [ $HTTP_GEOIP != NO ]; then
|
||||
have=NGX_HTTP_X_FORWARDED_FOR . auto/have
|
||||
|
||||
ngx_module_name=ngx_http_geoip_module
|
||||
ngx_module_incs=
|
||||
ngx_module_deps=
|
||||
ngx_module_srcs=src/http/modules/ngx_http_geoip_module.c
|
||||
ngx_module_libs=
|
||||
ngx_module_libs=GEOIP
|
||||
ngx_module_link=$HTTP_GEOIP
|
||||
|
||||
. auto/module
|
||||
@@ -864,7 +893,7 @@ if [ $HTTP_STUB_STATUS = YES ]; then
|
||||
fi
|
||||
|
||||
|
||||
if [ $MAIL == YES ]; then
|
||||
if [ $MAIL != NO ]; then
|
||||
MAIL_MODULES=
|
||||
MAIL_DEPS=
|
||||
MAIL_INCS=
|
||||
@@ -873,6 +902,8 @@ if [ $MAIL == YES ]; then
|
||||
ngx_module_libs=
|
||||
ngx_module_link=YES
|
||||
|
||||
ngx_module_order=
|
||||
|
||||
ngx_module_name="ngx_mail_module ngx_mail_core_module"
|
||||
ngx_module_incs="src/mail"
|
||||
ngx_module_deps="src/mail/ngx_mail.h"
|
||||
@@ -937,7 +968,7 @@ if [ $MAIL == YES ]; then
|
||||
fi
|
||||
|
||||
|
||||
if [ $STREAM = YES ]; then
|
||||
if [ $STREAM != NO ]; then
|
||||
STREAM_MODULES=
|
||||
STREAM_DEPS=
|
||||
STREAM_INCS=
|
||||
@@ -948,6 +979,8 @@ if [ $STREAM = YES ]; then
|
||||
ngx_module_libs=
|
||||
ngx_module_link=YES
|
||||
|
||||
ngx_module_order=
|
||||
|
||||
ngx_module_name="ngx_stream_module \
|
||||
ngx_stream_core_module \
|
||||
ngx_stream_proxy_module \
|
||||
@@ -1041,6 +1074,7 @@ if test -n "$NGX_ADDONS"; then
|
||||
ngx_module_deps=
|
||||
ngx_module_srcs=
|
||||
ngx_module_libs=
|
||||
ngx_module_order=
|
||||
ngx_module_link=ADDON
|
||||
|
||||
if test -f $ngx_addon_dir/config; then
|
||||
@@ -1056,6 +1090,36 @@ if test -n "$NGX_ADDONS"; then
|
||||
fi
|
||||
|
||||
|
||||
if test -n "$DYNAMIC_ADDONS"; then
|
||||
|
||||
echo configuring additional dynamic modules
|
||||
|
||||
for ngx_addon_dir in $DYNAMIC_ADDONS
|
||||
do
|
||||
echo "adding module in $ngx_addon_dir"
|
||||
|
||||
ngx_module_type=
|
||||
ngx_module_name=
|
||||
ngx_module_incs=
|
||||
ngx_module_deps=
|
||||
ngx_module_srcs=
|
||||
ngx_module_libs=
|
||||
ngx_module_order=
|
||||
ngx_module_link=DYNAMIC
|
||||
|
||||
if test -f $ngx_addon_dir/config; then
|
||||
. $ngx_addon_dir/config
|
||||
|
||||
echo " + $ngx_addon_name was configured"
|
||||
|
||||
else
|
||||
echo "$0: error: no $ngx_addon_dir/config was found"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
if [ $USE_OPENSSL = YES ]; then
|
||||
ngx_module_type=CORE
|
||||
ngx_module_name=ngx_openssl_module
|
||||
@@ -1065,6 +1129,7 @@ if [ $USE_OPENSSL = YES ]; then
|
||||
src/event/ngx_event_openssl_stapling.c"
|
||||
ngx_module_libs=
|
||||
ngx_module_link=YES
|
||||
ngx_module_order=
|
||||
|
||||
. auto/module
|
||||
fi
|
||||
@@ -1078,6 +1143,7 @@ if [ $USE_PCRE = YES ]; then
|
||||
ngx_module_srcs=src/core/ngx_regex.c
|
||||
ngx_module_libs=
|
||||
ngx_module_link=YES
|
||||
ngx_module_order=
|
||||
|
||||
. auto/module
|
||||
fi
|
||||
@@ -1100,14 +1166,42 @@ if [ $HTTP = YES ]; then
|
||||
fi
|
||||
|
||||
|
||||
if [ $MAIL = YES ]; then
|
||||
modules="$modules $MAIL_MODULES"
|
||||
if [ $MAIL != NO ]; then
|
||||
|
||||
if [ $MAIL = YES ]; then
|
||||
modules="$modules $MAIL_MODULES"
|
||||
|
||||
elif [ $MAIL = DYNAMIC ]; then
|
||||
ngx_module_name=$MAIL_MODULES
|
||||
ngx_module_incs=
|
||||
ngx_module_deps=$MAIL_DEPS
|
||||
ngx_module_srcs=$MAIL_SRCS
|
||||
ngx_module_libs=
|
||||
ngx_module_link=DYNAMIC
|
||||
|
||||
. auto/module
|
||||
fi
|
||||
|
||||
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(MAIL_DEPS)"
|
||||
fi
|
||||
|
||||
|
||||
if [ $STREAM = YES ]; then
|
||||
modules="$modules $STREAM_MODULES"
|
||||
if [ $STREAM != NO ]; then
|
||||
|
||||
if [ $STREAM = YES ]; then
|
||||
modules="$modules $STREAM_MODULES"
|
||||
|
||||
elif [ $STREAM = DYNAMIC ]; then
|
||||
ngx_module_name=$STREAM_MODULES
|
||||
ngx_module_incs=
|
||||
ngx_module_deps=$STREAM_DEPS
|
||||
ngx_module_srcs=$STREAM_SRCS
|
||||
ngx_module_libs=
|
||||
ngx_module_link=DYNAMIC
|
||||
|
||||
. auto/module
|
||||
fi
|
||||
|
||||
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(STREAM_DEPS)"
|
||||
fi
|
||||
|
||||
@@ -1167,3 +1261,16 @@ cat << END >> $NGX_MODULES_C
|
||||
};
|
||||
|
||||
END
|
||||
|
||||
echo 'char *ngx_module_names[] = {' >> $NGX_MODULES_C
|
||||
|
||||
for mod in $modules
|
||||
do
|
||||
echo " \"$mod\"," >> $NGX_MODULES_C
|
||||
done
|
||||
|
||||
cat << END >> $NGX_MODULES_C
|
||||
NULL
|
||||
};
|
||||
|
||||
END
|
||||
|
||||
26
auto/options
26
auto/options
@@ -7,6 +7,7 @@ help=no
|
||||
|
||||
NGX_PREFIX=
|
||||
NGX_SBIN_PATH=
|
||||
NGX_MODULES_PATH=
|
||||
NGX_CONF_PREFIX=
|
||||
NGX_CONF_PATH=
|
||||
NGX_ERROR_LOG_PATH=
|
||||
@@ -120,7 +121,11 @@ STREAM_UPSTREAM_HASH=YES
|
||||
STREAM_UPSTREAM_LEAST_CONN=YES
|
||||
STREAM_UPSTREAM_ZONE=YES
|
||||
|
||||
DYNAMIC_MODULES=
|
||||
|
||||
NGX_ADDONS=
|
||||
NGX_ADDON_DEPS=
|
||||
DYNAMIC_ADDONS=
|
||||
|
||||
USE_PCRE=NO
|
||||
PCRE=NONE
|
||||
@@ -151,6 +156,7 @@ NGX_PERL=perl
|
||||
|
||||
USE_LIBXSLT=NO
|
||||
USE_LIBGD=NO
|
||||
USE_GEOIP=NO
|
||||
|
||||
NGX_GOOGLE_PERFTOOLS=NO
|
||||
NGX_CPP_TEST=NO
|
||||
@@ -178,6 +184,7 @@ do
|
||||
--prefix=) NGX_PREFIX="!" ;;
|
||||
--prefix=*) NGX_PREFIX="$value" ;;
|
||||
--sbin-path=*) NGX_SBIN_PATH="$value" ;;
|
||||
--modules-path=*) NGX_MODULES_PATH="$value" ;;
|
||||
--conf-path=*) NGX_CONF_PATH="$value" ;;
|
||||
--error-log-path=*) NGX_ERROR_LOG_PATH="$value";;
|
||||
--pid-path=*) NGX_PID_PATH="$value" ;;
|
||||
@@ -215,8 +222,13 @@ do
|
||||
--with-http_realip_module) HTTP_REALIP=YES ;;
|
||||
--with-http_addition_module) HTTP_ADDITION=YES ;;
|
||||
--with-http_xslt_module) HTTP_XSLT=YES ;;
|
||||
--with-http_xslt_module=dynamic) HTTP_XSLT=DYNAMIC ;;
|
||||
--with-http_image_filter_module) HTTP_IMAGE_FILTER=YES ;;
|
||||
--with-http_image_filter_module=dynamic)
|
||||
HTTP_IMAGE_FILTER=DYNAMIC ;;
|
||||
--with-http_geoip_module) HTTP_GEOIP=YES ;;
|
||||
--with-http_geoip_module=dynamic)
|
||||
HTTP_GEOIP=DYNAMIC ;;
|
||||
--with-http_sub_module) HTTP_SUB=YES ;;
|
||||
--with-http_dav_module) HTTP_DAV=YES ;;
|
||||
--with-http_flv_module) HTTP_FLV=YES ;;
|
||||
@@ -266,6 +278,7 @@ do
|
||||
--with-http_stub_status_module) HTTP_STUB_STATUS=YES ;;
|
||||
|
||||
--with-mail) MAIL=YES ;;
|
||||
--with-mail=dynamic) MAIL=DYNAMIC ;;
|
||||
--with-mail_ssl_module) MAIL_SSL=YES ;;
|
||||
# STUB
|
||||
--with-imap)
|
||||
@@ -285,6 +298,7 @@ use the \"--with-mail_ssl_module\" option instead"
|
||||
--without-mail_smtp_module) MAIL_SMTP=NO ;;
|
||||
|
||||
--with-stream) STREAM=YES ;;
|
||||
--with-stream=dynamic) STREAM=DYNAMIC ;;
|
||||
--with-stream_ssl_module) STREAM_SSL=YES ;;
|
||||
--without-stream_limit_conn_module)
|
||||
STREAM_LIMIT_CONN=NO ;;
|
||||
@@ -300,6 +314,7 @@ use the \"--with-mail_ssl_module\" option instead"
|
||||
--with-cpp_test_module) NGX_CPP_TEST=YES ;;
|
||||
|
||||
--add-module=*) NGX_ADDONS="$NGX_ADDONS $value" ;;
|
||||
--add-dynamic-module=*) DYNAMIC_ADDONS="$DYNAMIC_ADDONS $value" ;;
|
||||
|
||||
--with-cc=*) CC="$value" ;;
|
||||
--with-cpp=*) CPP="$value" ;;
|
||||
@@ -356,6 +371,7 @@ cat << END
|
||||
|
||||
--prefix=PATH set installation prefix
|
||||
--sbin-path=PATH set nginx binary pathname
|
||||
--modules-path=PATH set modules path
|
||||
--conf-path=PATH set nginx.conf pathname
|
||||
--error-log-path=PATH set error log pathname
|
||||
--pid-path=PATH set nginx.pid pathname
|
||||
@@ -384,8 +400,12 @@ cat << END
|
||||
--with-http_realip_module enable ngx_http_realip_module
|
||||
--with-http_addition_module enable ngx_http_addition_module
|
||||
--with-http_xslt_module enable ngx_http_xslt_module
|
||||
--with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module
|
||||
--with-http_image_filter_module enable ngx_http_image_filter_module
|
||||
--with-http_image_filter_module=dynamic
|
||||
enable dynamic ngx_http_image_filter_module
|
||||
--with-http_geoip_module enable ngx_http_geoip_module
|
||||
--with-http_geoip_module=dynamic enable dynamic ngx_http_geoip_module
|
||||
--with-http_sub_module enable ngx_http_sub_module
|
||||
--with-http_dav_module enable ngx_http_dav_module
|
||||
--with-http_flv_module enable ngx_http_flv_module
|
||||
@@ -451,12 +471,14 @@ cat << END
|
||||
--without-http-cache disable HTTP cache
|
||||
|
||||
--with-mail enable POP3/IMAP4/SMTP proxy module
|
||||
--with-mail=dynamic enable dynamic POP3/IMAP4/SMTP proxy module
|
||||
--with-mail_ssl_module enable ngx_mail_ssl_module
|
||||
--without-mail_pop3_module disable ngx_mail_pop3_module
|
||||
--without-mail_imap_module disable ngx_mail_imap_module
|
||||
--without-mail_smtp_module disable ngx_mail_smtp_module
|
||||
|
||||
--with-stream enable TCP proxy module
|
||||
--with-stream=dynamic enable dynamic TCP proxy module
|
||||
--with-stream_ssl_module enable ngx_stream_ssl_module
|
||||
--without-stream_limit_conn_module disable ngx_stream_limit_conn_module
|
||||
--without-stream_access_module disable ngx_stream_access_module
|
||||
@@ -470,7 +492,8 @@ cat << END
|
||||
--with-google_perftools_module enable ngx_google_perftools_module
|
||||
--with-cpp_test_module enable ngx_cpp_test_module
|
||||
|
||||
--add-module=PATH enable an external module
|
||||
--add-module=PATH enable external module
|
||||
--add-dynamic-module=PATH enable dynamic external module
|
||||
|
||||
--with-cc=PATH set C compiler pathname
|
||||
--with-cpp=PATH set C preprocessor pathname
|
||||
@@ -533,6 +556,7 @@ fi
|
||||
|
||||
|
||||
NGX_SBIN_PATH=${NGX_SBIN_PATH:-sbin/nginx}
|
||||
NGX_MODULES_PATH=${NGX_MODULES_PATH:-modules}
|
||||
NGX_CONF_PATH=${NGX_CONF_PATH:-conf/nginx.conf}
|
||||
NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
|
||||
NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid}
|
||||
|
||||
@@ -14,6 +14,9 @@ CORE_SRCS="$UNIX_SRCS $DARWIN_SRCS"
|
||||
ngx_spacer='
|
||||
'
|
||||
|
||||
MAIN_LINK=
|
||||
MODULE_LINK="-shared -Wl,-undefined,dynamic_lookup"
|
||||
|
||||
# kqueue
|
||||
|
||||
echo " + kqueue found"
|
||||
|
||||
@@ -12,10 +12,15 @@ OS_CONFIG="$WIN32_CONFIG"
|
||||
NGX_ICONS="$NGX_WIN32_ICONS"
|
||||
SELECT_SRCS=$WIN32_SELECT_SRCS
|
||||
|
||||
ngx_pic_opt=
|
||||
|
||||
case "$NGX_CC_NAME" in
|
||||
|
||||
gcc)
|
||||
CORE_LIBS="$CORE_LIBS -ladvapi32 -lws2_32"
|
||||
MAIN_LINK="$MAIN_LINK -Wl,--export-all-symbols"
|
||||
MAIN_LINK="$MAIN_LINK -Wl,--out-implib=$NGX_OBJS/libnginx.a"
|
||||
MODULE_LINK="-shared -L $NGX_OBJS -lnginx"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
@@ -60,6 +60,7 @@ echo
|
||||
cat << END
|
||||
nginx path prefix: "$NGX_PREFIX"
|
||||
nginx binary file: "$NGX_SBIN_PATH"
|
||||
nginx modules path: "$NGX_MODULES_PATH"
|
||||
nginx configuration prefix: "$NGX_CONF_PREFIX"
|
||||
nginx configuration file: "$NGX_CONF_PATH"
|
||||
nginx pid file: "$NGX_PID_PATH"
|
||||
|
||||
Reference in New Issue
Block a user