wiki:pm-structure-config

Version 1 (modified by andrea5w, 14 years ago) (diff)

started first draft

Basic Structure of the configure.ac File

Autoconf works by running the preprocessor program m4, using the configure.ac as input. This input file containts proprocessor macros, that are expanded (recursively), until in the end a pure shell script for the /bin/sh is created. The configure.ac input file can also contain /bin/sh commands, which will appear litterally in the final {configure} script.

Everything in a line following a "#" is a comment. Comments are usually copied into the generated configure script, unless the line starts with at least two "#".

Beginning of the File =

At the beginning of a configure.ac file in COIN you will find something like the following:

## Copyright (C) 2006 International Business Machines.
# All Rights Reserved.
# This file is distributed under the Common Public License.

## $Id: configure.ac,v 1.1.2.1 2006/04/19 23:25:12 andreasw Exp $

# Author:  Andreas Waechter            IBM    2006-04-13

#############################################################################
#                       Names and other basic things                        #
#############################################################################

AC_PREREQ(2.59)

AC_INIT([SuperSolver],[0.1],[http://projects.coin-or.org/SuperSolver])

AC_COPYRIGHT([
Copyright 2006 International Business Machines and others.
All Rights Reserved.
This file is part of the open source package Coin which is distributed
under the Common Public License.])

AC_REVISION(0.9)

# List one file in the package so that the configure script can test
# whether the package is actually there
AC_CONFIG_SRCDIR(src/SuperSolverMain.cpp)

# Where should everything be installed by default?  Here, we want it
# to be installed directly in 'bin', 'lib', 'include' subdirectories
# of the directory where configure is run.  The default would be
# /usr/local.
AC_PREFIX_DEFAULT([`pwd`])
  • The file should contain the copyright note, information about the authors, and state under what license the file is made available. Note the $Id ...$ string. This is a subversion keyword, which is expanded to contain information about the file, such as revision number, author and date of the last submission etc, when the file is submitted (assuming that the svn::keywords property for this file contains "Id").
  • The AC_PREREQ macro specifies the version number of autoconf that is required to generated a configure script from this input file. In COIN we ask people to use exactly the same versions of all the GNU autotools, so that we can collectively take care of bug fixes, and can avoid that different versions of the autotools generate large difference of the resulting output files if two developers work on a project simultaneously.
  • The AC_INIT macro takes as arguments the name of the project for which this configure.ac file is, its version number, and contact information in case a user wants to get in touch with the developers, e.g., in order to report a bug. The name and version number determine the name of the tarball that can be created with make dist.