1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html lang="en">
3<head>
4  <meta http-equiv="content-type" content="text/html; charset=utf-8">
5  <title>Compilation and Installation using Autoconf</title>
6  <link rel="stylesheet" type="text/css" href="mesa.css">
7</head>
8<body>
9
10<h1>Compilation and Installation using Autoconf</h1>
11
12<ol>
13<li><p><a href="#basic">Basic Usage</a></li>
14<li><p><a href="#driver">Driver Options</a>
15  <ul>
16  <li><a href="#xlib">Xlib Driver Options</a></li>
17  <li><a href="#dri">DRI Driver Options</a></li>
18  <li><a href="#osmesa">OSMesa Driver Options</a></li>
19  </ul>
20<li><p><a href="#demos">Demo Program Options</a>
21</ol>
22
23
24<h2 id="basic">1. Basic Usage</h2>
25
26<p>
27The autoconf generated configure script can be used to guess your
28platform and change various options for building Mesa. To use the
29configure script, type:
30</p>
31
32<pre>
33    /configure
34</pre>
35
36<p>
37To see a short description of all the options, type <code>/configure
38--help</code>. If you are using a development snapshot and the configure
39script does not exist, type <code>/autogen.sh</code> to generate it
40first. If you know the options you want to pass to
41<code>configure</code>, you can pass them to <code>autogen.sh</code>. It
42will run <code>configure</code> with these options after it is
43generated. Once you have run <code>configure</code> and set the options
44to your preference, type:
45</p>
46
47<pre>
48    make
49</pre>
50
51<p>
52This will produce libGL.so and several other libraries depending on the
53options you have chosen. Later, if you want to rebuild for a different
54configuration run <code>make realclean</code> before rebuilding.
55</p>
56
57<p>
58Some of the generic autoconf options are used with Mesa:
59
60<ul>
61<li><code>--prefix=PREFIX</code> - This is the root directory where
62files will be installed by <code>make install</code>. The default is
63<code>/usr/local</code>.
64</li>
65<li><code>--exec-prefix=EPREFIX</code> - This is the root directory
66where architecture-dependent files will be installed. In Mesa, this is
67only used to derive the directory for the libraries. The default is
68<code>${prefix}</code>.
69</li>
70<li><code>--libdir=LIBDIR</code> - This option specifies the directory
71where the GL libraries will be installed. The default is
72<code>${exec_prefix}/lib</code>. It also serves as the name of the
73library staging area in the source tree. For instance, if the option
74<code>--libdir=/usr/local/lib64</code> is used, the libraries will be
75created in a <code>lib64</code> directory at the top of the Mesa source
76tree.
77</li>
78<li><code>--enable-static, --disable-shared</code> - By default, Mesa
79will build shared libraries. Either of these options will force static
80libraries to be built. It is not currently possible to build static and
81shared libraries in a single pass.
82</li>
83<li><code>CC, CFLAGS, CXX, CXXFLAGS</code> - These environment variables
84control the C and C++ compilers used during the build. By default,
85<code>gcc</code> and <code>g++</code> are used with the options
86<code>"-g -O2"</code>.
87</li>
88<li><code>LDFLAGS</code> - An environment variable specifying flags to
89pass when linking programs. These are normally empty, but can be used
90to direct the linker to use libraries in nonstandard directories. For
91example, <code>LDFLAGS="-L/usr/X11R6/lib"</code>.
92</li>
93<li><code>PKG_CONFIG_PATH</code> - When available, the
94<code>pkg-config</code> utility is used to search for external libraries
95on the system. This environment variable is used to control the search
96path for <code>pkg-config</code>. For instance, setting
97<code>PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig</code> will search for
98package metadata in <code>/usr/X11R6</code> before the standard
99directories.
100</li>
101</ul>
102
103<p>
104There are also a few general options for altering the Mesa build:
105<ul>
106<li><code>--with-x</code> - When the X11 development libraries are
107needed, the <code>pkg-config</code> utility <a href="#pkg-config">will
108be used</a> for locating them. If they cannot be found through
109<code>pkg-config</code> a fallback routing using <code>imake</code> will
110be used. In this case, the <code>--with-x</code>,
111<code>--x-includes</code> and <code>--x-libraries</code> options can
112control the use of X for Mesa.
113</li>
114<li><code>--enable-gl-osmesa</code> - The <a href="osmesa.html">OSMesa
115library</a> can be built on top of libGL for drivers that provide it.
116This option controls whether to build libOSMesa. By default, this is
117enabled for the Xlib driver and disabled otherwise. Note that this
118option is different than using OSMesa as the driver.
119</li>
120<li><code>--enable-debug</code> - This option will enable compiler
121options and macros to aid in debugging the Mesa libraries.
122</li>
123<li><code>--disable-asm</code> - There are assembly routines
124available for a few architectures. These will be used by default if
125one of these architectures is detected. This option ensures that
126assembly will not be used.
127</li>
128<li><code>--enable-32-bit, --enable-64-bit</code> - By default, the
129build will compile code as directed by the environment variables
130<code>CC</code>, <code>CFLAGS</code>, etc. If the compiler is
131<code>gcc</code>, these options offer a helper to add the compiler flags
132to force 32- or 64-bit code generation as used on the x86 and x86_64
133architectures.
134</li>
135</ul>
136
137
138<h2 id="driver">2. Driver Options</h2>
139
140<p>
141There are several different driver modes that Mesa can use. These are
142described in more detail in the <a href="install.html">basic
143installation instructions</a>. The Mesa driver is controlled through the
144configure option --with-driver. There are currently three supported
145options in the configure script.
146</p>
147
148<h3 id="xlib">Xlib</h3><p>This is the default mode for building Mesa.
149It uses Xlib as a software renderer to do all rendering. It corresponds
150to the option <code>--with-driver=xlib</code>. The libX11 and libXext
151libraries, as well as the X11 development headers, will be need to
152support the Xlib driver.
153
154<h3 id="dri">DRI</h3><p>This mode uses the DRI hardware drivers for
155accelerated OpenGL rendering. Enable the DRI drivers with the option
156<code>--with-driver=dri</code>. See the <a href="install.html">basic
157installation instructions</a> for details on prerequisites for the DRI
158drivers.
159
160<!-- DRI specific options -->
161<dl>
162<dt><code>--with-dri-driverdir=DIR</code>
163<dd><p> This option specifies the
164location the DRI drivers will be installed to and the location libGL
165will search for DRI drivers. The default is <code>${libdir}/dri</code>.
166<dt><code>--with-dri-drivers=DRIVER,DRIVER,...</code>
167<dd><p> This option
168allows a specific set of DRI drivers to be built. For example,
169<code>--with-dri-drivers="swrast,i965,radeon,nouveau"</code>. By
170default, the drivers will be chosen depending on the target platform.
171See the directory <code>src/mesa/drivers/dri</code> in the source tree
172for available drivers. Beware that the swrast DRI driver is used by both
173libGL and the X.Org xserver GLX module to do software rendering, so you
174may run into problems if it is not available.
175<!-- This explanation might be totally bogus. Kristian? -->
176<dt><code>--disable-driglx-direct</code>
177<dd><p> Disable direct rendering in
178GLX. Normally, direct hardware rendering through the DRI drivers and
179indirect software rendering are enabled in GLX. This option disables
180direct rendering entirely. It can be useful on architectures where
181kernel DRM modules are not available.
182<dt><code>--enable-glx-tls</code> <dd><p>
183Enable Thread Local Storage (TLS) in
184GLX.
185<dt><code>--with-expat=DIR</code> <dd> The DRI-enabled libGL uses expat to
186parse the DRI configuration files in <code>/etc/drirc</code> and
187<code>~/.drirc</code>. This option allows a specific expat installation
188to be used. For example, <code>--with-expat=/usr/local</code> will
189search for expat headers and libraries in <code>/usr/local/include</code>
190and <code>/usr/local/lib</code>, respectively.
191</dl>
192
193<h3 id="osmesa">OSMesa </h3><p> No libGL is built in this
194mode. Instead, the driver code is built into the Off-Screen Mesa
195(OSMesa) library. See the <a href="osmesa.html">Off-Screen Rendering</a>
196page for more details.
197
198<!-- OSMesa specific options -->
199<dl>
200<dt><code>--with-osmesa-bits=BITS</code>
201<dd><p> This option allows the size
202of the color channel in bits to be specified. By default, an 8-bit
203channel will be used, and the driver will be named libOSMesa. Other
204options are 16- and 32-bit color channels, which will add the bit size
205to the library name. For example, <code>--with-osmesa-bits=16</code>
206will create the libOSMesa16 library with a 16-bit color channel.
207</dl>
208
209
210<h2 id="library">3. Library Options</h2>
211
212<p>
213The configure script provides more fine grained control over the GL
214libraries that will be built. More details on the specific GL libraries
215can be found in the <a href="install.html">basic installation
216instructions</a>.
217
218
219<h2 id="demos">4. Demo Program Options</h2>
220
221<p>
222There are many demonstration programs in the MesaDemos tarball. If the
223programs are available when <code>/configure</code> is run, a subset of
224the programs will be built depending on the driver and library options
225chosen. See the directory <code>progs</code> for the full set of demos.
226
227<dl>
228<dt><code>--with-demos=DEMOS,DEMOS,...</code>
229<dd><p> This option allows a
230specific set of demo programs to be built. For example,
231<code>--with-demos="xdemos,slang"</code>. Beware that if this option is
232used, it will not be ensured that the necessary GL libraries will be
233available.
234<dt><code>--without-demos</code> <dd><p> This completely disables building the
235demo programs. It is equivalent to <code>--with-demos=no</code>.
236</dl>
237
238</body>
239</html>
240