Merge Trond
[m6w6/libmemcached] / m4 / pandora_with_lua.m4
1 dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 dnl
4 dnl pandora-build: A pedantic build system
5 dnl Copyright (C) 2009 Sun Microsystems, Inc.
6 dnl This file is free software; the Free Software Foundation
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
9 dnl
10 dnl From Monty Taylor
11
12 AC_DEFUN([PANDORA_WITH_LUA],[
13 dnl Check for lua
14 AC_ARG_WITH([lua],
15 [AS_HELP_STRING([--with-lua],
16 [Build Lua Bindings @<:@default=yes@:>@])],
17 [with_lua=$withval],
18 [with_lua=yes])
19
20 AS_IF([test "x$with_lua" != "xno"],[
21 AS_IF([test "x$with_lua" = "xyes"],
22 [LUAPC=lua],
23 [LUAPC=$with_lua])
24
25 PKG_CHECK_MODULES([LUA], $LUAPC >= 5.1, [
26 AC_DEFINE([HAVE_LUA], [1], [liblua])
27 AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
28 with_lua=yes
29 ],[
30 LUAPC=lua5.1
31 PKG_CHECK_MODULES([LUA], $LUAPC >= 5.1, [
32 AC_DEFINE([HAVE_LUA], [1], [liblua])
33 AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
34 with_lua=yes
35 ],[
36 AC_DEFINE([HAVE_LUA],["x"],["x"])
37 with_lua=no
38 ])
39 ])
40
41 AC_CACHE_CHECK([for LUA installation location],[pandora_cv_lua_archdir],[
42 AS_IF([test "$prefix" = "NONE"],[
43 pandora_cv_lua_archdir=`${PKG_CONFIG} --define-variable=prefix=${ac_default_prefix} --variable=INSTALL_CMOD ${LUAPC}`
44 ],[
45 pandora_cv_lua_archdir=`${PKG_CONFIG} --define-variable=prefix=${prefix} --variable=INSTALL_CMOD ${LUAPC}`
46 ])
47 ])
48 LUA_ARCHDIR="${pandora_cv_lua_archdir}"
49 AC_SUBST(LUA_ARCHDIR)
50 AC_SUBST(LUA_CFLAGS)
51 AC_SUBST(LUA_LIBS)
52 ])
53 AM_CONDITIONAL(BUILD_LUA, test "$with_lua" = "yes")
54
55 ])