O'Reilly logo

Autotools by John Calcote

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Some Real Functionality

I've suggested before that you should call config.status in your makefiles to generate those makefiles from templates. Example 3-4 shows the code in configure.ac that actually makes this happen. It's just a single additional macro call between the two original lines of Example 3-1.

Example 3-4. configure.ac: Using the AC_CONFIG_FILES macro

AC_INIT([Jupiter],[1.0])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

This code assumes that templates exist for Makefile and src/Makefile, called Makefile.in and src/Makefile.in, respectively. These template files look exactly like their Makefile counterparts, with one exception: Any text that I want Autoconf to replace is marked as an Autoconf substitution variable, using ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required