]> www.ginac.de Git - cln.git/blob - doc/cln_2.html
516165b14f97673bc8a11afe5f81393d3cf94203
[cln.git] / doc / cln_2.html
1 <HTML>
2 <HEAD>
3 <!-- Created by texi2html 1.56k from cln.texi on 2 June 2000 -->
4
5 <TITLE>CLN, a Class Library for Numbers - 2. Installation</TITLE>
6 </HEAD>
7 <BODY>
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>.
9 <P><HR><P>
10
11
12 <H1><A NAME="SEC2" HREF="cln_toc.html#TOC2">2. Installation</A></H1>
13
14 <P>
15 This section describes how to install the CLN package on your system.
16
17
18
19
20 <H2><A NAME="SEC3" HREF="cln_toc.html#TOC3">2.1 Prerequisites</A></H2>
21
22
23
24 <H3><A NAME="SEC4" HREF="cln_toc.html#TOC4">2.1.1 C++ compiler</A></H3>
25
26 <P>
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.
31
32
33 <P>
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.
39
40
41 <P>
42 The following C++ features are not used:
43 <CODE>new</CODE>, <CODE>delete</CODE>, virtual inheritance,
44 exceptions.
45
46
47 <P>
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.
51
52
53
54
55 <H3><A NAME="SEC5" HREF="cln_toc.html#TOC5">2.1.2 Make utility</A></H3>
56 <P>
57 <A NAME="IDX3"></A>
58
59
60 <P>
61 To build CLN, you also need to have GNU <CODE>make</CODE> installed.
62
63
64
65
66 <H3><A NAME="SEC6" HREF="cln_toc.html#TOC6">2.1.3 Sed utility</A></H3>
67 <P>
68 <A NAME="IDX4"></A>
69
70
71 <P>
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
75 limited.
76
77
78
79
80 <H2><A NAME="SEC7" HREF="cln_toc.html#TOC7">2.2 Building the library</A></H2>
81
82 <P>
83 As with any autoconfiguring GNU software, installation is as easy as this:
84
85
86
87 <PRE>
88 $ ./configure
89 $ make
90 $ make check
91 </PRE>
92
93 <P>
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.
96
97
98 <P>
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.
104
105
106 <P>
107 The <CODE>configure</CODE> command accepts options. To get a summary of them, try
108
109
110
111 <PRE>
112 $ ./configure --help
113 </PRE>
114
115 <P>
116 Some of the options are explained in detail in the <SAMP>`INSTALL.generic'</SAMP> file.
117
118
119 <P>
120 You can specify the C compiler, the C++ compiler and their options through
121 the following environment variables when running <CODE>configure</CODE>:
122
123
124 <DL COMPACT>
125
126 <DT><CODE>CC</CODE>
127 <DD>
128 Specifies the C compiler.
129
130 <DT><CODE>CFLAGS</CODE>
131 <DD>
132 Flags to be given to the C compiler when compiling programs (not when linking).
133
134 <DT><CODE>CXX</CODE>
135 <DD>
136 Specifies the C++ compiler.
137
138 <DT><CODE>CXXFLAGS</CODE>
139 <DD>
140 Flags to be given to the C++ compiler when compiling programs (not when linking).
141 </DL>
142
143 <P>
144 Examples:
145
146
147
148 <PRE>
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
156 </PRE>
157
158 <P>
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.
165
166
167 <P>
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.
170
171
172 <P>
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>.
175
176
177 <P>
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.
181
182
183 <P>
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 
189 the library.
190
191
192 <P>
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.
200
201
202
203
204 <H3><A NAME="SEC8" HREF="cln_toc.html#TOC8">2.2.1 Using the GNU MP Library</A></H3>
205 <P>
206 <A NAME="IDX5"></A>
207
208
209 <P>
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.
216
217
218 <P>
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
222 an example:
223
224
225
226 <PRE>
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
229 </PRE>
230
231
232
233 <H2><A NAME="SEC9" HREF="cln_toc.html#TOC9">2.3 Installing the library</A></H2>
234 <P>
235 <A NAME="IDX6"></A>
236
237
238 <P>
239 As with any autoconfiguring GNU software, installation is as easy as this:
240
241
242
243 <PRE>
244 $ make install
245 </PRE>
246
247 <P>
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.
252
253
254 <P>
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.
259
260
261
262
263 <H2><A NAME="SEC10" HREF="cln_toc.html#TOC10">2.4 Cleaning up</A></H2>
264
265 <P>
266 You can remove system-dependent files generated by <CODE>make</CODE> through
267
268
269
270 <PRE>
271 $ make clean
272 </PRE>
273
274 <P>
275 You can remove all files generated by <CODE>make</CODE>, thus reverting to a
276 virgin distribution of CLN, through
277
278
279
280 <PRE>
281 $ make distclean
282 </PRE>
283
284 <P><HR><P>
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>.
286 </BODY>
287 </HTML>