forked from laruence/php-lua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
66 lines (58 loc) · 1.77 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
dnl $Id: config.m4 321796 2012-01-05 17:23:48Z laruence $
PHP_ARG_WITH(lua, for lua support,
[ --with-lua=[DIR] Include php lua support])
if test "$PHP_LUA" != "no"; then
if test -r $PHP_LUA/include/lua.h; then
LUA_DIR=$PHP_LUA
else
AC_MSG_CHECKING(for lua in default path)
for i in /usr/local /usr; do
if test -r $i/include/lua/lua.h; then
LUA_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
for v in 5.0 5.1 5.2; do
if test -r $i/include/lua$v/lua.h; then
LUA_DIR=$i
LUA_VERSION=$v
AC_MSG_RESULT(lua.h found in $i)
break
fi
done
done
fi
if test -z "$LUA_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the lua distribution - lua.h should be in <lua-dir>/include/)
fi
LUA_LIB_NAME=liblua.a
if test -r $PHP_LUA/$PHP_LIBDIR/${LUA_LIB_NAME}; then
LUA_LIB_DIR=$PHP_LUA/$PHP_LIBDIR
else
AC_MSG_CHECKING(for lua library in default path)
for i in /usr/lib /usr/lib64 /usr/lib/x86_64-linux-gnu; do
if test -r $i/${LUA_LIB_NAME}; then
LUA_LIB_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
for v in 5.0 5.1 5.2; do
AC_MSG_RESULT(testing $i/liblua$v.a)
if test -r $i/liblua$v.a; then
LUA_LIB_DIR=$i
AC_MSG_RESULT(lua lib found in $i)
break
fi
done
done
fi
if test -z "$LUA_LIB_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the lua distribution - lua library should be in <lua-dir>/lib/)
fi
PHP_ADD_INCLUDE($LUA_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(lua, $LUA_LIB_DIR, LUA_SHARED_LIBADD)
PHP_SUBST(LUA_SHARED_LIBADD)
PHP_NEW_EXTENSION(lua, lua.c lua_closure.c, $ext_shared)
fi