2 local min_major, min_minor = 5, 1
3 local major, minor = string.match(_VERSION, 'Lua (%d+)\.(%d*)')
5 if (tonumber(major) < min_major or
6 tonumber(major) == min_major and tonumber(minor) < min_minor) then
8 '\n\n*** Lua rrdtool module requires Lua %d.%d or greater. ***\n',
12 local lua_version = major .. '.' .. minor
14 local options = arg[1]
16 io.write(string.gsub(options, ' (%S-=)', '\n%1'), '\n\n')
23 LUA_VERSION=]],major, '.',minor,[[
26 # set lua include, lib and C installation dirs
27 PKG_CONFIG=$(firstword $(shell which pkg-config))
28 ifeq (pkg-config,$(findstring pkg-config,$(PKG_CONFIG)))
29 LUA_LIBDIR=$(shell pkg-config --variable=INSTALL_CMOD lua$(LUA_VERSION))
31 $(warning *** couldn't find lua$(LUA_VERSION).pc)
33 LUA_CFLAGS=$(shell pkg-config --cflags lua$(LUA_VERSION) 2>/dev/null)
34 LUA_LFLAGS=$(shell pkg-config --libs lua$(LUA_VERSION) 2>/dev/null)
37 $(warning couldn't find pkg-config)
41 $(warning *** setting Lua dirs to defaults in src package)
42 LUA_CFLAGS=-I/usr/local/include -I/usr/local/include/lua
43 LUA_LFLAGS=-L/usr/local/lib/lua/$(LUA_VERSION) -llua
44 LUA_LIBDIR=/usr/local/lib/lua/$(LUA_VERSION)
49 -- overwrite global LUA_LIBDIR if default lib is set
52 # override LUA_LIBDIR for site install
53 LUA_LIBDIR=]],lib,[[/$(LUA_VERSION)
62 # if this "autoconf" doesn't work for you, set LIB_OPTION for shared
64 LD=$(shell ld -V -o /dev/null 2>&1)
65 ifneq (,$(findstring Solaris,$(LD)))
66 # Solaris - tested with 2.6, gcc 2.95.3 20010315 and Solaris ld
69 ifneq (,$(findstring GNU,$(LD)))
71 LIB_OPTION= -shared -dy
73 $(error couldn't identify your ld. Please set the shared option manually)
77 RRD_CFLAGS=-I../../src/
78 RRD_LIB_DIR=-L../../src/.libs -lrrd
80 # Choose the PIC option
81 # safest, works on most systems
83 # probably faster, but may not work on your system
86 # Compilation directives
87 OPTIONS= -O3 -Wall ${PIC} -fomit-frame-pointer -pedantic-errors -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings
88 LIBS= $(RRD_LIB_DIR) $(LUA_LFLAGS) -lm
89 CFLAGS= $(OPTIONS) $(LUA_CFLAGS) $(RRD_CFLAGS) -DLIB_VERSION=\"$(LIB_VERSION)\"
92 LIBNAME= $T-$(LIB_VERSION)$(LIB_EXT)
104 $(CC) $(CFLAGS) $(LIB_OPTION) $(OBJS) $(LIBS) -o $(LIBNAME)
107 mkdir -p $(LUA_LIBDIR)
108 cp $(LIBNAME) $(LUA_LIBDIR)
109 strip $(LUA_LIBDIR)/$(LIBNAME)
110 (cd $(LUA_LIBDIR) ; rm -f $T$(LIB_EXT) ; ln -fs $(LIBNAME) $T$(LIB_EXT))
111 $(POD2MAN) --release=$(VERSION) --center=RRDLua --section=3 rrdlua.pod > $(PREFIX)/man/man3/rrdlua.3
114 ln -sf $(LIBNAME) rrd.so
118 rm -f $L $(LIBNAME) $(OBJS) *.so *.rrd *.xml *.png *~