configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
authorMatthew Wild <mwild1@gmail.com>
Mon, 03 Dec 2018 19:38:19 +0000
changeset 9682 6178b491fe28
parent 9681 d0cc1c4e1a1c
child 9683 4f02aaf40ee9
configure: Also look for lua.h in a directory with the same suffix as the interpreter (FreeBSD-friendly)
configure
--- a/configure	Sun Dec 02 17:22:26 2018 +0100
+++ b/configure	Mon Dec 03 19:38:19 2018 +0000
@@ -469,24 +469,37 @@
 then
    echo "lua.h found in $lua_h"
 else
-   v_dir="$LUA_INCDIR/lua/$LUA_VERSION"
-   lua_h="$v_dir/lua.h"
-   if [ -f "$lua_h" ]
-   then
+  for postfix in "$LUA_VERSION" "$LUA_SUFFIX"; do
+    if ! [ "$postfix" = "" ]; then
+      v_dir="$LUA_INCDIR/lua/$postfix";
+    else
+      v_dir="$LUA_INCDIR/lua";
+    fi
+    lua_h="$v_dir/lua.h"
+    if [ -f "$lua_h" ]
+    then
       echo "lua.h found in $lua_h"
       LUA_INCDIR="$v_dir"
-   else
-      d_dir="$LUA_INCDIR/lua$LUA_VERSION"
+      break;
+    else
+      d_dir="$LUA_INCDIR/lua$postfix"
       lua_h="$d_dir/lua.h"
       if [ -f "$lua_h" ]
       then
-         echo "lua.h found in $lua_h (Debian/Ubuntu)"
-         LUA_INCDIR="$d_dir"
+        echo "lua.h found in $lua_h"
+        LUA_INCDIR="$d_dir"
+        break;
       else
-         echo "lua.h not found (looked in $LUA_INCDIR, $v_dir, $d_dir)"
-         die "You may want to use the flag --with-lua or --with-lua-include. See --help."
+        lua_h_search="$lua_h_search\n  $v_dir/lua.h\n  $d_dir/lua.h"
       fi
-   fi
+    fi
+  done
+  if [ ! -f "$lua_h" ]; then
+    echo "lua.h not found. Looked for:"
+    echo "$lua_h_search" | uniq
+    echo
+    die "You may want to use the flag --with-lua or --with-lua-include. See --help."
+  fi
 fi
 
 if [ "$lua_interp_found" = "yes" ]