Personal tools
You are here: Home cmgui Zinc Building With Autotools
Views
Building Zinc >>

Building With Autotools

last edited 3 years ago by pbier

For an excellent introduction to autotools see: http://markuskimius.wikidot.com/programming:tut:autotools

Autotools, also known as the GNU build system, is a set of tools used to build software from source. They are designed with portability in mind, so that the source for a package can be built on different systems. Many open source development projects use autotools. If you download the source of a package that is built with autotools and want to build it on your system the following will often do the trick (assuming you are in the top level directory or your package):

   ./configure
   make

The ./configure command analyzes your system to see what kind of programs and libraries you have and then produces a Makefile appropriate for your system. The make command uses the generated Makefile to build your executable or library files. Many Makefiles for packages include an install target, so once built you can type make install to install your package.

For the above two commands to work you need both a Makefile template (Makefile.in) and a configure script. Both of these files can be generated from other configuration files by using automake and autoconf.

Automake is a tool for generating Makefile template files (Makefile.in) from automake configuration files (Makefile.am). Once a template Makefile has been generated the configure script can be used to turn the template into an actual Makefile that is specific to your system.

Autoconf is a tool for generating the configure script (and other files) from an autoconf configuration file (configure.ac or configure.in). Running autoconf creates a script called configure (which will be used to generate the Makefiles). It will create other files and scripts too, including a script called config.status which can be run to update Makefiles.

Note that the configure.ac file may include automake macros it needs to use. The definitions of these macros need to be provided to autoconf or it will fail. Fortunately there is a tool called aclocal which will pull out the required macros by parsing configure.ac and then generating a file called aclocal.m4 which will contain any necessary automake macros.

If your build directory contains a Makefile.am and a configure.ac file you can do the following to set up your build files:

  aclocal (will generate aclocal.m4)
  automake (will generate Makefile.in files)
  autoconf (will generate configure script)
  ./configure (will generate Makefiles)
  make (will build source)

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.