diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-18 18:00:27 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-18 18:00:27 -0300 |
| commit | be3c52ddccabda19b5619117ece6317cc19aa9d5 (patch) | |
| tree | 87b33b55785515db6c22ed0831585846752db1f2 | |
| parent | 87398473ce42a42391565dbe26a5ad37a7d53fd3 (diff) | |
| download | luarocks-be3c52ddccabda19b5619117ece6317cc19aa9d5.tar.gz luarocks-be3c52ddccabda19b5619117ece6317cc19aa9d5.tar.bz2 luarocks-be3c52ddccabda19b5619117ece6317cc19aa9d5.zip | |
Add extra smartness to configure to check that the user-given flag seems correct.
Closes #293.
| -rwxr-xr-x | configure | 31 |
1 files changed, 24 insertions, 7 deletions
| @@ -256,22 +256,23 @@ detect_lua_version() { | |||
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | search_interpreter() { | 258 | search_interpreter() { |
| 259 | LUA_SUFFIX="$1" | 259 | suffix="$1" |
| 260 | if [ "$LUA_BINDIR_SET" = "yes" ] | 260 | if [ "$LUA_BINDIR_SET" = "yes" ] |
| 261 | then | 261 | then |
| 262 | find_lua="$LUA_BINDIR" | 262 | find_lua="$LUA_BINDIR" |
| 263 | elif [ "$LUA_DIR_SET" = "yes" ] | 263 | elif [ "$LUA_DIR_SET" = "yes" ] |
| 264 | then | 264 | then |
| 265 | if [ -f "$LUA_DIR/bin/lua$LUA_SUFFIX" ] | 265 | if [ -f "$LUA_DIR/bin/lua$suffix" ] |
| 266 | then | 266 | then |
| 267 | find_lua="$LUA_DIR/bin" | 267 | find_lua="$LUA_DIR/bin" |
| 268 | fi | 268 | fi |
| 269 | else | 269 | else |
| 270 | find_lua=`find_program lua$LUA_SUFFIX` | 270 | find_lua=`find_program lua$suffix` |
| 271 | fi | 271 | fi |
| 272 | if [ -n "$find_lua" -a -x "$find_lua/lua$LUA_SUFFIX" ] | 272 | if [ -n "$find_lua" -a -x "$find_lua/lua$suffix" ] |
| 273 | then | 273 | then |
| 274 | echo "Lua interpreter found: $find_lua/lua$LUA_SUFFIX..." | 274 | echo "Lua interpreter found: $find_lua/lua$suffix..." |
| 275 | LUA_SUFFIX=$suffix | ||
| 275 | detect_lua_version "$find_lua/lua$LUA_SUFFIX" | 276 | detect_lua_version "$find_lua/lua$LUA_SUFFIX" |
| 276 | return 0 | 277 | return 0 |
| 277 | fi | 278 | fi |
| @@ -292,9 +293,13 @@ then | |||
| 292 | else | 293 | else |
| 293 | suffixes="5.3 53 -5.3 -53 5.2 52 -5.2 -52 5.1 51 -5.1 -51" | 294 | suffixes="5.3 53 -5.3 -53 5.2 52 -5.2 -52 5.1 51 -5.1 -51" |
| 294 | fi | 295 | fi |
| 296 | lua_interp_found=no | ||
| 295 | for suffix in "" `echo $suffixes` | 297 | for suffix in "" `echo $suffixes` |
| 296 | do | 298 | do |
| 297 | search_interpreter "$suffix" && break | 299 | search_interpreter "$suffix" && { |
| 300 | lua_interp_found=yes | ||
| 301 | break | ||
| 302 | } | ||
| 298 | done | 303 | done |
| 299 | fi | 304 | fi |
| 300 | 305 | ||
| @@ -313,7 +318,7 @@ then | |||
| 313 | echo "lua$LUA_SUFFIX found in \$PATH: $find_lua" | 318 | echo "lua$LUA_SUFFIX found in \$PATH: $find_lua" |
| 314 | else | 319 | else |
| 315 | echo "lua$LUA_SUFFIX not found in \$PATH." | 320 | echo "lua$LUA_SUFFIX not found in \$PATH." |
| 316 | die "You may want to use the flags --with-lua and/or --lua-suffix. See --help." | 321 | die "You may want to use the flags --with-lua, --with-lua-bin and/or --lua-suffix. See --help." |
| 317 | fi | 322 | fi |
| 318 | fi | 323 | fi |
| 319 | 324 | ||
| @@ -332,6 +337,18 @@ then | |||
| 332 | LUA_BINDIR="$LUA_DIR/bin" | 337 | LUA_BINDIR="$LUA_DIR/bin" |
| 333 | fi | 338 | fi |
| 334 | 339 | ||
| 340 | if [ "$lua_interp_found" != "yes" ] | ||
| 341 | then | ||
| 342 | echo_n "Checking Lua interpreter... " | ||
| 343 | if [ -x "$LUA_BINDIR/lua$LUA_SUFFIX" ] | ||
| 344 | then | ||
| 345 | echo "lua$LUA_SUFFIX found in $LUA_BINDIR" | ||
| 346 | else | ||
| 347 | echo "lua$LUA_SUFFIX not found (looked in $LUA_BINDIR)" | ||
| 348 | die "You may want to use the flag --with-lua or --with-lua-bin. See --help." | ||
| 349 | fi | ||
| 350 | fi | ||
| 351 | |||
| 335 | echo_n "Checking Lua includes... " | 352 | echo_n "Checking Lua includes... " |
| 336 | lua_h="$LUA_INCDIR/lua.h" | 353 | lua_h="$LUA_INCDIR/lua.h" |
| 337 | if [ -f "$lua_h" ] | 354 | if [ -f "$lua_h" ] |
