--- /dev/null
+#
+# Copyright (C) 2017 Bartosz Golaszewski <bartekgola@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by the Free Software Foundation.
+#
+
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
+LIBS =
+
+AM_CPPFLAGS = -I$(top_srcdir) -include $(top_srcdir)/config.h -Wextra
+AM_CPPFLAGS += -fvisibility=hidden
+
+lib_LTLIBRARIES = libgpiod.la
+
+libgpiod_la_SOURCES = core.c
+
+bin_PROGRAMS = gpiodetect gpioinfo gpioget gpioset
+
+gpiodetect_SOURCES = gpiodetect.c
+gpiodetect_LDFLAGS = -lgpiod
+
+gpioinfo_SOURCES = gpioinfo.c
+gpioinfo_LDFLAGS = -lgpiod
+
+gpioget_SOURCES = gpioget.c
+gpioget_LDFLAGS = -lgpiod
+
+gpioset_SOURCES = gpioset.c
+gpioset_LDFLAGS = -lgpiod
--- /dev/null
+#
+# Copyright (C) 2017 Bartosz Golaszewski <bartekgola@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by the Free Software Foundation.
+#
+
+AC_PREREQ(2.61)
+AC_INIT([libgpiod], 0.0)
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR([autostuff])
+AM_INIT_AUTOMAKE([foreign -Wall -Werror subdir-objects])
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AC_CONFIG_HEADER([config.h])
+
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AC_PROG_INSTALL
+
+AC_HEADER_STDC
+
+AC_CHECK_FUNC([ioctl], [], [AC_MSG_ERROR([ioctl() unavailable])])
+AC_CHECK_FUNC([asprintf], [], [AC_MSG_ERROR([asprintf() unavailable])])
+AC_CHECK_FUNC([readdir], [], [AC_MSG_ERROR([readdir() unavailable])])
+
+AC_FUNC_MALLOC
+
+AC_CHECK_HEADERS([getopt.h], [], [AC_MSG_ERROR([getopt.h header not found])])
+AC_CHECK_HEADERS([stdint.h], [], [AC_MSG_ERROR([stdint.h header not found])])
+AC_CHECK_HEADERS([dirent.h], [], [AC_MSG_ERROR([dirent.h header not found])])
+AC_CHECK_HEADERS([linux/gpio.h], [],
+ [AC_MSG_ERROR([linux/gpio.h header not found])])
+
+AC_HEADER_STDC
+
+AC_CONFIG_FILES([Makefile])
+
+CFLAGS="$CFLAGS -Wall"
+
+AC_OUTPUT