1
1
ngx_lua_opt_I=
2
2
ngx_lua_opt_L=
3
+ luajit_ld_opt=
4
+
5
+ ngx_feature_name=
6
+ ngx_feature_run=no
7
+ ngx_feature_incs=
8
+ ngx_feature_test=
3
9
4
10
if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
5
11
# explicitly set LuaJIT paths
@@ -30,6 +36,7 @@ if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
30
36
ngx_feature_path="$LUAJIT_INC"
31
37
ngx_lua_opt_I="-I$LUAJIT_INC"
32
38
ngx_lua_opt_L="-L$LUAJIT_LIB"
39
+ luajit_ld_opt="-lm -ldl"
33
40
34
41
# ensure that -I$LUAJIT_INC and -L$LUAJIT_LIB come first
35
42
SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS"
@@ -38,9 +45,9 @@ if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
38
45
NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT"
39
46
40
47
if [ $NGX_RPATH = YES ]; then
41
- ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 -lm -ldl "
48
+ ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt "
42
49
else
43
- ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm -ldl "
50
+ ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt "
44
51
fi
45
52
46
53
. auto/feature
@@ -55,6 +62,7 @@ if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
55
62
ngx_feature_path="$LUAJIT_INC"
56
63
ngx_lua_opt_I="-I$LUAJIT_INC"
57
64
ngx_lua_opt_L="-L$LUAJIT_LIB"
65
+ luajit_ld_opt="-lm"
58
66
59
67
# ensure that -I$LUAJIT_INC and -L$LUAJIT_LIB come first
60
68
SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS"
@@ -63,9 +71,9 @@ if [ -n "$LUAJIT_INC" -o -n "$LUAJIT_LIB" ]; then
63
71
NGX_TEST_LD_OPT="$ngx_lua_opt_L $NGX_TEST_LD_OPT"
64
72
65
73
if [ $NGX_RPATH = YES ]; then
66
- ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 -lm "
74
+ ngx_feature_libs="-R$LUAJIT_LIB $ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt "
67
75
else
68
- ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 -lm "
76
+ ngx_feature_libs="$ngx_lua_opt_L -lluajit-5.1 $luajit_ld_opt "
69
77
fi
70
78
71
79
. auto/feature
88
96
case "$NGX_MACHINE" in
89
97
amd64 | x86_64 | i386)
90
98
echo "adding extra linking options needed by LuaJIT on $NGX_MACHINE"
99
+ luajit_ld_opt="$luajit_ld_opt -pagezero_size 10000 -image_base 100000000"
91
100
ngx_feature_libs="$ngx_feature_libs -pagezero_size 10000 -image_base 100000000"
92
101
;;
93
102
105
114
# FreeBSD with luajit-2.0 from ports collection
106
115
ngx_feature="LuaJIT library in /usr/local/"
107
116
ngx_feature_path="/usr/local/include/luajit-2.0"
117
+ luajit_ld_opt="-lm"
118
+ LUAJIT_LIB="/usr/local/lib"
108
119
if [ $NGX_RPATH = YES ]; then
109
120
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lluajit-5.1 -lm"
110
121
else
117
128
# Gentoo with LuaJIT-2.0, try with -ldl
118
129
ngx_feature="LuaJIT library in /usr/"
119
130
ngx_feature_path="/usr/include/luajit-2.0"
131
+ luajit_ld_opt="-lm -ldl"
132
+ LUAJIT_LIB="/usr/lib"
120
133
if [ $NGX_RPATH = YES ]; then
121
134
ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -lluajit-5.1 -ldl"
122
135
else
129
142
# Gentoo with LuaJIT 2.0
130
143
ngx_feature="LuaJIT library in /usr/"
131
144
ngx_feature_path="/usr/include/luajit-2.0"
145
+ luajit_ld_opt="-lm"
146
+ LUAJIT_LIB="/usr/lib"
132
147
if [ $NGX_RPATH = YES ]; then
133
148
ngx_feature_libs="-R/usr/lib -L/usr/lib -lm -lluajit-5.1"
134
149
else
159
174
# ----------------------------------------
160
175
161
176
ngx_feature="LuaJIT 2.x"
162
- ngx_feature_name=
163
177
ngx_feature_run=no
164
178
ngx_feature_incs="#include <luajit.h>"
165
- ngx_feature_path=
166
179
ngx_feature_test='#if !defined(LUAJIT_VERSION_NUM) || (LUAJIT_VERSION_NUM < 20000)
167
180
# error unsupported LuaJIT version
168
181
#endif'
169
- SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS"
170
- CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS"
171
182
172
183
. auto/feature
173
184
@@ -178,22 +189,17 @@ END
178
189
exit 1
179
190
fi
180
191
181
- CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS"
182
-
183
192
# ----------------------------------------
184
193
185
194
ngx_feature="LuaJIT has FFI"
186
- ngx_feature_name=
195
+ ngx_feature_libs="$LUAJIT_LIB/libluajit-5.1.a $luajit_ld_opt"
187
196
ngx_feature_run=yes
188
197
ngx_feature_incs="#include <lualib.h>
189
198
#include <lauxlib.h>
190
199
#include <assert.h>"
191
- ngx_feature_path=
192
- ngx_feature_test='lua_State *L = luaL_newstate();
200
+ ngx_feature_test="lua_State *L = luaL_newstate();
193
201
assert(L != NULL);
194
- luaopen_ffi(L);'
195
- SAVED_CC_TEST_FLAGS="$CC_TEST_FLAGS"
196
- CC_TEST_FLAGS="$ngx_lua_opt_I $CC_TEST_FLAGS"
202
+ luaopen_ffi(L);"
197
203
198
204
. auto/feature
199
205
204
210
exit 1
205
211
fi
206
212
207
- CC_TEST_FLAGS="$SAVED_CC_TEST_FLAGS"
208
-
209
213
# ----------------------------------------
210
214
211
215
ngx_addon_name=ngx_http_lua_module
468
472
469
473
# ----------------------------------------
470
474
471
- if [ $PCRE != NO -a $PCRE != YES ]; then
472
- # force pcre_version symbol to be undefined when PCRE is statically linked
473
- ngx_feature="force undefined symbols (--undefined)"
474
- ngx_feature_libs="-Wl,--undefined=printf"
475
- ngx_feature_name=
476
- ngx_feature_run=no
477
- ngx_feature_incs="#include <stdio.h>"
478
- ngx_feature_path=
479
- ngx_feature_test='printf("hello");'
475
+ if [ $USE_PCRE = YES -o $PCRE != NONE ] && [ $PCRE != NO -a $PCRE != YES ]; then
476
+ # force pcre_version symbol to be required when PCRE is statically linked
477
+ case "$NGX_PLATFORM" in
478
+ Darwin:*)
479
+ ngx_feature="require defined symbols (-u)"
480
+ ngx_feature_name=
481
+ ngx_feature_path=
482
+ ngx_feature_libs="-Wl,-u,_strerror"
483
+ ngx_feature_run=no
484
+ ngx_feature_incs="#include <stdio.h>"
485
+ ngx_feature_test='printf("hello");'
480
486
481
- . auto/feature
487
+ . auto/feature
482
488
483
- if [ $ngx_found = yes ]; then
484
- CORE_LIBS="$CORE_LIBS -Wl,--undefined=pcre_version"
485
- fi
489
+ if [ $ngx_found = yes ]; then
490
+ CORE_LIBS="-Wl,-u,_pcre_version $CORE_LIBS"
491
+ fi
492
+ ;;
486
493
487
- # for LLVM ld (Darwin )
488
- ngx_feature="force undefined symbols (-all_load -U )"
489
- ngx_feature_libs="-all_load -U printf"
490
- ngx_feature_name =
491
- ngx_feature_run=no
492
- ngx_feature_incs="#include <stdio.h>"
493
- ngx_feature_path=
494
- ngx_feature_test='printf("hello");'
494
+ * )
495
+ ngx_feature="require defined symbols (--require-defined )"
496
+ ngx_feature_name=
497
+ ngx_feature_path =
498
+ ngx_feature_libs="-Wl,--require-defined=strerror"
499
+ ngx_feature_run=no
500
+ ngx_feature_incs="#include <stdio.h>"
501
+ ngx_feature_test='printf("hello");'
495
502
496
- . auto/feature
503
+ . auto/feature
497
504
498
- if [ $ngx_found = yes ]; then
499
- CORE_LIBS="$CORE_LIBS -all_load -U pcre_version"
500
- fi
505
+ if [ $ngx_found = yes ]; then
506
+ CORE_LIBS="-Wl,--require-defined=pcre_version $CORE_LIBS"
507
+ fi
508
+ ;;
509
+ esac
501
510
fi
502
511
503
512
# ----------------------------------------
0 commit comments