This commit adds basic autoconf + automake files to build the project.
It also adds a main.c stub in order to simulate the main binary.
The configure script uses pkg-config to find the libraries. The usual
stuff should work. The only additional option right now is:
./configure --enable-debug [To enable debugging symbols]
The Makefile should also support the standard stuff:
make [To build the kmscon binary]
make check [To build the test_* binaries]
make dist [To create a tarball]
make clean
make install
etc.
To start from a clean tree (e.g. git clean -dfx), do something like the
following:
./autogen.sh
./configure --enable-debug CFLAGS=-O0
make
It all should work well enough for now.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
+++ /dev/null
-#
-# kmscon - Makefile
-# Written 2011 by David Herrmann <dh.herrmann@googlemail.com>
-#
-
-#
-# To compile the kmscon application, use:
-# $ make
-# To compile the test suites, use:
-# $ make tests
-#
-# This makefile is in no way complete nor sophisticated. If you have time to
-# replace it with autotools, I would be glad to apply your patches.
-#
-
-CFLAGS=-g -O0 -Wall `pkg-config --cflags --libs egl gbm gl cairo pango pangocairo` -Isrc
-
-all:
- gcc -o kmscon src/*.c $(CFLAGS)
-
-tests:
- gcc -o test_output tests/test_output.c src/*.c $(CFLAGS)
- gcc -o test_console tests/test_console.c src/*.c $(CFLAGS)
-
-clean:
- @rm -vf kmscon test_output test_console
-
-.PHONY: all tests clean
--- /dev/null
+ACLOCAL_AMFLAGS = -I m4
+
+bin_PROGRAMS = kmscon
+check_PROGRAMS = test_console test_output
+noinst_LTLIBRARIES = libkmscon-core.la
+
+AM_CFLAGS = \
+ -Wall \
+ -I $(srcdir)/src
+AM_LDFLAGS = \
+ -Wl,--as-needed
+
+if DEBUG
+AM_CFLAGS += -g
+endif
+
+libkmscon_core_la_SOURCES = \
+ src/console.c src/console.h \
+ src/output.c src/output.h \
+ src/console_char.c
+
+libkmscon_core_la_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(EGL_CFLAGS) \
+ $(GBM_CFLAGS) \
+ $(OPENGL_CFLAGS) \
+ $(CAIRO_CFLAGS) \
+ $(PANGO_CFLAGS)
+libkmscon_core_la_LIBADD = \
+ $(EGL_LIBS) \
+ $(GBM_LIBS) \
+ $(OPENGL_LIBS) \
+ $(CAIRO_LIBS) \
+ $(PANGO_LIBS)
+
+kmscon_SOURCES = src/main.c
+kmscon_LDADD = libkmscon-core.la
+kmscon_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(CAIRO_CFLAGS)
+
+test_console_SOURCES = tests/test_console.c
+test_console_LDADD = libkmscon-core.la \
+ $(OPENGL_LIBS)
+test_console_CFLAGS = $(kmscon_CFLAGS) \
+ $(OPENGL_CFLAGS)
+
+test_output_SOURCES = tests/test_output.c
+test_output_LDADD = libkmscon-core.la \
+ $(OPENGL_LIBS)
+test_output_CPPFLAGS = $(kmscon_CFLAGS) \
+ $(OPENGL_CFLAGS)
+
+dist_doc_DATA = README TODO
--- /dev/null
+#!/bin/sh
+mkdir -p m4/
+autoreconf -i
--- /dev/null
+AC_PREREQ(2.68)
+
+AC_INIT([kmscon], [0.0])
+AC_SUBST(PACKAGE_URL, [https://github.com/dvdhrm/kmscon])
+AC_CONFIG_SRCDIR([src/main.c])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_HEADER(config.h)
+
+AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects dist-bzip2 no-dist-gzip tar-pax -Wall -Werror])
+AM_SILENT_RULES([yes])
+
+LT_PREREQ(2.2)
+LT_INIT
+
+AC_PROG_CC
+AM_PROG_CC_C_O
+
+PKG_CHECK_MODULES([EGL], [egl])
+AC_SUBST(EGL_CFLAGS)
+AC_SUBST(EGL_LIBS)
+
+PKG_CHECK_MODULES([GBM], [gbm])
+AC_SUBST(GBM_CFLAGS)
+AC_SUBST(GBM_LIBS)
+
+PKG_CHECK_MODULES([OPENGL], [gl])
+AC_SUBST(OPENGL_CFLAGS)
+AC_SUBST(OPENGL_LIBS)
+
+PKG_CHECK_MODULES([CAIRO], [cairo])
+AC_SUBST(CAIRO_CFLAGS)
+AC_SUBST(CAIRI_LIBS)
+
+PKG_CHECK_MODULES([PANGO], [pango pangocairo])
+AC_SUBST(PANGO_CFLAGS)
+AC_SUBST(PANGO_LIBS)
+
+AC_MSG_CHECKING([whether to build with debugging on])
+AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [whether to build with debugging on)])],
+ [debug="$enableval"; AC_DEFINE([DEBUG], [0], [Debug])],
+ [debug=no])
+AM_CONDITIONAL([DEBUG], [test x$debug = xyes])
+AC_MSG_RESULT([$debug])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
--- /dev/null
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ return EXIT_SUCCESS;
+}