summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-07-02 16:24:26 +0200
committerNathan Angelacos <nangel@alpinelinux.org>2013-07-03 06:48:47 -0700
commit6fd9dd351e0e616d200f12126d57e20582f90633 (patch)
tree92e7d9284bf68c2ffa8dc9353be37d8712da3032 /src
parent338a9dc21cfdd1a6514fb2b485b1b0f91c3b61b8 (diff)
downloadhaserl-6fd9dd351e0e616d200f12126d57e20582f90633.tar.bz2
haserl-6fd9dd351e0e616d200f12126d57e20582f90633.tar.xz
use pkg-config to find Lua CFLAGS and LIBS
By default, use pkg-config lua --cflags/--libs but let user override the pkg-config name. For example, to build with lua5.2.pc use --with-lua=lua5.2 This fixes situations when both lua5.1 and lua5.2 is available but not 'lua'.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am6
-rw-r--r--src/h_lua.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 245d92e..c3e220a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,8 +27,8 @@ if USE_LUA
# lua2c_LIBS ?= -llua -ldl -lm
lua2c_LDFLAGS ?= -Wl,-E
lua2c: lua2c.c
- $(CC_FOR_BUILD) $(CFLAGS) $(LDFLAGS) $(lua2c_LDFLAGS) \
- -o $@ $^ $(LIBS)
+ $(CC_FOR_BUILD) $(CFLAGS) $(LUA_CFLAGS) $(LDFLAGS) $(lua2c_LDFLAGS) \
+ -o $@ $^ $(LIBS) $(LUA_LIBS)
haserl_lualib.inc : haserl_lualib.lua lua2c
if ! ./lua2c haserl_lualib haserl_lualib.lua >$@; then \
@@ -45,6 +45,8 @@ bin_PROGRAMS = haserl
haserl_SOURCES = common.c common.h sliding_buffer.c sliding_buffer.h \
h_error.c h_error.h h_script.c h_script.h rfc2388.c rfc2388.h \
$(BASHSOURCE) $(LUASOURCE) haserl.c haserl.h
+haserl_CFLAGS = $(LUA_CFLAGS)
+haserl_LDADD = $(LUA_LIBS)
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
diff --git a/src/h_lua.h b/src/h_lua.h
index f85efdc..e8984e5 100644
--- a/src/h_lua.h
+++ b/src/h_lua.h
@@ -21,6 +21,7 @@
#ifndef H_LUA_H
#define H_LUA_H 1
+#include <lua.h>
void lua_exec(buffer_t *buf, char *str);
void lua_echo(buffer_t *buf, char *str, size_t len);