The Mesa 3D Graphics Library

Compilation and Installation using Autoconf

  1. Basic Usage

  2. Driver Options

1. Basic Usage

The autoconf generated configure script can be used to guess your platform and change various options for building Mesa. To use the configure script, type:

    ./configure

To see a short description of all the options, type ./configure --help. If you are using a development snapshot and the configure script does not exist, type ./autogen.sh to generate it first. If you know the options you want to pass to configure, you can pass them to autogen.sh. It will run configure with these options after it is generated. Once you have run configure and set the options to your preference, type:

    make

This will produce libGL.so and several other libraries depending on the options you have chosen. Later, if you want to rebuild for a different configuration run make realclean before rebuilding.

Some of the generic autoconf options are used with Mesa:

--prefix=PREFIX

This is the root directory where files will be installed by make install. The default is /usr/local.

--exec-prefix=EPREFIX

This is the root directory where architecture-dependent files will be installed. In Mesa, this is only used to derive the directory for the libraries. The default is ${prefix}.

--libdir=LIBDIR

This option specifies the directory where the GL libraries will be installed. The default is ${exec_prefix}/lib. It also serves as the name of the library staging area in the source tree. For instance, if the option --libdir=/usr/local/lib64 is used, the libraries will be created in a lib64 directory at the top of the Mesa source tree.

--enable-static, --disable-shared

By default, Mesa will build shared libraries. Either of these options will force static libraries to be built. It is not currently possible to build static and shared libraries in a single pass.

CC, CFLAGS, CXX, CXXFLAGS

These environment variables control the C and C++ compilers used during the build. By default, gcc and g++ are used and the debug/optimisation level is left unchanged.

LDFLAGS

An environment variable specifying flags to pass when linking programs. These should be empty and PKG_CONFIG_PATH is recommended to be used instead. If needed it can be used to direct the linker to use libraries in nonstandard directories. For example, LDFLAGS="-L/usr/X11R6/lib".

PKG_CONFIG_PATH

The pkg-config utility is a hard requirement for cofiguring and building mesa. It is used to search for external libraries on the system. This environment variable is used to control the search path for pkg-config. For instance, setting PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig will search for package metadata in /usr/X11R6 before the standard directories.

There are also a few general options for altering the Mesa build:

--enable-debug

This option will enable compiler option# Provide compatibility with scripts for the old Mesa build system for # a while by putting a link to the driver into /lib of the build tree. if BUILD_SHARED if HAVE_COMPAT_SYMLINKS all-local : .install-gallium-links .install-gallium-links : $(dri_LTLIBRARIES) $(egl_LTLIBRARIES) $(lib_LTLIBRARIES) $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); \ link_dir=$(top_builddir)/$(LIB_DIR)/gallium; \ if test x$(egl_LTLIBRARIES) != x; then \ link_dir=$(top_builddir)/$(LIB_DIR)/egl; \ fi; \ $(MKDIR_P) $$link_dir; \ file_list="$(dri_LTLIBRARIES:%.la=.libs/%.so)"; \ file_list+="$(egl_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*)"; \ file_list+="$(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*)"; \ for f in $$file_list; do \ if test -h .libs/$$f; then \ cp -d $$f $$link_dir; \ else \ ln -f $$f $$link_dir; \ fi; \ done && touch $@ endif clean-local: for f in $(notdir $(dri_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*)) \ $(notdir $(egl_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*)) \ $(notdir $(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*)); do \ echo $$f; \ $(RM) $(top_builddir)/$(LIB_DIR)/gallium/$$f; \ done; rmdir $(top_builddir)/$(LIB_DIR)/gallium || true $(RM) .install-gallium-links endif

onds to the option --enable-osmesa.
--with-osmesa-bits=BITS

This option allows the size of the color channel in bits to be specified. By default, an 8-bit channel will be used, and the driver will be named libOSMesa. Other options are 16- and 32-bit color channels, which will add the bit size to the library name. For example, --with-osmesa-bits=16 will create the libOSMesa16 library with a 16-bit color channel.

3. Library Options

The configure script provides more fine grained control over the GL libraries that will be built. More details on the specific GL libraries can be found in the basic installation instructions.