blob: 605b6581551bc21f522b3dc34c16cdea8e931472 [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>
Brian Paul8412c602003-04-01 15:33:08 +0000237<p>(on some systems you may need to run <code>gmake</code> or
238<code>gnumake</code> instead)
239</p>
Brian Paulb0eee792003-03-16 16:43:04 +0000240<p>
241When finished, libGL.so will be in src/.libs/ and libGLU.so will be in
Brian Paul0b27ace2003-03-08 17:38:57 +0000242si-glu/.libs/, etc.
Brian Paulb0eee792003-03-16 16:43:04 +0000243</p>
244<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000245Optionally, you can strip the libraries using
Brian Paulb0eee792003-03-16 16:43:04 +0000246</p>
247<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000248 make strip
Brian Paulb0eee792003-03-16 16:43:04 +0000249</pre>
250<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000251Now make sure that you have the permissions to install Mesa in the
252specified directories, for example, by becoming super user ("su")
253Then run:
Brian Paulb0eee792003-03-16 16:43:04 +0000254</p>
255<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000256 make install
Brian Paulb0eee792003-03-16 16:43:04 +0000257</pre>
258<p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000259Mesa is now installed.
260Please don't move the installed files but rerun all installation
261steps if you want to use other directories.
Brian Paulb0eee792003-03-16 16:43:04 +0000262</p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000263
Brian Paulb0eee792003-03-16 16:43:04 +0000264<p>
265<b>3.</b>To test whether Mesa works properly you might want to run the
266Mesa demos:
267</p>
268<pre>
Brian Paul0b27ace2003-03-08 17:38:57 +0000269 make check
Brian Paul0b27ace2003-03-08 17:38:57 +0000270</pre>
Brian Paulb0eee792003-03-16 16:43:04 +0000271<p>
272Builds all demos.
273</p>
274<pre>
275 make exec
276</pre>
277<p>
278Builds and executes all demos.
279</p>
Brian Paul0b27ace2003-03-08 17:38:57 +0000280
281
282<a name="old">
283<H2>OLD-STYLE compilation and installation</H2>
284
285<p>
286This procedure usually works when <code>./configure ; make</code> fails.
287</p>
288
289<p>
290<b>Note</b>: If you tried <code>./configure ; make</code> but it failed,
291first copy the top-level <code>Makefile.X11</code> file over
292<code>Makefile</code>.
293</p>
294
295<p>
Brian Paulb0eee792003-03-16 16:43:04 +0000296Just type <code>make</code> alone.
Brian Paul0b27ace2003-03-08 17:38:57 +0000297You'll see a list of supported system configurations.
Brian Paulb0eee792003-03-16 16:43:04 +0000298Choose one and type <code>make</code> <em>config</em>
299(for example <code>make linux-x86</code>).
Brian Paul0b27ace2003-03-08 17:38:57 +0000300The Mesa libraries and demo programs will be compiled.
301</p>
302
303<H3>Header and library files</H3>
304
305<p>
306The standard location for the OpenGL header files on Unix-type systems is
307in <code>/usr/include/GL/</code>.
308The standard location for the libraries is <code>/usr/lib/</code>.
309For more information see, the
310<a href="http://oss.sgi.com/projects/ogl-sample/ABI/" target="_parent">
311Linux/OpenGL ABI specification</a>.
312</p>
313
314<p>
315If you'd like Mesa to co-exist with another implementation of OpenGL that's
316already installed, you'll have to choose different directories, like
317<code>/usr/local/include/GL/</code> and <code>/usr/local/lib/</code>.
318</p>
319
320<p>
321To install the Mesa headers, do this:
322<pre>
323 cp -r include/GL /usr/include
324</pre>
325
326<p>
327To install the Mesa libraries, do this:
328</p>
329<pre>
330 cp -pd lib/* /usr/lib
331
332 (The -pd options preserve symbolic links)
333</pre>
334
335<H3>LD_LIBRARY_PATH</H3>
336
337<p>
338On Linux and similar operating systems the <code>LD_LIBRARY_PATH</code>
339environment variable can be used to indicate a list of directories to
340search for shared libraries.
341If you don't install Mesa in <code>/usr/lib/</code> you may have to
342set the <code>LD_LIBRARY_PATH</code> variable in order to use the Mesa
343libraries.
344</p>
345
346</body>
347</html>