What is the job of autogen.sh when building a c++ package on Linux
This applies only to programs / libraries, which are built using the autotools build chain. It generates the files, which are configured by the configure
script. The configure script then populates .in
files and generates Makefile
s from Makefile.am
templates. Which can finally be used to compile, link and install the program / library.
It's becoming slowly obsolete with the move to multi platform packages. CMake and more modern tool chains are state of the art.
The steps:
The
autogen.sh
script generates theconfigure
script (fromconfigure.ac
, using autoconf) and any files it needs (like creatingMakefile.in
fromMakefile.am
using automake). This requires autotools to be installed on your system, and it must be run when checking out the project from source control (ifconfigure
isn’t checked in). People who download source tarballs can usually skip this step, because output of this step is included in source tarballs.Note This is usually equivalent to
autoreconf --install
. If there is notautogen.sh
file, then just runautoreconf --install
instead. If you have inherited a project with anautogen.sh
, consider deleting it if you can useautoreconf --install
.The
configure
script generatesMakefile
and other files needed to build. TypicallyMakefile.in
is used as a template to generateMakefile
(andconfig.h.in
to generateconfig.h
). This process happens using only standard tools installed on your system, like sed and awk, and doesn't require autotools to be installed.The
make
command builds the software.The
make install
command installs it.
These are broken into different steps because they are often run at different times. The autogen.sh
step is traditionally run by people who are developing the software, since they are expected to install autoconf on their systems and they make changes to configure.ac
. End-users are not expected to have autotools installed.
These expectations have been changed a bit now that end-users are more likely to check a project out of source control instead of downloading source releases.