diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-04 11:45:13 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-04 18:17:53 -0300 |
commit | 39d522622f07266892fb61113509711c4798421f (patch) | |
tree | f09758ffc29b29b998309a4983de010ae2cbe9f7 | |
parent | 410e3e057d41e08f497c770ce0576072e6b83fe7 (diff) | |
download | luarocks-39d522622f07266892fb61113509711c4798421f.tar.gz luarocks-39d522622f07266892fb61113509711c4798421f.tar.bz2 luarocks-39d522622f07266892fb61113509711c4798421f.zip |
configure: check presence of lua.h
Verification of the Lua include path happens at LuaRocks runtime,
but we also perform it here just so that the user gets an early failure
if they try to install LuaRocks with the Lua interpreter package
but not the "development files" that many Linux distros ship separately.
We also include a --disable-incdir-check flag for specialized scenarios: if
you do not wish to use "luarocks build", (e.g. when only deploying binary
packages) you do not need lua.h installed. This flag skips the check for lua.h
in "configure".
-rwxr-xr-x | configure | 73 |
1 files changed, 67 insertions, 6 deletions
@@ -114,30 +114,34 @@ Where to install files provided by rocks: | |||
114 | Where is your Lua interpreter: | 114 | Where 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 | ||
132 | For specialized uses of LuaRocks: | 132 | For 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 | ||
142 | EOF | 146 | EOF |
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 |
390 | fi | 399 | fi |
391 | 400 | ||
401 | # ---------------------------------------- | ||
402 | # Additional checks | ||
403 | # ---------------------------------------- | ||
404 | |||
405 | check_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 | |||
441 | if [ "$DISABLE_INCDIR_CHECK" != "yes" ] | ||
442 | then | ||
443 | check_incdir | ||
444 | echo "lua.h found: $(GREEN "$lua_h")" | ||
445 | fi | ||
446 | |||
392 | unzip_found=$(find_program "unzip") | 447 | unzip_found=$(find_program "unzip") |
393 | if [ -n "$unzip_found" ] | 448 | if [ -n "$unzip_found" ] |
394 | then | 449 | then |
395 | echo "unzip found in PATH: $(GREEN "$unzip_found")" | 450 | echo "unzip found in PATH: $(GREEN "$unzip_found")" |
396 | else | 451 | else |
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." |
399 | fi | 455 | fi |
400 | 456 | ||
457 | # ---------------------------------------- | ||
401 | # Write config | 458 | # Write config |
459 | # ---------------------------------------- | ||
402 | 460 | ||
403 | make clean > /dev/null 2> /dev/null | 461 | make clean > /dev/null 2> /dev/null |
404 | 462 | ||
@@ -441,6 +499,9 @@ echo "LuaRocks will be installed at......: $(GREEN "$PREFIX")" | |||
441 | echo "LuaRocks will install rocks at.....: $(GREEN "$ROCKS_TREE")" | 499 | echo "LuaRocks will install rocks at.....: $(GREEN "$ROCKS_TREE")" |
442 | echo "LuaRocks configuration directory...: $(GREEN "$SYSCONFDIR")" | 500 | echo "LuaRocks configuration directory...: $(GREEN "$SYSCONFDIR")" |
443 | echo "Using Lua from.....................: $(GREEN "$LUA_DIR")" | 501 | echo "Using Lua from.....................: $(GREEN "$LUA_DIR")" |
502 | if [ "$LUA_BINDIR_SET" = "yes" ]; then echo "Lua bin directory..................: $(GREEN "$LUA_BINDIR")" ; fi | ||
503 | if [ "$LUA_INCDIR_SET" = "yes" ]; then echo "Lua include directory..............: $(GREEN "$LUA_INCDIR")" ; fi | ||
504 | if [ "$LUA_LIBDIR_SET" = "yes" ]; then echo "Lua lib directory..................: $(GREEN "$LUA_LIBDIR")" ; fi | ||
444 | echo | 505 | echo |
445 | echo "* Type $(BOLD make build) and $(BOLD make install):" | 506 | echo "* Type $(BOLD make build) and $(BOLD make install):" |
446 | echo " to install to $PREFIX as usual." | 507 | echo " to install to $PREFIX as usual." |