bootstrap Autotools Initialization Script

About bootstrap

Gear icon GNU Autotools requires a certain amount of boilerplate initialization in order to generate a configure script. Software projects that use Autotools usually place this initialization in a shell script, often called bootstrap. I've been using such a script (implemented with bash) for many years, intermittently adding new features to accommodate my needs.

The latest version of this software is now maintained by Savarese Software Research Corporation. You can find the new project page at https://www.savarese.com/software/bootstrap/

bootstrap Usage

usage: bootstrap -help | -init [topdir] | -build [configure-options] | -clean | -config [configure-options] | -rebuild [configure-options] | -reconfig [configure-options] OPTIONS -help Displays this help message. -init Initializes the source tree for use with bootstrap. This consists merely of making a symbolic link to the bootstrap script in the specified directory (or the current directory if none is specified). bootstrap must be run from the link for all other operations, or it will fail to find the source tree. -build Performs the same operations as -config, but additionally builds the source. You can pass configure options after -build just as you would with -config. Additionally, if you specify a configuration name (see configure-options below) any arguments after the configuration name are passed along to the make command for building the source. -clean Removes all of the configure support files created by autotools. Specifying a configuration name will remove the build directory for that configuration; otherwise the default build directory is removed. -config After prepping the source tree by running the autotools, runs configure with the specified configure options, readying the source tree for building. -configonly Runs configure with the specified configure options without readying the source tree for building. -install Performs the same operations as -build, but in addition installs the resulting build. -mkdir Preps the source tree by running the autotools and then creates an architecture-specific build directory. Specifying a configuration name will create a build directory with a suffix matching the configuration name. -reconfig Performs the same operations as bootstrap -clean bootstrap -config [configure-options] -rebuild Like -build, but does a -reconfig before building. You can pass configure options after -build just as you would with -config. -version Print bootstrap version number. SPECIAL ARGUMENTS configure-options Argument may be options to pass to configure or the name of a configuration in the bootstrap config file that predefines the arguments to pass to configure.

Using bootstrap is largely self-explanatory from the help and the code if you already understand Autotools, but the ability to use a bootstrap.conf configuration file requires some explanation. In the course of development, you may want to maintain different build trees from the same source checkout. For example, you may have a debug build and a non-debug build. These builds must reside in different directories and require different configuration options. Or perhaps you have an installation tree in your home directory for individual testing and a system-wide installation tree for continuous integration testing. You can store build-specific options and associate them with a configuration name in bootstrap.conf. Here is an example adapted from a real project:

# -*- mode: shell-script; -*- # # Predefined configuration flags. # _install_dir="/opt/libssrcspread-$PACKAGE_VERSION" _conf_common=" --with-spread=/opt/spread --with-test-daemon=44803 --disable-libtool-lock " _conf_install_common=" $_conf_common --prefix=$_install_dir --with-perl-sitedir=${_install_dir}/lib/perl5/site_perl --with-ruby-sitedir=${_install_dir}/lib/ruby/site_ruby CFLAGS=-O2 -DNDEBUG CXXFLAGS=-O2 -DNDEBUG " conf_dev=" $_conf_common CFLAGS=-O0 CXXFLAGS=-O0 " conf_install_shared=" --enable-shared $conf_install_common " conf_test="$conf_dev" conf_default="$conf_dev" conf_release="$conf_install_shared"

Configuration names are prefixed by the conf_ prefix. Each configuration is a shell variable containing configure arguments. Each argument must be separated by a newline. This allows whitespace to be preserved in assignments such as CFLAGS=-O2 -DNDEBUG. When you pass a configuration name to bootstrap, the arguments defined by the configuration are passed along to configure. For example, the following command will configure, build, and install libsavaspread using the release configuration:

./bootstrap -install release

The build directory generated to perform the build will contain a suffix of .release as in build/i686-redhat-linux-gnu.release/. If a bootstrap.conf file exists and no configuration name is specified for a bootstrap run, then the value of conf_default is used. You do not need to use bootstrap.conf to use bootstrap. If you want to pass arguments to configure, however, you will have to type the arguments each time.

bootstrap expects to reside at the top of the source tree. It can be run from anywhere, but the command itself must be placed at the root of the source directory tree along with configure.ac. Therefore, the convention is to run bootstrap -init from the top of your source tree and then execute the instance of bootstrap in your source tree for all future operations related to that source tree. This avoids having to check in a copy of the bootstrap script with every project.

As of version 1.1.5 you can define pre_bootstrap and post_bootstrap functions in bootstrap.conf to perform custom actions before and after running autotools.

License

bootstrap is released under the Apache License 2.0.

Download

VersionSourceLicenseChanges
1.1.5bootstrap-1.1.5.tar.bz2LICENSECHANGES

Previous Releases
VersionSourceLicense
1.1.4bootstrap-1.1.4.tar.gzLICENSE