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