aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure73
1 files changed, 67 insertions, 6 deletions
diff --git a/configure b/configure
index 209f0c44..ecdb649a 100755
--- a/configure
+++ b/configure
@@ -114,30 +114,34 @@ Where to install files provided by rocks:
114Where is your Lua interpreter: 114Where is your Lua interpreter:
115------------------------------ 115------------------------------
116 116
117--lua-version=VERSION) Use specific Lua version: 5.1, 5.2, 5.3, or 5.4 117--lua-version=VERSION Use specific Lua version: 5.1, 5.2, 5.3, or 5.4
118 - Default is auto-detected. 118 - Default is auto-detected.
119--with-lua=LUA_DIR) Use Lua from given directory. 119--with-lua=LUA_DIR Use Lua from given directory.
120 - Default is auto-detected from your \$PATH 120 - Default is auto-detected from your \$PATH
121 (or the parent directory of LUA_BINDIR 121 (or the parent directory of LUA_BINDIR
122 if --with-lua-bin is used). 122 if --with-lua-bin is used).
123--with-lua-bin=LUA_BINDIR) You can also specify Lua's bin dir. 123--with-lua-bin=LUA_BINDIR You can also specify Lua's bin dir.
124 - Default is the directory of the 124 - Default is the directory of the
125 auto-detected Lua interpreter, 125 auto-detected Lua interpreter,
126 (or LUA_DIR/bin if --with-lua is used) 126 (or LUA_DIR/bin if --with-lua is used)
127--with-lua-include=LUA_INCDIR) Lua's includes dir. 127--with-lua-include=LUA_INCDIR Lua's includes dir.
128 - Default is LUA_DIR/include 128 - Default is LUA_DIR/include
129--with-lua-lib=LUA_LIBDIR) Lua's libraries dir. 129--with-lua-lib=LUA_LIBDIR Lua's libraries dir.
130 - Default is LUA_DIR/lib 130 - Default is LUA_DIR/lib
131 131
132For specialized uses of LuaRocks: 132For specialized uses of LuaRocks:
133--------------------------------- 133---------------------------------
134 134
135--force-config) Force using a single config location. 135--force-config Force using a single config location.
136 Do not honor the \$LUAROCKS_CONFIG_5_x 136 Do not honor the \$LUAROCKS_CONFIG_5_x
137 or \$LUAROCKS_CONFIG environment 137 or \$LUAROCKS_CONFIG environment
138 variable or the user's local config. 138 variable or the user's local config.
139 Useful to avoid conflicts when LuaRocks 139 Useful to avoid conflicts when LuaRocks
140 is embedded within an application. 140 is embedded within an application.
141--disable-incdir-check If you do not wish to use "luarocks build",
142 (e.g. when only deploying binary packages)
143 you do not need lua.h installed. This flag
144 skips the check for lua.h in "configure".
141 145
142EOF 146EOF
143} 147}
@@ -273,11 +277,13 @@ do
273 [ -n "$value" ] || die "Missing value in flag $key." 277 [ -n "$value" ] || die "Missing value in flag $key."
274 LUA_INCDIR="$(canonicalpath "$value")" 278 LUA_INCDIR="$(canonicalpath "$value")"
275 [ -d "$LUA_INCDIR" ] || die "Bad value for --with-lua-include: $LUA_INCDIR is not a valid directory." 279 [ -d "$LUA_INCDIR" ] || die "Bad value for --with-lua-include: $LUA_INCDIR is not a valid directory."
280 LUA_INCDIR_SET=yes
276 ;; 281 ;;
277 --with-lua-lib) 282 --with-lua-lib)
278 [ -n "$value" ] || die "Missing value in flag $key." 283 [ -n "$value" ] || die "Missing value in flag $key."
279 LUA_LIBDIR="$(canonicalpath "$value")" 284 LUA_LIBDIR="$(canonicalpath "$value")"
280 [ -d "$LUA_LIBDIR" ] || die "Bad value for --with-lua-lib: $LUA_LIBDIR is not a valid directory." 285 [ -d "$LUA_LIBDIR" ] || die "Bad value for --with-lua-lib: $LUA_LIBDIR is not a valid directory."
286 LUA_LIBDIR_SET=yes
281 ;; 287 ;;
282 288
283 # For specialized uses of LuaRocks: 289 # For specialized uses of LuaRocks:
@@ -285,6 +291,9 @@ do
285 --force-config) 291 --force-config)
286 FORCE_CONFIG=yes 292 FORCE_CONFIG=yes
287 ;; 293 ;;
294 --disable-incdir-check)
295 DISABLE_INCDIR_CHECK=yes
296 ;;
288 297
289 # Old options that no longer apply 298 # Old options that no longer apply
290 # -------------------------------- 299 # --------------------------------
@@ -389,16 +398,65 @@ then
389 fi 398 fi
390fi 399fi
391 400
401# ----------------------------------------
402# Additional checks
403# ----------------------------------------
404
405check_incdir() {
406 if [ "$LUA_INCDIR_SET" = "yes" ]
407 then
408 incdir="$LUA_INCDIR"
409 else
410 incdir="$LUA_DIR/include"
411 fi
412
413 tried=""
414 # Verification of the Lua include path happens at LuaRocks runtime,
415 # but we also perform it here just so that the user gets an early failure
416 # if they try to install LuaRocks with the Lua interpreter package
417 # but not the "development files" that many Linux distros ship separately.
418 for lua_h in \
419 "$incdir/lua/$LUA_VERSION/lua.h" \
420 "$incdir/lua$LUA_VERSION/lua.h" \
421 "$incdir/lua.h" \
422 "$incdir/lua$LUA_VERSION/lua.h" \
423 $("$LUA_BINDIR/$LUA_INTERPRETER" -e 'print(jit and [['"$incdir"'/luajit-]]..jit.version:match("(%d+%.%d+)")..[[/lua.h]] or "")')
424 do
425 [ -f "$lua_h" ] && return
426 tried="$tried $lua_h"
427 done
428
429 echo "$(RED "lua.h not found") (tried$tried)"
430 echo
431 echo "If the development files for Lua (headers and libraries)"
432 echo "are installed in your system, you may need to use the"
433 echo "$(BOLD --with-lua) or $(BOLD --with-include) flags to specify their location."
434 echo
435 echo "If those files are not yet installed, you need to install"
436 echo "them using the appropriate method for your operating system."
437 echo
438 die "Run $(BOLD ./configure --help) for details on flags."
439}
440
441if [ "$DISABLE_INCDIR_CHECK" != "yes" ]
442then
443 check_incdir
444 echo "lua.h found: $(GREEN "$lua_h")"
445fi
446
392unzip_found=$(find_program "unzip") 447unzip_found=$(find_program "unzip")
393if [ -n "$unzip_found" ] 448if [ -n "$unzip_found" ]
394then 449then
395 echo "unzip found in PATH: $(GREEN "$unzip_found")" 450 echo "unzip found in PATH: $(GREEN "$unzip_found")"
396else 451else
397 RED "Could not find 'unzip'." 452 RED "Could not find 'unzip'."
453 echo
398 die "Make sure it is installed and available in your PATH." 454 die "Make sure it is installed and available in your PATH."
399fi 455fi
400 456
457# ----------------------------------------
401# Write config 458# Write config
459# ----------------------------------------
402 460
403make clean > /dev/null 2> /dev/null 461make clean > /dev/null 2> /dev/null
404 462
@@ -441,6 +499,9 @@ echo "LuaRocks will be installed at......: $(GREEN "$PREFIX")"
441echo "LuaRocks will install rocks at.....: $(GREEN "$ROCKS_TREE")" 499echo "LuaRocks will install rocks at.....: $(GREEN "$ROCKS_TREE")"
442echo "LuaRocks configuration directory...: $(GREEN "$SYSCONFDIR")" 500echo "LuaRocks configuration directory...: $(GREEN "$SYSCONFDIR")"
443echo "Using Lua from.....................: $(GREEN "$LUA_DIR")" 501echo "Using Lua from.....................: $(GREEN "$LUA_DIR")"
502if [ "$LUA_BINDIR_SET" = "yes" ]; then echo "Lua bin directory..................: $(GREEN "$LUA_BINDIR")" ; fi
503if [ "$LUA_INCDIR_SET" = "yes" ]; then echo "Lua include directory..............: $(GREEN "$LUA_INCDIR")" ; fi
504if [ "$LUA_LIBDIR_SET" = "yes" ]; then echo "Lua lib directory..................: $(GREEN "$LUA_LIBDIR")" ; fi
444echo 505echo
445echo "* Type $(BOLD make build) and $(BOLD make install):" 506echo "* Type $(BOLD make build) and $(BOLD make install):"
446echo " to install to $PREFIX as usual." 507echo " to install to $PREFIX as usual."