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