Skip to content
Boilerplate for cpp project with autotools
M4 Other
  1. M4 98.2%
  2. Other 1.8%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
adding boost


Obtaining software directly from the source code is a common procedure on Unix computers, and generally involves the following three steps:

  • Configuring the Makefile : [./configure]
  • Compiling the code : [make]
  • Installing the executable : [make install]

The challenge of cross-platform is simplified by using GNU's AutoTools

AutoTool : The GNU Build System, also known as the Autotools, is a suite of programming tools designed to assist in making source code packages portable to many Unix-like systems. Autotools consists of the GNU utility programs Autoconf, Automake, and Libtool.

Configuration Files

  • Makefile

How do they work?
      |                  |
 [Autoconf]           [Automake]   
      |                  |
configure script
      \                  /
  • Source

  • Autoconf generates a configure script based on the contents of a file which characterizes a particular body of source code.

  • The configure script, when run, scans the build environment and generates a subordinate config.status script which, in turn, converts other input files and most commonly into output files (Makefile)

  • Automake helps to create portable Makefiles, which are in turn processed with the make utility.

  • It takes its input as (programmer-defined file : so that they can write the make commands in developer friendly manner), and turns it into

  • Finally the make program uses Makefile to generate executable programs from source code.


  • Create file
  • Create file
  • run command aclocal
    • first we need to generate m4 environment for autotools to use
  • run command autoconf
    • this command will generate configure script.
  • run command automake --add-missing
    • this command will generate file.
  • The end user doesn’t need to see our autotools setup, so we can distribute the configure script and without all of the files we used to generate them.
  • run command ./configure : to Generate Makefile from
  • run command make distcheck : Use Makefile to build and test a tarball to distribute

So on Maintainer's system:

aclocal # Set up an m4 environment
autoconf # Generate configure from
automake --add-missing # Generate from
./configure # Generate Makefile from
make distcheck # Use Makefile to build and test a tarball to distribute

On the user's system:

./configure # Generate Makefile from
make # Use Makefile to build the program
make install # Use Makefile to install the program

Git Submodule

Initialize Submodule

To add a submodule

git submodule add -f -b master lib/helloworld

First, we need to initialize the submodule(s). We can do that with the following command:

git submodule init

Then we need to run the update in order to pull down the files.

git submodule update

To remove a submodule?

  • Remove the submodule’s entry in the .gitmodules file.
  • Remove the submodule’s entry in the .git/config
  • Remove the path created for the submodule by using the command below.

git rm --cached lib/helloworld

To get the HEAD of each submodule

git submodule foreach 'echo $path git rev-parse HEAD'

Generating lib

  • cd lib/helloworld
  • ./
  • ./configure
  • make

  • static vs dynamic library.
  • static vs dynamic linking.

Using BOOST library in project

  • The Boost C++ Libraries are a collection of modern libraries based on the C++ standard.


You can’t perform that action at this time.