• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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<div class="header">
11  <h1>The Mesa 3D Graphics Library</h1>
12</div>
13
14<iframe src="contents.html"></iframe>
15<div class="content">
16
17<h1>Compilation and Installation using Autoconf</h1>
18
19<ol>
20<li><p><a href="#basic">Basic Usage</a></li>
21<li><p><a href="#driver">Driver Options</a>
22  <ul>
23  <li><a href="#xlib">Xlib Driver Options</a></li>
24  <li><a href="#dri">DRI Driver Options</a></li>
25  <li><a href="#osmesa">OSMesa Driver Options</a></li>
26  </ul>
27</ol>
28
29
30<h2 id="basic">1. Basic Usage</h2>
31
32<p>
33The autoconf generated configure script can be used to guess your
34platform and change various options for building Mesa. To use the
35configure script, type:
36</p>
37
38<pre>
39    ./configure
40</pre>
41
42<p>
43To see a short description of all the options, type <code>./configure
44--help</code>. If you are using a development snapshot and the configure
45script does not exist, type <code>./autogen.sh</code> to generate it
46first. If you know the options you want to pass to
47<code>configure</code>, you can pass them to <code>autogen.sh</code>. It
48will run <code>configure</code> with these options after it is
49generated. Once you have run <code>configure</code> and set the options
50to your preference, type:
51</p>
52
53<pre>
54    make
55</pre>
56
57<p>
58This will produce libGL.so and/or several other libraries depending on the
59options you have chosen. Later, if you want to rebuild for a different
60configuration run <code>make realclean</code> before rebuilding.
61</p>
62
63<p>
64Some of the generic autoconf options are used with Mesa:
65</p>
66<dl>
67<dt><code>--prefix=PREFIX</code></dt>
68<dd><p>This is the root directory where
69files will be installed by <code>make install</code>. The default is
70<code>/usr/local</code>.</p>
71</dd>
72
73<dt><code>--exec-prefix=EPREFIX</code></dt>
74<dd><p>This is the root directory
75where architecture-dependent files will be installed. In Mesa, this is
76only used to derive the directory for the libraries. The default is
77<code>${prefix}</code>.</p>
78</dd>
79
80<dt><code>--libdir=LIBDIR</code></dt>
81<dd><p>This option specifies the directory
82where the GL libraries will be installed. The default is
83<code>${exec_prefix}/lib</code>. It also serves as the name of the
84library staging area in the source tree. For instance, if the option
85<code>--libdir=/usr/local/lib64</code> is used, the libraries will be
86created in a <code>lib64</code> directory at the top of the Mesa source
87tree.</p>
88</dd>
89
90<dt><code>--sysconfdir=DIR</code></dt>
91<dd><p>This option specifies the directory where the configuration
92files will be installed. The default is <code>${prefix}/etc</code>.
93Currently there's only one config file provided when dri drivers are
94enabled - it's <code>drirc</code>.</p>
95</dd>
96
97<dt><code>--enable-static, --disable-shared</code></dt>
98<dd><p>By default, Mesa
99will build shared libraries. Either of these options will force static
100libraries to be built. It is not currently possible to build static and
101shared libraries in a single pass.</p>
102</dd>
103
104<dt><code>CC, CFLAGS, CXX, CXXFLAGS</code></dt>
105<dd><p>These environment variables
106control the C and C++ compilers used during the build. By default,
107<code>gcc</code> and <code>g++</code> are used and the debug/optimisation
108level is left unchanged.</p>
109</dd>
110
111<dt><code>LDFLAGS</code></dt>
112<dd><p>An environment variable specifying flags to
113pass when linking programs. These should be empty and
114<code>PKG_CONFIG_PATH</code> is recommended to be used instead. If needed
115it can be used to direct the linker to use libraries in nonstandard
116directories. For example, <code>LDFLAGS="-L/usr/X11R6/lib"</code>.</p>
117</dd>
118
119<dt><code>PKG_CONFIG_PATH</code></dt>
120<dd><p>The
121<code>pkg-config</code> utility is a hard requirement for configuring and
122building mesa. It is used to search for external libraries
123on the system. This environment variable is used to control the search
124path for <code>pkg-config</code>. For instance, setting
125<code>PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig</code> will search for
126package metadata in <code>/usr/X11R6</code> before the standard
127directories.</p>
128</dd>
129</dl>
130
131<p>
132There are also a few general options for altering the Mesa build:
133</p>
134<dl>
135<dt><code>--enable-debug</code></dt>
136<dd><p>This option will set the compiler debug/optimisation levels (if the user
137hasn't already set them via the CFLAGS/CXXFLAGS) and macros to aid in
138debugging the Mesa libraries.</p>
139
140<p>Note that enabling this option can lead to noticeable loss of performance.</p>
141
142<dt><code>--disable-asm</code></dt>
143<dd><p>There are assembly routines
144available for a few architectures. These will be used by default if
145one of these architectures is detected. This option ensures that
146assembly will not be used.</p>
147</dd>
148
149<dt><code>--build=</code></dt>
150<dt><code>--host=</code></dt>
151<dd><p>By default, the build will compile code for the architecture that
152it's running on. In order to build cross-compile Mesa on a x86-64 machine
153that is to run on a i686, one would need to set the options to:</p>
154
155<p><code>--build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu</code></p>
156
157Note that these can vary from distribution to distribution. For more
158information check with the
159<a href="https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Specifying-Target-Triplets.html">
160autoconf manual</a>.
161Note that you will need to correctly set <code>PKG_CONFIG_PATH</code> as well.
162
163
164<p>In some cases a single compiler is capable of handling both architectures
165(multilib) in that case one would need to set the <code>CC,CXX</code> variables
166appending the correct machine options. Seek your compiler documentation for
167further information -
168<a href="https://gcc.gnu.org/onlinedocs/gcc/Submodel-Options.html"> gcc
169machine dependent options</a></p>
170
171<p>In addition to specifying correct <code>PKG_CONFIG_PATH</code> for the target
172architecture, the following should be sufficient to configure multilib Mesa</p>
173
174<code>./configure CC="gcc -m32" CXX="g++ -m32" --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu ...</code>
175</dd>
176</dl>
177
178
179<h2 id="driver">2. GL Driver Options</h2>
180
181<p>
182There are several different driver modes that Mesa can use. These are
183described in more detail in the <a href="install.html">basic
184installation instructions</a>. The Mesa driver is controlled through the
185configure options <code>--enable-glx</code> and <code>--enable-osmesa</code>
186</p>
187
188<h3 id="xlib">Xlib</h3><p>
189It uses Xlib as a software renderer to do all rendering. It corresponds
190to the option <code>--enable-glx=xlib</code> or <code>--enable-glx=gallium-xlib</code>.
191
192<h3 id="dri">DRI</h3><p>This mode uses the DRI hardware drivers for
193accelerated OpenGL rendering. To enable use <code>--enable-glx=dri
194--enable-dri</code>.
195
196<!-- DRI specific options -->
197<dl>
198<dt><code>--with-dri-driverdir=DIR</code>
199<dd><p> This option specifies the
200location the DRI drivers will be installed to and the location libGL
201will search for DRI drivers. The default is <code>${libdir}/dri</code>.
202<dt><code>--with-dri-drivers=DRIVER,DRIVER,...</code>
203<dd><p> This option
204allows a specific set of DRI drivers to be built. For example,
205<code>--with-dri-drivers="swrast,i965,radeon,nouveau"</code>. By
206default, the drivers will be chosen depending on the target platform.
207See the directory <code>src/mesa/drivers/dri</code> in the source tree
208for available drivers. Beware that the swrast DRI driver is used by both
209libGL and the X.Org xserver GLX module to do software rendering, so you
210may run into problems if it is not available.
211<!-- This explanation might be totally bogus. Kristian? -->
212<dt><code>--disable-driglx-direct</code>
213<dd><p> Disable direct rendering in
214GLX. Normally, direct hardware rendering through the DRI drivers and
215indirect software rendering are enabled in GLX. This option disables
216direct rendering entirely. It can be useful on architectures where
217kernel DRM modules are not available.
218<dt><code>--enable-glx-tls</code> <dd><p>
219Enable Thread Local Storage (TLS) in
220GLX.
221<dt><code>--with-expat=DIR</code>
222<dd><p><strong>DEPRECATED</strong>, use <code>PKG_CONFIG_PATH</code> instead.</p>
223<p>The DRI-enabled libGL uses expat to
224parse the DRI configuration files in <code>${sysconfdir}/drirc</code> and
225<code>~/.drirc</code>. This option allows a specific expat installation
226to be used. For example, <code>--with-expat=/usr/local</code> will
227search for expat headers and libraries in <code>/usr/local/include</code>
228and <code>/usr/local/lib</code>, respectively.
229</dl>
230
231<h3 id="osmesa">OSMesa </h3><p> No libGL is built in this
232mode. Instead, the driver code is built into the Off-Screen Mesa
233(OSMesa) library. See the <a href="osmesa.html">Off-Screen Rendering</a>
234page for more details.  It corresponds to the option
235<code>--enable-osmesa</code>.
236
237<!-- OSMesa specific options -->
238<dl>
239<dt><code>--with-osmesa-bits=BITS</code>
240<dd><p> This option allows the size
241of the color channel in bits to be specified. By default, an 8-bit
242channel will be used, and the driver will be named libOSMesa. Other
243options are 16- and 32-bit color channels, which will add the bit size
244to the library name. For example, <code>--with-osmesa-bits=16</code>
245will create the libOSMesa16 library with a 16-bit color channel.
246</dl>
247
248
249<h2 id="library">3. Library Options</h2>
250
251<p>
252The configure script provides more fine grained control over the libraries
253that will be built.
254
255</div>
256</body>
257</html>
258