3 <!-- Created by texi2html 1.56k from cln.texi on 2 June 2000 -->
5 <TITLE>CLN, a Class Library for Numbers - 2. Installation</TITLE>
8 Go to the <A HREF="cln_1.html">first</A>, <A HREF="cln_1.html">previous</A>, <A HREF="cln_3.html">next</A>, <A HREF="cln_13.html">last</A> section, <A HREF="cln_toc.html">table of contents</A>.
12 <H1><A NAME="SEC2" HREF="cln_toc.html#TOC2">2. Installation</A></H1>
15 This section describes how to install the CLN package on your system.
20 <H2><A NAME="SEC3" HREF="cln_toc.html#TOC3">2.1 Prerequisites</A></H2>
24 <H3><A NAME="SEC4" HREF="cln_toc.html#TOC4">2.1.1 C++ compiler</A></H3>
27 To build CLN, you need a C++ compiler.
28 Actually, you need GNU <CODE>g++ 2.7.0</CODE> or newer.
29 On HPPA, you need GNU <CODE>g++ 2.8.0</CODE> or newer.
30 I recommend GNU <CODE>g++ 2.95</CODE> or newer.
34 The following C++ features are used:
35 classes, member functions,
36 overloading of functions and operators,
37 constructors and destructors, inline, const,
38 multiple inheritance, templates.
42 The following C++ features are not used:
43 <CODE>new</CODE>, <CODE>delete</CODE>, virtual inheritance,
48 CLN relies on semi-automatic ordering of initializations
49 of static and global variables, a feature which I could
50 implement for GNU g++ only.
55 <H3><A NAME="SEC5" HREF="cln_toc.html#TOC5">2.1.2 Make utility</A></H3>
61 To build CLN, you also need to have GNU <CODE>make</CODE> installed.
66 <H3><A NAME="SEC6" HREF="cln_toc.html#TOC6">2.1.3 Sed utility</A></H3>
72 To build CLN on HP-UX, you also need to have GNU <CODE>sed</CODE> installed.
73 This is because the libtool script, which creates the CLN library, relies
74 on <CODE>sed</CODE>, and the vendor's <CODE>sed</CODE> utility on these systems is too
80 <H2><A NAME="SEC7" HREF="cln_toc.html#TOC7">2.2 Building the library</A></H2>
83 As with any autoconfiguring GNU software, installation is as easy as this:
94 If on your system, <SAMP>`make'</SAMP> is not GNU <CODE>make</CODE>, you have to use
95 <SAMP>`gmake'</SAMP> instead of <SAMP>`make'</SAMP> above.
99 The <CODE>configure</CODE> command checks out some features of your system and
100 C++ compiler and builds the <CODE>Makefile</CODE>s. The <CODE>make</CODE> command
101 builds the library. This step may take 4 hours on an average workstation.
102 The <CODE>make check</CODE> runs some test to check that no important subroutine
103 has been miscompiled.
107 The <CODE>configure</CODE> command accepts options. To get a summary of them, try
116 Some of the options are explained in detail in the <SAMP>`INSTALL.generic'</SAMP> file.
120 You can specify the C compiler, the C++ compiler and their options through
121 the following environment variables when running <CODE>configure</CODE>:
128 Specifies the C compiler.
130 <DT><CODE>CFLAGS</CODE>
132 Flags to be given to the C compiler when compiling programs (not when linking).
136 Specifies the C++ compiler.
138 <DT><CODE>CXXFLAGS</CODE>
140 Flags to be given to the C++ compiler when compiling programs (not when linking).
149 $ CC="gcc" CFLAGS="-O" CXX="g++" CXXFLAGS="-O" ./configure
150 $ CC="gcc -V 2.7.2" CFLAGS="-O -g" \
151 CXX="g++ -V 2.7.2" CXXFLAGS="-O -g" ./configure
152 $ CC="gcc -V 2.8.1" CFLAGS="-O -fno-exceptions" \
153 CXX="g++ -V 2.8.1" CXXFLAGS="-O -fno-exceptions" ./configure
154 $ CC="gcc -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" \
155 CXX="g++ -V egcs-2.91.60" CFLAGS="-O2 -fno-exceptions" ./configure
159 Note that for these environment variables to take effect, you have to set
160 them (assuming a Bourne-compatible shell) on the same line as the
161 <CODE>configure</CODE> command. If you made the settings in earlier shell
162 commands, you have to <CODE>export</CODE> the environment variables before
163 calling <CODE>configure</CODE>. In a <CODE>csh</CODE> shell, you have to use the
164 <SAMP>`setenv'</SAMP> command for setting each of the environment variables.
168 On Linux, <CODE>g++</CODE> needs 15 MB to compile the tests. So you should better
169 have 17 MB swap space and 1 MB room in $TMPDIR.
173 If you use <CODE>g++</CODE> version 2.7.x, don't add <SAMP>`-O2'</SAMP> to the CXXFLAGS,
174 because <SAMP>`g++ -O'</SAMP> generates better code for CLN than <SAMP>`g++ -O2'</SAMP>.
178 If you use <CODE>g++</CODE> version 2.8.x or egcs-2.91.x (a.k.a. egcs-1.1) or
179 gcc-2.95.x, I recommend adding <SAMP>`-fno-exceptions'</SAMP> to the CXXFLAGS.
180 This will likely generate better code.
184 If you use <CODE>g++</CODE> version egcs-2.91.x (egcs-1.1) or gcc-2.95.x on Sparc,
185 add either <SAMP>`-O'</SAMP>, <SAMP>`-O1'</SAMP> or <SAMP>`-O2 -fno-schedule-insns'</SAMP> to the
186 CXXFLAGS. With full <SAMP>`-O2'</SAMP>, <CODE>g++</CODE> miscompiles the division routines.
187 Also, if you have <CODE>g++</CODE> version egcs-1.1.1 or older on Sparc, you must
188 specify <SAMP>`--disable-shared'</SAMP> because <CODE>g++</CODE> would miscompile parts of
193 By default, both a shared and a static library are built. You can build
194 CLN as a static (or shared) library only, by calling <CODE>configure</CODE> with
195 the option <SAMP>`--disable-shared'</SAMP> (or <SAMP>`--disable-static'</SAMP>). While
196 shared libraries are usually more convenient to use, they may not work
197 on all architectures. Try disabling them if you run into linker
198 problems. Also, they are generally somewhat slower than static
199 libraries so runtime-critical applications should be linked statically.
204 <H3><A NAME="SEC8" HREF="cln_toc.html#TOC8">2.2.1 Using the GNU MP Library</A></H3>
210 Starting with version 1.1, CLN may be configured to make use of a
211 preinstalled <CODE>gmp</CODE> library. Please make sure that you have at
212 least <CODE>gmp</CODE> version 3.0 installed since earlier versions are
213 unsupported and likely not to work. Enabling this feature by calling
214 <CODE>configure</CODE> with the option <SAMP>`--with-gmp'</SAMP> is known to be quite
215 a boost for CLN's performance.
219 If you have installed the <CODE>gmp</CODE> library and its header file in
220 some place where your compiler cannot find it by default, you must help
221 <CODE>configure</CODE> by setting <CODE>CPPFLAGS</CODE> and <CODE>LDFLAGS</CODE>. Here is
227 $ CC="gcc" CFLAGS="-O2" CXX="g++" CXXFLAGS="-O2 -fno-exceptions" \
228 CPPFLAGS="-I/opt/gmp/include" LDFLAGS="-L/opt/gmp/lib" ./configure --with-gmp
233 <H2><A NAME="SEC9" HREF="cln_toc.html#TOC9">2.3 Installing the library</A></H2>
239 As with any autoconfiguring GNU software, installation is as easy as this:
248 The <SAMP>`make install'</SAMP> command installs the library and the include files
249 into public places (<TT>`/usr/local/lib/'</TT> and <TT>`/usr/local/include/'</TT>,
250 if you haven't specified a <CODE>--prefix</CODE> option to <CODE>configure</CODE>).
251 This step may require superuser privileges.
255 If you have already built the library and wish to install it, but didn't
256 specify <CODE>--prefix=...</CODE> at configure time, just re-run
257 <CODE>configure</CODE>, giving it the same options as the first time, plus
258 the <CODE>--prefix=...</CODE> option.
263 <H2><A NAME="SEC10" HREF="cln_toc.html#TOC10">2.4 Cleaning up</A></H2>
266 You can remove system-dependent files generated by <CODE>make</CODE> through
275 You can remove all files generated by <CODE>make</CODE>, thus reverting to a
276 virgin distribution of CLN, through
285 Go to the <A HREF="cln_1.html">first</A>, <A HREF="cln_1.html">previous</A>, <A HREF="cln_3.html">next</A>, <A HREF="cln_13.html">last</A> section, <A HREF="cln_toc.html">table of contents</A>.