From be3c52ddccabda19b5619117ece6317cc19aa9d5 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 18 Mar 2015 18:00:27 -0300 Subject: Add extra smartness to configure to check that the user-given flag seems correct. Closes #293. --- configure | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/configure b/configure index e84f00bf..7916749f 100755 --- a/configure +++ b/configure @@ -256,22 +256,23 @@ detect_lua_version() { } search_interpreter() { - LUA_SUFFIX="$1" + suffix="$1" if [ "$LUA_BINDIR_SET" = "yes" ] then find_lua="$LUA_BINDIR" elif [ "$LUA_DIR_SET" = "yes" ] then - if [ -f "$LUA_DIR/bin/lua$LUA_SUFFIX" ] + if [ -f "$LUA_DIR/bin/lua$suffix" ] then find_lua="$LUA_DIR/bin" fi else - find_lua=`find_program lua$LUA_SUFFIX` + find_lua=`find_program lua$suffix` fi - if [ -n "$find_lua" -a -x "$find_lua/lua$LUA_SUFFIX" ] + if [ -n "$find_lua" -a -x "$find_lua/lua$suffix" ] then - echo "Lua interpreter found: $find_lua/lua$LUA_SUFFIX..." + echo "Lua interpreter found: $find_lua/lua$suffix..." + LUA_SUFFIX=$suffix detect_lua_version "$find_lua/lua$LUA_SUFFIX" return 0 fi @@ -292,9 +293,13 @@ then else suffixes="5.3 53 -5.3 -53 5.2 52 -5.2 -52 5.1 51 -5.1 -51" fi + lua_interp_found=no for suffix in "" `echo $suffixes` do - search_interpreter "$suffix" && break + search_interpreter "$suffix" && { + lua_interp_found=yes + break + } done fi @@ -313,7 +318,7 @@ then echo "lua$LUA_SUFFIX found in \$PATH: $find_lua" else echo "lua$LUA_SUFFIX not found in \$PATH." - die "You may want to use the flags --with-lua and/or --lua-suffix. See --help." + die "You may want to use the flags --with-lua, --with-lua-bin and/or --lua-suffix. See --help." fi fi @@ -332,6 +337,18 @@ then LUA_BINDIR="$LUA_DIR/bin" fi +if [ "$lua_interp_found" != "yes" ] +then + echo_n "Checking Lua interpreter... " + if [ -x "$LUA_BINDIR/lua$LUA_SUFFIX" ] + then + echo "lua$LUA_SUFFIX found in $LUA_BINDIR" + else + echo "lua$LUA_SUFFIX not found (looked in $LUA_BINDIR)" + die "You may want to use the flag --with-lua or --with-lua-bin. See --help." + fi +fi + echo_n "Checking Lua includes... " lua_h="$LUA_INCDIR/lua.h" if [ -f "$lua_h" ] -- cgit v1.2.3-55-g6feb