diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-06 19:13:20 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-07-10 19:02:50 -0300 |
commit | fd1d9fe0fd48b79b13ca029e1f99f0ca297b170e (patch) | |
tree | 3ac4c42a32d22f5690c6e412663f9bf0ffe581a2 /configure | |
parent | d9f09ba8c9630e93331a45722ad1d2d9fb5f4aa4 (diff) | |
download | luarocks-fd1d9fe0fd48b79b13ca029e1f99f0ca297b170e.tar.gz luarocks-fd1d9fe0fd48b79b13ca029e1f99f0ca297b170e.tar.bz2 luarocks-fd1d9fe0fd48b79b13ca029e1f99f0ca297b170e.zip |
configure: add --with-lua-interpreter option
Support using any interpreter name, even if it doesn't start with
'lua'.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 40 |
1 files changed, 26 insertions, 14 deletions
@@ -128,6 +128,8 @@ Where is your Lua interpreter: | |||
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 | --with-lua-interpreter=NAME Lua interpreter name | ||
132 | - Default is to auto-detected | ||
131 | 133 | ||
132 | For specialized uses of LuaRocks: | 134 | For specialized uses of LuaRocks: |
133 | --------------------------------- | 135 | --------------------------------- |
@@ -167,7 +169,7 @@ detect_lua_version() { | |||
167 | } | 169 | } |
168 | 170 | ||
169 | search_interpreter() { | 171 | search_interpreter() { |
170 | suffix="$1" | 172 | name="$1" |
171 | lua_at="" | 173 | lua_at="" |
172 | if [ "$LUA_BINDIR_SET" = "yes" ] | 174 | if [ "$LUA_BINDIR_SET" = "yes" ] |
173 | then | 175 | then |
@@ -175,18 +177,18 @@ search_interpreter() { | |||
175 | elif [ "$LUA_DIR_SET" = "yes" ] | 177 | elif [ "$LUA_DIR_SET" = "yes" ] |
176 | then | 178 | then |
177 | LUA_BINDIR="$LUA_DIR/bin" | 179 | LUA_BINDIR="$LUA_DIR/bin" |
178 | if [ -f "$LUA_BINDIR/lua$suffix" ] | 180 | if [ -f "$LUA_BINDIR/$name" ] |
179 | then | 181 | then |
180 | lua_at="$LUA_BINDIR" | 182 | lua_at="$LUA_BINDIR" |
181 | fi | 183 | fi |
182 | else | 184 | else |
183 | lua_at=$(find_program "lua$suffix") | 185 | lua_at=$(find_program "$name") |
184 | fi | 186 | fi |
185 | if [ -n "$lua_at" ] && [ -x "$lua_at/lua$suffix" ] | 187 | if [ -n "$lua_at" ] && [ -x "$lua_at/$name" ] |
186 | then | 188 | then |
187 | if detect_lua_version "$lua_at/lua$suffix" | 189 | if detect_lua_version "$lua_at/$name" |
188 | then | 190 | then |
189 | echo "Lua interpreter found: $(GREEN "$lua_at/lua$suffix")" | 191 | echo "Lua interpreter found: $(GREEN "$lua_at/$name")" |
190 | if [ "$LUA_BINDIR_SET" != "yes" ] | 192 | if [ "$LUA_BINDIR_SET" != "yes" ] |
191 | then | 193 | then |
192 | LUA_BINDIR="$lua_at" | 194 | LUA_BINDIR="$lua_at" |
@@ -195,7 +197,7 @@ search_interpreter() { | |||
195 | then | 197 | then |
196 | LUA_DIR=$(dirname "$lua_at") | 198 | LUA_DIR=$(dirname "$lua_at") |
197 | fi | 199 | fi |
198 | LUA_INTERPRETER="lua$suffix" | 200 | LUA_INTERPRETER="$name" |
199 | return 0 | 201 | return 0 |
200 | fi | 202 | fi |
201 | fi | 203 | fi |
@@ -285,6 +287,11 @@ do | |||
285 | [ -d "$LUA_LIBDIR" ] || die "Bad value for --with-lua-lib: $LUA_LIBDIR is not a valid directory." | 287 | [ -d "$LUA_LIBDIR" ] || die "Bad value for --with-lua-lib: $LUA_LIBDIR is not a valid directory." |
286 | LUA_LIBDIR_SET=yes | 288 | LUA_LIBDIR_SET=yes |
287 | ;; | 289 | ;; |
290 | --with-lua-interpreter) | ||
291 | [ -n "$value" ] || die "Missing value in flag $key." | ||
292 | LUA_INTERPRETER="$value" | ||
293 | LUA_INTERPRETER_SET=yes | ||
294 | ;; | ||
288 | 295 | ||
289 | # For specialized uses of LuaRocks: | 296 | # For specialized uses of LuaRocks: |
290 | # --------------------------------- | 297 | # --------------------------------- |
@@ -343,25 +350,30 @@ lua_interp_found=no | |||
343 | 350 | ||
344 | case "$LUA_VERSION" in | 351 | case "$LUA_VERSION" in |
345 | 5.1) | 352 | 5.1) |
346 | suffixes="5.1 51 -5.1 -51 jit" | 353 | names="lua5.1 lua51 lua-5.1 lua-51 luajit lua" |
347 | ;; | 354 | ;; |
348 | 5.2) | 355 | 5.2) |
349 | suffixes="5.2 52 -5.2 -52" | 356 | names="lua5.2 lua52 lua-5.2 lua-52 lua" |
350 | ;; | 357 | ;; |
351 | 5.3) | 358 | 5.3) |
352 | suffixes="5.3 53 -5.3 -53" | 359 | names="lua5.3 lua53 lua-5.3 lua-53 lua" |
353 | ;; | 360 | ;; |
354 | 5.4) | 361 | 5.4) |
355 | suffixes="5.4 54 -5.4 -54" | 362 | names="lua5.4 lua54 lua-5.4 lua-54 lua" |
356 | ;; | 363 | ;; |
357 | *) | 364 | *) |
358 | suffixes="5.4 54 -5.4 -54 5.3 53 -5.3 -53 5.2 52 -5.2 -52 5.1 51 -5.1 -51 jit" | 365 | names="lua5.4 lua54 lua-5.4 lua-54 lua5.3 lua53 lua-5.3 lua-53 lua5.2 lua52 lua-5.2 lua-52 lua5.1 lua51 lua-5.1 lua-51 luajit lua" |
359 | ;; | 366 | ;; |
360 | esac | 367 | esac |
361 | 368 | ||
362 | for suffix in $suffixes "" | 369 | if [ "$LUA_INTERPRETER_SET" = "yes" ] |
370 | then | ||
371 | names="$LUA_INTERPRETER" | ||
372 | fi | ||
373 | |||
374 | for name in $names | ||
363 | do | 375 | do |
364 | search_interpreter "$suffix" && { | 376 | search_interpreter "$name" && { |
365 | lua_interp_found=yes | 377 | lua_interp_found=yes |
366 | break | 378 | break |
367 | } | 379 | } |