diff options
author | Nikos Mavrogiannopoulos | 2008-02-20 19:53:44 +0000 |
---|---|---|
committer | Nokis Mavrogiannopoulos | 2008-02-20 19:53:44 +0000 |
commit | abce2980c929dbb6ccb9d45c7cd88df3106c6ee4 (patch) | |
tree | b71cda083d1ed8ceb2db2fb815eadf042295c348 /m4/lua.m4 | |
parent | 572096be0da2690e3e32ad8fd19ae5758c870874 (diff) |
added new m4 directory
Diffstat (limited to 'm4/lua.m4')
-rw-r--r-- | m4/lua.m4 | 71 |
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 @@ | |||
1 | dnl Check for Lua 5.0 Libraries | ||
2 | dnl CHECK_LUA(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) | ||
3 | dnl Sets: | ||
4 | dnl LUA_CFLAGS | ||
5 | dnl LUA_LIBS | ||
6 | AC_DEFUN([CHECK_LUA], | ||
7 | [dnl | ||
8 | |||
9 | AC_ARG_WITH( | ||
10 | lua, | ||
11 | [AC_HELP_STRING([--with-lua=PATH],[Path to the Lua 5.0 prefix])], | ||
12 | lua_path="$withval", | ||
13 | :) | ||
14 | |||
15 | dnl # Determine memcache lib directory | ||
16 | if test -z $mc_path; then | ||
17 | test_paths="/usr/local /usr" | ||
18 | else | ||
19 | test_paths="${lua_path}" | ||
20 | fi | ||
21 | |||
22 | for 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 | ||
59 | done | ||
60 | |||
61 | AC_SUBST(LUA_LIBS) | ||
62 | AC_SUBST(LUA_CFLAGS) | ||
63 | |||
64 | if 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) | ||
67 | else | ||
68 | AC_MSG_NOTICE([using '${LUA_LIBS}' for Lua Library]) | ||
69 | ifelse([$1], , , $1) | ||
70 | fi | ||
71 | ]) | ||