Bump version
[phplua.git] / config.m4
blobe99046bd89b257608a4c01c2a53f40c520547bdb
1 PHP_ARG_WITH(lua,for LUA support,
2 [  --with-lua[=DIR]     Include LUA support])
4 if test "$PHP_LUA" != "no"; then
5         PHP_NEW_EXTENSION(lua, lua.c, $ext_shared)
6         if test "$PHP_LUA" != "yes"; then
7             LUA_SEARCH_DIRS=$PHP_LUA
8         else
9             LUA_SEARCH_DIRS="/usr/local /usr"
10         fi
11         for i in $LUA_SEARCH_DIRS; do
12                 if test -f $i/include/lua/lua.h; then
13                         LUA_DIR=$i
14                         LUA_INCDIR=$i/include/lua
15                 elif test -f $i/include/lua5.1/lua.h; then
16                         LUA_DIR=$i
17                         LUA_INCDIR=$i/include/lua5.1
18                 elif test -f $i/include/lua.h; then
19                         LUA_DIR=$i
20                         LUA_INCDIR=$i/include
21                 fi
22         done
24         if test -z "$LUA_DIR"; then
25                 AC_MSG_ERROR(Cannot find lua)
26         fi
28         LUA_LIBDIR=$LUA_DIR/$PHP_LIBDIR
30         PHP_ADD_LIBRARY_WITH_PATH(lua, $LUA_LIBDIR, LUA_SHARED_LIBADD)
32         PHP_CHECK_LIBRARY(lua,lua_new_state,
33         [
34                 PHP_ADD_LIBRARY_WITH_PATH(lua, $LUA_LIBDIR, LUA_SHARED_LIBADD)
35         ], [], [
36                 -L$LUA_LIBDIR
37         ])
39         PHP_ADD_INCLUDE($LUA_INCDIR)
40         PHP_SUBST(LUA_SHARED_LIBADD)
41         AC_DEFINE(HAVE_LUA,1,[ ])