[Novalug] Re: [Dclug] Learning automake and autoconf

Matt Good matt@matt-good.net
Wed Nov 15 02:25:14 EST 2006


On Wed, 2006-11-15 at 00:24 -0500, Kevin Dwyer wrote:
> On Tue, Nov 14, 2006 at 11:23:36PM -0500, Peter S. May wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > For some reason, probably because I'd like to be able to create a
> > project that passes for real live software at some point, I decided I
> > wanted to learn how to use automake and autoconf.  Now, there's a free
> > book (<http://sources.redhat.com/autobook/autobook/autobook_toc.html>)
> > about these things, but it's not exactly the smoothest reading so far.
> > 
> > Anyone with some degree of experience using the GNU autotools:  Is there
> >  some tutorial or reference I should be looking at instead?  Should I
> > stick with this one?  Does it get better?
> 
> The autotools are an interesting exercise in hacking the shell.  People
> really should stop using them and start using more modern build suites
> like scons or cons or ant (ok, maybe not ant) or something.  At the very
> least, they replace make, who's time has come.
> 
> To answer your question: It doesn't get better.  I've seen it stated
> that only about 30 people in the world know how to write a configure
> script from scratch; the rest copy.  It's believable given the
> difficulty.

That's probably true, but with autotools you have plenty of examples to
copy from.  I first used autotools a few months ago, and only had a
rather limited experience with writing Makefiles during college.  Yes,
my configure.ac and Makefile.am files are copied pretty verbatim from
other sources, but there wasn't that much to it.  This was for a GNOME
application and I was able to rely on rules and macros defined to meet
everything I already needed to do, so it was mainly a matter of just
plugging in my filenames in the right places.  There is the start of a
guide to using scons for GNOME apps http://live.gnome.org/scons but it's
not as complete as the numerous apps already using autotools where you
can find the right rules to install what you need.

Maybe when if my build process gets more complex I'll look for an
alternative, but for now autotools was the path with the most examples
to draw from.  Here's my Makefile.am for installing a glade file, menu
entry, mimetype data, and GConf schema:
http://projects.matt-good.net/trac/emusic-gnome/browser/data/Makefile.am

I'll be interested to see progress on the GNOME scons build tools, since
I'd much rather use Python to script my builds, but at this point it
just seems like it would be *more* work.

But, back to the original question about how to learn autotools.  I
think copy&paste is really the easiest method.  Find a library or app
that's similar to yours and copy what you need.  I know it feels dirty,
but from what I've seen it's generally just a matter of defining what
gets installed where.  For me there was just as much need to learn the
right way to install the resources in my application, so even trying to
use another build system I'd probably end up looking through build files
to find "oh I need to run update-desktop-database when I install that."

-- Matt Good




More information about the Novalug mailing list