Skip to content
Mark Grant edited this page Mar 14, 2023 · 8 revisions

AutoTools (Configure and Make) Build Helper Script

Please navigate the wiki via the Page List to the right.

Project Description

This project produces a helper script for AutoTools projects. It has two main goals; to reduce repetitive typing of some AutoTools commands, and, to afford a more standard interface for the programmer across AutoTools projects.

Design

At the command line level the script offers it's own options and provides that all other arguments are passed unparsed and untouched straight to the configure command line. For example:-

acmbuild.sh --config .. sysconfdir=/etc -- --prefix=/usr

In this case --config is an acmbuild.sh option to configure the project, .. is the base directory and everything else is passed untouched to configure, invoking:-

../configure sysconfdir=/etc --prefix=/usr

thereby obviously supporting environment variable setting and option passing for configure.

The acmbuild.sh options come in two flavours; action options and enabling options.

b, c, C, D, g, i, K, S and T are action options. -b, for instance will run make, whereas -D will run make dist. (p just sets the number of parallel jobs make will use).

The rest, (apart from help and version), are enabling options. Invariably these are implemented merely by passing an enable argument to configure. For example

acmbuild.sh --config --debug ..

will run

configure --enable-debug=yes

That is all. For it to be meaningful the developer must process this argument in configure. The script does not know if the option is sensible, or indeed, if it is supported by configure, so, in the above example, if the developer had not written code in configure to process this argument, configure will issue a warning and then just ignore the option.

Implementation

The project functionality is implemented as two scripts; acmbuild.sh and bootstrap.sh. acmbuild.sh does nothing more than invoke bootstrap.sh with the same arguments. This means that all the functionality is in bootstrap.sh. On project install both scripts are installed but only acmbuild.sh is installed in the PATH. So all usage is via acmbuild.sh. The reason for this is that it enables a secondary usage of bootstrap.sh. bootstrap.sh can be copied and pasted into the project-root of all AutoTools project to provide a simplified and standardised build bootstrap as is generally recommended. This eliminates any possible confusion as to which version of bootstrap.sh is being used whilst also obviating any dependency on this project.

Options

The script offers the following options:-

   -a, --at-only
          during  testing  and  for  an AutoTools-only install, some build
          changes are required. e.g. You may reference  an  external  Java
          jar  in  datadir but in AT builds and installations this may ex‐
          pand to /usr/local/share... So a substitution  is  required  for
          this scenario.

   -A, --analyzer
          enable compiler analyzer output.

   -b, --build
          make the project.

   -c, --config
          configure the project.

   -C, --distcheck
          perform a normal make distcheck.

   --CC compiler
          Specify a compiler to use. Functionally equivalent to:-
          bootstrap.sh -c . -- CC=compiler
          More ephemerally, as a one-off you can use:-
          make CC=compiler

   -d, --debug
          build with appropriate debug flags.

   -D, --dist
          perform a make dist.

   -g, --gnulib
          run  gnulib-tool --update. Checks for the existence of the cache
          file proj-root/m4/gnulib-cache.m4. If it does not exist the  up‐
          date is not run.

   -h, --help
          prints usage information.

   -H, --header-check
          show include stack depth

   -i, --iwyu
          Run clang's include-what-you-use to analyse header file usage.
          include-what-you-use  invokes the clang compiler, so this option
          automatically sets clang as the compiler and requires  that  op‐
          tion c is specified.

   -K, --check
          run make check

   -m, --config-menu
          invoke menu of configurable options. The only thing fixed is the
          script name, configurable-options.sh in the project root  direc‐
          tory. Usually this would be expected to have a dialog interface.

   -p[X], --parallel-jobs[=X]
          if  X  is specified then make runs with X parallel jobs. If X is
          not specified then make will run with the same number of jobs as
          processors.  If  this option is not specified then make runs se‐
          quentially.

   -s, --sparse
          pass --enable-sparse=yes to configure.

   -S, --scan-build
          Run clang's scan-build static analyser.

   -t, --testing-hacks
          some build changes may be required for testing purposes.  e.g. A
          script  may  invoke a project jar file which when installed will
          be somewhere under datadir, but during  testing  it  is  in  the
          project tree.

   -T, --source-tarball
          perform a make srctarball to build a source tarball.

   -v, --verbose
          emit extra information

   -V, --version
          prints version information

   Options  b build, C distcheck, D dist and T source-tarball are mutually
   exclusive.

   Options a at-only, A analyzer, CC, d debug, H header-check, i  iwyu,  m
   menu-config,  s sparse, S scan-build, t testing-hacks and v verbose are
   enabled by configure so require option c config.

Blog

Occasionally useful blogs about my projects and development and packaging environments can be found at: https://techmiscellany.tech.blog/