Software /
code /
prosody
Comparison
configure @ 10411:db2a06b9ff98
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 16 Nov 2019 16:52:31 +0100 |
parent | 10010:34bfefb39937 |
child | 11009:74ef9f2334f3 |
comparison
equal
deleted
inserted
replaced
10410:659b577f280c | 10411:db2a06b9ff98 |
---|---|
21 RUNWITH="lua" | 21 RUNWITH="lua" |
22 EXCERTS="yes" | 22 EXCERTS="yes" |
23 PRNG= | 23 PRNG= |
24 PRNGLIBS= | 24 PRNGLIBS= |
25 | 25 |
26 CFLAGS="-fPIC -Wall -pedantic -std=c99" | 26 CFLAGS="-fPIC -std=c99" |
27 CFLAGS="$CFLAGS -Wall -pedantic -Wextra -Wshadow -Wformat=2" | |
27 LDFLAGS="-shared" | 28 LDFLAGS="-shared" |
28 | 29 |
29 IDN_LIBRARY="idn" | 30 IDN_LIBRARY="idn" |
30 # Help | 31 # Help |
31 | 32 |
150 [ -n "$value" ] || die "Missing value in flag $key." | 151 [ -n "$value" ] || die "Missing value in flag $key." |
151 SYSCONFDIR="$value" | 152 SYSCONFDIR="$value" |
152 SYSCONFDIR_SET=yes | 153 SYSCONFDIR_SET=yes |
153 ;; | 154 ;; |
154 --ostype) | 155 --ostype) |
155 # TODO make this a switch? | |
156 OSPRESET="$value" | 156 OSPRESET="$value" |
157 if [ "$OSPRESET" = "debian" ]; then | 157 OSPRESET_SET="yes" |
158 if [ "$LUA_SUFFIX_SET" != "yes" ]; then | |
159 LUA_SUFFIX="5.1"; | |
160 LUA_SUFFIX_SET=yes | |
161 fi | |
162 if [ "$RUNWITH_SET" != "yes" ]; then | |
163 RUNWITH="lua$LUA_SUFFIX"; | |
164 RUNWITH_SET=yes | |
165 fi | |
166 LUA_INCDIR="/usr/include/lua$LUA_SUFFIX" | |
167 LUA_INCDIR_SET=yes | |
168 CFLAGS="$CFLAGS -ggdb" | |
169 fi | |
170 if [ "$OSPRESET" = "macosx" ]; then | |
171 LUA_INCDIR=/usr/local/include; | |
172 LUA_INCDIR_SET=yes | |
173 LUA_LIBDIR=/usr/local/lib | |
174 LUA_LIBDIR_SET=yes | |
175 CFLAGS="$CFLAGS -mmacosx-version-min=10.3" | |
176 LDFLAGS="-bundle -undefined dynamic_lookup" | |
177 fi | |
178 if [ "$OSPRESET" = "linux" ]; then | |
179 LUA_INCDIR=/usr/local/include; | |
180 LUA_INCDIR_SET=yes | |
181 LUA_LIBDIR=/usr/local/lib | |
182 LUA_LIBDIR_SET=yes | |
183 CFLAGS="$CFLAGS -ggdb" | |
184 fi | |
185 if [ "$OSPRESET" = "freebsd" ] || [ "$OSPRESET" = "openbsd" ]; then | |
186 LUA_INCDIR="/usr/local/include/lua51" | |
187 LUA_INCDIR_SET=yes | |
188 CFLAGS="-Wall -fPIC -I/usr/local/include" | |
189 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared" | |
190 LUA_SUFFIX="51" | |
191 LUA_SUFFIX_SET=yes | |
192 LUA_DIR=/usr/local | |
193 LUA_DIR_SET=yes | |
194 CC=cc | |
195 LD=ld | |
196 fi | |
197 if [ "$OSPRESET" = "openbsd" ]; then | |
198 LUA_INCDIR="/usr/local/include"; | |
199 LUA_INCDIR_SET="yes" | |
200 fi | |
201 if [ "$OSPRESET" = "netbsd" ]; then | |
202 LUA_INCDIR="/usr/pkg/include/lua-5.1" | |
203 LUA_INCDIR_SET=yes | |
204 LUA_LIBDIR="/usr/pkg/lib/lua/5.1" | |
205 LUA_LIBDIR_SET=yes | |
206 CFLAGS="-Wall -fPIC -I/usr/pkg/include" | |
207 LDFLAGS="-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -shared" | |
208 fi | |
209 if [ "$OSPRESET" = "pkg-config" ]; then | |
210 if [ "$LUA_SUFFIX_SET" != "yes" ]; then | |
211 LUA_SUFFIX="5.1"; | |
212 LUA_SUFFIX_SET=yes | |
213 fi | |
214 LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)" | |
215 LUA_CF="${LUA_CF#*-I}" | |
216 LUA_CF="${LUA_CF%% *}" | |
217 if [ "$LUA_CF" != "" ]; then | |
218 LUA_INCDIR="$LUA_CF" | |
219 LUA_INCDIR_SET=yes | |
220 fi | |
221 CFLAGS="$CFLAGS" | |
222 fi | |
223 ;; | 158 ;; |
224 --libdir) | 159 --libdir) |
225 LIBDIR="$value" | 160 LIBDIR="$value" |
226 LIBDIR_SET=yes | 161 LIBDIR_SET=yes |
227 ;; | 162 ;; |
235 LUA_SUFFIX_SET=yes | 170 LUA_SUFFIX_SET=yes |
236 ;; | 171 ;; |
237 --lua-version|--with-lua-version) | 172 --lua-version|--with-lua-version) |
238 [ -n "$value" ] || die "Missing value in flag $key." | 173 [ -n "$value" ] || die "Missing value in flag $key." |
239 LUA_VERSION="$value" | 174 LUA_VERSION="$value" |
240 [ "$LUA_VERSION" = "5.1" ] || [ "$LUA_VERSION" = "5.2" ] || [ "$LUA_VERSION" = "5.3" ] || die "Invalid Lua version in flag $key." | 175 [ "$LUA_VERSION" = "5.1" ] || [ "$LUA_VERSION" = "5.2" ] || [ "$LUA_VERSION" = "5.3" ] || [ "$LUA_VERSION" = "5.4" ] || die "Invalid Lua version in flag $key." |
241 LUA_VERSION_SET=yes | 176 LUA_VERSION_SET=yes |
242 ;; | 177 ;; |
243 --with-lua) | 178 --with-lua) |
244 [ -n "$value" ] || die "Missing value in flag $key." | 179 [ -n "$value" ] || die "Missing value in flag $key." |
245 LUA_DIR="$value" | 180 LUA_DIR="$value" |
316 ;; | 251 ;; |
317 esac | 252 esac |
318 shift | 253 shift |
319 done | 254 done |
320 | 255 |
256 if [ "$OSPRESET_SET" = "yes" ]; then | |
257 # TODO make this a switch? | |
258 if [ "$OSPRESET" = "debian" ]; then | |
259 CFLAGS="$CFLAGS -ggdb" | |
260 fi | |
261 if [ "$OSPRESET" = "macosx" ]; then | |
262 if [ "$LUA_INCDIR_SET" != "yes" ]; then | |
263 LUA_INCDIR=/usr/local/include; | |
264 LUA_INCDIR_SET=yes | |
265 fi | |
266 if [ "$LUA_LIBDIR_SET" != "yes" ]; then | |
267 LUA_LIBDIR=/usr/local/lib | |
268 LUA_LIBDIR_SET=yes | |
269 fi | |
270 CFLAGS="$CFLAGS -mmacosx-version-min=10.3" | |
271 LDFLAGS="-bundle -undefined dynamic_lookup" | |
272 fi | |
273 if [ "$OSPRESET" = "linux" ]; then | |
274 CFLAGS="$CFLAGS -ggdb" | |
275 fi | |
276 if [ "$OSPRESET" = "freebsd" ] || [ "$OSPRESET" = "openbsd" ]; then | |
277 LUA_INCDIR="/usr/local/include/lua51" | |
278 LUA_INCDIR_SET=yes | |
279 CFLAGS="-Wall -fPIC -I/usr/local/include" | |
280 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared" | |
281 LUA_SUFFIX="51" | |
282 LUA_SUFFIX_SET=yes | |
283 LUA_DIR=/usr/local | |
284 LUA_DIR_SET=yes | |
285 CC=cc | |
286 LD=ld | |
287 fi | |
288 if [ "$OSPRESET" = "openbsd" ]; then | |
289 LUA_INCDIR="/usr/local/include"; | |
290 LUA_INCDIR_SET="yes" | |
291 fi | |
292 if [ "$OSPRESET" = "netbsd" ]; then | |
293 LUA_INCDIR="/usr/pkg/include/lua-5.1" | |
294 LUA_INCDIR_SET=yes | |
295 LUA_LIBDIR="/usr/pkg/lib/lua/5.1" | |
296 LUA_LIBDIR_SET=yes | |
297 CFLAGS="-Wall -fPIC -I/usr/pkg/include" | |
298 LDFLAGS="-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -shared" | |
299 fi | |
300 if [ "$OSPRESET" = "pkg-config" ]; then | |
301 if [ "$LUA_SUFFIX_SET" != "yes" ]; then | |
302 LUA_SUFFIX="5.1"; | |
303 LUA_SUFFIX_SET=yes | |
304 fi | |
305 LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)" | |
306 LUA_CF="${LUA_CF#*-I}" | |
307 LUA_CF="${LUA_CF%% *}" | |
308 if [ "$LUA_CF" != "" ]; then | |
309 LUA_INCDIR="$LUA_CF" | |
310 LUA_INCDIR_SET=yes | |
311 fi | |
312 CFLAGS="$CFLAGS" | |
313 fi | |
314 fi | |
315 | |
321 if [ "$PREFIX_SET" = "yes" ] && [ ! "$SYSCONFDIR_SET" = "yes" ] | 316 if [ "$PREFIX_SET" = "yes" ] && [ ! "$SYSCONFDIR_SET" = "yes" ] |
322 then | 317 then |
323 if [ "$PREFIX" = "/usr" ] | 318 if [ "$PREFIX" = "/usr" ] |
324 then SYSCONFDIR=/etc/$APP_DIRNAME | 319 then SYSCONFDIR=/etc/$APP_DIRNAME |
325 else SYSCONFDIR=$PREFIX/etc/$APP_DIRNAME | 320 else SYSCONFDIR=$PREFIX/etc/$APP_DIRNAME |
338 then | 333 then |
339 LIBDIR=$PREFIX/lib | 334 LIBDIR=$PREFIX/lib |
340 fi | 335 fi |
341 | 336 |
342 detect_lua_version() { | 337 detect_lua_version() { |
343 detected_lua=$("$1" -e 'print(_VERSION:match(" (5%.[123])$"))' 2> /dev/null) | 338 detected_lua=$("$1" -e 'print(_VERSION:match(" (5%.[1234])$"))' 2> /dev/null) |
344 if [ "$detected_lua" != "nil" ] | 339 if [ "$detected_lua" != "nil" ] |
345 then | 340 then |
346 if [ "$LUA_VERSION_SET" != "yes" ] | 341 if [ "$LUA_VERSION_SET" != "yes" ] |
347 then | 342 then |
348 echo "Lua version detected: $detected_lua" | 343 echo "Lua version detected: $detected_lua" |
401 then | 396 then |
402 suffixes="5.2 52 -5.2 -52" | 397 suffixes="5.2 52 -5.2 -52" |
403 elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.3" ] | 398 elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.3" ] |
404 then | 399 then |
405 suffixes="5.3 53 -5.3 -53" | 400 suffixes="5.3 53 -5.3 -53" |
401 elif [ "$LUA_VERSION_SET" = "yes" ] && [ "$LUA_VERSION" = "5.4" ] | |
402 then | |
403 suffixes="5.4 54 -5.4 -54" | |
406 else | 404 else |
407 suffixes="5.1 51 -5.1 -51 5.2 52 -5.2 -52 5.3 53 -5.3 -53" | 405 suffixes="5.1 51 -5.1 -51" |
406 suffixes="$suffixes 5.2 52 -5.2 -52" | |
407 suffixes="$suffixes 5.3 53 -5.3 -53" | |
408 suffixes="$suffixes 5.4 54 -5.4 -54" | |
408 fi | 409 fi |
409 for suffix in "" $suffixes | 410 for suffix in "" $suffixes |
410 do | 411 do |
411 search_interpreter "$suffix" && { | 412 search_interpreter "$suffix" && { |
412 lua_interp_found=yes | 413 lua_interp_found=yes |
462 if [ "$LUA_LIBDIR_SET" != "yes" ] | 463 if [ "$LUA_LIBDIR_SET" != "yes" ] |
463 then | 464 then |
464 LUA_LIBDIR="$LUA_DIR/lib" | 465 LUA_LIBDIR="$LUA_DIR/lib" |
465 fi | 466 fi |
466 | 467 |
467 echo_n "Checking Lua includes... " | |
468 lua_h="$LUA_INCDIR/lua.h" | 468 lua_h="$LUA_INCDIR/lua.h" |
469 echo_n "Looking for lua.h at $lua_h..." | |
469 if [ -f "$lua_h" ] | 470 if [ -f "$lua_h" ] |
470 then | 471 then |
471 echo "lua.h found in $lua_h" | 472 echo found |
472 else | 473 else |
473 v_dir="$LUA_INCDIR/lua/$LUA_VERSION" | 474 echo "not found" |
474 lua_h="$v_dir/lua.h" | 475 for postfix in "$LUA_VERSION" "$LUA_SUFFIX"; do |
475 if [ -f "$lua_h" ] | 476 if ! [ "$postfix" = "" ]; then |
476 then | 477 v_dir="$LUA_INCDIR/lua/$postfix"; |
477 echo "lua.h found in $lua_h" | 478 else |
479 v_dir="$LUA_INCDIR/lua"; | |
480 fi | |
481 lua_h="$v_dir/lua.h" | |
482 echo_n "Looking for lua.h at $lua_h..." | |
483 if [ -f "$lua_h" ] | |
484 then | |
478 LUA_INCDIR="$v_dir" | 485 LUA_INCDIR="$v_dir" |
479 else | 486 echo found |
480 d_dir="$LUA_INCDIR/lua$LUA_VERSION" | 487 break; |
488 else | |
489 echo "not found" | |
490 d_dir="$LUA_INCDIR/lua$postfix" | |
481 lua_h="$d_dir/lua.h" | 491 lua_h="$d_dir/lua.h" |
492 echo_n "Looking for lua.h at $lua_h..." | |
482 if [ -f "$lua_h" ] | 493 if [ -f "$lua_h" ] |
483 then | 494 then |
484 echo "lua.h found in $lua_h (Debian/Ubuntu)" | 495 echo found |
485 LUA_INCDIR="$d_dir" | 496 LUA_INCDIR="$d_dir" |
497 break; | |
486 else | 498 else |
487 echo "lua.h not found (looked in $LUA_INCDIR, $v_dir, $d_dir)" | 499 echo "not found" |
488 die "You may want to use the flag --with-lua or --with-lua-include. See --help." | 500 fi |
489 fi | 501 fi |
490 fi | 502 done |
503 if [ ! -f "$lua_h" ]; then | |
504 echo "lua.h not found." | |
505 echo | |
506 die "You may want to use the flag --with-lua or --with-lua-include. See --help." | |
507 fi | |
491 fi | 508 fi |
492 | 509 |
493 if [ "$lua_interp_found" = "yes" ] | 510 if [ "$lua_interp_found" = "yes" ] |
494 then | 511 then |
495 echo_n "Checking if Lua header version matches that of the interpreter... " | 512 echo_n "Checking if Lua header version matches that of the interpreter... " |