Autoconf'ing an SDL program

New with SDL 0.11.2 is the ability to easily add autoconf support
for SDL programs.

SDL installs a file into /usr/share/aclocal which provides a way
for your program to detect the current SDL installation and build
with it. This replaces the old GNUmake system.

Without further ado, here is a short document describing the process
for simple programs.

Further automake/autoconf documentation can be found at:
http://www.gnu.org/software/

See ya!
-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec
-------------- next part --------------

Note: SDL must be installed for this to work properly.

Here’s how I converted the founts example program to use autoconf:

I first created a configure.in file for the application:

configure.in
dnl Process this file with autoconf to produce a configure script.
AC_INIT(README)

dnl Setup for automake
AM_INIT_AUTOMAKE(founts, 1.2)

dnl Check for tools

AC_PROG_CC

dnl Check for SDL 0.11.2
AM_PATH_SDL(0.11.2)
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"

Finally create all the generated files

AC_OUTPUT([Makefile])

I then created a Makefile.am file for the application:

Makefile.am

bin_PROGRAMS = founts

EXTRA_DIST = COPYING Changelog README

Then I ran the following programs:
aclocal
autoconf
automake -v --foreign -c -a

Now the program is all set up!
Type ‘./configure’ and then ‘make’ to build the program.
When you are ready to redistribute it, type ‘make dist’