The GNU Build System is basically composed of GNU Autoconf and GNU Automake. The latest versions of these tools are 2.59 and 1.9.1 respectively, at the moment of this writing. Compared to 2.13 and 1.4, these are far better, although not completely compatible with the previous ones. However, if you are maintaining a software project which uses these two tools, you should consider updating to the latest versions, as your program will be more portable and easier to manage.
Let's discuss some of the changes you'll need to do in the configure.ac or configure.in file (note that the first name is preferred):
- The AC_INIT macro now takes four arguments (the last two are optional). The first one is the full name of the package in its full form; for example XML Catalog Manager; the second one is its version; the third one an email address where bugs should be reported; and the last one is the package name in its short form, like xmlcatmgr. Check out the GNU Autoconf manual for more details, because the last parameter can be automatically derived from the first if you follow some rules.
- Be sure to set AC_PREREQ to 2.59, so that GNU Autoconf knows if it should parse the file or not.
- Since AC_INIT does not take a file name to verify if the script is being run from the appropiate directory, you have to use the AC_CONFIG_SRCDIR macro to achieve the same thing.
- Optionally set AC_COPYRIGHT to a copyright string that should appear in the generated configure script, to take credit for your work.
- The AM_INIT_AUTOMAKE macro now takes a whitespace separated list of options to pass to GNU Automake. My suggestion is that you add the following: 1.9, which specifies the minimum version of the utility needed; -Wall, which turns on multiple warning messages; check-news, which verifies that your NEWS file describes the changes for the latest version; and no-define, which avoids defining the PACKAGE and VERSION macros in the configuration header (these two are deprecated anyway).
- When formatting help strings, required by the AC_ARG_ENABLE and AC_ARG_WITH macros, use the AS_HELP_STRING macro. This ensures that the text appears properly aligned when calling ./configure --help.
The Makefile.am files will also need some tweaks:
- Remove AUTOMAKE_OPTIONS assignments, since we have specified them in the AM_INIT_AUTOMAKE macro.
- Rename the INCLUDES variable to AM_CPPFLAGS.
At last, since we are passing the no-define option to GNU Automake, you'll have to do some minor changes in your source files:
- Where you need to specify the full package name, use PACKAGE_NAME.
- Where you need to specify the package version, use PACKAGE_VERSION.
- Where you need to specify the full package name, together with its version, use PACKAGE_STRING.
- Where you need to specify the short package name (usually, when calling functions like bindtextdomain), use PACKAGE_TARNAME.
- As a rule of thumb, replacing PACKAGE with PACKAGE_TARNAME and VERSION with PACKAGE_VERSION should produce the same results as before. However, the new macros allow more flexibility, so you can replace some hardcoded strings in your sources.
Well... and that's all you need to get started. You may want to do other changes while you are at it, but you should now have a good idea of what needs to be done. Let's code!