automake: Basic Installation

1 
1 2.2.1 Basic Installation
1 ------------------------
1 
1 The most common installation procedure looks as follows.
1 
1      ~ % tar zxf amhello-1.0.tar.gz
1      ~ % cd amhello-1.0
1      ~/amhello-1.0 % ./configure
1      ...
1      config.status: creating Makefile
1      config.status: creating src/Makefile
1      ...
1      ~/amhello-1.0 % make
1      ...
1      ~/amhello-1.0 % make check
1      ...
1      ~/amhello-1.0 % su
1      Password:
1      /home/adl/amhello-1.0 # make install
1      ...
1      /home/adl/amhello-1.0 # exit
1      ~/amhello-1.0 % make installcheck
1      ...
1 
1    The user first unpacks the package.  Here, and in the following
1 examples, we will use the non-portable ‘tar zxf’ command for simplicity.
1 On a system without GNU ‘tar’ installed, this command should read
1 ‘gunzip -c amhello-1.0.tar.gz | tar xf -’.
1 
1    The user then enters the newly created directory to run the
1 ‘configure’ script.  This script probes the system for various features,
1 and finally creates the ‘Makefile’s.  In this toy example there are only
1 two ‘Makefile’s, but in real-world projects, there may be many more,
1 usually one ‘Makefile’ per directory.
1 
1    It is now possible to run ‘make’.  This will construct all the
1 programs, libraries, and scripts that need to be constructed for the
1 package.  In our example, this compiles the ‘hello’ program.  All files
1 are constructed in place, in the source tree; we will see later how this
1 can be changed.
1 
1    ‘make check’ causes the package’s tests to be run.  This step is not
1 mandatory, but it is often good to make sure the programs that have been
1 built behave as they should, before you decide to install them.  Our
1 example does not contain any tests, so running ‘make check’ is a no-op.
1 
1    After everything has been built, and maybe tested, it is time to
1 install it on the system.  That means copying the programs, libraries,
1 header files, scripts, and other data files from the source directory to
1 their final destination on the system.  The command ‘make install’ will
1 do that.  However, by default everything will be installed in
1 subdirectories of ‘/usr/local’: binaries will go into ‘/usr/local/bin’,
1 libraries will end up in ‘/usr/local/lib’, etc.  This destination is
1 usually not writable by any user, so we assume that we have to become
1 root before we can run ‘make install’.  In our example, running ‘make
1 install’ will copy the program ‘hello’ into ‘/usr/local/bin’ and
1 ‘README’ into ‘/usr/local/share/doc/amhello’.
1 
1    A last and optional step is to run ‘make installcheck’.  This command
1 may run tests on the installed files.  ‘make check’ tests the files in
1 the source tree, while ‘make installcheck’ tests their installed copies.
1 The tests run by the latter can be different from those run by the
1 former.  For instance, there are tests that cannot be run in the source
1 tree.  Conversely, some packages are set up so that ‘make installcheck’
1 will run the very same tests as ‘make check’, only on different files
1 (non-installed vs. installed).  It can make a difference, for instance
1 when the source tree’s layout is different from that of the
1 installation.  Furthermore it may help to diagnose an incomplete
1 installation.
1 
1    Presently most packages do not have any ‘installcheck’ tests because
1 the existence of ‘installcheck’ is little known, and its usefulness is
1 neglected.  Our little toy package is no better: ‘make installcheck’
1 does nothing.
1