The |
Writing packages which compile on all platforms and can easily be
maintained is a complex task. The
Systematically use
Keep configure.ac and the Makefile.am as straightforward as possible.
Use a uniform organization for the directory structure.
More precisely, the directory structure of a new package foox should be as follows:
|
Of course, there may be multiple dependency: any external dependency of your package should come with a separate .m4 file. Similarly, you also have one subdir for each type of functionality of your package. A configuration file foox/include/foox-config.hpp should be created automatically using autoheader and AC_PREFIX_CONFIG_H. The file foox/Makefile.am is very short and mainly refers to the main makefile foox/build/Makefile.am.
The file configure.ac should be modeled on the corresponding file of basix. In particular, you have to start with something like
|
and end with something like
|
The file mmx_module.m4 defines a convenient macro AC_MMX_MODULE. When calling this macro inside your configure.ac, the following common options for
Enable debugging (disabled by default).
Enable optimization (enabled by default).
Support exceptions for high level routines (enabled by default).
Enable security checks for low level routines (disabled by default).
Build the glue libraries for use with the interpreter (enabled by default).
Build suite of test programs (disabled by default).
Build suite of benchmark programs (disabled by default).
Activate the building of the documentation (disabled by default).
Additional dependencies should all come with a corresponding m4 file. For instance, numerix tests for gmp in the following way:
|
The macro AC_WITH_GMP provides an option to specify
the install path for gmp. The macro AC_LIB_GMP
tests whether it is possible to execute some functionality of the
library. Notice that the m4 files of some of the
Each package should come with a global Makefile.am which should be kept as straightforward as possible and the build/Makefile.am, which control how to build the package. Let us describe its content.
First of all, all include files in foox/include/ should be put into the mathemagix subdirectory of includedir:
|
One next has to specify the
|
and the corresponding sources to be built:
|
We also have to provide a configuration script foox/script/foox-config.in and distribute it with our package:
|
In order to produce a clean distribution of the package, you also have to add:
|
In addition to the above required sources and targets, additional libraries and binaries may have to be built as a function of the configuration options –enable-glue, –enable-test and –enable-bench. For instance, in order to build the library which has to be glued to the interpreter, one typically adds the following lines:
|
For the other options, and as a more general rule, we recommend to mimick the code in the existing files */build/Makefile.am.
When your package is finished, according to the above guidelines, then
we can include it in the main