1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
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">
11 <h1>The Mesa
3D Graphics Library
</h1>
14 <iframe src=
"contents.html"></iframe>
17 <h1>Compilation and Installation using Autoconf
</h1>
20 <li><p><a href=
"#basic">Basic Usage
</a></li>
21 <li><p><a href=
"#driver">Driver Options
</a>
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>
30 <h2 id=
"basic">1. Basic Usage
</h2>
33 The autoconf generated configure script can be used to guess your
34 platform and change various options for building Mesa. To use the
35 configure script, type:
43 To see a short description of all the options, type
<code>./configure
44 --help
</code>. If you are using a development snapshot and the configure
45 script does not exist, type
<code>./autogen.sh
</code> to generate it
46 first. If you know the options you want to pass to
47 <code>configure
</code>, you can pass them to
<code>autogen.sh
</code>. It
48 will run
<code>configure
</code> with these options after it is
49 generated. Once you have run
<code>configure
</code> and set the options
50 to your preference, type:
58 This will produce libGL.so and several other libraries depending on the
59 options you have chosen. Later, if you want to rebuild for a different
60 configuration run
<code>make realclean
</code> before rebuilding.
64 Some of the generic autoconf options are used with Mesa:
67 <dt><code>--prefix=PREFIX
</code></dt>
68 <dd><p>This is the root directory where
69 files will be installed by
<code>make install
</code>. The default is
70 <code>/usr/local
</code>.
</p>
73 <dt><code>--exec-prefix=EPREFIX
</code></dt>
74 <dd><p>This is the root directory
75 where architecture-dependent files will be installed. In Mesa, this is
76 only used to derive the directory for the libraries. The default is
77 <code>${prefix}
</code>.
</p>
80 <dt><code>--libdir=LIBDIR
</code></dt>
81 <dd><p>This option specifies the directory
82 where the GL libraries will be installed. The default is
83 <code>${exec_prefix}/lib
</code>. It also serves as the name of the
84 library staging area in the source tree. For instance, if the option
85 <code>--libdir=/usr/local/lib64
</code> is used, the libraries will be
86 created in a
<code>lib64
</code> directory at the top of the Mesa source
90 <dt><code>--enable-static, --disable-shared
</code></dt>
91 <dd><p>By default, Mesa
92 will build shared libraries. Either of these options will force static
93 libraries to be built. It is not currently possible to build static and
94 shared libraries in a single pass.
</p>
97 <dt><code>CC, CFLAGS, CXX, CXXFLAGS
</code></dt>
98 <dd><p>These environment variables
99 control the C and C++ compilers used during the build. By default,
100 <code>gcc
</code> and
<code>g++
</code> are used and the debug/optimisation
101 level is left unchanged.
</p>
104 <dt><code>LDFLAGS
</code></dt>
105 <dd><p>An environment variable specifying flags to
106 pass when linking programs. These should be empty and
107 <code>PKG_CONFIG_PATH
</code> is recommended to be used instead. If needed
108 it can be used to direct the linker to use libraries in nonstandard
109 directories. For example,
<code>LDFLAGS=
"-L/usr/X11R6/lib"</code>.
</p>
112 <dt><code>PKG_CONFIG_PATH
</code></dt>
114 <code>pkg-config
</code> utility is a hard requirement for cofiguring and
115 building mesa. It is used to search for external libraries
116 on the system. This environment variable is used to control the search
117 path for
<code>pkg-config
</code>. For instance, setting
118 <code>PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig
</code> will search for
119 package metadata in
<code>/usr/X11R6
</code> before the standard
125 There are also a few general options for altering the Mesa build:
128 <dt><code>--enable-debug
</code></dt>
129 <dd><p>This option will enable compiler
130 options and macros to aid in debugging the Mesa libraries.
</p>
133 <dt><code>--disable-asm
</code></dt>
134 <dd><p>There are assembly routines
135 available for a few architectures. These will be used by default if
136 one of these architectures is detected. This option ensures that
137 assembly will not be used.
</p>
140 <dt><code>--build=
</code></dt>
141 <dt><code>--host=
</code></dt>
142 <dd><p>By default, the build will compile code for the architecture that
143 it's running on. In order to build cross-compile Mesa on a x86-
64 machine
144 that is to run on a i686, one would need to set the options to:
</p>
146 <p><code>--build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu
</code></p>
148 Note that these can vary from distribution to distribution. For more
149 information check with the
150 <a href=
"https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Specifying-Target-Triplets.html">
152 Note that you will need to correctly set
<code>PKG_CONFIG_PATH
</code> as well.
155 <p>In some cases a single compiler is capable of handling both architectures
156 (multilib) in that case one would need to set the
<code>CC,CXX
</code> variables
157 appending the correct machine options. Seek your compiler documentation for
158 further information -
159 <a href=
"https://gcc.gnu.org/onlinedocs/gcc/Submodel-Options.html"> gcc
160 machine dependent options
</a></p>
162 <p>In addition to specifying correct
<code>PKG_CONFIG_PATH
</code> for the target
163 architecture, the following should be sufficient to configure multilib Mesa
</p>
165 <code>./configure
CC=
"gcc -m32" CXX=
"g++ -m32" --build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu ...
</code>
170 <h2 id=
"driver">2. Driver Options
</h2>
173 There are several different driver modes that Mesa can use. These are
174 described in more detail in the
<a href=
"install.html">basic
175 installation instructions
</a>. The Mesa driver is controlled through the
176 configure options
<code>--enable-xlib-glx
</code>,
<code>--enable-osmesa
</code>,
177 and
<code>--enable-dri
</code>.
180 <h3 id=
"xlib">Xlib
</h3><p>
181 It uses Xlib as a software renderer to do all rendering. It corresponds
182 to the option
<code>--enable-xlib-glx
</code>. The libX11 and libXext
183 libraries, as well as the X11 development headers, will be need to
184 support the Xlib driver.
186 <h3 id=
"dri">DRI
</h3><p>This mode uses the DRI hardware drivers for
187 accelerated OpenGL rendering. Enable the DRI drivers with the option
188 <code>--enable-dri
</code>. See the
<a href=
"install.html">basic
189 installation instructions
</a> for details on prerequisites for the DRI
192 <!-- DRI specific options -->
194 <dt><code>--with-dri-driverdir=DIR
</code>
195 <dd><p> This option specifies the
196 location the DRI drivers will be installed to and the location libGL
197 will search for DRI drivers. The default is
<code>${libdir}/dri
</code>.
198 <dt><code>--with-dri-drivers=DRIVER,DRIVER,...
</code>
200 allows a specific set of DRI drivers to be built. For example,
201 <code>--with-dri-drivers=
"swrast,i965,radeon,nouveau"</code>. By
202 default, the drivers will be chosen depending on the target platform.
203 See the directory
<code>src/mesa/drivers/dri
</code> in the source tree
204 for available drivers. Beware that the swrast DRI driver is used by both
205 libGL and the X.Org xserver GLX module to do software rendering, so you
206 may run into problems if it is not available.
207 <!-- This explanation might be totally bogus. Kristian? -->
208 <dt><code>--disable-driglx-direct
</code>
209 <dd><p> Disable direct rendering in
210 GLX. Normally, direct hardware rendering through the DRI drivers and
211 indirect software rendering are enabled in GLX. This option disables
212 direct rendering entirely. It can be useful on architectures where
213 kernel DRM modules are not available.
214 <dt><code>--enable-glx-tls
</code> <dd><p>
215 Enable Thread Local Storage (TLS) in
217 <dt><code>--with-expat=DIR
</code>
218 <dd><p><strong>DEPRECATED
</strong>, use
<code>PKG_CONFIG_PATH
</code> instead.
</p>
219 <p>The DRI-enabled libGL uses expat to
220 parse the DRI configuration files in
<code>/etc/drirc
</code> and
221 <code>~/.drirc
</code>. This option allows a specific expat installation
222 to be used. For example,
<code>--with-expat=/usr/local
</code> will
223 search for expat headers and libraries in
<code>/usr/local/include
</code>
224 and
<code>/usr/local/lib
</code>, respectively.
227 <h3 id=
"osmesa">OSMesa
</h3><p> No libGL is built in this
228 mode. Instead, the driver code is built into the Off-Screen Mesa
229 (OSMesa) library. See the
<a href=
"osmesa.html">Off-Screen Rendering
</a>
230 page for more details. It corresponds to the option
231 <code>--enable-osmesa
</code>.
233 <!-- OSMesa specific options -->
235 <dt><code>--with-osmesa-bits=BITS
</code>
236 <dd><p> This option allows the size
237 of the color channel in bits to be specified. By default, an
8-bit
238 channel will be used, and the driver will be named libOSMesa. Other
239 options are
16- and
32-bit color channels, which will add the bit size
240 to the library name. For example,
<code>--with-osmesa-bits=
16</code>
241 will create the libOSMesa16 library with a
16-bit color channel.
245 <h2 id=
"library">3. Library Options
</h2>
248 The configure script provides more fine grained control over the GL
249 libraries that will be built. More details on the specific GL libraries
250 can be found in the
<a href=
"install.html">basic installation