From 797d9864db1bb8e4e9b55d31de27e0794319e06e Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 2 Jan 2017 11:23:20 +0100 Subject: [PATCH] build: add autotools configuration This allows to build the library and programs using autotools. Signed-off-by: Bartosz Golaszewski --- Makefile.am | 32 ++++++++++++++++++++++++++++++++ autogen.sh | 3 +++ configure.ac | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..9408f4f --- /dev/null +++ b/Makefile.am @@ -0,0 +1,32 @@ +# +# Copyright (C) 2017 Bartosz Golaszewski +# +# 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 diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..7f824e9 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +autoreconf --force --install --verbose diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..85424cb --- /dev/null +++ b/configure.ac @@ -0,0 +1,43 @@ +# +# Copyright (C) 2017 Bartosz Golaszewski +# +# 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 -- 2.30.2