]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - m4/lua.m4
Import lutok, a Lightweight C++ API for Lua.
[FreeBSD/FreeBSD.git] / m4 / lua.m4
1 dnl Copyright 2011 Google Inc.
2 dnl All rights reserved.
3 dnl
4 dnl Redistribution and use in source and binary forms, with or without
5 dnl modification, are permitted provided that the following conditions are
6 dnl met:
7 dnl
8 dnl * Redistributions of source code must retain the above copyright
9 dnl   notice, this list of conditions and the following disclaimer.
10 dnl * Redistributions in binary form must reproduce the above copyright
11 dnl   notice, this list of conditions and the following disclaimer in the
12 dnl   documentation and/or other materials provided with the distribution.
13 dnl * Neither the name of Google Inc. nor the names of its contributors
14 dnl   may be used to endorse or promote products derived from this software
15 dnl   without specific prior written permission.
16 dnl
17 dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 dnl
30 dnl KYUA_LUA
31 dnl
32 dnl Helper macro to detect Lua in a variety of systems.
33 dnl
34 AC_DEFUN([KYUA_LUA], [
35     lua_found=no
36
37     for lua_release in 5.2 5.1; do
38         if test "${lua_found}" = no; then
39             PKG_CHECK_MODULES([LUA], [lua${lua_release} >= ${lua_release}],
40                               [lua_found=yes], [true])
41         fi
42         if test "${lua_found}" = no; then
43             PKG_CHECK_MODULES([LUA], [lua-${lua_release} >= ${lua_release}],
44                               [lua_found=yes], [true])
45         fi
46         if test "${lua_found}" = no; then
47             PKG_CHECK_MODULES([LUA], [lua >= ${lua_release}],
48                               [lua_found=yes], [true])
49         fi
50
51         test "${lua_found}" = no || break
52     done
53
54     if test "${lua_found}" = no; then
55         AC_PATH_PROGS([LUA_CONFIG], [lua-config], [unset])
56         if test "${LUA_CONFIG}" != unset; then
57             AC_SUBST([LUA_CFLAGS], [$(${LUA_CONFIG} --include)])
58             AC_SUBST([LUA_LIBS], [$(${LUA_CONFIG} --libs)])
59             lua_found=yes
60         fi
61     fi
62
63     if test "${lua_found}" = no; then
64         AC_MSG_ERROR([lua (5.1 or newer) is required])
65     else
66         AC_MSG_NOTICE([using LUA_CFLAGS = ${LUA_CFLAGS}])
67         AC_MSG_NOTICE([using LUA_LIBS = ${LUA_LIBS}])
68     fi
69 ])