Autoconf: The Unsung Hero of Source Code Compatibility

by Ostatic Staff - May. 20, 2008

One of the unsung heroes of the open-source revolution is a little program called "Autoconf," written and distributed by the Free Software Foundation as part of its GNU project. Autoconf was designed to solve a problem that existed for many years on Unix systems, namely that they were largely compatible at the source level, but not at the binary level. This meant that while the source code could remain the same, or mostly the same, no matter what version of Unix you were running, you needed to compile the program on your particular computer in order for it to work.

The thing is, these different Unixes were *largely* source compatible, not completely so. Each Unix had a slightly different set of signals used for interprocess communication, or semantics for allocating and releasing memory, or for locking files. Even more confusing was the fact that many third-party libraries -- including many distributed by the Free Software Foundation itself -- were sometimes available, but not always.

To make the programs as compatible and portable as possible, programmers thus tried a number of different tricks. One of the longest-running practices was to create a large "Makefile," describing what needed to be compiled, with a number of variables that could be set by the end user. If you would download a copy of Emacs, or Perl, or even the GNU file utilities, you would thus open the source-code package, modify the Makefile to indicate that you were using HP-UX, Solaris, Irix, or any of a dozen other flavors of Unix. With those hints, the compiler would be able to successfully compile the program for your system, and your software would work well.

As open-source software became more powerful and popular, this situation became increasingly untenable. After all, how many hours could system administrators be expected to spend messing around with Makefiles?

Larry Wall, the author of Perl, came up with one solution, known as Configure. Configure would create the Makefile semi-automatically, choosing values based on what libraries and configuration files it would detect. However, it would rarely make decisions on its own, often asking for input and advice from the end user. (Configure was also known for making snide and humorous remarks about the user's system, depending on what it found.)

After years of people using Configure, the Free Software Foundation announced a new project, called "Autoconf." Autoconf, which uses macros to describe certain capabilities that it expects or requires on target systems, was designed to be less interactive than Configure, handling all of the detection automatically. Over the years, Autoconf has become a key ingredient in nearly every open-source program, ensuring that the same program can run on modern versions of Linux and BSD, as well as many legacy Unix systems. Indeed, Autoconf's modular design helped to ensure that many open-source programs could be installed easily on Linux as it grew in popularity, without requiring every open-source developer to install a Linux system.

Today, Autoconf is largely hidden behind the scenes. If you compile programs on your computer, rather than download binary packages, then you might well see its output on a relatively frequent basis. But even if you don't, you are undoubtedly enjoying its benefits, running a variety of programs that weren't necessarily written for your specific version of Unix.