5.2 Variants of the Libraries

The distribution of the Aldor libraries comes in three variants:

All these variants are not compatible with each other.

ALLPROSE provides a simple mechanism for several variants of the project and testcases library which are built on the corresponding Aldor libraries. The following variable specifies which library variants should be built.

ToDo 5 Must change include/combinat.as.nw and tools/generateTestCases.pl.nw if we have other POSTFIXes than "d", "-gmp", or "".

We would rather like to suggest that all variants of libraries come with the same name but are collected in different subdirectories, i. e., all libraries related to the debug version should go into $ALDORROOT/lib/debug, all libraries related to the GMP version should go under $ALDORROOT/lib/gmp. In these directories the libraries should all have the same name. For example, instead of libalgebra.al, libalgebrad.al, and libalgebra-gmp.al in the directory lib, we would have libalgebra.al in the subdirectories lib/ordinary, lib/debug, and lib/gmp. In that way the corresponding file include/algebra.as could be made a bit simpler.

ToDo 6 Currently, there is some restriction on the variants, since the include files include/combinat.as.nw and include/testcases.as select the library name only depending on the Aldor command line switches -dDEBUG and -dGMP.
36library variants 36  (30)  39
VARIANTSTOBUILD=debug axiom
# debug
# axiom
# ordinary
# gmp

Defines:
VARIANTSTOBUILD, never used.

The above value of VARIANTSTOBUILD can be any value xxx as long as there are corresponding variables VARIANTPOSTFIXxxx and VARIANTFLAGSxxx etc.

For each of the variants there are four variables. They are put on the command line for the specific variant as can be seen in the targets libraryvariant.% and executablevariant.% in Makefile.inc.nw.

If there is some need to have specific flags for certain executables, it is possible to define them through a variable VARIANTSOMENAMEFLAGSxxx where SOMENAME has to be replaced by the actual name of the specific executable (without any variant postfix). For example if the name of the executable is Foo, and it needs the flags ’-Dbar -Drandom’ for the ordinary variant. Then one would have to define the following variable.

VARIANTFooFLAGSordinary=-Dbar -Drandom

Of course this limits the possible names of executables, since their names appear as substrings in a Makefile variable.

39library variants 36+   (30)  36  40
VARIANTPOSTFIXordinary=
VARIANTASSERTIONordinary=
ToDo 7 14-Mar-2007: We have to turn off some optimizations, since (at least) src/sitools/siprimes.as.nw needs -qno-cc and -qno-cc-fnonstd. Several files dislike inlining. There is another bug which makes equality of cycle index series in several tests fail, for example, in testBinaryTreesOfSets, but this occurs even when setting -q1.

The ordinary version takes roughly half the time for completing the test suite, although this may parially be due to the fact that some tests fail earlier. There is hardly any difference between the timings of -q4 and -q1.

Curiously, we hit an error when compiling src/species.as.nw with -q0:

#10 (Fatal Error) Storage allocation error (atempt to free unknown space).

40library variants 36+   (30)  39
VARIANTFLAGSordinary=-v -q4 -qno-cc-fnonstd -qno-inline -qno-cc -qinline-limit=1 -qinline-size=1 -lalgebra -laldor
VARIANTEXECUTABLEFLAGSordinary=

VARIANTPOSTFIXgmp=-gmp
VARIANTASSERTIONgmp=-dGMP
VARIANTFLAGSgmp=-q3 -qinline-all -lalgebra-gmp -laldor
VARIANTEXECUTABLEFLAGSgmp=-Cruntime=foam-gmp,gmp,m

VARIANTPOSTFIXdebug=d
VARIANTASSERTIONdebug=-dDEBUG
VARIANTFLAGSdebug=-q1 -lalgebrad -laldord
VARIANTEXECUTABLEFLAGSdebug=

VARIANTPOSTFIXaxiom=ax
VARIANTASSERTIONaxiom=-dAxiom
VARIANTFLAGSaxiom=-q1 -Fasy -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -Y $(AXIOM)/algebra
VARIANTEXECUTABLEFLAGSaxiom=

Defines:
VARIANTASSERTION, never used.
VARIANTEXECUTABLEFLAGS, never used.
VARIANTFLAGS, never used.
VARIANTPOSTFIX, never used.
ToDo 8
rhx 4 21-Dec-2006: The above flags for Axiom are similar to the ones currently provided via )co file.as on the Axiom command line. However, currently, we just use -q1 since that allows to compile with ALLPROSE, while -O leads to an error during an (unnecessary) compilation of a .a library.

The .ao files are currently automatically removed by ALLPROSE. They must be manually recreated via the command.

for f in $(ar t libcombinatax.al); do ar x libcombinatax.al $f; done

In an Axiom session one would have to load all the libraries in the correct order. Usually the library itself contains the correct dependency order and thus we can generate the corresponding file.

rm combinat.input  
for f in $(ar t libcombinatax.al); do echo ")lib $f" >> combinat.input; done

Of course, all this should already be done via some MAKE target, but I still have to figure out, how this can be achieved best.