aboutsummaryrefslogtreecommitdiffstats
path: root/m4/lua.m4
diff options
context:
space:
mode:
authorGravatar Nokis Mavrogiannopoulos 2008-02-20 19:53:44 +0000
committerGravatar Nokis Mavrogiannopoulos 2008-02-20 19:53:44 +0000
commit4dd789740526f169c5acf821d220a38e35d42389 (patch)
treeb71cda083d1ed8ceb2db2fb815eadf042295c348 /m4/lua.m4
parentb4d4a1e816332777d3196b50b0be33fc31aef47b (diff)
added new m4 directory
Diffstat (limited to 'm4/lua.m4')
-rw-r--r--m4/lua.m471
1 files changed, 71 insertions, 0 deletions
diff --git a/m4/lua.m4 b/m4/lua.m4
new file mode 100644
index 0000000..beae980
--- /dev/null
+++ b/m4/lua.m4
@@ -0,0 +1,71 @@
1dnl Check for Lua 5.0 Libraries
2dnl CHECK_LUA(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
3dnl Sets:
4dnl LUA_CFLAGS
5dnl LUA_LIBS
6AC_DEFUN([CHECK_LUA],
7[dnl
8
9AC_ARG_WITH(
10 lua,
11 [AC_HELP_STRING([--with-lua=PATH],[Path to the Lua 5.0 prefix])],
12 lua_path="$withval",
13 :)
14
15dnl # Determine memcache lib directory
16if test -z $mc_path; then
17 test_paths="/usr/local /usr"
18else
19 test_paths="${lua_path}"
20fi
21
22for x in $test_paths ; do
23 AC_MSG_CHECKING([for lua.h in ${x}/include/lua50])
24 if test -f ${x}/include/lua50/lua.h; then
25 AC_MSG_RESULT([yes])
26 save_CFLAGS=$CFLAGS
27 save_LDFLAGS=$LDFLAGS
28 CFLAGS="$CFLAGS"
29 LDFLAGS="-L$x/lib $LDFLAGS"
30 AC_CHECK_LIB(lua50, lua_open,
31 [
32 LUA_LIBS="-L$x/lib -llua50 -llualib50"
33 LUA_CFLAGS="-I$x/include/lua50"
34 ])
35 CFLAGS=$save_CFLAGS
36 LDFLAGS=$save_LDFLAGS
37 break
38 else
39 AC_MSG_RESULT([no])
40 fi
41 AC_MSG_CHECKING([for lua.h in ${x}/include])
42 if test -f ${x}/include/lua.h; then
43 AC_MSG_RESULT([yes])
44 save_CFLAGS=$CFLAGS
45 save_LDFLAGS=$LDFLAGS
46 CFLAGS="$CFLAGS"
47 LDFLAGS="-L$x/lib $LDFLAGS"
48 AC_CHECK_LIB(lua, lua_open,
49 [
50 LUA_LIBS="-L$x/lib -llua -llualib"
51 LUA_CFLAGS="-I$x/include/lua50"
52 ])
53 CFLAGS=$save_CFLAGS
54 LDFLAGS=$save_LDFLAGS
55 break
56 else
57 AC_MSG_RESULT([no])
58 fi
59done
60
61AC_SUBST(LUA_LIBS)
62AC_SUBST(LUA_CFLAGS)
63
64if test -z "${LUA_LIBS}"; then
65 AC_MSG_NOTICE([*** Lua 5.0 library not found.])
66 ifelse([$2], , AC_MSG_ERROR([Lua 5.0 library is required]), $2)
67else
68 AC_MSG_NOTICE([using '${LUA_LIBS}' for Lua Library])
69 ifelse([$1], , , $1)
70fi
71])