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?
autoreconf
script that does the same thing asautogen.sh
and more. As for why you need to run it, do you have aMakefile.am
in thesomedir
subdirectory for Automake to findsomedir/Makefile.am
and generatesomedir/Makefile.in
from it? – Mcgarryautoreg.sh
script, then run it. If not, then runautoupdate && autoreconf -f -i
. Both should produce aconfigure
for you to run. It is sad it is not clearly stated in the Autotools manuals, but it is par for the course with Autotools. By the way, I believeautogen.sh
is a wrapper script forautoreconf -f -i
(maybe with a verbose option). – Steerage