comparison auto/module @ 6383:85dea406e18f

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 04 Feb 2016 20:25:29 +0300
parents 392959224560
children 39a806ccf21e
comparison
equal deleted inserted replaced
6382:392959224560 6383:85dea406e18f
7 HTTP_*) ngx_var=HTTP ;; 7 HTTP_*) ngx_var=HTTP ;;
8 *) ngx_var=$ngx_module_type ;; 8 *) ngx_var=$ngx_module_type ;;
9 esac 9 esac
10 10
11 11
12 if [ "$ngx_module_link" = YES ]; then 12 if [ "$ngx_module_link" = DYNAMIC ]; then
13
14 for ngx_module in $ngx_module_name; do
15 # extract the first name
16 break
17 done
18
19 DYNAMIC_MODULES="$DYNAMIC_MODULES $ngx_module"
20 eval ${ngx_module}_SRCS=\"$ngx_module_srcs\"
21
22 eval ${ngx_module}_MODULES=\"$ngx_module_name\"
23
24 if [ -z "$ngx_module_order" -a \
25 \( "$ngx_module_type" = "HTTP_FILTER" \
26 -o "$ngx_module_type" = "HTTP_AUX_FILTER" \) ]
27 then
28 eval ${ngx_module}_ORDER=\"$ngx_module_name \
29 ngx_http_copy_filter_module\"
30 else
31 eval ${ngx_module}_ORDER=\"$ngx_module_order\"
32 fi
33
34 if test -n "$ngx_module_incs"; then
35 CORE_INCS="$CORE_INCS $ngx_module_incs"
36 fi
37
38 libs=
39 for lib in $ngx_module_libs
40 do
41 case $lib in
42
43 LIBXSLT | LIBGD | GEOIP)
44 libs="$libs \$NGX_LIB_$lib"
45
46 if eval [ "\$USE_${lib}" = NO ] ; then
47 eval USE_${lib}=DYNAMIC
48 fi
49 ;;
50
51 PCRE | OPENSSL | MD5 | SHA1 | ZLIB | PERL)
52 eval USE_${lib}=YES
53 ;;
54
55 *)
56 libs="$libs $lib"
57 ;;
58
59 esac
60 done
61 eval ${ngx_module}_LIBS=\'$libs\'
62
63 elif [ "$ngx_module_link" = YES ]; then
13 64
14 eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \ 65 eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \
15 $ngx_module_name\" 66 $ngx_module_name\"
16 67
17 eval ${ngx_var}_SRCS=\"\$${ngx_var}_SRCS $ngx_module_srcs\" 68 eval ${ngx_var}_SRCS=\"\$${ngx_var}_SRCS $ngx_module_srcs\"