blob: f126097bba2313be28a27804c6c74c46b2f4ebd9 [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.
34</dd>
35</dl>
36
37<p>
38<B>NOTE</b>: The GLUT library and demonstrations programs are in the
39MesaDemos-x.y.z.tar.gz file. If you don't have GLUT or you want to
40run some demos, download the MesaDemos package too.
41</p>
42
43<p>
44In either case, building Mesa entails the following:
45<p>
46<ul>
47<li>Compiling libGL, the OpenGL-replacement library.
48<li>Compiling libGLU, the OpenGL Utility library.
49<li>Compiling libglut, the GLUT library (if you downloaded the Mesa demos
50package)
51<li>Compiling the demonstration programs in the directories:
52<code>demos, xdemos, samples</code> and <code>book</code>
53(if you downloaded the Mesa demos package.)
54</ul>
55
56
57<a name="new">
58<H2>NEW-STYLE compilation and installation</H2>
59
Brian Paulb0eee792003-03-16 16:43:04 +000060<p>
61<b> 0.</b> If you've downloaded Mesa via CVS there will not be a "configure"
Brian Paul0b27ace2003-03-08 17:38:57 +000062 script. You'll have to run the "bootstrap" script first. This script
63 may not work on any OS other than Linux. You'll need these programs
64 to run the bootstrap script:
Brian Paulb0eee792003-03-16 16:43:04 +000065</p>
Brian Paul0b27ace2003-03-08 17:38:57 +000066
Brian Paulb0eee792003-03-16 16:43:04 +000067<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000068 autoconf 2.50
69 automake 1.4-p2
70 libtool 1.4
Brian Paulb0eee792003-03-16 16:43:04 +000071</pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000072
Brian Paulb0eee792003-03-16 16:43:04 +000073<p>
74<b>1.</b> Run the configure script
75</p>
Brian Paul0b27ace2003-03-08 17:38:57 +000076
Brian Paulb0eee792003-03-16 16:43:04 +000077<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000078 ./configure [options]
Brian Paulb0eee792003-03-16 16:43:04 +000079</pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000080
Brian Paulb0eee792003-03-16 16:43:04 +000081<p>
Brian Paul0b27ace2003-03-08 17:38:57 +000082For Linux, it is recommended that you use:
Brian Paulb0eee792003-03-16 16:43:04 +000083</p>
84<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +000085 ./configure --prefix=/usr
Brian Paulb0eee792003-03-16 16:43:04 +000086</pre>
87
Brian Paul0b27ace2003-03-08 17:38:57 +000088So that the headers and libs are located according to the Linux/OpenGL
89standard spec at http://oss.sgi.com/projects/ogl-sample/ABI/
Brian Paulb0eee792003-03-16 16:43:04 +000090</p>
91<p>
92For Red Hat 8.0, Mandrake 9.1 and other Linux distros, you may have to use
93the following:
94</p>
95<pre>
96 export LDFLAGS="-lstdc++" ; ./configure --prefix=/usr
97 or
98 setenv LDFLAGS -lstdc++ ; ./configure --prefix=/usr
99</pre>
100<p>
101This works around a problem when building the GLU library. It needs to
102be linked with the C++ runtime library, but libtool (for some reason)
103doesn't do this.
104</p>
105<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000106Possible options are:
107
108--prefix=DIR
109 The toplevel directory of the hierachy in which Mesa
110 will be installed (DIR/include,DIR/lib etc.).
111 The default is "/usr/local".
112
113--sysconfdir=DIR
114 The directory where Mesa configuration files
115 will be stored. The default is "$prefix/etc".
116 You may want to overwrite the default with --sysconfdir=/etc.
117
118--enable-static
119 Enable building of static libraries.
120 Static libraries are NOT built by default.
121
122--disable-shared
123 Disable building of shared libraries.
124 Shared libraries are built by default.
125
126--with-pic
127--without-pic
128 In normal operation, libtool will build shared libraries from
129 PIC objects and static archives from non-PIC objects, except where one
130 or the other is not provided by the target host. By specifying
131 --with-pic you are asking libtool to build static archives from
132 PIC objects, and similarly by specifying --without-pic you are asking
133 libtool to build shared libraries from non-PIC objects.
134 libtool will only honour this flag where it will produce a
135 working library, otherwise it reverts to the default.
136
137--enable-debug
138 Enable debugging messages (disabled by default).
139
140--enable-profile
141 Enable profiling (disabled by default).
142
143--disable-optimize
144 Disable extra optimizations (enabled by default,
145 i.e., optimize for maximum performance).
146
147--enable-warn
148 Enable extended compiler warnings (disabled by default).
149
150--enable-x86[=ARG]
151--disable-x86
152 Enable/disable x86 assembler support to speed up Mesa
153 (autodetected by default). You may set `on' or `off'.
154
155--enable-3dnow[=ARG]
156--disable-3dnow
157 Enable/disable 3Dnow support to speed up Mesa
158 (autodetected by default). You may set `on' or `off'.
159
160--enable-mmx[=ARG]
161--disable-mmx
162 Enable/disable MMX support to speed up Mesa
163 (autodetected by default). You may set `on' or `off'.
164
165--enable-sse[=ARG]
166--disable-sse
167 Enable/disable SSE support to speed up Mesa
168 (autodetected by default). You may set `on' or `off'.
169 If you have a PentiumIII and want to use SSE make sure you have the
170 PIII Linux kernel-patch installed or things will fail!
171 You can get the patch from http://www.redhat.com/~dledford/linux_kernel.html
172
173--with-glide[=DIR]
174--without-glide
175 Enable/disable support for Glide (disabled by default).
176 DIR is the installation directory of Glide.
177 If Glide cannot be found, the driver won't be built.
178
179--with-glut[=DIR]
180--without-glut
181 Don't/use already-installed GLUT (autodetected by default).
182 DIR is the installation directory of Glut.
183 If GLUT cannot be found, the version shipped with Mesa will be built.
184
185--with-ggi[=DIR]
186--without-ggi
187 Enable/disable support for GGI (autodetected by default).
188 DIR is the installation directory of GGI.
189 If GGI cannot be found, the driver won't be built.
190
191--disable-ggi-fbdev
192 Don't build the GGI fbdev target (autodetected by default).
193
194--disable-ggi-genkgi
195 Don't build the GGI generic KGI driver (autodetected by default).
196
197--disable-ggi-savage4
198 Don't build the GGI Savage4 KGI driver (autodetected by default).
199
200--disable-osmesa
201 Disable OSmesa (offscreen rendering) support (enabled by default).
202
203--with-svga[=DIR]
204--without-svga
205 Enable/disable support for SVGALib (autodetected by default).
206 DIR is the installation directory of SVGALib.
207 If SVGALib cannot be found, the driver won't be built.
208
209--x-includes=DIR
210 Search for the X include files in DIR.
211
212--x-libraries=DIR
213 Search for the X library files in DIR.
Brian Paulb0eee792003-03-16 16:43:04 +0000214</pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000215
Brian Paulb0eee792003-03-16 16:43:04 +0000216<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000217User specific compiler options can be set using the shell variable
218CFLAGS. For instance,
Brian Paulb0eee792003-03-16 16:43:04 +0000219</p>
220<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000221 CFLAGS="-g -O2" ./configure
Brian Paulb0eee792003-03-16 16:43:04 +0000222</pre>
223<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000224(on some systems: env CFLAGS="-g -O2" ./configure)
225sets the compiler flags to "-g -O2".
Brian Paulb0eee792003-03-16 16:43:04 +0000226</p>
227<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000228For more options run "./configure --help" and read INSTALL.GNU.
Brian Paulb0eee792003-03-16 16:43:04 +0000229</p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000230
Brian Paulb0eee792003-03-16 16:43:04 +0000231<p>
232<b>2.</b> To build the Mesa libraries run:
233</p>
234<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000235 make
Brian Paulb0eee792003-03-16 16:43:04 +0000236</pre>
237<p>
238When finished, libGL.so will be in src/.libs/ and libGLU.so will be in
Brian Paul0b27ace2003-03-08 17:38:57 +0000239si-glu/.libs/, etc.
Brian Paulb0eee792003-03-16 16:43:04 +0000240</p>
241<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000242Optionally, you can strip the libraries using
Brian Paulb0eee792003-03-16 16:43:04 +0000243</p>
244<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000245 make strip
Brian Paulb0eee792003-03-16 16:43:04 +0000246</pre>
247<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000248Now make sure that you have the permissions to install Mesa in the
249specified directories, for example, by becoming super user ("su")
250Then run:
Brian Paulb0eee792003-03-16 16:43:04 +0000251</p>
252<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000253 make install
Brian Paulb0eee792003-03-16 16:43:04 +0000254</pre>
255<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000256Mesa is now installed.
257Please don't move the installed files but rerun all installation
258steps if you want to use other directories.
Brian Paulb0eee792003-03-16 16:43:04 +0000259</p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000260
Brian Paulb0eee792003-03-16 16:43:04 +0000261<p>
262<b>3.</b>To test whether Mesa works properly you might want to run the
263Mesa demos:
264</p>
265<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000266 make check
Brian Paul0b27ace2003-03-08 17:38:57 +0000267</pre>
Brian Paulb0eee792003-03-16 16:43:04 +0000268<p>
269Builds all demos.
270</p>
271<pre>
272 make exec
273</pre>
274<p>
275Builds and executes all demos.
276</p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000277
278
279<a name="old">
280<H2>OLD-STYLE compilation and installation</H2>
281
282<p>
283This procedure usually works when <code>./configure ; make</code> fails.
284</p>
285
286<p>
287<b>Note</b>: If you tried <code>./configure ; make</code> but it failed,
288first copy the top-level <code>Makefile.X11</code> file over
289<code>Makefile</code>.
290</p>
291
292<p>
Brian Paulb0eee792003-03-16 16:43:04 +0000293Just type <code>make</code> alone.
Brian Paul0b27ace2003-03-08 17:38:57 +0000294You'll see a list of supported system configurations.
Brian Paulb0eee792003-03-16 16:43:04 +0000295Choose one and type <code>make</code> <em>config</em>
296(for example <code>make linux-x86</code>).
Brian Paul0b27ace2003-03-08 17:38:57 +0000297The Mesa libraries and demo programs will be compiled.
298</p>
299
300<H3>Header and library files</H3>
301
302<p>
303The standard location for the OpenGL header files on Unix-type systems is
304in <code>/usr/include/GL/</code>.
305The standard location for the libraries is <code>/usr/lib/</code>.
306For more information see, the
307<a href="http://oss.sgi.com/projects/ogl-sample/ABI/" target="_parent">
308Linux/OpenGL ABI specification</a>.
309</p>
310
311<p>
312If you'd like Mesa to co-exist with another implementation of OpenGL that's
313already installed, you'll have to choose different directories, like
314<code>/usr/local/include/GL/</code> and <code>/usr/local/lib/</code>.
315</p>
316
317<p>
318To install the Mesa headers, do this:
319<pre>
320 cp -r include/GL /usr/include
321</pre>
322
323<p>
324To install the Mesa libraries, do this:
325</p>
326<pre>
327 cp -pd lib/* /usr/lib
328
329 (The -pd options preserve symbolic links)
330</pre>
331
332<H3>LD_LIBRARY_PATH</H3>
333
334<p>
335On Linux and similar operating systems the <code>LD_LIBRARY_PATH</code>
336environment variable can be used to indicate a list of directories to
337search for shared libraries.
338If you don't install Mesa in <code>/usr/lib/</code> you may have to
339set the <code>LD_LIBRARY_PATH</code> variable in order to use the Mesa
340libraries.
341</p>
342
343</body>
344</html>