Skip to main content

Posts

Showing posts from September, 2011

A simple autotool template

Every now and then, you feel a big urge to start hacking on a small thingy and need to create Makefiles for it. Turns out that the autotools won't be that intrusive when we are talking about small programs and you get do a reasonable job with a few lines, first the configure.ac file:# autoconf AC_PREREQ(2.59) AC_INIT([fart], [0.0.1], [damien.lespiau@gmail.com]) AC_CONFIG_MACRO_DIR([build]) AC_CONFIG_AUX_DIR([build]) AC_CONFIG_SRCDIR([fart.c]) AC_CONFIG_HEADERS([config.h]) # automake AM_INIT_AUTOMAKE([1.11 -Wall foreign no-define]) AM_SILENT_RULES([yes]) # Check for programs AC_PROG_CC # Check for header files AC_HEADER_STDC AS_COMPILER_FLAGS([WARNING_CFLAGS], ["-Wall -Wshadow -Wcast-align -Wno-uninitialized -Wno-strict-aliasing -Wempty-body -Wformat -Wformat-security -Winit-self -Wdeclaration-after-statement -Wvla -Wpointer-arith"]) PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.24]) AC_OUTPUT([ Makefile ])and then Makefile.am:ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAG…