wiki:pm-base-config

Version 7 (modified by stefan, 9 years ago) (diff)

update docu for BuildTools? 0.7

Table of Contents

  1. Working With the GNU Autotools
    1. Introduction
    2. The configure.ac Files
      1. Basic structure of the configure.ac file
      2. Base directory configure.ac file
      3. Package directory configure.ac files
    3. The Makefile.am Files
    4. Running the Autotools
    5. Which Files Should be in the Subversion Repository?
    6. Working On Your Project
  2. Autotools Basics
    1. autoconf
      1. Template Files
      2. Configuration Header Files
    2. automake
    3. libtool
  3. Basic Structure of the configure.ac File
    1. General Concepts
    2. Beginning of a configure.ac file
    3. The Body of the configure.ac File
    4. The End of the configure.ac File
  4. The Package Base Directory configure.ac File
  5. The Project Directory configure.ac File
    1. Initialization of Tools and Compilers
    2. Check for other COIN-OR Components
    3. Checks for some specific System Libraries
      1. Check for the Math Library
      2. Checks for BLAS and LAPACK
      3. Checks for GNU libraries
    4. Check for User Libraries
    5. Generation of Links for Data Files
    6. Project Specific Tests
  6. Introduction of Automake Concepts
  7. The Package Base Directory Makefile.am File
  8. The Project Main Directory Makefile.am File
  9. The Source Directories Makefile.am Files
    1. Beginning of the Makefile.am File
    2. Building a Library
      1. Name of the Library
      2. Source Files for the Library
      3. Additional Link Command for the Library
      4. Collecting Objects from Other Libraries
    3. Building a Program
      1. Name of the Program
      2. Source Files for the Executable
      3. Specifying Linking Flags
    4. Additional Flags
      1. Include Directories
      2. Additional Preprocessor Definitions
      3. Correction for Default Include Flags
    5. Installation of Header Files
  10. The Test Directory Makefile.am File
    1. Beginning of the File
    2. Compilation of the Unit Test Program
    3. The Test Target
    4. House Cleaning
  11. Using the Correct Version of the Autotools
  12. Hints, tricks, bugs, and suggestions
    1. Using autoreconf

The Package Base Directory configure.ac File

The purpose of the configuration script in a package's base directory (Coin-Clp in the example) is to test what COIN-OR project subdirectories are present and should be compiled, and then to initiate the configuration in those subdirectories.

The beginning and the end of the file follow the basic structure of configure.ac files. The body for a base directory configure.ac file then looks like this:

.
.
.

##############################################################################
#              Create the libtool script for the subdirectories             #
#############################################################################

AC_COIN_CREATE_LIBTOOL

#############################################################################
#                  Check which subprojects are there                        #
#############################################################################

AC_COIN_MAIN_PACKAGEDIR(Blas,ThirdParty,daxpy.f,coinblas)
AC_COIN_MAIN_PACKAGEDIR(Lapack,ThirdParty,[LAPACK/SRC/dlarf.f],coinlapack)
AC_COIN_MAIN_PACKAGEDIR(Sample,Data,,coindatasample)
AC_COIN_MAIN_PACKAGEDIR(Netlib,Data,,coindatanetlib)
AC_COIN_MAIN_PACKAGEDIR(CoinUtils)
AC_COIN_MAIN_PACKAGEDIR(Osi)
AC_COIN_MAIN_PACKAGEDIR(Clp)

#############################################################################
#                  Check for doxygen                                        #
#############################################################################

AC_COIN_DOXYGEN(CoinUtils Osi)

.
.
.
  • The AC_COIN_CREATE_LIBTOOL macro executes a number of tests, and then creates the libtool script. If this script exists in the base directory, it can be used in the subdirectories, and doesn't have to be recreated there. Using this macro here speeds up the configuration time considerably.
  • The AC_COIN_MAIN_PACKAGEDIR macros tell us (in the first argument) the names of COIN-OR projects that should be compiled for this package. The second argument specifies an optional subdirectory under which the project is found. The optional third argument specifies a source file that need to be present. The final configure script checks whether for each project a configure.ac file exists and, if the third argument is given, also the specified file is available. E.g., for the Netlib project it is checked whether Data/Netlib/configure.ac exists, while for the Blas project it is checked whether both ThirdParty/Blas/configure.ac and ThirdParty/Blas/daxpy.f exist.

The final configure and Makefiles will recurse into those directories in the specified order, i.e., if there are interdependencies, e.g., between libraries, make sure that you list the project subdirectories in the right order. If during the run of configure by the user a subdirectory is not found, the configuration and make for that subdirectory is skipped.

Note that, in the above example, we also specify subdirectories for ThirdParty and Data. The ThirdParty subdirectories contain build systems for third-party codes that may be used by a COIN-OR project. Here, we want configure and make to recurse into a ThirdParty directory only if the user provided the corresponding source code. The Data subdirectories contain data files required for running the unit tests or example programs.

  • The AC_COIN_DOXYGEN macro is used to initialize variables that are used in the doxygen configuration file of the project base directory. See here for more information on using Doxygen in COIN-OR.