blob: 3570eaf735b3d005bd3acaea88eb9b24f10f9c10 [file] [log] [blame]
Brian Paul0b27ace2003-03-08 17:38:57 +00001<HTML>
2
3<TITLE>Compilation and Installation</TITLE>
4
5<BODY text="#000000" bgcolor="#55bbff" link="#111188">
6
7<H1>Compilation and Installation for Unix/X11</H1>
8
9<p>
10If you're not using a variant of Unix with X11, see the
11<a href="systems.html">Supported Systems and Drivers</a> section
12for instructions.
13</p>
14
15<p>
16There are two methods for building Mesa on Unix/X11 systems:
17</p>
18
19<dl>
20<dt><a href="#new">NEW-STYLE</a><dt>
21<dd>
22Basically, type "./configure" followed by "make"
23This <em>should</em> work on most Unix-like operating systems.
24Unfortunately, autoconf/automake seems to seldom work reliably on non-Linux
25systems. For that reason, the old-style make system is still supported
26(and is the preferred method of the Mesa developers).
27</dd>
28<br>
29<dt><a href="#old">OLD-STYLE</a><dt>
30<dd>
31Simply type <code>make</code> and you'll see a list of supported
32system configurations. Pick one and type <code>make</code> <em>config</em>.
33More details below.
Brian Paulafc04282003-09-03 23:04:31 +000034<br>
Brian Paul0b27ace2003-03-08 17:38:57 +000035</dd>
36</dl>
37
38<p>
39<B>NOTE</b>: The GLUT library and demonstrations programs are in the
40MesaDemos-x.y.z.tar.gz file. If you don't have GLUT or you want to
41run some demos, download the MesaDemos package too.
42</p>
43
44<p>
45In either case, building Mesa entails the following:
46<p>
47<ul>
48<li>Compiling libGL, the OpenGL-replacement library.
49<li>Compiling libGLU, the OpenGL Utility library.
50<li>Compiling libglut, the GLUT library (if you downloaded the Mesa demos
51package)
52<li>Compiling the demonstration programs in the directories:
53<code>demos, xdemos, samples</code> and <code>book</code>
54(if you downloaded the Mesa demos package.)
55</ul>
56
57
58<a name="new">
59<H2>NEW-STYLE compilation and installation</H2>
60
Brian Paulb0eee792003-03-16 16:43:04 +000061<p>
62<b> 0.</b> If you've downloaded Mesa via CVS there will not be a "configure"
Brian Paul0b27ace2003-03-08 17:38:57 +000063 script. You'll have to run the "bootstrap" script first. This script
64 may not work on any OS other than Linux. You'll need these programs
65 to run the bootstrap script:
Brian Paulb0eee792003-03-16 16:43:04 +000066</p>
Brian Paul0b27ace2003-03-08 17:38:57 +000067
Brian Paulb0eee792003-03-16 16:43:04 +000068<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000069 autoconf 2.50
70 automake 1.4-p2
71 libtool 1.4
Brian Paulb0eee792003-03-16 16:43:04 +000072</pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000073
Brian Paulb0eee792003-03-16 16:43:04 +000074<p>
75<b>1.</b> Run the configure script
76</p>
Brian Paul0b27ace2003-03-08 17:38:57 +000077
Brian Paulb0eee792003-03-16 16:43:04 +000078<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000079 ./configure [options]
Brian Paulb0eee792003-03-16 16:43:04 +000080</pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000081
Brian Paulb0eee792003-03-16 16:43:04 +000082<p>
Brian Paul0b27ace2003-03-08 17:38:57 +000083For Linux, it is recommended that you use:
Brian Paulb0eee792003-03-16 16:43:04 +000084</p>
85<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000086 ./configure --prefix=/usr
Brian Paulb0eee792003-03-16 16:43:04 +000087</pre>
88
Brian Paul0b27ace2003-03-08 17:38:57 +000089So that the headers and libs are located according to the Linux/OpenGL
90standard spec at http://oss.sgi.com/projects/ogl-sample/ABI/
Brian Paulb0eee792003-03-16 16:43:04 +000091</p>
92<p>
93For Red Hat 8.0, Mandrake 9.1 and other Linux distros, you may have to use
94the following:
95</p>
96<pre>
97 export LDFLAGS="-lstdc++" ; ./configure --prefix=/usr
98 or
99 setenv LDFLAGS -lstdc++ ; ./configure --prefix=/usr
100</pre>
101<p>
102This works around a problem when building the GLU library. It needs to
103be linked with the C++ runtime library, but libtool (for some reason)
104doesn't do this.
105</p>
106<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000107Possible options are:
108
109--prefix=DIR
110 The toplevel directory of the hierachy in which Mesa
111 will be installed (DIR/include,DIR/lib etc.).
112 The default is "/usr/local".
113
114--sysconfdir=DIR
115 The directory where Mesa configuration files
116 will be stored. The default is "$prefix/etc".
117 You may want to overwrite the default with --sysconfdir=/etc.
118
119--enable-static
120 Enable building of static libraries.
121 Static libraries are NOT built by default.
122
123--disable-shared
124 Disable building of shared libraries.
125 Shared libraries are built by default.
126
127--with-pic
128--without-pic
129 In normal operation, libtool will build shared libraries from
130 PIC objects and static archives from non-PIC objects, except where one
131 or the other is not provided by the target host. By specifying
132 --with-pic you are asking libtool to build static archives from
133 PIC objects, and similarly by specifying --without-pic you are asking
134 libtool to build shared libraries from non-PIC objects.
135 libtool will only honour this flag where it will produce a
136 working library, otherwise it reverts to the default.
137
138--enable-debug
139 Enable debugging messages (disabled by default).
140
141--enable-profile
142 Enable profiling (disabled by default).
143
144--disable-optimize
145 Disable extra optimizations (enabled by default,
146 i.e., optimize for maximum performance).
147
148--enable-warn
149 Enable extended compiler warnings (disabled by default).
150
151--enable-x86[=ARG]
152--disable-x86
153 Enable/disable x86 assembler support to speed up Mesa
154 (autodetected by default). You may set `on' or `off'.
155
156--enable-3dnow[=ARG]
157--disable-3dnow
158 Enable/disable 3Dnow support to speed up Mesa
159 (autodetected by default). You may set `on' or `off'.
160
161--enable-mmx[=ARG]
162--disable-mmx
163 Enable/disable MMX support to speed up Mesa
164 (autodetected by default). You may set `on' or `off'.
165
166--enable-sse[=ARG]
167--disable-sse
168 Enable/disable SSE support to speed up Mesa
169 (autodetected by default). You may set `on' or `off'.
170 If you have a PentiumIII and want to use SSE make sure you have the
171 PIII Linux kernel-patch installed or things will fail!
172 You can get the patch from http://www.redhat.com/~dledford/linux_kernel.html
173
174--with-glide[=DIR]
175--without-glide
176 Enable/disable support for Glide (disabled by default).
177 DIR is the installation directory of Glide.
178 If Glide cannot be found, the driver won't be built.
179
180--with-glut[=DIR]
181--without-glut
182 Don't/use already-installed GLUT (autodetected by default).
183 DIR is the installation directory of Glut.
184 If GLUT cannot be found, the version shipped with Mesa will be built.
185
186--with-ggi[=DIR]
187--without-ggi
188 Enable/disable support for GGI (autodetected by default).
189 DIR is the installation directory of GGI.
190 If GGI cannot be found, the driver won't be built.
191
192--disable-ggi-fbdev
193 Don't build the GGI fbdev target (autodetected by default).
194
195--disable-ggi-genkgi
196 Don't build the GGI generic KGI driver (autodetected by default).
197
198--disable-ggi-savage4
199 Don't build the GGI Savage4 KGI driver (autodetected by default).
200
201--disable-osmesa
202 Disable OSmesa (offscreen rendering) support (enabled by default).
203
204--with-svga[=DIR]
205--without-svga
206 Enable/disable support for SVGALib (autodetected by default).
207 DIR is the installation directory of SVGALib.
208 If SVGALib cannot be found, the driver won't be built.
209
210--x-includes=DIR
211 Search for the X include files in DIR.
212
213--x-libraries=DIR
214 Search for the X library files in DIR.
Brian Paulb0eee792003-03-16 16:43:04 +0000215</pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000216
Brian Paulb0eee792003-03-16 16:43:04 +0000217<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000218User specific compiler options can be set using the shell variable
219CFLAGS. For instance,
Brian Paulb0eee792003-03-16 16:43:04 +0000220</p>
221<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000222 CFLAGS="-g -O2" ./configure
Brian Paulb0eee792003-03-16 16:43:04 +0000223</pre>
224<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000225(on some systems: env CFLAGS="-g -O2" ./configure)
226sets the compiler flags to "-g -O2".
Brian Paulb0eee792003-03-16 16:43:04 +0000227</p>
228<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000229For more options run "./configure --help" and read INSTALL.GNU.
Brian Paulb0eee792003-03-16 16:43:04 +0000230</p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000231
Brian Paulb0eee792003-03-16 16:43:04 +0000232<p>
233<b>2.</b> To build the Mesa libraries run:
234</p>
235<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000236 make
Brian Paulb0eee792003-03-16 16:43:04 +0000237</pre>
Brian Paul8412c602003-04-01 15:33:08 +0000238<p>(on some systems you may need to run <code>gmake</code> or
239<code>gnumake</code> instead)
240</p>
Brian Paulb0eee792003-03-16 16:43:04 +0000241<p>
242When finished, libGL.so will be in src/.libs/ and libGLU.so will be in
Brian Paul0b27ace2003-03-08 17:38:57 +0000243si-glu/.libs/, etc.
Brian Paulb0eee792003-03-16 16:43:04 +0000244</p>
245<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000246Optionally, you can strip the libraries using
Brian Paulb0eee792003-03-16 16:43:04 +0000247</p>
248<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000249 make strip
Brian Paulb0eee792003-03-16 16:43:04 +0000250</pre>
251<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000252Now make sure that you have the permissions to install Mesa in the
253specified directories, for example, by becoming super user ("su")
254Then run:
Brian Paulb0eee792003-03-16 16:43:04 +0000255</p>
256<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000257 make install
Brian Paulb0eee792003-03-16 16:43:04 +0000258</pre>
259<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000260Mesa is now installed.
261Please don't move the installed files but rerun all installation
262steps if you want to use other directories.
Brian Paulb0eee792003-03-16 16:43:04 +0000263</p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000264
Brian Paulb0eee792003-03-16 16:43:04 +0000265<p>
266<b>3.</b>To test whether Mesa works properly you might want to run the
267Mesa demos:
268</p>
269<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000270 make check
Brian Paul0b27ace2003-03-08 17:38:57 +0000271</pre>
Brian Paulb0eee792003-03-16 16:43:04 +0000272<p>
273Builds all demos.
274</p>
275<pre>
276 make exec
277</pre>
278<p>
279Builds and executes all demos.
280</p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000281
282
283<a name="old">
284<H2>OLD-STYLE compilation and installation</H2>
285
286<p>
287This procedure usually works when <code>./configure ; make</code> fails.
288</p>
289
290<p>
291<b>Note</b>: If you tried <code>./configure ; make</code> but it failed,
292first copy the top-level <code>Makefile.X11</code> file over
293<code>Makefile</code>.
294</p>
295
296<p>
Brian Paulafc04282003-09-03 23:04:31 +0000297<B>Also Note</B>: if you've obtained Mesa directly from CVS you'll have
298to copy the top-level Makefile.X11 to Makefile.
299</p>
300
301<p>
Brian Paulb0eee792003-03-16 16:43:04 +0000302Just type <code>make</code> alone.
Brian Paul0b27ace2003-03-08 17:38:57 +0000303You'll see a list of supported system configurations.
Brian Paulb0eee792003-03-16 16:43:04 +0000304Choose one and type <code>make</code> <em>config</em>
305(for example <code>make linux-x86</code>).
Brian Paul0b27ace2003-03-08 17:38:57 +0000306The Mesa libraries and demo programs will be compiled.
307</p>
308
309<H3>Header and library files</H3>
310
311<p>
312The standard location for the OpenGL header files on Unix-type systems is
313in <code>/usr/include/GL/</code>.
314The standard location for the libraries is <code>/usr/lib/</code>.
315For more information see, the
316<a href="http://oss.sgi.com/projects/ogl-sample/ABI/" target="_parent">
317Linux/OpenGL ABI specification</a>.
318</p>
319
320<p>
321If you'd like Mesa to co-exist with another implementation of OpenGL that's
322already installed, you'll have to choose different directories, like
323<code>/usr/local/include/GL/</code> and <code>/usr/local/lib/</code>.
324</p>
325
326<p>
327To install the Mesa headers, do this:
328<pre>
329 cp -r include/GL /usr/include
330</pre>
331
332<p>
333To install the Mesa libraries, do this:
334</p>
335<pre>
336 cp -pd lib/* /usr/lib
337
338 (The -pd options preserve symbolic links)
339</pre>
340
341<H3>LD_LIBRARY_PATH</H3>
342
343<p>
344On Linux and similar operating systems the <code>LD_LIBRARY_PATH</code>
345environment variable can be used to indicate a list of directories to
346search for shared libraries.
347If you don't install Mesa in <code>/usr/lib/</code> you may have to
348set the <code>LD_LIBRARY_PATH</code> variable in order to use the Mesa
349libraries.
350</p>
351
352</body>
353</html>