Simplify check for lua.h and -llua
authorAri Johnson <ari@theari.com>
Thu, 28 Apr 2011 19:07:22 +0000 (15:07 -0400)
committerAri Johnson <ari@theari.com>
Thu, 28 Apr 2011 19:07:22 +0000 (15:07 -0400)
m4/ax_lua.m4

index 8a5a771e2d7e3fc5938d3abc15bf50e5e6e40ff1..e50085595d931ce5119c22b003bbec7f3d474c38 100644 (file)
@@ -118,39 +118,9 @@ dnl
       ])
 
 AC_DEFUN([AX_FIND_LUA],[
-dnl First check if its int he normal spot.. /usr/include.. If it is.. forget the rest
-  AC_MSG_CHECKING([for lua.h in /usr/include..])
-  if test -f "/usr/include/lua.h"; then
-    AC_MSG_RESULT([yes])
-  else
-    AC_MSG_RESULT([no])
-    AC_MSG_NOTICE([Checking other possible global loations...])
-    lua_myincs="/opt/ports/include /usr/include/lua5.1"
-    for thisincl in $lua_myincs
-    do
-      AC_MSG_CHECKING([for lua header in $thisincl])
-      if test -f "$thisincl/lua.h"
-      then
-        lua_h_path="$thisincl"
-       AC_MSG_RESULT([yes])
-      else
-        AC_MSG_RESULT([no])
-      fi
-    done
-  fi
-  if test -z "$lua_h_path"; then
-    AC_MSG_NOTICE([Unable to find global lua.h.])
-    AX_CHECK_LOCAL_LUA()
-  fi
-  AC_SUBST([lua_h_path])
-  dnl Now Lets look for our library
-  LDFLAGS="$LDFLAGS $lua_ldflags"
-  CFLAGS="$CFLAGS -I$lua_h_path"
-  AC_MSG_NOTICE([CFLAGS = $cflags and LDFLAGS = $LDFLAGS])
-  AC_CHECK_LIB([lua], [lua_call], ,[
-     AC_CHECK_LIB([lua5.1], [lua_call], , AC_MSG_ERROR([CobraMUSH requires lua libraries.]))
-    ])
-])
+  AC_CHECK_HEADER([lua.h], [
+    AC_SEARCH_LIBS([lua_call], [lua lua5.1], , AC_MSG_ERROR([CobraMUSH requires lua]))], [
+    AX_CHECK_LOCAL_LUA()])])
 
 dnl Helper function to declare extra options
 AC_DEFUN([_AX_LUA_OPTS],