diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-08-21 15:40:26 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-08-21 16:05:04 +0200 |
commit | 36940845e7621f3b375da7218259e3d7b22664b6 (patch) | |
tree | 6d7a307df8fb06de4bb4d9fedd98b44e46a1a45e | |
parent | 74757be0a9359a0b1a2c276068b7cbdf2feb357b (diff) | |
download | pingu-36940845e7621f3b375da7218259e3d7b22664b6.tar.bz2 pingu-36940845e7621f3b375da7218259e3d7b22664b6.tar.xz |
configure: add --with-luapc option
This lets users to specify the pkg-config package name, eg. lua5.1 or
lua5.2
-rw-r--r-- | Makefile | 23 | ||||
-rwxr-xr-x | configure | 14 |
2 files changed, 31 insertions, 6 deletions
@@ -3,7 +3,7 @@ BIN_TARGETS = mtu SBIN_TARGETS = pingu pinguctl -LUA_TARGETS = client.so + TARGETS = $(BIN_TARGETS) $(SBIN_TARGETS) $(LUA_TARGETS) VERSION = 1.2 PINGU_VERSION := $(shell \ @@ -27,15 +27,23 @@ rundir ?= $(localstatedir)/run pingustatedir = $(rundir)/pingu -luasharedir = /usr/share/lua/5.1 -lualibdir = /usr/lib/lua/5.1 - DESTDIR ?= INSTALL = install INSTALLDIR = $(INSTALL) -d PKG_CONFIG ?= pkg-config +ifneq (LUAPC,) +LUA_TARGETS := client.so +INSTALL_LUA_TARGET := install-lua +LUA_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(LUAPC)) +LUA_VERSION ?= $(shell $(PKG_CONFIG) --variable V $(LUAPC)) + +luasharedir := $(datarootdir)/lua/$(LUA_VERSION) +lualibdir := $(libdir)/lua/$(LUA_VERSION) + +endif + SUBDIRS := man CFLAGS ?= -g @@ -73,16 +81,19 @@ mtu_OBJS = \ netlink.o \ icmp.o +lua-client.o_CFLAGS = $(LUA_CFLAGS) client.so_OBJS = \ lua-client.o -client.so_LIBS = $(shell $(PKG_CONFIG) --libs lua) client.so_LDFLAGS = -shared ALL_OBJS= $(pingu_OBJS) $(pinguctl_OBJS) $(mtu_OBJS) $(client.so_OBJS) all: $(TARGETS) man +%.o: %.c + $(CC) $(CFLAGS) $($@_CFLAGS) -c $< + $(TARGETS): $(CC) $(LDFLAGS) $($@_LDFLAGS) $($@_OBJS) $($@_LIBS) -o $@ @@ -94,7 +105,7 @@ mtu: $(mtu_OBJS) $(SUBDIRS): $(MAKE) -C $@ -install: $(TARGETS) +install: $(TARGETS) $(INSTALL_LUA_TARGET) $(INSTALLDIR) $(DESTDIR)/$(bindir) $(DESTDIR)/$(sbindir) \ $(DESTDIR)/$(pingustatedir) $(INSTALL) $(BIN_TARGETS) $(DESTDIR)/$(bindir) @@ -55,6 +55,9 @@ Optional features: --enable-debug build with debugging information [disabled] --enable-warnings build with recommended warnings flags [enabled] --enable-werror build with -Werror [disabled] + --enable-lua build Lua client binding [disabled] + --with-luapc=LUAPC build Lua client binding, using LUAPC pkg-config + package [disabled] Some influential environment variables: CC C compiler command [detected] @@ -81,6 +84,7 @@ mandir='$(datarootdir)/man' enable_debug=false enable_warnings=true enable_werror=false +enable_lua=false for arg; do case "$arg" in @@ -100,6 +104,7 @@ case "$arg" in --disable-warnings) enable_warnings=false ;; --enable-werror) enable_werror=true ;; --disable-werror) enable_werror=false ;; +--with-luapc=*) with_luapc=${arg#*=};; -* ) die "$0: unknown option $arg" ;; CC=*) CC=${arg#*=} ;; CFLAGS=*) CFLAGS=${arg#*=} ;; @@ -121,6 +126,14 @@ if $enable_werror; then CFLAGS="$CFLAGS -Werror" fi +echo -n "Checking for Lua support: " +if [ -n "$with_luapc" ]; then + LUAPC="$with_luapc" + echo $with_luapc +else + echo disabled +fi + cc=${CC:-gcc} cat > $TMPC << EOF @@ -176,6 +189,7 @@ localstatedir libdir datarootdir mandir +LUAPC CC CFLAGS LDFLAGS |