22

I am newbie of Autotools. From my understanding, one would use the following basic steps to build software using Autotools:

  1. autoreconf --install
  2. ./configure
  3. make

However, I noticed that most open source software packages (on Linux) does not need the 1st step. Most of the time they just need step 2 and 3 to build. It seems that they already are packaged with a Makefile.in. I am wondering why? Do they manually code the Makefile.in, or does the software developer use autoreconf to generate the Makefile.in before creating the software package?

Boris Verkhovskiy
  • 14,854
  • 11
  • 100
  • 103
user1783732
  • 1,599
  • 5
  • 22
  • 44
  • 6
    OK. I think I got a possible answer myself: by Not needing the user to run "autoreconf", the software package puts less requirements on the end users' system. I.e. There is no need for the end user to have Autotools installed. I think this is actually quite big and good reason. – user1783732 Oct 09 '13 at 05:49
  • 2
    That's correct; when `configure` runs, all the user needs is a couple of script interpreters (a Bourne shell, sed, maybe perl too), plus the compiler toolchain. Even if all the library dependencies are missing, the `configure` script should be able to run and diagnose the problem or work around it. When you run `make dist-gzip`, you get a tarball with the `configure` script, plus all `*.in` template files packaged so the user doesn't have to do the previous steps that require autotools. – DanielKO Oct 11 '13 at 02:02

2 Answers2

11

The software developer who creates the tarball (or who checks out the sources from a version control system) will usually invoke autoreconf from a script called bootstrap.sh or autogen.sh which may do other stuff. autoreconf might be invoked by Makefile as well (like when configure.ac has changed).

Most users will never need to run autoreconf, even those who are making some modifications to source (e.g. patches). Only those who need to make modifications to the package itself (making changes to configure.ac and/or Makefile.am) will need autoreconf.

ldav1s
  • 15,885
  • 2
  • 53
  • 56
3

Running autoreconf requires having the correct version of autotools installed already. This leads to a chicken-and-egg problem -- how do you get autotools installed in the first place? It also adds an extra dependency that most end-users don't really need.

As a result, most packagers run autoreconf before producing the source tarballs that they distribute. This means that if you download such a tarball, you can configure and build it without needing to install autotools first.

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226
  • If you want to bootstrap your system from source without using pre-generated `configure` scripts, then it's not impossible to install autotools directly without using autotools/configure (`autoconf` is just a shell script, you just need to replace a few placeholder variables that can be done with `sed`). And once you have one version of autotools, bootstrapping other versions is a bit easier. – Andrius Štikonas Mar 14 '21 at 21:09