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