Automatically locate lua.h header
authorAri Johnson <ari@theari.com>
Wed, 12 Jan 2011 21:17:44 +0000 (21:17 +0000)
committerAri Johnson <ari@theari.com>
Wed, 12 Jan 2011 21:17:44 +0000 (21:17 +0000)
U/d_lua.U

index 0efc9e4e377ce48f85adaba0175cdcbdaf204165..b4a91b5457cd85989d70be982fca73453502ce34 100644 (file)
--- a/U/d_lua.U
+++ b/U/d_lua.U
@@ -14,3 +14,25 @@ case $libs in
         exit 1;
         ;;
 esac
+
+myincs="/usr/include $locincpth"
+otherincs=""
+for thisincl in $myincs; do
+    otherincs="$otherincs $thisincl/lua5.1"
+done
+
+lua_h_path=""
+for thisincl in $myincs $otherincs; do
+    if [ -r "$thisincl/lua.h" ]; then
+        lua_h_path="$thisincl"
+    fi
+done
+
+if [ x"$lua_h_path" == "x" ]; then
+    echo "Unable to find lua.h header. Check your LUA installation." >&4
+    echo "Looked in $myincs $otherincs for it" >&4
+    exit 1
+fi
+
+ccflags="$ccflags -I$lua_h_path"
+