Navaneeth K N Navaneeth K N - 3 years ago 199
Linux Question

Why use build tools like Autotools when we can just write our own makefiles?

Recently, I switched my development environment from Windows to Linux. So far, I have only used Visual Studio for C++ development, so many concepts, like make and Autotools, are new to me. I have read the GNU makefile documentation and got almost an idea about it. But I am kind of confused about Autotools.

As far as I know, makefiles are used to make the build process easier.

  1. Why do we need tools like Autotools just for creating the makefiles? Since all knows how to create a makefile, I am not getting the real use of Autotools.

  2. What is the standard? Do we need to use tools like this or would just handwritten makefiles do?

Answer Source

You are talking about two separate but intertwined things here:

  • Autotools
  • GNU coding standards

Within Autotools, you have several projects:

  • Autoconf
  • Automake
  • Libtool

Let's look at each one individually.


Autoconf easily scans an existing tree to find its dependencies and create a configure script that will run under almost any kind of shell. The configure script allows the user to control the build behavior (i.e. --with-foo, --without-foo, --prefix, --sysconfdir, etc..) as well as doing checks to ensure that the system can compile the program.

Configure generates a config.h file (from a template) which programs can include to work around portability issues. For example, if HAVE_LIBPTHREAD is not defined, use forks instead.

I personally use Autoconf on many projects. It usually takes people some time to get used to m4. However, it does save time.

You can have makefiles inherit some of the values that configure finds without using automake.


By providing a short template that describes what programs will be built and what objects need to be linked to build them, Makefiles that adhere to GNU coding standards can automatically be created. This includes dependency handling and all of the required GNU targets.

Some people find this easier. I prefer to write my own makefiles.


Libtool is a very cool tool for simplifying the building and installation of shared libraries on any Unix-like system. Sometimes I use it; other times (especially when just building static link objects) I do it by hand.

There are other options too, see StackOverflow question Alternatives to Autoconf and Autotools?.

In short, you really should use some kind of portable build configuration system if you release your code to the masses. What you use is up to you. GNU software is known to build and run on almost anything. However, you might not need to adhere to such (and sometimes extremely pedantic) standards.

If anything, I'd recommend giving Autoconf a try if you're writing software for POSIX systems. If you need documentation and how-to links, update your question.


Don't fear m4 :) There is always the Autoconf macro archive. Plenty of examples, or drop in checks. Write your own or use what's tested. Autoconf is far too often confused with Automake. They are two separate things.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download