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