I'm currently learning how to use the autoconf
/automake
toolchain. I seem to have a general understanding of the workflow here - basically you have a configure.ac
script which generates an executable configure
file. The generated configure
script is then executed by the end user to generate Makefile
s, so the program can be built/installed.
So the installation for a typical end-user is basically:
./configure
make
make install
make clean
Okay, now here's where I'm confused:
As a developer, I've noticed that the auto-generated configure script sometimes won't run, and will error with:
config.status: error: cannot find input file: `somedir/Makefile.in'
This confuses me, because I thought the configure script is supposed to generate the Makefile.in
. So Googling around for some answers, I've discovered that this can be fixed with an autogen.sh
script, which basically "resets" the state of the autoconf
environment. A typical autogen.sh
script would be something like:
aclocal \
&& automake --add-missing \
&& autoconf
Okay fine. But as an end-user who's downloaded countless tarballs throughout my life, I've never had to use an autogen.sh
script. All I did was uncompress the tarball, and do the usual configure/make/make install/make clean routine.
But as a developer who's now using autoconf
, it seems that configure
doesn't actually run unless you run autogen.sh
first. So I find this very confusing, because I thought the end-user shouldn't have to run autogen.sh
.
So why do I have to run autogen.sh
first - in order for the configure script to find Makefile.in
? Why doesn't the configure script simply generate it?