commit 8020e6001858ca7d4d90d5b7677c61bd5c3e17c2
Author: Sam Morris <sam@red-redemption.com>
Date:   Thu Jan 28 17:17:44 2010 +0000

    Example autotoolisation.
    
    Run 'autoreconf -si' to generate a configure script.

diff --git a/Makefile b/Makefile
deleted file mode 100644
index ce81438..0000000
--- a/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-LUA_LIBDIR = /usr/local/lib/lua/5.1
-
-CFLAGS += -Wall -Wextra --pedantic --std=c99
-CFLAGS += `pkg-config --cflags lua5.1 dbus-1`
-CFLAGS += -fPIC
-
-LIBS = `pkg-config --libs dbus-1`
-
-OBJS = ldbus.o connection.o bus.o message.o message_iter.o
-
-all:	ldbus.so
-
-ldbus.so: $(OBJS)
-	$(CC) -o ldbus.so -shared $(CFLAGS) $^ $(LIBS)
-
-clean:
-	rm ldbus.so $(OBJS)
-
-install: ldbus.so
-	mkdir -p $(LUA_LIBDIR)
-	cp ldbus.so $(LUA_LIBDIR)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..75cba6c
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,18 @@
+# compile options for all C targets
+AM_CFLAGS := -Wall -Wextra --pedantic --std=c99 -fPIC
+
+# pre-processor flags for all C targets
+AM_CPPFLAGS := $(LUA_CFLAGS) $(DBUS_CFLAGS)
+
+# define a directory
+luamoduledir := $(libdir)/lua/5.1
+
+# define a target
+luamodule_LTLIBRARIES := ldbus.la
+
+# specify the target's sources...
+ldbus_la_SOURCES := bus.c connection.c ldbus.c message.c message_iter.c
+# link options...
+ldbus_la_LDFLAGS := -module -avoid-version
+# and dependencies
+ldbus_la_LIBADD := $(LUA_LIBS) $(DBUS_LIBS)
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..734934a
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,16 @@
+AC_INIT(ldbus, 0.1)
+AM_INIT_AUTOMAKE(-Wall -Werror foreign nostdinc silent-rules)
+LT_INIT(disable-static)
+
+PKG_CHECK_MODULES(DBUS, dbus-1)
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
+
+PKG_CHECK_MODULES(LUA, lua5.1)
+AC_SUBST(LUA_CFLAGS)
+AC_SUBST(LUA_LIBS)
+
+AC_PROG_CC
+
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
