[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.2 Building the library
As with any autoconfiguring GNU software, installation is as easy as this:
$ ./configure $ make $ make check
If on your system, ‘make’ is not GNU make
, you have to use
‘gmake’ instead of ‘make’ above.
The configure
command checks out some features of your system and
C++ compiler and builds the Makefile
s. The make
command
builds the library. This step may take about half an hour on an average
workstation. The make check
runs some test to check that no
important subroutine has been miscompiled.
The configure
command accepts options. To get a summary of them, try
$ ./configure --help
Some of the options are explained in detail in the ‘INSTALL.generic’ file.
You can specify the C compiler, the C++ compiler and their options through
the following environment variables when running configure
:
CC
Specifies the C compiler.
CFLAGS
Flags to be given to the C compiler when compiling programs (not when linking).
CXX
Specifies the C++ compiler.
CXXFLAGS
Flags to be given to the C++ compiler when compiling programs (not when linking).
CPPFLAGS
Flags to be given to the C/C++ preprocessor.
LDFLAGS
Flags to be given to the linker.
Examples:
$ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure
$ CC="gcc -V 3.2.3" CFLAGS="-O2 -finline-limit=1000" \ CXX="g++ -V 3.2.3" CXXFLAGS="-O2 -finline-limit=1000" \ CPPFLAGS="-DNO_ASM" ./configure
$ CC="gcc-4.2" CFLAGS="-O2" CXX="g++-4.2" CXXFLAGS="-O2" ./configure
Note that for these environment variables to take effect, you have to set
them (assuming a Bourne-compatible shell) on the same line as the
configure
command. If you made the settings in earlier shell
commands, you have to export
the environment variables before
calling configure
. In a csh
shell, you have to use the
‘setenv’ command for setting each of the environment variables.
Currently CLN works only with the GNU g++
compiler, and only in
optimizing mode. So you should specify at least -O
in the
CXXFLAGS, or no CXXFLAGS at all. If CXXFLAGS is not set, CLN will be
compiled with -O
.
The assembler language kernel can be turned off by specifying
-DNO_ASM
in the CPPFLAGS. If make check
reports any
problems, you may try to clean up (see Cleaning up) and configure
and compile again, this time with -DNO_ASM
.
If you use g++
3.2.x or earlier, I recommend adding
‘-finline-limit=1000’ to the CXXFLAGS. This is essential for good
code.
If you use g++
from gcc-3.0.4 or older on Sparc, add either
‘-O’, ‘-O1’ or ‘-O2 -fno-schedule-insns’ to the
CXXFLAGS. With full ‘-O2’, g++
miscompiles the division
routines. Also, do not use gcc-3.0 on Sparc for compiling CLN, it
won’t work at all.
Also, please do not compile CLN with g++
using the -O3
optimization level. This leads to inferior code quality.
Some newer versions of g++
require quite an amount of memory.
You might need some swap space if your machine doesn’t have 512 MB of
RAM.
By default, both a shared and a static library are built. You can build
CLN as a static (or shared) library only, by calling configure
with the option ‘--disable-shared’ (or ‘--disable-static’).
While shared libraries are usually more convenient to use, they may not
work on all architectures. Try disabling them if you run into linker
problems. Also, they are generally slightly slower than static
libraries so runtime-critical applications should be linked statically.
2.2.1 Using the GNU MP Library |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 27, 2013 using texi2html 5.0.