5 | | The beginning and the end of the file follow the [wiki:pm-structure-config basic structure] of {{{configure.ac}}} files. The body for a project main directory {{{configure.ac}}} file then looks like this: |
| 5 | The beginning and the end of the file follow the [wiki:pm-structure-config basic structure] of {{{configure.ac}}} files. The body for a project main directory {{{configure.ac}}} contains the following parts: |
| 6 | |
| 7 | * Initialization of tools and checks for programs, such as compiler |
| 8 | * Checks for other COIN components |
| 9 | * Checks for third party libraries (such as GNU's zlib or a third party LP solver) |
| 10 | * Generation of links to files required for unit tests or example programs in case of a VPATH configuration |
| 11 | * Other project specific tests and settings (such as byte size of types, existence of header files etc) |
| 12 | |
| 13 | In the following we describe the indiviual parts of the {{{configure.ac}} file body in more details and present examples. |
| 14 | |
| 15 | == Initialization of Tools and Compilers == |
| 16 | |
| 17 | This part usually looks like this: |
| 45 | |
| 46 | * The '''AC_CANONICAL_BUILD''' makes the {{{configure}}} script check the host type, on which the script is run. |
| 47 | |
| 48 | * '''AC_COIN_PROJECTDIR_INIT''' is a COIN specific macro that inializes a few things and should be included at this place |
| 49 | |
| 50 | * The macro '''AC_COIN_DEBUG_COMPILE''' makes the {{{--enable-debug}}} flag available for {{{configure}}}. It also sets the Automake conditional accordingly, as well as the {{{COIN_DEBUG}}} for the configuration header file. |
| 51 | |
| 52 | * The macros '''AC_COIN_PROG_CC''' and '''AC_COIN_PROG_CXX''' determine the name of the C and C++ compiler, and chooses the default compiler options. One only needs to specify those compilers that are required to compile the source code in the project. If the source code contains Fortran files, one should use '''AC_COIN_PROG_F77'''. |
| 53 | |
| 54 | * Finally, the '''AC_COIN_INIT_AUTO_TOOLS''' sets everything up that is required to have Automake and Libtool work correctly. |
| 55 | |
| 56 | == Check for Other COIN Components == |
| 57 | |
| 58 | This part looks like this: |
| 59 | |
| 60 | {{{ |
| 61 | ############################################################################# |
| 62 | # COIN components # |
| 63 | ############################################################################# |
| 64 | |
| 65 | AC_COIN_HAS_PROJECT(Cbc) |
| 66 | AC_COIN_HAS_PROJECT(Cgl) |
| 67 | AC_COIN_HAS_PROJECT(Clp) |
| 68 | AC_COIN_HAS_PROJECT(CoinUtils) |
| 69 | AC_COIN_HAS_PROJECT(DyLP) |
| 70 | AC_COIN_HAS_PROJECT(Osi) |
| 71 | AC_COIN_HAS_PROJECT(Sym) |
| 72 | AC_COIN_HAS_PROJECT(Vol) |
| 73 | }}} |
| 74 | |
| 75 | Here, for each COIN project that is required to compile the libraries and programs in this project (including unit tests and example programs), we list its name as argument of one '''AC_COIN_HAS_PROJECT'''. This example is taken from Cbc, and as you see, the project itself should also be listed. |
| 76 | |
| 77 | The final {{{configure}}} script will search for the project; first, it will check if itself is this package (by comparing with the name that is given to {{{AC_INIT}}} at the beginning of the {{{configure.ac}}} file), and otherwise looks for a parallel subdirectory with the projects name. |
| 78 | |
| 79 | If the project is found, a {{{#define}}} will set in the configuration header files with the name {{{COIN_HAS_PRJCT}}} (where {{{PRJCT}}} is replaced by the name of the project in all capital letters, e.g., {{{COIN_HAS_CLP}}} in the example above). Also, an Automake conditional with the same name will be set to true. |
| 80 | |
| 81 | The project can be listed in any order. |
| 82 | |
| 83 | == Checks For Third-Party Components == |
| 84 | |
| 85 | For a few third-party packages we have defined special COIN macros, namely for those packages that are released under the GNU Public License (GLP). Those libraries will only be used, if the user specified the {{{--enable-gnu-packages}}} flag for {{{configure}}}. So far, those macros are |
| 86 | |
| 87 | * '''AC_COIN_CHECK_GNU_ZLIB''': Check for the zlib compression library |
| 88 | * '''AC_COIN_CHECK_GNU_BZLIB''': Check for the bzlib compression library |
| 89 | * '''AC_COIN_CHECK_GNU_READLINE''': Check for the readline library. |
| 90 | |
| 91 | Those macros check for the availability of those packages (if required by the user). If the package is available, it adds the flags required for linking to the {{{ADDLIBS}}} output variable, {{{#define}}}s the preprocessor {{{COIN_HAS_ZLIB}}} (and similar) in the configuration header file, and defines an Automake conditional with the same name. |
| 92 | |
| 93 | We also provide a generic macro for testing the availability of other third-party libraries, called '''AC_COIN_HAS_USER_LIBRARY'''. |
| 94 | A typical invocation looks like this: |
| 95 | |
| 96 | {{{ |
| 97 | AC_COIN_HAS_USER_LIBRARY([Cplex],[CPX],[cplex.h],[CPXgetstat]) |
| 98 | }}} |
| 99 | |
| 100 | The arguments have to following meaning: |
| 101 | |
| 102 | 1. ''Name of the package''. |