[Mesa-dev] [PATCH 10/21] mesa: Build libmesa shared.

Johannes Obermayr johannesobermayr at gmx.de
Wed Sep 11 15:32:48 PDT 2013


---
 configure.ac                                     | 23 ++++++-
 src/Makefile.am                                  |  6 +-
 src/gallium/targets/dri-i915/Makefile.am         |  5 +-
 src/gallium/targets/dri-ilo/Makefile.am          |  5 +-
 src/gallium/targets/dri-nouveau/Makefile.am      |  5 +-
 src/gallium/targets/dri-r300/Makefile.am         |  5 +-
 src/gallium/targets/dri-r600/Makefile.am         |  5 +-
 src/gallium/targets/dri-radeonsi/Makefile.am     |  5 +-
 src/gallium/targets/dri-swrast/Makefile.am       |  3 +-
 src/gallium/targets/dri-vmwgfx/Makefile.am       |  5 +-
 src/gallium/targets/egl-static/Makefile.am       |  3 +-
 src/gallium/targets/libgl-xlib/Makefile.am       |  5 +-
 src/glsl/Makefile.am                             |  1 +
 src/glsl/builtin_type_macros.h                   | 20 +++----
 src/glsl/builtin_types.cpp                       |  4 ++
 src/glsl/glsl_parser_extras.cpp                  |  5 ++
 src/glsl/glsl_types.cpp                          | 14 ++++-
 src/glsl/glsl_types.h                            |  6 ++
 src/glsl/ir.cpp                                  | 65 ++++++++++++++++++--
 src/glsl/ir.h                                    | 26 ++------
 src/glsl/ir_builder.cpp                          | 22 +++++++
 src/glsl/ir_clone.cpp                            |  4 +-
 src/glsl/ir_expression_flattening.cpp            |  4 ++
 src/glsl/ir_function.cpp                         |  2 +
 src/glsl/ir_hierarchical_visitor.cpp             | 42 +++++++++++++
 src/glsl/ir_hierarchical_visitor.h               |  6 +-
 src/glsl/ir_hv_accept.cpp                        |  6 +-
 src/glsl/ir_print_visitor.cpp                    |  3 +
 src/glsl/ir_rvalue_visitor.cpp                   | 17 +++++-
 src/glsl/ir_rvalue_visitor.h                     |  6 +-
 src/glsl/ir_set_program_inouts.cpp               |  2 +
 src/glsl/ir_validate.cpp                         |  2 +
 src/glsl/lower_discard.cpp                       |  2 +
 src/glsl/lower_if_to_cond_assign.cpp             |  2 +
 src/glsl/lower_instructions.cpp                  |  2 +
 src/glsl/lower_jumps.cpp                         |  2 +
 src/glsl/lower_mat_op_to_vec.cpp                 |  2 +
 src/glsl/lower_noise.cpp                         |  2 +
 src/glsl/lower_output_reads.cpp                  |  2 +
 src/glsl/lower_packed_varyings.cpp               |  1 +
 src/glsl/lower_packing_builtins.cpp              |  2 +
 src/glsl/lower_texture_projection.cpp            |  4 ++
 src/glsl/lower_ubo_reference.cpp                 |  2 +
 src/glsl/lower_variable_index_to_cond_assign.cpp |  2 +
 src/glsl/lower_vec_index_to_cond_assign.cpp      |  2 +
 src/glsl/lower_vector.cpp                        |  2 +
 src/glsl/lower_vector_insert.cpp                 |  2 +
 src/glsl/ralloc.c                                | 24 +++++++-
 src/mapi/glapi/gen/gl_enums.py                   |  2 +
 src/mesa/Makefile.am                             | 76 +++++++++++++++---------
 src/mesa/Makefile.sources                        | 22 +++----
 src/mesa/drivers/common/driverfuncs.c            |  3 +
 src/mesa/drivers/common/meta.c                   | 11 ++++
 src/mesa/drivers/dri/common/Makefile.am          |  6 +-
 src/mesa/drivers/dri/i915/Makefile.am            |  5 +-
 src/mesa/drivers/dri/i965/Makefile.am            | 22 +++----
 src/mesa/drivers/dri/nouveau/Makefile.am         |  2 +-
 src/mesa/drivers/dri/r200/Makefile.am            |  2 +-
 src/mesa/drivers/dri/radeon/Makefile.am          |  2 +-
 src/mesa/drivers/dri/swrast/Makefile.am          |  2 +-
 src/mesa/drivers/osmesa/Makefile.am              |  2 +-
 src/mesa/drivers/x11/Makefile.am                 | 12 ++--
 src/mesa/libdricore/Makefile.am                  | 69 ---------------------
 src/mesa/main/accum.c                            |  3 +
 src/mesa/main/api_arrayelt.c                     |  3 +
 src/mesa/main/arbprogram.c                       |  7 +++
 src/mesa/main/arrayobj.c                         |  9 +++
 src/mesa/main/blend.c                            |  6 ++
 src/mesa/main/bufferobj.c                        |  9 +++
 src/mesa/main/buffers.c                          |  3 +-
 src/mesa/main/condrender.c                       |  4 ++
 src/mesa/main/context.c                          | 26 +++++++-
 src/mesa/main/cpuinfo.c                          |  3 +-
 src/mesa/main/depth.c                            |  3 +
 src/mesa/main/enable.c                           |  6 ++
 src/mesa/main/errors.c                           |  6 ++
 src/mesa/main/execmem.c                          |  7 ++-
 src/mesa/main/extensions.c                       |  2 +
 src/mesa/main/fbobject.c                         | 17 ++++++
 src/mesa/main/feedback.c                         |  4 ++
 src/mesa/main/ffvertex_prog.c                    |  2 +
 src/mesa/main/format_pack.c                      | 12 ++++
 src/mesa/main/format_unpack.c                    |  6 ++
 src/mesa/main/formatquery.c                      |  2 +
 src/mesa/main/formats.c                          | 16 +++++
 src/mesa/main/framebuffer.c                      | 14 +++++
 src/mesa/main/glformats.c                        | 14 +++++
 src/mesa/main/hash.c                             |  2 +
 src/mesa/main/hash_table.c                       |  8 +++
 src/mesa/main/image.c                            | 12 ++++
 src/mesa/main/imports.c                          | 14 +++++
 src/mesa/main/light.c                            |  3 +
 src/mesa/main/matrix.c                           |  5 ++
 src/mesa/main/mipmap.c                           |  3 +
 src/mesa/main/pack.c                             |  5 ++
 src/mesa/main/pbo.c                              |  9 +++
 src/mesa/main/pixel.c                            |  2 +
 src/mesa/main/pixeltransfer.c                    |  4 ++
 src/mesa/main/points.c                           |  2 +
 src/mesa/main/polygon.c                          |  2 +
 src/mesa/main/queryobj.c                         |  4 ++
 src/mesa/main/readpix.c                          |  4 ++
 src/mesa/main/renderbuffer.c                     |  6 ++
 src/mesa/main/samplerobj.c                       |  7 +++
 src/mesa/main/scissor.c                          |  2 +
 src/mesa/main/shader_query.cpp                   |  2 +
 src/mesa/main/shaderapi.c                        | 14 +++++
 src/mesa/main/shaderobj.c                        |  5 ++
 src/mesa/main/state.c                            |  4 ++
 src/mesa/main/stencil.c                          |  9 +++
 src/mesa/main/syncobj.c                          |  2 +
 src/mesa/main/tests/Makefile.am                  |  2 +-
 src/mesa/main/tests/hash_table/Makefile.am       |  2 +-
 src/mesa/main/texcompress.c                      |  2 +
 src/mesa/main/texcompress_etc.c                  |  2 +
 src/mesa/main/texenv.c                           |  2 +
 src/mesa/main/texformat.c                        |  3 +
 src/mesa/main/texgetimage.c                      |  3 +
 src/mesa/main/teximage.c                         | 18 ++++++
 src/mesa/main/texobj.c                           | 15 +++++
 src/mesa/main/texparam.c                         |  2 +
 src/mesa/main/texstate.c                         |  3 +
 src/mesa/main/texstorage.c                       |  2 +
 src/mesa/main/texstore.c                         |  8 +++
 src/mesa/main/texturebarrier.c                   |  2 +
 src/mesa/main/transformfeedback.c                |  5 ++
 src/mesa/main/uniforms.c                         |  6 ++
 src/mesa/main/varray.c                           |  7 +++
 src/mesa/main/version.c                          |  4 ++
 src/mesa/main/viewport.c                         |  3 +
 src/mesa/main/vtxfmt.c                           |  2 +
 src/mesa/math/m_matrix.c                         | 11 ++++
 src/mesa/math/m_translate.c                      |  4 +-
 src/mesa/math/m_vector.c                         |  4 ++
 src/mesa/program/Makefile.am                     | 18 ++----
 src/mesa/state_tracker/st_manager.c              |  2 +
 src/mesa/swrast/s_clear.c                        |  2 +
 src/mesa/swrast/s_context.c                      | 18 +++++-
 src/mesa/swrast/s_copypix.c                      |  4 ++
 src/mesa/swrast/s_drawpix.c                      |  2 +
 src/mesa/swrast/s_fog.c                          |  2 +
 src/mesa/swrast/s_lines.c                        |  2 +
 src/mesa/swrast/s_points.c                       |  4 ++
 src/mesa/swrast/s_renderbuffer.c                 |  4 ++
 src/mesa/swrast/s_texrender.c                    |  2 +
 src/mesa/swrast/s_texture.c                      |  7 +++
 src/mesa/swrast/s_triangle.c                     |  2 +
 src/mesa/swrast_setup/ss_context.c               |  6 ++
 src/mesa/tnl/t_context.c                         |  8 +++
 src/mesa/tnl/t_draw.c                            |  3 +
 src/mesa/tnl/t_pipeline.c                        |  4 ++
 src/mesa/tnl/t_vb_fog.c                          |  2 +
 src/mesa/tnl/t_vb_light.c                        |  3 +
 src/mesa/tnl/t_vb_normals.c                      |  2 +
 src/mesa/tnl/t_vb_points.c                       |  2 +
 src/mesa/tnl/t_vb_program.c                      |  3 +
 src/mesa/tnl/t_vb_render.c                       |  6 +-
 src/mesa/tnl/t_vb_texgen.c                       |  2 +
 src/mesa/tnl/t_vb_texmat.c                       |  2 +
 src/mesa/tnl/t_vb_vertex.c                       |  2 +
 src/mesa/tnl/t_vertex.c                          | 11 ++++
 src/mesa/tnl/t_vertex_generic.c                  |  2 +
 src/mesa/vbo/vbo_context.c                       |  5 ++
 src/mesa/vbo/vbo_exec_api.c                      |  3 +
 src/mesa/vbo/vbo_exec_array.c                    |  3 +
 src/mesa/vbo/vbo_primitive_restart.c             |  2 +
 src/mesa/vbo/vbo_rebase.c                        |  3 +
 src/mesa/vbo/vbo_split.c                         |  2 +
 src/mesa/x86/common_x86.c                        |  3 +
 src/mesa/x86/read_rgba_span_x86.S                | 12 ----
 170 files changed, 963 insertions(+), 248 deletions(-)
 delete mode 100644 src/mesa/libdricore/Makefile.am

diff --git a/configure.ac b/configure.ac
index ee272c0..94815e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -722,6 +722,13 @@ if test "x$enable_dri" = xyes; then
     GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS"
 fi
 
+if test "x$enable_osmesa" = xyes -a \
+        -z "$with_dri_drivers" -a \
+	-n "$with_gallium_drivers"; then
+    AC_MSG_WARN([Only Gallium based drivers are selected. Switching to more reasonable Gallium OSMesa implementation])
+    enable_gallium_osmesa=yes
+    enable_osmesa=no
+fi
 if test "x$enable_gallium_osmesa" = xyes; then
     if test -z "$with_gallium_drivers"; then
         AC_MSG_ERROR([Cannot enable gallium_osmesa without Gallium])
@@ -829,7 +836,14 @@ AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
 AC_SUBST([GLESv2_LIB_DEPS])
 AC_SUBST([GLESv2_PC_LIB_PRIV])
 
-DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la"
+AC_SUBST([DRICOMMON_LIB], "\$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la")
+
+LIBGALLIUM_LIB="\$(top_builddir)/src/gallium/auxiliary/libgallium${VERSION}.la"
+MESACORE_LIB="\$(top_builddir)/src/mesa/libmesacore${VERSION}.la"
+MESADRI_LIB="\$(top_builddir)/src/mesa/libmesadri${VERSION}.la"
+MESAGALLIUM_LIB="\$(top_builddir)/src/mesa/libmesagallium${VERSION}.la"
+DRI_LIB_DEPS="${MESACORE_LIB} ${MESADRI_LIB}"
+AC_SUBST([LIBMESAGALLIUM_LIBS], "${MESACORE_LIB} ${MESAGALLIUM_LIB} ${LIBGALLIUM_LIB}")
 
 AC_SUBST([HAVE_XF86VIDMODE])
 
@@ -1004,7 +1018,7 @@ if test "x$enable_dri" = xyes; then
     DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
     GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
 fi
-AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS")
+AM_CONDITIONAL(NEED_LIBMESADRI, test -n "$DRI_DIRS" -o test "x$enable_osmesa" = xyes)
 AC_SUBST([EXPAT_INCLUDES])
 AC_SUBST([DRI_LIB_DEPS])
 AC_SUBST([GALLIUM_DRI_LIB_DEPS])
@@ -1328,6 +1342,10 @@ dnl
 dnl Gallium configuration
 dnl
 AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
+AM_CONDITIONAL(NEED_LIBMESACORE, test -n "$DRI_DIRS" -o \
+                                      -n "$with_gallium_drivers" -o \
+                                      "x$enable_xlib_glx" = xyes -o \
+                                      "x$enable_osmesa" = xyes)
 
 AC_SUBST([LLVM_BINDIR])
 AC_SUBST([LLVM_CFLAGS])
@@ -2074,7 +2092,6 @@ AC_CONFIG_FILES([Makefile
 		src/mesa/drivers/osmesa/Makefile
 		src/mesa/drivers/osmesa/osmesa.pc
 		src/mesa/drivers/x11/Makefile
-		src/mesa/libdricore/Makefile
 		src/mesa/main/tests/Makefile
 		src/mesa/main/tests/hash_table/Makefile
 		src/mesa/program/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 76280a0..0bf5289 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,6 +21,11 @@
 
 SUBDIRS = gtest mapi
 
+# This must be built before mesa
+if HAVE_GALLIUM
+SUBDIRS += gallium/auxiliary
+endif
+
 if NEED_OPENGL_COMMON
 SUBDIRS += glsl mesa
 endif
@@ -43,7 +48,6 @@ endif
 
 if HAVE_GALLIUM
 SUBDIRS +=			\
-	gallium/auxiliary	\
 	gallium/drivers		\
 	gallium/state_trackers	\
 	gallium/winsys		\
diff --git a/src/gallium/targets/dri-i915/Makefile.am b/src/gallium/targets/dri-i915/Makefile.am
index 4ef587b..113cbbd 100644
--- a/src/gallium/targets/dri-i915/Makefile.am
+++ b/src/gallium/targets/dri-i915/Makefile.am
@@ -47,9 +47,6 @@ i915_dri_la_SOURCES = target.c
 i915_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 i915_dri_la_LIBADD = \
-	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
 	$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
 	$(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
@@ -58,6 +55,8 @@ i915_dri_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/i915/libi915.la \
+	$(DRICOMMON_LIB) \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(INTEL_LIBS)
 
diff --git a/src/gallium/targets/dri-ilo/Makefile.am b/src/gallium/targets/dri-ilo/Makefile.am
index 45cd928..c7ab9bf 100644
--- a/src/gallium/targets/dri-ilo/Makefile.am
+++ b/src/gallium/targets/dri-ilo/Makefile.am
@@ -46,15 +46,14 @@ ilo_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
 		     -rpath $(abs_builddir)
 
 ilo_dri_la_LIBADD = \
-	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
 	$(top_builddir)/src/gallium/winsys/intel/drm/libintelwinsys.la \
 	$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/ilo/libilo.la \
+	$(DRICOMMON_LIB) \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(INTEL_LIBS)
 
diff --git a/src/gallium/targets/dri-nouveau/Makefile.am b/src/gallium/targets/dri-nouveau/Makefile.am
index 05d0e8c..1e1487f 100644
--- a/src/gallium/targets/dri-nouveau/Makefile.am
+++ b/src/gallium/targets/dri-nouveau/Makefile.am
@@ -45,14 +45,13 @@ nouveau_dri_la_SOURCES = target.c
 nouveau_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 nouveau_dri_la_LIBADD = \
-	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
 	$(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
+	$(DRICOMMON_LIB) \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(LIBDRM_LIBS) \
 	$(NOUVEAU_LIBS)
diff --git a/src/gallium/targets/dri-r300/Makefile.am b/src/gallium/targets/dri-r300/Makefile.am
index f17a07c..88b6846 100644
--- a/src/gallium/targets/dri-r300/Makefile.am
+++ b/src/gallium/targets/dri-r300/Makefile.am
@@ -45,14 +45,13 @@ r300_dri_la_SOURCES = target.c
 r300_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 r300_dri_la_LIBADD = \
-	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
 	$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
 	$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/r300/libr300.la \
+	$(DRICOMMON_LIB) \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(RADEON_LIBS)
diff --git a/src/gallium/targets/dri-r600/Makefile.am b/src/gallium/targets/dri-r600/Makefile.am
index 48fcaa9..1e3e4d2 100644
--- a/src/gallium/targets/dri-r600/Makefile.am
+++ b/src/gallium/targets/dri-r600/Makefile.am
@@ -45,9 +45,6 @@ r600_dri_la_SOURCES = target.c
 r600_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 r600_dri_la_LIBADD = \
-	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/drivers/r600/libr600.la \
 	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
@@ -56,6 +53,8 @@ r600_dri_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/noop/libnoop.la \
 	$(LLVM_R600_LIBS) \
+	$(DRICOMMON_LIB) \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
diff --git a/src/gallium/targets/dri-radeonsi/Makefile.am b/src/gallium/targets/dri-radeonsi/Makefile.am
index fa6309b..fbb67e1 100644
--- a/src/gallium/targets/dri-radeonsi/Makefile.am
+++ b/src/gallium/targets/dri-radeonsi/Makefile.am
@@ -45,9 +45,6 @@ radeonsi_dri_la_SOURCES = target.c
 radeonsi_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 radeonsi_dri_la_LIBADD = \
-	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
 	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
@@ -56,6 +53,8 @@ radeonsi_dri_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/noop/libnoop.la \
 	$(LLVM_RADEON_LIBS) \
+	$(DRICOMMON_LIB) \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(RADEON_LIBS)
 
diff --git a/src/gallium/targets/dri-swrast/Makefile.am b/src/gallium/targets/dri-swrast/Makefile.am
index 073b4c2..39bad77 100644
--- a/src/gallium/targets/dri-swrast/Makefile.am
+++ b/src/gallium/targets/dri-swrast/Makefile.am
@@ -50,13 +50,12 @@ swrast_dri_la_SOURCES = \
 swrast_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 swrast_dri_la_LIBADD = \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/sw/libdrisw.la \
 	$(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \
 	$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS)
 
 nodist_EXTRA_swrast_dri_la_SOURCES = dummy.cpp
diff --git a/src/gallium/targets/dri-vmwgfx/Makefile.am b/src/gallium/targets/dri-vmwgfx/Makefile.am
index abb2dd5..535eae8 100644
--- a/src/gallium/targets/dri-vmwgfx/Makefile.am
+++ b/src/gallium/targets/dri-vmwgfx/Makefile.am
@@ -45,15 +45,14 @@ vmwgfx_dri_la_SOURCES = \
 vmwgfx_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 vmwgfx_dri_la_LIBADD = \
-	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
 	$(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \
 	$(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/svga/libsvga.la \
+	$(DRICOMMON_LIB) \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS)
 
 # Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am
index 6425bc6..ca2e207 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -103,7 +103,8 @@ AM_CPPFLAGS += \
 	-DFEATURE_GL=1
 
 egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/mesa/libmesagallium.la \
+	$(top_builddir)/src/mesa/libmesagallium at VERSION@.la \
+	$(top_builddir)/src/mesa/libmesacore at VERSION@.la \
 	$(GLAPI_LIB)
 endif
 
diff --git a/src/gallium/targets/libgl-xlib/Makefile.am b/src/gallium/targets/libgl-xlib/Makefile.am
index fe7781d..8cebfb4 100644
--- a/src/gallium/targets/libgl-xlib/Makefile.am
+++ b/src/gallium/targets/libgl-xlib/Makefile.am
@@ -51,9 +51,8 @@ libGL_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
-	$(top_builddir)/src/mapi/glapi/libglapi.la \
-	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
+	$(GL_LIB_DEPS) \
+	$(LIBMESAGALLIUM_LIBS) \
 	$(GL_LIB_DEPS) \
 	$(GLAPI_LIB) \
 	$(PTHREAD_LIBS) \
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 9352848..901a5c2 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -26,6 +26,7 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/glsl/glcpp \
 	-I$(top_srcdir)/src/gtest/include \
 	$(DEFINES)
+
 AM_CFLAGS = $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
diff --git a/src/glsl/builtin_type_macros.h b/src/glsl/builtin_type_macros.h
index fec38da..4fbfae4 100644
--- a/src/glsl/builtin_type_macros.h
+++ b/src/glsl/builtin_type_macros.h
@@ -33,25 +33,25 @@
 DECL_TYPE(error,  GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0)
 DECL_TYPE(void,   GL_INVALID_ENUM, GLSL_TYPE_VOID,  0, 0)
 
-DECL_TYPE(bool,   GL_BOOL,         GLSL_TYPE_BOOL,  1, 1)
+DECL_PUBLIC_TYPE(bool,   GL_BOOL,         GLSL_TYPE_BOOL,  1, 1)
 DECL_TYPE(bvec2,  GL_BOOL_VEC2,    GLSL_TYPE_BOOL,  2, 1)
 DECL_TYPE(bvec3,  GL_BOOL_VEC3,    GLSL_TYPE_BOOL,  3, 1)
 DECL_TYPE(bvec4,  GL_BOOL_VEC4,    GLSL_TYPE_BOOL,  4, 1)
 
-DECL_TYPE(int,    GL_INT,          GLSL_TYPE_INT,   1, 1)
+DECL_PUBLIC_TYPE(int,    GL_INT,          GLSL_TYPE_INT,   1, 1)
 DECL_TYPE(ivec2,  GL_INT_VEC2,     GLSL_TYPE_INT,   2, 1)
 DECL_TYPE(ivec3,  GL_INT_VEC3,     GLSL_TYPE_INT,   3, 1)
-DECL_TYPE(ivec4,  GL_INT_VEC4,     GLSL_TYPE_INT,   4, 1)
+DECL_PUBLIC_TYPE(ivec4,  GL_INT_VEC4,     GLSL_TYPE_INT,   4, 1) // HAVE_I965
 
-DECL_TYPE(uint,   GL_UNSIGNED_INT,      GLSL_TYPE_UINT, 1, 1)
-DECL_TYPE(uvec2,  GL_UNSIGNED_INT_VEC2, GLSL_TYPE_UINT, 2, 1)
+DECL_PUBLIC_TYPE(uint,   GL_UNSIGNED_INT,      GLSL_TYPE_UINT, 1, 1)
+DECL_PUBLIC_TYPE(uvec2,  GL_UNSIGNED_INT_VEC2, GLSL_TYPE_UINT, 2, 1) // HAVE_I965
 DECL_TYPE(uvec3,  GL_UNSIGNED_INT_VEC3, GLSL_TYPE_UINT, 3, 1)
-DECL_TYPE(uvec4,  GL_UNSIGNED_INT_VEC4, GLSL_TYPE_UINT, 4, 1)
+DECL_PUBLIC_TYPE(uvec4,  GL_UNSIGNED_INT_VEC4, GLSL_TYPE_UINT, 4, 1) // HAVE_I965
 
-DECL_TYPE(float,  GL_FLOAT,        GLSL_TYPE_FLOAT, 1, 1)
-DECL_TYPE(vec2,   GL_FLOAT_VEC2,   GLSL_TYPE_FLOAT, 2, 1)
-DECL_TYPE(vec3,   GL_FLOAT_VEC3,   GLSL_TYPE_FLOAT, 3, 1)
-DECL_TYPE(vec4,   GL_FLOAT_VEC4,   GLSL_TYPE_FLOAT, 4, 1)
+DECL_PUBLIC_TYPE(float,  GL_FLOAT,        GLSL_TYPE_FLOAT, 1, 1)
+DECL_PUBLIC_TYPE(vec2,   GL_FLOAT_VEC2,   GLSL_TYPE_FLOAT, 2, 1)
+DECL_PUBLIC_TYPE(vec3,   GL_FLOAT_VEC3,   GLSL_TYPE_FLOAT, 3, 1) // HAVE_I965
+DECL_PUBLIC_TYPE(vec4,   GL_FLOAT_VEC4,   GLSL_TYPE_FLOAT, 4, 1)
 
 DECL_TYPE(mat2,   GL_FLOAT_MAT2,   GLSL_TYPE_FLOAT, 2, 2)
 DECL_TYPE(mat3,   GL_FLOAT_MAT3,   GLSL_TYPE_FLOAT, 3, 3)
diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp
index 722eda2..10c3039 100644
--- a/src/glsl/builtin_types.cpp
+++ b/src/glsl/builtin_types.cpp
@@ -46,6 +46,10 @@
    const glsl_type glsl_type::_##NAME##_type = glsl_type(__VA_ARGS__, #NAME); \
    const glsl_type *const glsl_type::NAME##_type = &glsl_type::_##NAME##_type;
 
+#define DECL_PUBLIC_TYPE(NAME, ...)                                    \
+   const glsl_type glsl_type::_##NAME##_type = glsl_type(__VA_ARGS__, #NAME); \
+   PUBLIC const glsl_type *const glsl_type::NAME##_type = &glsl_type::_##NAME##_type;
+
 #define STRUCT_TYPE(NAME)                                       \
    const glsl_type glsl_type::_struct_##NAME##_type =           \
       glsl_type(NAME##_fields, Elements(NAME##_fields), #NAME); \
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 1e4d7c7..f6518f2 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -25,6 +25,8 @@
 #include <string.h>
 #include <assert.h>
 
+#include "main/compiler.h"
+
 extern "C" {
 #include "main/core.h" /* for struct gl_context */
 #include "main/context.h"
@@ -320,6 +322,7 @@ extern "C" {
  * with a struct gl_program->Target, not just a struct
  * gl_shader->Type.
  */
+PUBLIC
 const char *
 _mesa_glsl_shader_target_name(GLenum type)
 {
@@ -1546,6 +1549,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
  *                                    unrolling.
  * \param options                     The driver's preferred shader options.
  */
+PUBLIC
 bool
 do_common_optimization(exec_list *ir, bool linked,
 		       bool uniform_locations_assigned,
@@ -1610,6 +1614,7 @@ extern "C" {
  * programs would be invalid.  So this should happen at approximately
  * program exit.
  */
+PUBLIC
 void
 _mesa_destroy_shader_compiler(void)
 {
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 0c7e8eb..6fd2754 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -23,6 +23,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include "main/compiler.h"
 #include "main/core.h" /* for Elements */
 #include "glsl_symbol_table.h"
 #include "glsl_parser_extras.h"
@@ -210,7 +211,9 @@ const glsl_type *glsl_type::get_base_type() const
    }
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 const glsl_type *glsl_type::get_scalar_type() const
 {
    const glsl_type *type = this;
@@ -333,6 +336,7 @@ glsl_type::bvec(unsigned components)
 }
 
 
+PUBLIC
 const glsl_type *
 glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns)
 {
@@ -390,7 +394,9 @@ glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns)
    return error_type;
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 const glsl_type *
 glsl_type::get_array_instance(const glsl_type *base, unsigned array_size)
 {
@@ -561,7 +567,9 @@ glsl_type::field_index(const char *name) const
    return -1;
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 unsigned
 glsl_type::component_slots() const
 {
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 647867a..eacd5db 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -160,6 +160,9 @@ struct glsl_type {
 #undef  DECL_TYPE
 #define DECL_TYPE(NAME, ...) \
    static const glsl_type *const NAME##_type;
+#undef  DECL_PUBLIC_TYPE
+#define DECL_PUBLIC_TYPE(NAME, ...) \
+   static const glsl_type *const NAME##_type;
 #undef  STRUCT_TYPE
 #define STRUCT_TYPE(NAME) \
    static const glsl_type *const struct_##NAME##_type;
@@ -547,6 +550,8 @@ private:
    /*@{*/
 #undef  DECL_TYPE
 #define DECL_TYPE(NAME, ...) static const glsl_type _##NAME##_type;
+#undef  DECL_PUBLIC_TYPE
+#define DECL_PUBLIC_TYPE(NAME, ...) static const glsl_type _##NAME##_type;
 #undef  STRUCT_TYPE
 #define STRUCT_TYPE(NAME)        static const glsl_type _struct_##NAME##_type;
 #include "builtin_type_macros.h"
@@ -578,6 +583,7 @@ glsl_align(unsigned int a, unsigned int align)
 }
 
 #undef DECL_TYPE
+#undef DECL_PUBLIC_TYPE
 #undef STRUCT_TYPE
 #endif /* __cplusplus */
 
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 1b17999..91f9f53 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -21,11 +21,15 @@
  * DEALINGS IN THE SOFTWARE.
  */
 #include <string.h>
+#include "main/compiler.h"
 #include "main/core.h" /* for MAX2 */
 #include "ir.h"
 #include "ir_visitor.h"
 #include "glsl_types.h"
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_rvalue::ir_rvalue()
 {
    this->type = glsl_type::error_type;
@@ -151,6 +155,9 @@ ir_assignment::whole_variable_written()
    return v;
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs,
 			     ir_rvalue *condition, unsigned write_mask)
 {
@@ -171,6 +178,7 @@ ir_assignment::ir_assignment(ir_dereference *lhs, ir_rvalue *rhs,
    }
 }
 
+PUBLIC
 ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs,
 			     ir_rvalue *condition)
 {
@@ -195,6 +203,20 @@ ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs,
    this->set_lhs(lhs);
 }
 
+PUBLIC
+ir_if::ir_if(ir_rvalue *condition) : condition(condition)
+{
+   ir_type=ir_type_if;
+}
+
+PUBLIC
+ir_loop_jump::ir_loop_jump(jump_mode mode)
+{
+   this->ir_type = ir_type_loop_jump;
+   this->mode = mode;
+}
+
+PUBLIC
 ir_expression::ir_expression(int op, const struct glsl_type *type,
 			     ir_rvalue *op0, ir_rvalue *op1,
 			     ir_rvalue *op2, ir_rvalue *op3)
@@ -446,6 +468,7 @@ ir_expression::ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1,
    }
 }
 
+PUBLIC
 unsigned int
 ir_expression::get_num_operands(ir_expression_operation op)
 {
@@ -606,6 +629,9 @@ ir_constant::ir_constant()
    this->ir_type = ir_type_constant;
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_constant::ir_constant(const struct glsl_type *type,
 			 const ir_constant_data *data)
 {
@@ -617,6 +643,9 @@ ir_constant::ir_constant(const struct glsl_type *type,
    memcpy(& this->value, data, sizeof(this->value));
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_constant::ir_constant(float f)
 {
    this->ir_type = ir_type_constant;
@@ -637,6 +666,9 @@ ir_constant::ir_constant(unsigned int u)
    }
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_constant::ir_constant(int i)
 {
    this->ir_type = ir_type_constant;
@@ -1265,6 +1297,7 @@ ir_loop::ir_loop()
 }
 
 
+PUBLIC
 ir_dereference_variable::ir_dereference_variable(ir_variable *var)
 {
    assert(var != NULL);
@@ -1369,6 +1402,17 @@ const char *ir_texture::opcode_string()
    return tex_opcode_strs[op];
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
+ir_texture::ir_texture(enum ir_texture_opcode op)
+   : op(op), sampler(NULL), coordinate(NULL), projector(NULL),
+     shadow_comparitor(NULL), offset(NULL)
+{
+   this->ir_type = ir_type_texture;
+   memset(&lod_info, 0, sizeof(lod_info));
+}
+
 ir_texture_opcode
 ir_texture::get_opcode(const char *str)
 {
@@ -1380,7 +1424,9 @@ ir_texture::get_opcode(const char *str)
    return (ir_texture_opcode) -1;
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 void
 ir_texture::set_sampler(ir_dereference *sampler, const glsl_type *type)
 {
@@ -1446,6 +1492,9 @@ ir_swizzle::init_mask(const unsigned *comp, unsigned count)
    type = glsl_type::get_instance(val->type->base_type, mask.num_components, 1);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_swizzle::ir_swizzle(ir_rvalue *val, unsigned x, unsigned y, unsigned z,
 		       unsigned w, unsigned count)
    : val(val)
@@ -1561,7 +1610,9 @@ ir_swizzle::variable_referenced() const
    return this->val->variable_referenced();
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_variable::ir_variable(const struct glsl_type *type, const char *name,
 			 ir_variable_mode mode)
    : max_array_access(0), read_only(false), centroid(false), invariant(false),
@@ -1601,7 +1652,9 @@ ir_variable::interpolation_string() const
    return "";
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 glsl_interp_qualifier
 ir_variable::determine_interpolation_mode(bool flat_shade)
 {
@@ -1739,6 +1792,7 @@ ir_rvalue::error_value(void *mem_ctx)
 }
 
 
+PUBLIC
 void
 visit_exec_list(exec_list *list, ir_visitor *visitor)
 {
@@ -1778,7 +1832,9 @@ steal_memory(ir_instruction *ir, void *new_ctx)
    ralloc_steal(new_ctx, ir);
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 void
 reparent_ir(exec_list *list, void *mem_ctx)
 {
@@ -1822,6 +1878,7 @@ try_max_zero(ir_rvalue *ir)
    return NULL;
 }
 
+PUBLIC
 ir_rvalue *
 ir_rvalue::as_rvalue_to_saturate()
 {
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 2637b40..5978d86 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -809,11 +809,7 @@ inline const char *ir_function_signature::function_name() const
  */
 class ir_if : public ir_instruction {
 public:
-   ir_if(ir_rvalue *condition)
-      : condition(condition)
-   {
-      ir_type = ir_type_if;
-   }
+   ir_if(ir_rvalue *condition);
 
    virtual ir_if *clone(void *mem_ctx, struct hash_table *ht) const;
 
@@ -1471,16 +1467,13 @@ public:
  */
 class ir_loop_jump : public ir_jump {
 public:
+   /* Mode selector for the jump instruction. */
    enum jump_mode {
       jump_break,
       jump_continue
-   };
+   } mode;
 
-   ir_loop_jump(jump_mode mode)
-   {
-      this->ir_type = ir_type_loop_jump;
-      this->mode = mode;
-   }
+   ir_loop_jump(jump_mode mode);
 
    virtual ir_loop_jump *clone(void *mem_ctx, struct hash_table *) const;
 
@@ -1500,9 +1493,6 @@ public:
    {
       return mode == jump_continue;
    }
-
-   /** Mode selector for the jump instruction. */
-   enum jump_mode mode;
 };
 
 /**
@@ -1580,13 +1570,7 @@ enum ir_texture_opcode {
  */
 class ir_texture : public ir_rvalue {
 public:
-   ir_texture(enum ir_texture_opcode op)
-      : op(op), sampler(NULL), coordinate(NULL), projector(NULL),
-        shadow_comparitor(NULL), offset(NULL)
-   {
-      this->ir_type = ir_type_texture;
-      memset(&lod_info, 0, sizeof(lod_info));
-   }
+   ir_texture(enum ir_texture_opcode op);
 
    virtual ir_texture *clone(void *mem_ctx, struct hash_table *) const;
 
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 98b4322..bcd8088 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -21,6 +21,7 @@
  * IN THE SOFTWARE.
  */
 
+#include "main/compiler.h"
 #include "ir_builder.h"
 #include "program/prog_instruction.h"
 
@@ -45,6 +46,9 @@ ir_factory::make_temp(const glsl_type *type, const char *name)
    return var;
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_assignment *
 assign(deref lhs, operand rhs, operand condition, int writemask)
 {
@@ -58,6 +62,9 @@ assign(deref lhs, operand rhs, operand condition, int writemask)
    return assign;
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_assignment *
 assign(deref lhs, operand rhs)
 {
@@ -96,6 +103,9 @@ swizzle(operand a, int swizzle, int components)
 				  components);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_swizzle *
 swizzle_for_size(operand a, unsigned components)
 {
@@ -177,6 +187,9 @@ swizzle_xyzw(operand a)
    return swizzle(a, SWIZZLE_XYZW, 4);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_expression *
 expr(ir_expression_operation op, operand a)
 {
@@ -185,6 +198,9 @@ expr(ir_expression_operation op, operand a)
    return new(mem_ctx) ir_expression(op, a.val);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_expression *
 expr(ir_expression_operation op, operand a, operand b)
 {
@@ -211,6 +227,9 @@ ir_expression *sub(operand a, operand b)
    return expr(ir_binop_sub, a, b);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_expression *mul(operand a, operand b)
 {
    return expr(ir_binop_mul, a, b);
@@ -226,6 +245,9 @@ ir_expression *round_even(operand a)
    return expr(ir_unop_round_even, a);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_expression *dot(operand a, operand b)
 {
    return expr(ir_binop_dot, a, b);
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index fb303b0..1c96df4 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -431,7 +431,9 @@ fixup_function_calls(struct hash_table *ht, exec_list *instructions)
    v.run(instructions);
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 void
 clone_ir_list(void *mem_ctx, exec_list *out, const exec_list *in)
 {
diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp
index b44e68c..5f2ef96 100644
--- a/src/glsl/ir_expression_flattening.cpp
+++ b/src/glsl/ir_expression_flattening.cpp
@@ -31,6 +31,7 @@
  * create a temporary and work on each of its vector components individually.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_visitor.h"
 #include "ir_rvalue_visitor.h"
@@ -53,6 +54,9 @@ public:
    bool (*predicate)(ir_instruction *ir);
 };
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 void
 do_expression_flattening(exec_list *instructions,
 			 bool (*predicate)(ir_instruction *ir))
diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp
index 53cf469..5f11e44 100644
--- a/src/glsl/ir_function.cpp
+++ b/src/glsl/ir_function.cpp
@@ -21,6 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "main/compiler.h"
 #include "glsl_types.h"
 #include "ir.h"
 
@@ -115,6 +116,7 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b)
 }
 
 
+PUBLIC
 ir_function_signature *
 ir_function::matching_signature(_mesa_glsl_parse_state *state,
                                 const exec_list *actual_parameters)
diff --git a/src/glsl/ir_hierarchical_visitor.cpp b/src/glsl/ir_hierarchical_visitor.cpp
index 2e606dd..df5e732 100644
--- a/src/glsl/ir_hierarchical_visitor.cpp
+++ b/src/glsl/ir_hierarchical_visitor.cpp
@@ -21,9 +21,18 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_hierarchical_visitor.h"
 
+/*
+#if !defined(HAVE_I965)
+#undef PUBLIC
+#define PUBLIC
+#endif
+*/
+
+PUBLIC
 ir_hierarchical_visitor::ir_hierarchical_visitor()
 {
    this->base_ir = NULL;
@@ -32,6 +41,7 @@ ir_hierarchical_visitor::ir_hierarchical_visitor()
    this->in_assignee = false;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit(ir_rvalue *ir)
 {
@@ -41,6 +51,7 @@ ir_hierarchical_visitor::visit(ir_rvalue *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit(ir_variable *ir)
 {
@@ -50,6 +61,7 @@ ir_hierarchical_visitor::visit(ir_variable *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit(ir_constant *ir)
 {
@@ -59,6 +71,7 @@ ir_hierarchical_visitor::visit(ir_constant *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit(ir_loop_jump *ir)
 {
@@ -68,6 +81,7 @@ ir_hierarchical_visitor::visit(ir_loop_jump *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit(ir_emit_vertex *ir)
 {
@@ -77,6 +91,7 @@ ir_hierarchical_visitor::visit(ir_emit_vertex *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit(ir_end_primitive *ir)
 {
@@ -86,6 +101,7 @@ ir_hierarchical_visitor::visit(ir_end_primitive *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit(ir_dereference_variable *ir)
 {
@@ -95,6 +111,7 @@ ir_hierarchical_visitor::visit(ir_dereference_variable *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_loop *ir)
 {
@@ -104,6 +121,7 @@ ir_hierarchical_visitor::visit_enter(ir_loop *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_loop *ir)
 {
@@ -111,6 +129,7 @@ ir_hierarchical_visitor::visit_leave(ir_loop *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_function_signature *ir)
 {
@@ -120,6 +139,7 @@ ir_hierarchical_visitor::visit_enter(ir_function_signature *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_function_signature *ir)
 {
@@ -127,6 +147,7 @@ ir_hierarchical_visitor::visit_leave(ir_function_signature *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_function *ir)
 {
@@ -136,6 +157,7 @@ ir_hierarchical_visitor::visit_enter(ir_function *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_function *ir)
 {
@@ -143,6 +165,7 @@ ir_hierarchical_visitor::visit_leave(ir_function *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_expression *ir)
 {
@@ -152,6 +175,7 @@ ir_hierarchical_visitor::visit_enter(ir_expression *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_expression *ir)
 {
@@ -159,6 +183,7 @@ ir_hierarchical_visitor::visit_leave(ir_expression *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_texture *ir)
 {
@@ -168,6 +193,7 @@ ir_hierarchical_visitor::visit_enter(ir_texture *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_texture *ir)
 {
@@ -175,6 +201,7 @@ ir_hierarchical_visitor::visit_leave(ir_texture *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_swizzle *ir)
 {
@@ -184,6 +211,7 @@ ir_hierarchical_visitor::visit_enter(ir_swizzle *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_swizzle *ir)
 {
@@ -191,6 +219,7 @@ ir_hierarchical_visitor::visit_leave(ir_swizzle *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_dereference_array *ir)
 {
@@ -200,6 +229,7 @@ ir_hierarchical_visitor::visit_enter(ir_dereference_array *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_dereference_array *ir)
 {
@@ -207,6 +237,7 @@ ir_hierarchical_visitor::visit_leave(ir_dereference_array *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_dereference_record *ir)
 {
@@ -216,6 +247,7 @@ ir_hierarchical_visitor::visit_enter(ir_dereference_record *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_dereference_record *ir)
 {
@@ -223,6 +255,7 @@ ir_hierarchical_visitor::visit_leave(ir_dereference_record *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_assignment *ir)
 {
@@ -232,6 +265,7 @@ ir_hierarchical_visitor::visit_enter(ir_assignment *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_assignment *ir)
 {
@@ -239,6 +273,7 @@ ir_hierarchical_visitor::visit_leave(ir_assignment *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_call *ir)
 {
@@ -248,6 +283,7 @@ ir_hierarchical_visitor::visit_enter(ir_call *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_call *ir)
 {
@@ -255,6 +291,7 @@ ir_hierarchical_visitor::visit_leave(ir_call *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_return *ir)
 {
@@ -264,6 +301,7 @@ ir_hierarchical_visitor::visit_enter(ir_return *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_return *ir)
 {
@@ -271,6 +309,7 @@ ir_hierarchical_visitor::visit_leave(ir_return *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_discard *ir)
 {
@@ -280,6 +319,7 @@ ir_hierarchical_visitor::visit_enter(ir_discard *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_discard *ir)
 {
@@ -287,6 +327,7 @@ ir_hierarchical_visitor::visit_leave(ir_discard *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_enter(ir_if *ir)
 {
@@ -296,6 +337,7 @@ ir_hierarchical_visitor::visit_enter(ir_if *ir)
    return visit_continue;
 }
 
+PUBLIC
 ir_visitor_status
 ir_hierarchical_visitor::visit_leave(ir_if *ir)
 {
diff --git a/src/glsl/ir_hierarchical_visitor.h b/src/glsl/ir_hierarchical_visitor.h
index 647d2e0..810bfe8 100644
--- a/src/glsl/ir_hierarchical_visitor.h
+++ b/src/glsl/ir_hierarchical_visitor.h
@@ -75,7 +75,11 @@ enum ir_visitor_status {
  *    http://c2.com/cgi/wiki?HierarchicalVisitorDiscussion
  */
 
-class ir_hierarchical_visitor {
+// #if defined(HAVE_I965)
+class PUBLIC ir_hierarchical_visitor {
+// #else
+// class ir_hierarchical_visitor {
+// #endif
 public:
    ir_hierarchical_visitor();
 
diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp
index 76a607d..5e599b9 100644
--- a/src/glsl/ir_hv_accept.cpp
+++ b/src/glsl/ir_hv_accept.cpp
@@ -21,6 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 
 /**
@@ -43,6 +44,9 @@
  * from the list.  However, if nodes are added to the list after the node being
  * processed, some of the added nodes may not be processed.
  */
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 ir_visitor_status
 visit_list_elements(ir_hierarchical_visitor *v, exec_list *l,
                     bool statement_list)
@@ -114,7 +118,6 @@ ir_loop::accept(ir_hierarchical_visitor *v)
    return v->visit_leave(this);
 }
 
-
 ir_visitor_status
 ir_loop_jump::accept(ir_hierarchical_visitor *v)
 {
@@ -389,7 +392,6 @@ ir_discard::accept(ir_hierarchical_visitor *v)
    return v->visit_leave(this);
 }
 
-
 ir_visitor_status
 ir_if::accept(ir_hierarchical_visitor *v)
 {
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index b518310..57a6f43 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -21,6 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "main/compiler.h"
 #include "ir_print_visitor.h"
 #include "glsl_types.h"
 #include "glsl_parser_extras.h"
@@ -29,6 +30,7 @@
 
 static void print_type(const glsl_type *t);
 
+PUBLIC
 void
 ir_instruction::print(void) const
 {
@@ -39,6 +41,7 @@ ir_instruction::print(void) const
 }
 
 extern "C" {
+PUBLIC
 void
 _mesa_print_ir(exec_list *instructions,
 	       struct _mesa_glsl_parse_state *state)
diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp
index 8eb1c62..176992a 100644
--- a/src/glsl/ir_rvalue_visitor.cpp
+++ b/src/glsl/ir_rvalue_visitor.cpp
@@ -29,11 +29,19 @@
  * class.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_visitor.h"
 #include "ir_rvalue_visitor.h"
 #include "glsl_types.h"
 
+/*
+#if defined(HAVE_I965)
+#undef PUBLIC
+#define PUBLIC
+#endif
+*/
+
 ir_visitor_status
 ir_rvalue_base_visitor::rvalue_visit(ir_expression *ir)
 {
@@ -145,31 +153,35 @@ ir_rvalue_base_visitor::rvalue_visit(ir_if *ir)
    return visit_continue;
 }
 
-
+PUBLIC
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_expression *ir)
 {
    return rvalue_visit(ir);
 }
 
+PUBLIC
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_texture *ir)
 {
    return rvalue_visit(ir);
 }
 
+PUBLIC
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_swizzle *ir)
 {
    return rvalue_visit(ir);
 }
 
+PUBLIC
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_dereference_array *ir)
 {
    return rvalue_visit(ir);
 }
 
+PUBLIC
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_dereference_record *ir)
 {
@@ -182,18 +194,21 @@ ir_rvalue_visitor::visit_leave(ir_assignment *ir)
    return rvalue_visit(ir);
 }
 
+PUBLIC
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_call *ir)
 {
    return rvalue_visit(ir);
 }
 
+PUBLIC
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_return *ir)
 {
    return rvalue_visit(ir);
 }
 
+PUBLIC
 ir_visitor_status
 ir_rvalue_visitor::visit_leave(ir_if *ir)
 {
diff --git a/src/glsl/ir_rvalue_visitor.h b/src/glsl/ir_rvalue_visitor.h
index 2179fa5..4563068 100644
--- a/src/glsl/ir_rvalue_visitor.h
+++ b/src/glsl/ir_rvalue_visitor.h
@@ -45,7 +45,11 @@ public:
    virtual void handle_rvalue(ir_rvalue **rvalue) = 0;
 };
 
-class ir_rvalue_visitor : public ir_rvalue_base_visitor {
+// #if defined(HAVE_I965)
+class PUBLIC ir_rvalue_visitor : public ir_rvalue_base_visitor {
+// #else
+// class ir_rvalue_visitor : public ir_rvalue_base_visitor {
+// #endif
 public:
 
    virtual ir_visitor_status visit_leave(ir_assignment *);
diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp
index 6196d6a..4f534b2 100644
--- a/src/glsl/ir_set_program_inouts.cpp
+++ b/src/glsl/ir_set_program_inouts.cpp
@@ -37,6 +37,7 @@
  * from the GLSL IR.
  */
 
+#include "main/compiler.h"
 #include "main/core.h" /* for struct gl_program */
 #include "ir.h"
 #include "ir_visitor.h"
@@ -315,6 +316,7 @@ ir_set_program_inouts_visitor::visit_enter(ir_discard *)
    return visit_continue;
 }
 
+PUBLIC
 void
 do_set_program_inouts(exec_list *instructions, struct gl_program *prog,
                       GLenum shader_type)
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index ae3f09d..32ed2da 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -33,6 +33,7 @@
  * a dereference chain.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_hierarchical_visitor.h"
 #include "program/hash_table.h"
@@ -788,6 +789,7 @@ check_node_type(ir_instruction *ir, void *data)
       assert(value->type != glsl_type::error_type);
 }
 
+PUBLIC
 void
 validate_ir_tree(exec_list *instructions)
 {
diff --git a/src/glsl/lower_discard.cpp b/src/glsl/lower_discard.cpp
index cafd2dd..bcc5a9c 100644
--- a/src/glsl/lower_discard.cpp
+++ b/src/glsl/lower_discard.cpp
@@ -105,6 +105,7 @@
  * Unconditional discards are treated as having a condition of "true".
  */
 
+#include "main/compiler.h"
 #include "glsl_types.h"
 #include "ir.h"
 
@@ -121,6 +122,7 @@ public:
 };
 
 
+PUBLIC
 bool
 lower_discard(exec_list *instructions)
 {
diff --git a/src/glsl/lower_if_to_cond_assign.cpp b/src/glsl/lower_if_to_cond_assign.cpp
index 2c5d561..deb51ba 100644
--- a/src/glsl/lower_if_to_cond_assign.cpp
+++ b/src/glsl/lower_if_to_cond_assign.cpp
@@ -45,6 +45,7 @@
  * to attempt to flatten any if-statements appearing at depth > N.
  */
 
+#include "main/compiler.h"
 #include "glsl_types.h"
 #include "ir.h"
 #include "program/hash_table.h"
@@ -76,6 +77,7 @@ public:
    struct hash_table *condition_variables;
 };
 
+PUBLIC
 bool
 lower_if_to_cond_assign(exec_list *instructions, unsigned max_depth)
 {
diff --git a/src/glsl/lower_instructions.cpp b/src/glsl/lower_instructions.cpp
index d32ec80..ffdc9c9 100644
--- a/src/glsl/lower_instructions.cpp
+++ b/src/glsl/lower_instructions.cpp
@@ -96,6 +96,7 @@
  *
  */
 
+#include "main/compiler.h"
 #include "main/core.h" /* for M_LOG2E */
 #include "glsl_types.h"
 #include "ir.h"
@@ -132,6 +133,7 @@ private:
  */
 #define lowering(x) (this->lower & x)
 
+PUBLIC
 bool
 lower_instructions(exec_list *instructions, unsigned what_to_lower)
 {
diff --git a/src/glsl/lower_jumps.cpp b/src/glsl/lower_jumps.cpp
index bfc8c01..46a8b42 100644
--- a/src/glsl/lower_jumps.cpp
+++ b/src/glsl/lower_jumps.cpp
@@ -56,6 +56,7 @@
  * prevents further optimization, and thus is not currently performed.
  */
 
+#include "main/compiler.h"
 #include "glsl_types.h"
 #include <string.h>
 #include "ir.h"
@@ -992,6 +993,7 @@ lower_continue:
    }
 };
 
+PUBLIC
 bool
 do_lower_jumps(exec_list *instructions, bool pull_out_jumps, bool lower_sub_return, bool lower_main_return, bool lower_continue, bool lower_break)
 {
diff --git a/src/glsl/lower_mat_op_to_vec.cpp b/src/glsl/lower_mat_op_to_vec.cpp
index 08cae29..ae8ef9d 100644
--- a/src/glsl/lower_mat_op_to_vec.cpp
+++ b/src/glsl/lower_mat_op_to_vec.cpp
@@ -31,6 +31,7 @@
  * column or row.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_expression_flattening.h"
 #include "glsl_types.h"
@@ -80,6 +81,7 @@ mat_op_to_vec_predicate(ir_instruction *ir)
    return false;
 }
 
+PUBLIC
 bool
 do_mat_op_to_vec(exec_list *instructions)
 {
diff --git a/src/glsl/lower_noise.cpp b/src/glsl/lower_noise.cpp
index 85f59b6..94d86c4 100644
--- a/src/glsl/lower_noise.cpp
+++ b/src/glsl/lower_noise.cpp
@@ -28,6 +28,7 @@
  * \author Ian Romanick <ian.d.romanick at intel.com>
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_rvalue_visitor.h"
 
@@ -60,6 +61,7 @@ public:
 };
 
 
+PUBLIC
 bool
 lower_noise(exec_list *instructions)
 {
diff --git a/src/glsl/lower_output_reads.cpp b/src/glsl/lower_output_reads.cpp
index 5ba9720..6eb03de 100644
--- a/src/glsl/lower_output_reads.cpp
+++ b/src/glsl/lower_output_reads.cpp
@@ -22,6 +22,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "program/hash_table.h"
 
@@ -161,6 +162,7 @@ output_read_remover::visit_leave(ir_function_signature *sig)
    return visit_continue;
 }
 
+PUBLIC
 void
 lower_output_reads(exec_list *instructions)
 {
diff --git a/src/glsl/lower_packed_varyings.cpp b/src/glsl/lower_packed_varyings.cpp
index 4f61722..404ced8 100644
--- a/src/glsl/lower_packed_varyings.cpp
+++ b/src/glsl/lower_packed_varyings.cpp
@@ -144,6 +144,7 @@
  *   }
  */
 
+#include "main/compiler.h"
 #include "glsl_symbol_table.h"
 #include "ir.h"
 #include "ir_optimization.h"
diff --git a/src/glsl/lower_packing_builtins.cpp b/src/glsl/lower_packing_builtins.cpp
index db73c7b..25c4e20 100644
--- a/src/glsl/lower_packing_builtins.cpp
+++ b/src/glsl/lower_packing_builtins.cpp
@@ -21,6 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_builder.h"
 #include "ir_optimization.h"
@@ -1305,6 +1306,7 @@ private:
  *
  * \param op_mask is a bitmask of `enum lower_packing_builtins_op`.
  */
+PUBLIC
 bool
 lower_packing_builtins(exec_list *instructions, int op_mask)
 {
diff --git a/src/glsl/lower_texture_projection.cpp b/src/glsl/lower_texture_projection.cpp
index 6e3aaec..903f717 100644
--- a/src/glsl/lower_texture_projection.cpp
+++ b/src/glsl/lower_texture_projection.cpp
@@ -35,6 +35,7 @@
  * \author Eric Anholt <eric at anholt.net>
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 
 class lower_texture_projection_visitor : public ir_hierarchical_visitor {
@@ -88,6 +89,9 @@ lower_texture_projection_visitor::visit_leave(ir_texture *ir)
    return visit_continue;
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 bool
 do_lower_texture_projection(exec_list *instructions)
 {
diff --git a/src/glsl/lower_ubo_reference.cpp b/src/glsl/lower_ubo_reference.cpp
index aade203..632696d 100644
--- a/src/glsl/lower_ubo_reference.cpp
+++ b/src/glsl/lower_ubo_reference.cpp
@@ -36,6 +36,7 @@
 #include "ir.h"
 #include "ir_builder.h"
 #include "ir_rvalue_visitor.h"
+#include "main/compiler.h"
 #include "main/macros.h"
 
 using namespace ir_builder;
@@ -370,6 +371,7 @@ lower_ubo_reference_visitor::emit_ubo_loads(ir_dereference *deref,
 
 } /* unnamed namespace */
 
+PUBLIC
 void
 lower_ubo_reference(struct gl_shader *shader, exec_list *instructions)
 {
diff --git a/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp
index 0f50727..3021aab 100644
--- a/src/glsl/lower_variable_index_to_cond_assign.cpp
+++ b/src/glsl/lower_variable_index_to_cond_assign.cpp
@@ -46,6 +46,7 @@
  * used.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_rvalue_visitor.h"
 #include "ir_optimization.h"
@@ -512,6 +513,7 @@ public:
    }
 };
 
+PUBLIC
 bool
 lower_variable_index_to_cond_assign(exec_list *instructions,
 				    bool lower_input,
diff --git a/src/glsl/lower_vec_index_to_cond_assign.cpp b/src/glsl/lower_vec_index_to_cond_assign.cpp
index 8808596..9332ec5 100644
--- a/src/glsl/lower_vec_index_to_cond_assign.cpp
+++ b/src/glsl/lower_vec_index_to_cond_assign.cpp
@@ -36,6 +36,7 @@
  * propagation, will result in the same code in the end.
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_visitor.h"
 #include "ir_optimization.h"
@@ -223,6 +224,7 @@ ir_vec_index_to_cond_assign_visitor::visit_enter(ir_if *ir)
    return visit_continue;
 }
 
+PUBLIC
 bool
 do_vec_index_to_cond_assign(exec_list *instructions)
 {
diff --git a/src/glsl/lower_vector.cpp b/src/glsl/lower_vector.cpp
index 0cd6909..f4244f4 100644
--- a/src/glsl/lower_vector.cpp
+++ b/src/glsl/lower_vector.cpp
@@ -28,6 +28,7 @@
  * \author Ian Romanick <ian.d.romanick at intel.com>
  */
 
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_rvalue_visitor.h"
 
@@ -212,6 +213,7 @@ lower_vector_visitor::handle_rvalue(ir_rvalue **rvalue)
    this->progress = true;
 }
 
+PUBLIC
 bool
 lower_quadop_vector(exec_list *instructions, bool dont_lower_swz)
 {
diff --git a/src/glsl/lower_vector_insert.cpp b/src/glsl/lower_vector_insert.cpp
index 0e640cc..1407160 100644
--- a/src/glsl/lower_vector_insert.cpp
+++ b/src/glsl/lower_vector_insert.cpp
@@ -20,6 +20,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
+#include "main/compiler.h"
 #include "ir.h"
 #include "ir_builder.h"
 #include "ir_rvalue_visitor.h"
@@ -128,6 +129,7 @@ vector_insert_visitor::handle_rvalue(ir_rvalue **rv)
    base_ir->insert_before(factory.instructions);
 }
 
+PUBLIC
 bool
 lower_vector_insert(exec_list *instructions, bool lower_nonconstant_index)
 {
diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c
index e79dad7..1a77187 100644
--- a/src/glsl/ralloc.c
+++ b/src/glsl/ralloc.c
@@ -39,6 +39,7 @@
 _CRTIMP int _vscprintf(const char *format, va_list argptr);
 #endif
 
+#include "main/compiler.h"
 #include "ralloc.h"
 
 #ifndef va_copy
@@ -97,12 +98,14 @@ add_child(ralloc_header *parent, ralloc_header *info)
    }
 }
 
+PUBLIC
 void *
 ralloc_context(const void *ctx)
 {
    return ralloc_size(ctx, 0);
 }
 
+PUBLIC
 void *
 ralloc_size(const void *ctx, size_t size)
 {
@@ -122,6 +125,7 @@ ralloc_size(const void *ctx, size_t size)
    return PTR_FROM_HEADER(info);
 }
 
+PUBLIC
 void *
 rzalloc_size(const void *ctx, size_t size)
 {
@@ -172,6 +176,9 @@ reralloc_size(const void *ctx, void *ptr, size_t size)
    return resize(ptr, size);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 void *
 ralloc_array_size(const void *ctx, size_t size, unsigned count)
 {
@@ -181,6 +188,7 @@ ralloc_array_size(const void *ctx, size_t size, unsigned count)
    return ralloc_size(ctx, size * count);
 }
 
+PUBLIC
 void *
 rzalloc_array_size(const void *ctx, size_t size, unsigned count)
 {
@@ -190,6 +198,9 @@ rzalloc_array_size(const void *ctx, size_t size, unsigned count)
    return rzalloc_size(ctx, size * count);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 void *
 reralloc_array_size(const void *ctx, void *ptr, size_t size, unsigned count)
 {
@@ -199,6 +210,7 @@ reralloc_array_size(const void *ctx, void *ptr, size_t size, unsigned count)
    return reralloc_size(ctx, ptr, size * count);
 }
 
+PUBLIC
 void
 ralloc_free(void *ptr)
 {
@@ -265,6 +277,9 @@ ralloc_steal(const void *new_ctx, void *ptr)
    add_child(parent, info);
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 void *
 ralloc_parent(const void *ptr)
 {
@@ -357,7 +372,9 @@ cat(char **dest, const char *str, size_t n)
    return true;
 }
 
-
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 bool
 ralloc_strcat(char **dest, const char *str)
 {
@@ -375,6 +392,7 @@ ralloc_strncat(char **dest, const char *str, size_t n)
    return cat(dest, str, n);
 }
 
+PUBLIC
 char *
 ralloc_asprintf(const void *ctx, const char *fmt, ...)
 {
@@ -415,6 +433,9 @@ printf_length(const char *fmt, va_list untouched_args)
    return size;
 }
 
+// #if defined(HAVE_I965)
+PUBLIC
+// #endif
 char *
 ralloc_vasprintf(const void *ctx, const char *fmt, va_list args)
 {
@@ -438,6 +459,7 @@ ralloc_asprintf_append(char **str, const char *fmt, ...)
    return success;
 }
 
+PUBLIC
 bool
 ralloc_vasprintf_append(char **str, const char *fmt, va_list args)
 {
diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index 806d384..fe8b7ab 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -42,6 +42,7 @@ class PrintGlEnums(gl_XML.gl_print_base):
 
 
     def printRealHeader(self):
+        print '#include "main/compiler.h"'
         print '#include "main/glheader.h"'
         print '#include "main/enums.h"'
         print '#include "main/imports.h"'
@@ -91,6 +92,7 @@ static int compar_nr( const int *a, const unsigned *b )
 
 static char token_tmp[20];
 
+PUBLIC
 const char *_mesa_lookup_enum_by_nr( int nr )
 {
    unsigned * i;
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index e9c16e7..59cfd0c 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -19,11 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-if NEED_LIBDRICORE
-DRICORE_SUBDIR = libdricore
-endif
-
-SUBDIRS = program x86 x86-64 . $(DRICORE_SUBDIR) main/tests
+SUBDIRS = program x86 x86-64 . main/tests
 
 if HAVE_X11_DRIVER
 SUBDIRS += drivers/x11
@@ -79,14 +75,26 @@ main/get_hash.h: $(GLAPI)/gl_and_es_API.xml main/get_hash_params.py 	\
 		-f $< > $@.tmp;						\
 	mv $@.tmp $@;
 
-noinst_LTLIBRARIES =
-if NEED_LIBMESA
-noinst_LTLIBRARIES += libmesa.la
+lib_LTLIBRARIES =
+check_LTLIBRARIES =
+
+if NEED_LIBMESACORE
+lib_LTLIBRARIES += libmesacore at VERSION@.la
+libmesacore at VERSION@_la_LDFLAGS = -Wl,--no-undefined -shared -avoid-version
 else
-check_LTLIBRARIES = libmesa.la
+check_LTLIBRARIES += libmesacore at VERSION@.la
 endif
+
 if HAVE_GALLIUM
-noinst_LTLIBRARIES += libmesagallium.la
+lib_LTLIBRARIES += libmesagallium at VERSION@.la
+libmesagallium at VERSION@_la_LDFLAGS = -Wl,--no-undefined -shared -avoid-version
+endif
+
+if NEED_LIBMESADRI
+lib_LTLIBRARIES += libmesadri at VERSION@.la
+libmesadri at VERSION@_la_LDFLAGS = -Wl,--no-undefined -shared -avoid-version
+else
+check_LTLIBRARIES += libmesadri at VERSION@.la
 endif
 
 SRCDIR = $(top_srcdir)/src/mesa/
@@ -94,6 +102,9 @@ BUILDDIR = $(top_builddir)/src/mesa/
 include Makefile.sources
 
 AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
+if HAVE_X11_DRIVER
+AM_CPPFLAGS += -DHAVE_X11_DRIVER
+endif
 AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
 
@@ -118,24 +129,35 @@ AM_CPPFLAGS += \
         -I$(top_srcdir)/src/mesa/sparc
 endif
 
-libmesa_la_SOURCES = \
+
+libmesacore at VERSION@_la_SOURCES = $(MESA_CORE_FILES)
+
+libmesacore at VERSION@_la_LIBADD = \
+	$(top_builddir)/src/mesa/program/libmesacore_program.la \
+	$(top_builddir)/src/glsl/libglsl.la \
+	$(GLAPI_LIB) \
+	$(DLOPEN_LIBS)
+
+nodist_EXTRA_libmesadri at VERSION@_la_SOURCES = dummy.cpp
+
+
+libmesadri at VERSION@_la_SOURCES = \
 	$(MESA_FILES) \
-        $(MESA_ASM_FILES_FOR_ARCH)
-
-libmesa_la_LIBADD = \
-        $(top_builddir)/src/glsl/libglsl.la \
-        $(top_builddir)/src/mesa/program/libprogram.la \
-        $()
-libmesa_la_LDFLAGS =
-
-libmesagallium_la_SOURCES = \
-	$(MESA_GALLIUM_FILES) \
-        $(MESA_ASM_FILES_FOR_ARCH)
-
-libmesagallium_la_LIBADD = \
-        $(top_builddir)/src/glsl/libglsl.la \
-        $(top_builddir)/src/mesa/program/libprogram.la \
-        $()
+	$(MESA_ASM_FILES_FOR_ARCH)
+
+libmesadri at VERSION@_la_LIBADD = \
+	libmesacore at VERSION@.la \
+	$(GLAPI_LIB) \
+	$(DLOPEN_LIBS)
+
+
+libmesagallium at VERSION@_la_SOURCES = $(MESA_GALLIUM_FILES)
+
+libmesagallium at VERSION@_la_LIBADD = \
+	libmesacore at VERSION@.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
+	$(GLAPI_LIB) \
+	$(DLOPEN_LIBS)
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index 122ea8e..81f92eb 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -274,7 +274,6 @@ PROGRAM_FILES = \
 	$(BUILDDIR)program/program_parse.tab.c
 
 ASM_C_FILES =	\
-	$(SRCDIR)x86/common_x86.c \
 	$(SRCDIR)x86/x86_xform.c \
 	$(SRCDIR)x86/3dnow.c \
 	$(SRCDIR)x86/sse.c \
@@ -283,7 +282,6 @@ ASM_C_FILES =	\
 	$(SRCDIR)x86-64/x86-64.c
 
 X86_FILES =			\
-	$(SRCDIR)x86/common_x86_asm.S	\
 	$(SRCDIR)x86/x86_xform2.S	\
 	$(SRCDIR)x86/x86_xform3.S	\
 	$(SRCDIR)x86/x86_xform4.S	\
@@ -313,13 +311,20 @@ COMMON_DRIVER_FILES =			\
 	$(SRCDIR)drivers/common/driverfuncs.c	\
 	$(SRCDIR)drivers/common/meta.c
 
+# Core files for non-Gallium and Gallium drivers
+MESA_CORE_FILES = \
+	$(MAIN_FILES) \
+	$(MATH_FILES) \
+	$(VBO_FILES) \
+	$(SRCDIR)x86/common_x86.c
+
+if HAVE_X86_ASM
+MESA_CORE_FILES += $(SRCDIR)x86/common_x86_asm.S
+endif
 
 # Sources for building non-Gallium drivers
 MESA_FILES = \
-	$(MAIN_FILES)		\
-	$(MATH_FILES)		\
 	$(MATH_XFORM_FILES)	\
-	$(VBO_FILES)		\
 	$(TNL_FILES)		\
 	$(SWRAST_FILES)	\
 	$(SWRAST_SETUP_FILES)	\
@@ -328,14 +333,9 @@ MESA_FILES = \
 
 # Sources for building Gallium drivers
 MESA_GALLIUM_FILES = \
-	$(MAIN_FILES)		\
-	$(MATH_FILES)		\
-	$(VBO_FILES)		\
-	$(STATETRACKER_FILES)	\
-	$(SRCDIR)x86/common_x86.c
+	$(STATETRACKER_FILES)
 
 ### Include directories
-
 INCLUDE_DIRS = \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/glsl \
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 5faa98a..0ef5a80 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/accum.h"
@@ -68,6 +69,7 @@
  *
  * \param table the dd_function_table to initialize
  */
+PUBLIC
 void
 _mesa_init_driver_functions(struct dd_function_table *driver)
 {
@@ -221,6 +223,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
  * driver state.
  * Only the Intel drivers use this so far.
  */
+PUBLIC
 void
 _mesa_init_driver_state(struct gl_context *ctx)
 {
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 798efa6..215408d 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -31,6 +31,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/mtypes.h"
 #include "main/imports.h"
@@ -427,6 +428,7 @@ link_program_with_debug(struct gl_context *ctx, GLuint program)
  * Initialize meta-ops for a context.
  * To be called once during context creation.
  */
+PUBLIC
 void
 _mesa_meta_init(struct gl_context *ctx)
 {
@@ -440,6 +442,7 @@ _mesa_meta_init(struct gl_context *ctx)
  * Free context meta-op state.
  * To be called once during context destruction.
  */
+PUBLIC
 void
 _mesa_meta_free(struct gl_context *ctx)
 {
@@ -1150,6 +1153,7 @@ _mesa_meta_end(struct gl_context *ctx)
 /**
  * Determine whether Mesa is currently in a meta state.
  */
+PUBLIC
 GLboolean
 _mesa_meta_in_progress(struct gl_context *ctx)
 {
@@ -1787,6 +1791,7 @@ blitframebuffer_texture(struct gl_context *ctx,
  * Meta implementation of ctx->Driver.BlitFramebuffer() in terms
  * of texture mapping and polygon rendering.
  */
+PUBLIC
 void
 _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
                            GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
@@ -2013,6 +2018,7 @@ meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit)
 /**
  * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
  */
+PUBLIC
 void
 _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
 {
@@ -2263,6 +2269,7 @@ meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear)
 /**
  * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
  */
+PUBLIC
 void
 _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
 {
@@ -2380,6 +2387,7 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers)
  * Meta implementation of ctx->Driver.CopyPixels() in terms
  * of texture mapping and polygon rendering and GLSL shaders.
  */
+PUBLIC
 void
 _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
                       GLsizei width, GLsizei height,
@@ -2630,6 +2638,7 @@ init_draw_depth_pixels(struct gl_context *ctx)
  * Meta implementation of ctx->Driver.DrawPixels() in terms
  * of texture mapping and polygon rendering.
  */
+PUBLIC
 void
 _mesa_meta_DrawPixels(struct gl_context *ctx,
                       GLint x, GLint y, GLsizei width, GLsizei height,
@@ -2899,6 +2908,7 @@ alpha_test_raster_color(struct gl_context *ctx)
  * the 'off' bits.  A bitmap cache as in the gallium/mesa state
  * tracker would improve performance a lot.
  */
+PUBLIC
 void
 _mesa_meta_Bitmap(struct gl_context *ctx,
                   GLint x, GLint y, GLsizei width, GLsizei height,
@@ -3810,6 +3820,7 @@ get_temp_image_type(struct gl_context *ctx, gl_format format)
  * Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions.
  * Have to be careful with locking and meta state for pixel transfer.
  */
+PUBLIC
 void
 _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
                            struct gl_texture_image *texImage,
diff --git a/src/mesa/drivers/dri/common/Makefile.am b/src/mesa/drivers/dri/common/Makefile.am
index ce4119d..1d406ce 100644
--- a/src/mesa/drivers/dri/common/Makefile.am
+++ b/src/mesa/drivers/dri/common/Makefile.am
@@ -30,9 +30,9 @@ AM_CFLAGS = \
 	$(LIBDRM_CFLAGS) \
 	$(VISIBILITY_CFLAGS)
 
-noinst_LTLIBRARIES = \
-	libdricommon.la \
-	libdri_test_stubs.la
+noinst_LTLIBRARIES = libdricommon.la
+
+check_LTLIBRARIES = libdri_test_stubs.la
 
 libdricommon_la_SOURCES = \
 	utils.c \
diff --git a/src/mesa/drivers/dri/i915/Makefile.am b/src/mesa/drivers/dri/i915/Makefile.am
index b66ccbe..feb8a19 100644
--- a/src/mesa/drivers/dri/i915/Makefile.am
+++ b/src/mesa/drivers/dri/i915/Makefile.am
@@ -50,9 +50,10 @@ dri_LTLIBRARIES = i915_dri.la
 endif
 
 i915_dri_la_SOURCES = $(i915_FILES)
-i915_dri_la_LDFLAGS = -module -avoid-version -shared
+i915_dri_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
 i915_dri_la_LIBADD = \
 	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
 	$(DRI_LIB_DEPS) \
 	$(GLAPI_LIB) \
-	$(INTEL_LIBS)
+	$(INTEL_LIBS) \
+	$(CLOCK_LIB)
diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
index 043a599..fc7db92 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -52,28 +52,28 @@ AM_CXXFLAGS = $(AM_CFLAGS)
 
 dridir = $(DRI_DRIVER_INSTALL_DIR)
 
-noinst_LTLIBRARIES = libi965_dri.la
+if HAVE_I965_DRI
 dri_LTLIBRARIES = i965_dri.la
+else
+check_LTLIBRARIES = i965_dri.la
+endif
 
-libi965_dri_la_SOURCES = $(i965_FILES)
 
 # list of libs to be linked against by i965_dri.so and i965 test programs.
 COMMON_LIBS = \
-	libi965_dri.la \
 	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
 	$(DRI_LIB_DEPS) \
-	$(GLAPI_LIB) \
-	$(INTEL_LIBS)
+	$(INTEL_LIBS) \
+	$(CLOCK_LIB)
 
 TEST_LIBS = \
-        $(top_builddir)/src/mesa/drivers/dri/common/libdri_test_stubs.la \
-	$(COMMON_LIBS) \
-	$(CLOCK_LIB)
+	i965_dri.la \
+	$(top_builddir)/src/mesa/drivers/dri/common/libdri_test_stubs.la \
+	$(COMMON_LIBS)
 
-i965_dri_la_SOURCES =
-nodist_EXTRA_i965_dri_la_SOURCES = dummy2.cpp
+i965_dri_la_SOURCES = $(i965_FILES)
 i965_dri_la_LIBADD = $(COMMON_LIBS)
-i965_dri_la_LDFLAGS = -module -avoid-version -shared
+i965_dri_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
 
 TESTS = \
         test_eu_compact \
diff --git a/src/mesa/drivers/dri/nouveau/Makefile.am b/src/mesa/drivers/dri/nouveau/Makefile.am
index 3bd2885..fbb6d32 100644
--- a/src/mesa/drivers/dri/nouveau/Makefile.am
+++ b/src/mesa/drivers/dri/nouveau/Makefile.am
@@ -42,7 +42,7 @@ endif
 nouveau_vieux_dri_la_SOURCES = \
 	$(NOUVEAU_C_FILES)
 
-nouveau_vieux_dri_la_LDFLAGS = -module -avoid-version -shared
+nouveau_vieux_dri_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
 nouveau_vieux_dri_la_LIBADD = \
 	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
 	$(DRI_LIB_DEPS) \
diff --git a/src/mesa/drivers/dri/r200/Makefile.am b/src/mesa/drivers/dri/r200/Makefile.am
index bcb6592..0af8114 100644
--- a/src/mesa/drivers/dri/r200/Makefile.am
+++ b/src/mesa/drivers/dri/r200/Makefile.am
@@ -45,7 +45,7 @@ endif
 r200_dri_la_SOURCES = \
         $(R200_C_FILES)
 
-r200_dri_la_LDFLAGS = -module -avoid-version -shared
+r200_dri_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
 r200_dri_la_LIBADD = \
 	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
 	$(DRI_LIB_DEPS) \
diff --git a/src/mesa/drivers/dri/radeon/Makefile.am b/src/mesa/drivers/dri/radeon/Makefile.am
index 3da3ecd..f9a7bd8 100644
--- a/src/mesa/drivers/dri/radeon/Makefile.am
+++ b/src/mesa/drivers/dri/radeon/Makefile.am
@@ -45,7 +45,7 @@ endif
 radeon_dri_la_SOURCES = \
         $(RADEON_C_FILES)
 
-radeon_dri_la_LDFLAGS = -module -avoid-version -shared
+radeon_dri_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
 radeon_dri_la_LIBADD = \
 	$(top_builddir)/src/mesa/drivers/dri/common/libdricommon.la \
 	$(DRI_LIB_DEPS) \
diff --git a/src/mesa/drivers/dri/swrast/Makefile.am b/src/mesa/drivers/dri/swrast/Makefile.am
index d7e94b2..d71d93c 100644
--- a/src/mesa/drivers/dri/swrast/Makefile.am
+++ b/src/mesa/drivers/dri/swrast/Makefile.am
@@ -42,6 +42,6 @@ endif
 swrast_dri_la_SOURCES = \
 	$(SWRAST_C_FILES)
 
-swrast_dri_la_LDFLAGS = -module -avoid-version -shared
+swrast_dri_la_LDFLAGS = -Wl,--no-undefined -module -avoid-version -shared
 swrast_dri_la_LIBADD = \
 	$(DRI_LIB_DEPS)
diff --git a/src/mesa/drivers/osmesa/Makefile.am b/src/mesa/drivers/osmesa/Makefile.am
index 748486d..9d4ef84 100644
--- a/src/mesa/drivers/osmesa/Makefile.am
+++ b/src/mesa/drivers/osmesa/Makefile.am
@@ -40,7 +40,7 @@ lib at OSMESA_LIB@_la_SOURCES = osmesa.c
 lib at OSMESA_LIB@_la_LDFLAGS = -Wl,--no-undefined -shared -version-number @OSMESA_VERSION@
 
 lib at OSMESA_LIB@_la_LIBADD = \
-	$(top_builddir)/src/mesa/libmesa.la \
+	$(DRI_LIB_DEPS) \
 	$(GLAPI_LIB) \
 	$(OSMESA_LIB_DEPS)
 
diff --git a/src/mesa/drivers/x11/Makefile.am b/src/mesa/drivers/x11/Makefile.am
index 0041494..902258f 100644
--- a/src/mesa/drivers/x11/Makefile.am
+++ b/src/mesa/drivers/x11/Makefile.am
@@ -49,17 +49,15 @@ lib at GL_LIB@_la_SOURCES = \
 	xm_line.c \
 	xm_tri.c
 
-# Force usage of a C++ linker
-nodist_EXTRA_lib at GL_LIB@_la_SOURCES = dummy.cpp
-
 GL_MAJOR = 1
 GL_MINOR = 6
 GL_PATCH = 0
 
 lib at GL_LIB@_la_LIBADD = \
-	$(top_builddir)/src/mesa/libmesa.la \
-	$(top_builddir)/src/mapi/glapi/libglapi.la
+	$(top_builddir)/src/mapi/glapi/libglapi.la \
+	$(DRI_LIB_DEPS) \
+	$(GLAPI_LIB)
+
 lib at GL_LIB@_la_LDFLAGS = \
 	-version-number $(GL_MAJOR):$(GL_MINOR):$(GL_PATCH) \
-	-no-undefined \
-	$(GL_LIB_DEPS)
+	-no-undefined
diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
deleted file mode 100644
index 56771ed..0000000
--- a/src/mesa/libdricore/Makefile.am
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright © 2012 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-SRCDIR=$(top_srcdir)/src/mesa/
-BUILDDIR=$(top_builddir)/src/mesa/
-include ../Makefile.sources
-include ../../glsl/Makefile.sources
-
-noinst_PROGRAMS =
-
-AM_CPPFLAGS = \
-	$(INCLUDE_DIRS) \
-	$(DEFINES) \
-	-DUSE_DRICORE
-
-libdricore at VERSION@_la_SOURCES = \
-	$(MESA_FILES) \
-	$(LIBGLCPP_GENERATED_FILES) \
-	$(LIBGLCPP_FILES) \
-	$(LIBGLSL_GENERATED_CXX_FILES) \
-	$(LIBGLSL_FILES)
-libdricore at VERSION@_la_LDFLAGS = -version-number 1:0
-libdricore at VERSION@_la_LIBADD = \
-	../program/libdricore_program.la \
-	$(GLAPI_LIB) \
-	$(DLOPEN_LIBS)
-
-if HAVE_X86_ASM
-libdricore at VERSION@_la_SOURCES += $(X86_FILES)
-AM_CPPFLAGS += \
-        -I$(top_builddir)/src/mesa/x86 \
-        -I$(top_srcdir)/src/mesa/x86
-endif
-
-if HAVE_X86_64_ASM
-libdricore at VERSION@_la_SOURCES += $(X86_64_FILES)
-AM_CPPFLAGS += \
-        -I$(top_builddir)/src/mesa/x86-64 \
-        -I$(top_srcdir)/src/mesa/x86-64
-endif
-
-if HAVE_SPARC_ASM
-libdricore at VERSION@_la_SOURCES += $(SPARC_FILES)
-AM_CPPFLAGS += \
-        -I$(top_builddir)/src/mesa/sparc \
-        -I$(top_srcdir)/src/mesa/sparc
-endif
-
-if HAVE_DRI
-lib_LTLIBRARIES = libdricore at VERSION@.la
-endif
diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c
index 421fe6c..43cab6d 100644
--- a/src/mesa/main/accum.c
+++ b/src/mesa/main/accum.c
@@ -22,6 +22,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "compiler.h"
 #include "glheader.h"
 #include "accum.h"
 #include "condrender.h"
@@ -109,6 +110,7 @@ _mesa_Accum( GLenum op, GLfloat value )
  * writing the clear color to it.  Called by the driver's implementation
  * of the glClear function.
  */
+PUBLIC
 void
 _mesa_clear_accum_buffer(struct gl_context *ctx)
 {
@@ -436,6 +438,7 @@ accum_return(struct gl_context *ctx, GLfloat value,
  * signed 16-bit color channels could implement hardware accumulation
  * operations, but no driver does so at this time.
  */
+PUBLIC
 void
 _mesa_accum(struct gl_context *ctx, GLenum op, GLfloat value)
 {
diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index ea09238..206c5ee 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -34,6 +34,7 @@
  *    Keith Whitwell <keith at tungstengraphics.com>
  */
 
+#include "compiler.h"
 #include "glheader.h"
 #include "api_arrayelt.h"
 #include "bufferobj.h"
@@ -1405,6 +1406,7 @@ static attrib_func AttribFuncsARB[3][4][NUM_TYPES] = {
 };
 
 
+PUBLIC
 GLboolean
 _ae_create_context(struct gl_context *ctx)
 {
@@ -1702,6 +1704,7 @@ _ae_ArrayElement(GLint elt)
 }
 
 
+PUBLIC
 void
 _ae_invalidate_state(struct gl_context *ctx, GLuint new_state)
 {
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index 51a2993..25f95da 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -29,6 +29,7 @@
  */
 
 
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/hash.h"
@@ -45,6 +46,7 @@
  * \note Called from the GL API dispatcher by both glBindProgramNV
  * and glBindProgramARB.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_BindProgramARB(GLenum target, GLuint id)
 {
@@ -130,6 +132,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
  * \note Not compiled into display lists.
  * \note Called by both glDeleteProgramsNV and glDeleteProgramsARB.
  */
+PUBLIC
 void GLAPIENTRY 
 _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids)
 {
@@ -184,6 +187,7 @@ _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids)
  * \note Not compiled into display lists.
  * \note Called by both glGenProgramsNV and glGenProgramsARB.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_GenProgramsARB(GLsizei n, GLuint *ids)
 {
@@ -297,6 +301,7 @@ get_env_param_pointer(struct gl_context *ctx, const char *func,
    }
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
                        const GLvoid *string)
@@ -482,6 +487,7 @@ _mesa_GetProgramEnvParameterfvARB(GLenum target, GLuint index,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
                                  GLfloat x, GLfloat y, GLfloat z, GLfloat w)
@@ -499,6 +505,7 @@ _mesa_ProgramLocalParameter4fARB(GLenum target, GLuint index,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
                                   const GLfloat *params)
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 5d50d29..a36dbae 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -38,6 +38,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "hash.h"
 #include "image.h"
@@ -92,6 +93,7 @@ unbind_array_object_vbos(struct gl_context *ctx, struct gl_array_object *obj)
  * This function is intended to be called via
  * \c dd_function_table::NewArrayObject.
  */
+PUBLIC
 struct gl_array_object *
 _mesa_new_array_object( struct gl_context *ctx, GLuint name )
 {
@@ -108,6 +110,7 @@ _mesa_new_array_object( struct gl_context *ctx, GLuint name )
  * This function is intended to be called via
  * \c dd_function_table::DeleteArrayObject.
  */
+PUBLIC
 void
 _mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj )
 {
@@ -125,6 +128,7 @@ _mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj )
  * Note: this should only be called from the _mesa_reference_array_object()
  * inline function.
  */
+PUBLIC
 void
 _mesa_reference_array_object_(struct gl_context *ctx,
                               struct gl_array_object **ptr,
@@ -398,6 +402,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
  * that this function requires all ids to have been previously generated
  * by glGenVertexArrays[APPLE]().
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_BindVertexArray( GLuint id )
 {
@@ -414,6 +419,7 @@ _mesa_BindVertexArray( GLuint id )
  * pointers in the old and new objects.  The only arrays that are "dirty" are
  * the ones that are non-NULL in either object.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_BindVertexArrayAPPLE( GLuint id )
 {
@@ -428,6 +434,7 @@ _mesa_BindVertexArrayAPPLE( GLuint id )
  * \param n      Number of array objects to delete.
  * \param ids    Array of \c n array object IDs.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids)
 {
@@ -509,6 +516,7 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays)
  * ARB version of glGenVertexArrays()
  * All arrays will be required to live in VBOs.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
 {
@@ -521,6 +529,7 @@ _mesa_GenVertexArrays(GLsizei n, GLuint *arrays)
  * APPLE version of glGenVertexArraysAPPLE()
  * Arrays may live in VBOs or ordinary memory.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays)
 {
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 9e11ca7..cec2f3f 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -29,6 +29,7 @@
 
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "blend.h"
 #include "context.h"
@@ -560,6 +561,7 @@ _mesa_BlendColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
  * On a change, flushes the vertices and notifies the driver via
  * dd_function_table::AlphaFunc callback.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_AlphaFunc( GLenum func, GLclampf ref )
 {
@@ -676,6 +678,7 @@ _mesa_IndexMask( GLuint mask )
  * change, flushes the vertices and notifies the driver via the
  * dd_function_table::ColorMask callback.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_ColorMask( GLboolean red, GLboolean green,
                  GLboolean blue, GLboolean alpha )
@@ -716,6 +719,7 @@ _mesa_ColorMask( GLboolean red, GLboolean green,
 /**
  * For GL_EXT_draw_buffers2 and GL3
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_ColorMaski( GLuint buf, GLboolean red, GLboolean green,
                         GLboolean blue, GLboolean alpha )
@@ -751,6 +755,7 @@ _mesa_ColorMaski( GLuint buf, GLboolean red, GLboolean green,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_ClampColor(GLenum target, GLenum clamp)
 {
@@ -862,6 +867,7 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx)
  * overriding the format of the surface.  This is a helper for doing the
  * surface format override variant.
  */
+PUBLIC
 gl_format
 _mesa_get_render_format(const struct gl_context *ctx, gl_format format)
 {
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index b22340f..eb42c7d 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -31,6 +31,7 @@
  */
 
 #include <stdbool.h>
+#include "compiler.h"
 #include "glheader.h"
 #include "enums.h"
 #include "hash.h"
@@ -276,6 +277,7 @@ _mesa_delete_buffer_object(struct gl_context *ctx,
  * This is normally only called from the _mesa_reference_buffer_object() macro
  * when there's a real pointer change.
  */
+PUBLIC
 void
 _mesa_reference_buffer_object_(struct gl_context *ctx,
                                struct gl_buffer_object **ptr,
@@ -339,6 +341,7 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
 /**
  * Initialize a buffer object to default values.
  */
+PUBLIC
 void
 _mesa_initialize_buffer_object( struct gl_context *ctx,
 				struct gl_buffer_object *obj,
@@ -783,6 +786,7 @@ unbind(struct gl_context *ctx,
  * Plug default/fallback buffer object functions into the device
  * driver hooks.
  */
+PUBLIC
 void
 _mesa_init_buffer_object_functions(struct dd_function_table *driver)
 {
@@ -809,6 +813,7 @@ _mesa_init_buffer_object_functions(struct dd_function_table *driver)
 /* API Functions                                                      */
 /**********************************************************************/
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BindBuffer(GLenum target, GLuint buffer)
 {
@@ -828,6 +833,7 @@ _mesa_BindBuffer(GLenum target, GLuint buffer)
  * \param n      Number of buffer objects to delete.
  * \param ids    Array of \c n buffer object IDs.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
 {
@@ -937,6 +943,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
  * \param n       Number of IDs to generate.
  * \param buffer  Array of \c n locations to store the IDs.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_GenBuffers(GLsizei n, GLuint *buffer)
 {
@@ -996,6 +1003,7 @@ _mesa_IsBuffer(GLuint id)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BufferData(GLenum target, GLsizeiptrARB size,
                     const GLvoid * data, GLenum usage)
@@ -1075,6 +1083,7 @@ _mesa_BufferData(GLenum target, GLsizeiptrARB size,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BufferSubData(GLenum target, GLintptrARB offset,
                        GLsizeiptrARB size, const GLvoid * data)
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 2bdbf41..1aab99f 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -29,7 +29,7 @@
  */
 
 
-
+#include "compiler.h"
 #include "glheader.h"
 #include "buffers.h"
 #include "colormac.h"
@@ -238,6 +238,7 @@ read_buffer_enum_to_index(GLenum buffer)
  *
  * See the GL_EXT_framebuffer_object spec for more info.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_DrawBuffer(GLenum buffer)
 {
diff --git a/src/mesa/main/condrender.c b/src/mesa/main/condrender.c
index 3d9b0ec..298a1b9 100644
--- a/src/mesa/main/condrender.c
+++ b/src/mesa/main/condrender.c
@@ -30,6 +30,7 @@
  * \author Brian Paul
  */
 
+#include "compiler.h"
 #include "glheader.h"
 #include "condrender.h"
 #include "enums.h"
@@ -37,6 +38,7 @@
 #include "queryobj.h"
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BeginConditionalRender(GLuint queryId, GLenum mode)
 {
@@ -85,6 +87,7 @@ _mesa_BeginConditionalRender(GLuint queryId, GLenum mode)
 }
 
 
+PUBLIC
 void APIENTRY
 _mesa_EndConditionalRender(void)
 {
@@ -117,6 +120,7 @@ _mesa_EndConditionalRender(void)
  *
  * \return GL_TRUE if we should render, GL_FALSE if we should discard
  */
+PUBLIC
 GLboolean
 _mesa_check_conditional_render(struct gl_context *ctx)
 {
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index d726d11..5eb72bd 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -76,6 +76,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "accum.h"
@@ -141,16 +142,16 @@
 
 
 #ifndef MESA_VERBOSE
-int MESA_VERBOSE = 0;
+PUBLIC int MESA_VERBOSE = 0;
 #endif
 
 #ifndef MESA_DEBUG_FLAGS
-int MESA_DEBUG_FLAGS = 0;
+PUBLIC int MESA_DEBUG_FLAGS = 0;
 #endif
 
 
 /* ubyte -> float conversion */
-GLfloat _mesa_ubyte_to_float_color_tab[256];
+PUBLIC GLfloat _mesa_ubyte_to_float_color_tab[256];
 
 
 
@@ -162,6 +163,7 @@ GLfloat _mesa_ubyte_to_float_color_tab[256];
  * Called by window system just before swapping buffers.
  * We have to finish any pending rendering.
  */
+PUBLIC
 void
 _mesa_notifySwapBuffers(struct gl_context *ctx)
 {
@@ -204,6 +206,7 @@ _mesa_notifySwapBuffers(struct gl_context *ctx)
  *
  * \note Need to add params for level and numAuxBuffers (at least)
  */
+PUBLIC
 struct gl_config *
 _mesa_create_visual( GLboolean dbFlag,
                      GLboolean stereoFlag,
@@ -245,6 +248,9 @@ _mesa_create_visual( GLboolean dbFlag,
  *
  * \sa _mesa_create_visual() above for the parameter description.
  */
+#if defined(HAVE_X11_DRIVER)
+PUBLIC
+#endif
 GLboolean
 _mesa_initialize_visual( struct gl_config *vis,
                          GLboolean dbFlag,
@@ -313,6 +319,7 @@ _mesa_initialize_visual( struct gl_config *vis,
  * 
  * Frees the visual structure.
  */
+PUBLIC
 void
 _mesa_destroy_visual( struct gl_config *vis )
 {
@@ -928,6 +935,7 @@ create_beginend_table(const struct gl_context *ctx)
    return table;
 }
 
+PUBLIC
 void
 _mesa_initialize_dispatch_tables(struct gl_context *ctx)
 {
@@ -964,6 +972,7 @@ _mesa_initialize_dispatch_tables(struct gl_context *ctx)
  * \param driverFunctions table of device driver functions for this context
  *        to use
  */
+PUBLIC
 GLboolean
 _mesa_initialize_context(struct gl_context *ctx,
                          gl_api api,
@@ -1097,6 +1106,7 @@ fail:
  * 
  * \return pointer to a new __struct gl_contextRec or NULL if error.
  */
+PUBLIC
 struct gl_context *
 _mesa_create_context(gl_api api,
                      const struct gl_config *visual,
@@ -1129,6 +1139,7 @@ _mesa_create_context(gl_api api,
  *
  * \sa _mesa_initialize_context() and init_attrib_groups().
  */
+PUBLIC
 void
 _mesa_free_context_data( struct gl_context *ctx )
 {
@@ -1206,6 +1217,7 @@ _mesa_free_context_data( struct gl_context *ctx )
  * 
  * Calls _mesa_free_context_data() and frees the gl_context object itself.
  */
+PUBLIC
 void
 _mesa_destroy_context( struct gl_context *ctx )
 {
@@ -1228,6 +1240,7 @@ _mesa_destroy_context( struct gl_context *ctx )
  * memcpy is not enough due to the existence of internal pointers in their data
  * structures.
  */
+PUBLIC
 void
 _mesa_copy_context( const struct gl_context *src, struct gl_context *dst,
                     GLuint mask )
@@ -1421,6 +1434,7 @@ _mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height)
  * \param drawBuffer  the drawing framebuffer
  * \param readBuffer  the reading framebuffer
  */
+PUBLIC
 GLboolean
 _mesa_make_current( struct gl_context *newCtx,
                     struct gl_framebuffer *drawBuffer,
@@ -1527,6 +1541,7 @@ _mesa_make_current( struct gl_context *newCtx,
  * Any display lists, textures or programs associated with 'ctx' will
  * be deleted if nobody else is sharing them.
  */
+PUBLIC
 GLboolean
 _mesa_share_state(struct gl_context *ctx, struct gl_context *ctxToShare)
 {
@@ -1560,6 +1575,7 @@ _mesa_share_state(struct gl_context *ctx, struct gl_context *ctxToShare)
  * context.  If you need speed, see the #GET_CURRENT_CONTEXT macro in
  * context.h.
  */
+PUBLIC
 struct gl_context *
 _mesa_get_current_context( void )
 {
@@ -1634,6 +1650,7 @@ _mesa_finish(struct gl_context *ctx)
 /**
  * Flush commands.
  */
+PUBLIC
 void
 _mesa_flush(struct gl_context *ctx)
 {
@@ -1667,6 +1684,9 @@ _mesa_Finish(void)
  * Calls the #ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH macro and the
  * dd_function_table::Flush driver callback, if not NULL.
  */
+#if defined(HAVE_X11_DRIVER)
+PUBLIC
+#endif
 void GLAPIENTRY
 _mesa_Flush(void)
 {
diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c
index 8d482a6..1e7e2fe 100644
--- a/src/mesa/main/cpuinfo.c
+++ b/src/mesa/main/cpuinfo.c
@@ -23,7 +23,7 @@
  */
 
 
-#include "main/compiler.h"
+#include "compiler.h"
 #include "main/cpuinfo.h"
 
 
@@ -45,6 +45,7 @@ _mesa_get_cpu_features(void)
  * Mesa is using (such as SSE or Altivec).
  * \return information string, free it with free()
  */
+PUBLIC
 char *
 _mesa_get_cpu_string(void)
 {
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c
index 29851ec..d3e2ace 100644
--- a/src/mesa/main/depth.c
+++ b/src/mesa/main/depth.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
@@ -57,6 +58,7 @@ _mesa_ClearDepthf( GLclampf depth )
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_DepthFunc( GLenum func )
 {
@@ -92,6 +94,7 @@ _mesa_DepthFunc( GLenum func )
 
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_DepthMask( GLboolean flag )
 {
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 5e2fd80..22476c8 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -28,6 +28,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "clip.h"
 #include "context.h"
@@ -154,6 +155,7 @@ invalid_enum_error:
  * Get's the current context, assures that we're outside glBegin()/glEnd() and
  * calls client_state().
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_EnableClientState( GLenum cap )
 {
@@ -232,6 +234,7 @@ enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit)
  * Helper function to enable or disable GL_MULTISAMPLE, skipping the check for
  * whether the API supports it (GLES doesn't).
  */
+PUBLIC
 void
 _mesa_set_multisample(struct gl_context *ctx, GLboolean state)
 {
@@ -249,6 +252,7 @@ _mesa_set_multisample(struct gl_context *ctx, GLboolean state)
  * Helper function to enable or disable GL_FRAMEBUFFER_SRGB, skipping the
  * check for whether the API supports it (GLES doesn't).
  */
+PUBLIC
 void
 _mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state)
 {
@@ -274,6 +278,7 @@ _mesa_set_framebuffer_srgb(struct gl_context *ctx, GLboolean state)
  * are effectivly present before updating. Notifies the driver via
  * dd_function_table::Enable.
  */
+PUBLIC
 void
 _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
 {
@@ -1060,6 +1065,7 @@ _mesa_Disable( GLenum cap )
 /**
  * Enable/disable an indexed state var.
  */
+PUBLIC
 void
 _mesa_set_enablei(struct gl_context *ctx, GLenum cap,
                   GLuint index, GLboolean state)
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 28357e0..507766e 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -28,6 +28,7 @@
  */
 
 
+#include "compiler.h"
 #include "errors.h"
 #include "enums.h"
 #include "imports.h"
@@ -1105,6 +1106,7 @@ flush_delayed_errors( struct gl_context *ctx )
  * \param ctx GL context.
  * \param fmtString printf()-like format string.
  */
+PUBLIC
 void
 _mesa_warning( struct gl_context *ctx, const char *fmtString, ... )
 {
@@ -1128,6 +1130,7 @@ _mesa_warning( struct gl_context *ctx, const char *fmtString, ... )
  * \param ctx GL context.
  * \param fmtString problem description string.
  */
+PUBLIC
 void
 _mesa_problem( const struct gl_context *ctx, const char *fmtString, ... )
 {
@@ -1185,6 +1188,7 @@ should_output(struct gl_context *ctx, GLenum error, const char *fmtString)
    return GL_FALSE;
 }
 
+PUBLIC
 void
 _mesa_gl_debug(struct gl_context *ctx,
                GLuint *id,
@@ -1219,6 +1223,7 @@ _mesa_gl_debug(struct gl_context *ctx,
  * \param error the error value.
  * \param fmtString printf() style format string, followed by optional args
  */
+PUBLIC
 void
 _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... )
 {
@@ -1288,6 +1293,7 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... )
  * \param ctx GL context.
  * \param fmtString printf()-style format string, followed by optional args.
  */
+PUBLIC
 void
 _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... )
 {
diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c
index d63bb4a..fb00d68 100644
--- a/src/mesa/main/execmem.c
+++ b/src/mesa/main/execmem.c
@@ -31,6 +31,7 @@
  */
 
 
+#include "compiler.h"
 #include "imports.h"
 #include "glapi/glthread.h"
 
@@ -87,6 +88,7 @@ init_heap(void)
 }
 
 
+PUBLIC
 void *
 _mesa_exec_malloc(GLuint size)
 {
@@ -115,6 +117,7 @@ bail:
 }
 
  
+PUBLIC
 void 
 _mesa_exec_free(void *addr)
 {
@@ -137,13 +140,15 @@ _mesa_exec_free(void *addr)
  * Just use regular memory.
  */
 
+PUBLIC
 void *
 _mesa_exec_malloc(GLuint size)
 {
    return malloc( size );
 }
 
- 
+
+PUBLIC 
 void 
 _mesa_exec_free(void *addr)
 {
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 88fcde3..e71c1ae 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
@@ -372,6 +373,7 @@ name_to_offset(const char* name)
  * Enable all extensions suitable for a software-only renderer.
  * This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc.
  */
+PUBLIC
 void
 _mesa_enable_sw_extensions(struct gl_context *ctx)
 {
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 1034c7a..b3e7fa5 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -33,6 +33,7 @@
 
 #include <stdbool.h>
 
+#include "compiler.h"
 #include "buffers.h"
 #include "context.h"
 #include "enums.h"
@@ -101,6 +102,7 @@ _mesa_init_fbobjects(struct gl_context *ctx)
    IncompleteFramebuffer.Delete = delete_dummy_framebuffer;
 }
 
+PUBLIC
 struct gl_framebuffer *
 _mesa_get_incomplete_framebuffer(void)
 {
@@ -110,6 +112,7 @@ _mesa_get_incomplete_framebuffer(void)
 /**
  * Helper routine for getting a gl_renderbuffer.
  */
+PUBLIC
 struct gl_renderbuffer *
 _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id)
 {
@@ -481,6 +484,7 @@ _mesa_set_renderbuffer_attachment(struct gl_context *ctx,
  * Fallback for ctx->Driver.FramebufferRenderbuffer()
  * Attach a renderbuffer object to a framebuffer object.
  */
+PUBLIC
 void
 _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
                                struct gl_framebuffer *fb,
@@ -518,6 +522,7 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
  * renderer.
  * Drivers should probably override this.
  */
+PUBLIC
 void
 _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
 {
@@ -554,6 +559,7 @@ _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
  * Return true if the framebuffer has a combined depth/stencil
  * renderbuffer attached.
  */
+PUBLIC
 GLboolean
 _mesa_has_depthstencil_combined(const struct gl_framebuffer *fb)
 {
@@ -1200,6 +1206,7 @@ bind_renderbuffer(GLenum target, GLuint renderbuffer, bool allow_user_names)
    _mesa_reference_renderbuffer(&ctx->CurrentRenderbuffer, newRb);
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BindRenderbuffer(GLenum target, GLuint renderbuffer)
 {
@@ -1326,6 +1333,7 @@ _mesa_DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
 {
@@ -1369,6 +1377,7 @@ _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
  * \param internalFormat  as passed to glRenderbufferStorage()
  * \return the base internal format, or 0 if internalFormat is illegal
  */
+PUBLIC
 GLenum
 _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
 {
@@ -1846,6 +1855,7 @@ get_component_bits(GLenum pname, GLenum baseFormat, gl_format format)
 
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_RenderbufferStorage(GLenum target, GLenum internalFormat,
                              GLsizei width, GLsizei height)
@@ -2130,6 +2140,7 @@ bind_framebuffer(GLenum target, GLuint framebuffer, bool allow_user_names)
    }
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BindFramebuffer(GLenum target, GLuint framebuffer)
 {
@@ -2204,6 +2215,7 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers)
 {
@@ -2233,6 +2245,7 @@ _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers)
 
 
 
+PUBLIC
 GLenum GLAPIENTRY
 _mesa_CheckFramebufferStatus(GLenum target)
 {
@@ -2468,6 +2481,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
 
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
                               GLenum textarget, GLuint texture, GLint level)
@@ -2501,6 +2515,7 @@ _mesa_FramebufferTexture1D(GLenum target, GLenum attachment,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_FramebufferTexture2D(GLenum target, GLenum attachment,
                               GLenum textarget, GLuint texture, GLint level)
@@ -2552,6 +2567,7 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum attachment,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_FramebufferTexture3D(GLenum target, GLenum attachment,
                               GLenum textarget, GLuint texture,
@@ -2597,6 +2613,7 @@ _mesa_FramebufferTexture(GLenum target, GLenum attachment,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment,
                                  GLenum renderbufferTarget,
diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c
index e751a3c..115078f 100644
--- a/src/mesa/main/feedback.c
+++ b/src/mesa/main/feedback.c
@@ -29,6 +29,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "colormac.h"
 #include "context.h"
@@ -110,6 +111,7 @@ _mesa_PassThrough( GLfloat token )
 /**
  * Put a vertex into the feedback buffer.
  */
+PUBLIC
 void
 _mesa_feedback_vertex(struct gl_context *ctx,
                       const GLfloat win[4],
@@ -209,6 +211,7 @@ write_record(struct gl_context *ctx, GLuint value)
  * Sets gl_selection::HitFlag and updates gl_selection::HitMinZ and
  * gl_selection::HitMaxZ.
  */
+PUBLIC
 void
 _mesa_update_hitflag(struct gl_context *ctx, GLfloat z)
 {
@@ -408,6 +411,7 @@ _mesa_PopName( void )
  * __struct gl_contextRec::RenderMode and notifies the driver via the
  * dd_function_table::RenderMode callback.
  */
+PUBLIC
 GLint GLAPIENTRY
 _mesa_RenderMode( GLenum mode )
 {
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index be6ac0f..e1f5f58 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -33,6 +33,7 @@
  */
 
 
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/mtypes.h"
 #include "main/macros.h"
@@ -1649,6 +1650,7 @@ create_new_program( const struct state_key *key,
  * Return a vertex program which implements the current fixed-function
  * transform/lighting/texgen operations.
  */
+PUBLIC
 struct gl_vertex_program *
 _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
 {
diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
index 826fc10..b769f10 100644
--- a/src/mesa/main/format_pack.c
+++ b/src/mesa/main/format_pack.c
@@ -36,6 +36,7 @@
  */
 
 
+#include "compiler.h"
 #include "colormac.h"
 #include "format_pack.h"
 #include "macros.h"
@@ -1828,6 +1829,7 @@ pack_float_XBGR32323232_FLOAT(const GLfloat src[4], void *dst)
 /**
  * Return a function that can pack a GLubyte rgba[4] color.
  */
+PUBLIC
 gl_pack_ubyte_rgba_func
 _mesa_get_pack_ubyte_rgba_function(gl_format format)
 {
@@ -1989,6 +1991,7 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format)
 /**
  * Return a function that can pack a GLfloat rgba[4] color.
  */
+PUBLIC
 gl_pack_float_rgba_func
 _mesa_get_pack_float_rgba_function(gl_format format)
 {
@@ -2213,6 +2216,7 @@ get_pack_ubyte_rgba_row_function(gl_format format)
 /**
  * Pack a row of GLfloat rgba[4] values to the destination.
  */
+PUBLIC
 void
 _mesa_pack_float_rgba_row(gl_format format, GLuint n,
                           const GLfloat src[][4], void *dst)
@@ -2244,6 +2248,7 @@ _mesa_pack_float_rgba_row(gl_format format, GLuint n,
 /**
  * Pack a row of GLubyte rgba[4] values to the destination.
  */
+PUBLIC
 void
 _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n,
                           const GLubyte src[][4], void *dst)
@@ -2450,6 +2455,7 @@ pack_uint_z_Z32_FLOAT_X24S8(const GLuint *src, void *dst)
    assert(*d <= 1.0f);
 }
 
+PUBLIC
 gl_pack_uint_z_func
 _mesa_get_pack_uint_z_func(gl_format format)
 {
@@ -2514,6 +2520,7 @@ pack_ubyte_stencil_Z32_FLOAT_X24S8(const GLubyte *src, void *dst)
 }
 
 
+PUBLIC
 gl_pack_ubyte_stencil_func
 _mesa_get_pack_ubyte_stencil_func(gl_format format)
 {
@@ -2535,6 +2542,7 @@ _mesa_get_pack_ubyte_stencil_func(gl_format format)
 
 
 
+PUBLIC
 void
 _mesa_pack_float_z_row(gl_format format, GLuint n,
                        const GLfloat *src, void *dst)
@@ -2611,6 +2619,7 @@ _mesa_pack_float_z_row(gl_format format, GLuint n,
 /**
  * The incoming Z values are always in the range [0, 0xffffffff].
  */
+PUBLIC
 void
 _mesa_pack_uint_z_row(gl_format format, GLuint n,
                       const GLuint *src, void *dst)
@@ -2684,6 +2693,7 @@ _mesa_pack_uint_z_row(gl_format format, GLuint n,
 }
 
 
+PUBLIC
 void
 _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n,
                              const GLubyte *src, void *dst)
@@ -2734,6 +2744,7 @@ _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n,
 /**
  * Incoming Z/stencil values are always in uint_24_8 format.
  */
+PUBLIC
 void
 _mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n,
                                        const GLuint *src, void *dst)
@@ -2778,6 +2789,7 @@ _mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n,
  * Convert a boolean color mask to a packed color where each channel of
  * the packed value at dst will be 0 or ~0 depending on the colorMask.
  */
+PUBLIC
 void
 _mesa_pack_colormask(gl_format format, const GLubyte colorMask[4], void *dst)
 {
diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index 0a8b8b1..45a24ed 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "compiler.h"
 #include "colormac.h"
 #include "format_unpack.h"
 #include "macros.h"
@@ -2496,6 +2497,7 @@ get_unpack_rgba_function(gl_format format)
 /**
  * Unpack rgba colors, returning as GLfloat values.
  */
+PUBLIC
 void
 _mesa_unpack_rgba_row(gl_format format, GLuint n,
                       const void *src, GLfloat dst[][4])
@@ -2869,6 +2871,7 @@ unpack_ubyte_RG88(const void *src, GLubyte dst[][4], GLuint n)
  * Unpack rgba colors, returning as GLubyte values.  This should usually
  * only be used for unpacking formats that use 8 bits or less per channel.
  */
+PUBLIC
 void
 _mesa_unpack_ubyte_rgba_row(gl_format format, GLuint n,
                             const void *src, GLubyte dst[][4])
@@ -3902,6 +3905,7 @@ unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst)
  * Unpack Z values.
  * The returned values will always be in the range [0.0, 1.0].
  */
+PUBLIC
 void
 _mesa_unpack_float_z_row(gl_format format, GLuint n,
                          const void *src, GLfloat *dst)
@@ -4006,6 +4010,7 @@ unpack_uint_z_Z32_FLOAT_X24S8(const void *src, GLuint *dst, GLuint n)
  * Unpack Z values.
  * The returned values will always be in the range [0, 0xffffffff].
  */
+PUBLIC
 void
 _mesa_unpack_uint_z_row(gl_format format, GLuint n,
                         const void *src, GLuint *dst)
@@ -4080,6 +4085,7 @@ unpack_ubyte_s_Z32_FLOAT_X24S8(const void *src, GLubyte *dst, GLuint n)
       dst[i] = s[i].x24s8 & 0xff;
 }
 
+PUBLIC
 void
 _mesa_unpack_ubyte_stencil_row(gl_format format, GLuint n,
 			       const void *src, GLubyte *dst)
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 40eca87..2c565cd 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -21,6 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "compiler.h"
 #include "mtypes.h"
 #include "context.h"
 #include "glformats.h"
@@ -31,6 +32,7 @@
 
 /* default implementation of QuerySamplesForFormat driverfunc, for
  * non-multisample-capable drivers. */
+PUBLIC
 size_t
 _mesa_query_samples_for_format(struct gl_context *ctx, GLenum target,
                                GLenum internalFormat, int samples[16])
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 07d2a72..f3b23cc 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -24,6 +24,7 @@
  */
 
 
+#include "compiler.h"
 #include "imports.h"
 #include "formats.h"
 #include "macros.h"
@@ -1777,6 +1778,7 @@ _mesa_get_format_info(gl_format format)
 
 
 /** Return string name of format (for debugging) */
+PUBLIC
 const char *
 _mesa_get_format_name(gl_format format)
 {
@@ -1793,6 +1795,7 @@ _mesa_get_format_name(gl_format format)
  *
  * Note: not GLuint, so as not to coerce math to unsigned. cf. fdo #37351
  */
+PUBLIC
 GLint
 _mesa_get_format_bytes(gl_format format)
 {
@@ -1809,6 +1812,7 @@ _mesa_get_format_bytes(gl_format format)
  * \param format  one of MESA_FORMAT_x
  * \param pname  the component, such as GL_RED_BITS, GL_TEXTURE_BLUE_BITS, etc.
  */
+PUBLIC
 GLint
 _mesa_get_format_bits(gl_format format, GLenum pname)
 {
@@ -1858,6 +1862,7 @@ _mesa_get_format_bits(gl_format format, GLenum pname)
 }
 
 
+PUBLIC
 GLuint
 _mesa_get_format_max_bits(gl_format format)
 {
@@ -1883,6 +1888,7 @@ _mesa_get_format_max_bits(gl_format format)
  *    GL_INT = an ordinary signed integer
  *    GL_FLOAT = an ordinary float
  */
+PUBLIC
 GLenum
 _mesa_get_format_datatype(gl_format format)
 {
@@ -1896,6 +1902,7 @@ _mesa_get_format_datatype(gl_format format)
  * GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_INTENSITY,
  * GL_YCBCR_MESA, GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
  */
+PUBLIC
 GLenum
 _mesa_get_format_base_format(gl_format format)
 {
@@ -1911,6 +1918,7 @@ _mesa_get_format_base_format(gl_format format)
  * \param bw  returns block width in pixels
  * \param bh  returns block height in pixels
  */
+PUBLIC
 void
 _mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh)
 {
@@ -1921,6 +1929,7 @@ _mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh)
 
 
 /** Is the given format a compressed format? */
+PUBLIC
 GLboolean
 _mesa_is_format_compressed(gl_format format)
 {
@@ -1932,6 +1941,7 @@ _mesa_is_format_compressed(gl_format format)
 /**
  * Determine if the given format represents a packed depth/stencil buffer.
  */
+PUBLIC
 GLboolean
 _mesa_is_format_packed_depth_stencil(gl_format format)
 {
@@ -1944,6 +1954,7 @@ _mesa_is_format_packed_depth_stencil(gl_format format)
 /**
  * Is the given format a signed/unsigned integer color format?
  */
+PUBLIC
 GLboolean
 _mesa_is_format_integer_color(gl_format format)
 {
@@ -1970,6 +1981,7 @@ _mesa_is_format_unsigned(gl_format format)
  * Return color encoding for given format.
  * \return GL_LINEAR or GL_SRGB
  */
+PUBLIC
 GLenum
 _mesa_get_format_color_encoding(gl_format format)
 {
@@ -1996,6 +2008,7 @@ _mesa_get_format_color_encoding(gl_format format)
  * For an sRGB format, return the corresponding linear color space format.
  * For non-sRGB formats, return the format as-is.
  */
+PUBLIC
 gl_format
 _mesa_get_srgb_format_linear(gl_format format)
 {
@@ -2120,6 +2133,7 @@ _mesa_format_num_components(gl_format format)
  * Return number of bytes needed to store an image of the given size
  * in the given format.
  */
+PUBLIC
 GLuint
 _mesa_format_image_size(gl_format format, GLsizei width,
                         GLsizei height, GLsizei depth)
@@ -2172,6 +2186,7 @@ _mesa_format_image_size64(gl_format format, GLsizei width,
 
 
 
+PUBLIC
 GLint
 _mesa_format_row_stride(gl_format format, GLsizei width)
 {
@@ -2846,6 +2861,7 @@ _mesa_format_to_type_and_comps(gl_format format,
  * \param swapBytes  typically the current pixel pack/unpack byteswap state
  * \return GL_TRUE if the formats match, GL_FALSE otherwise.
  */
+PUBLIC
 GLboolean
 _mesa_format_matches_format_and_type(gl_format gl_format,
 				     GLenum format, GLenum type,
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 2fad458..929b72b 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "blend.h"
@@ -83,6 +84,7 @@ compute_depth_max(struct gl_framebuffer *fb)
  *
  * \sa _mesa_new_framebuffer
  */
+PUBLIC
 struct gl_framebuffer *
 _mesa_create_framebuffer(const struct gl_config *visual)
 {
@@ -102,6 +104,7 @@ _mesa_create_framebuffer(const struct gl_config *visual)
  * framebuffers!
  * \sa _mesa_create_framebuffer
  */
+PUBLIC
 struct gl_framebuffer *
 _mesa_new_framebuffer(struct gl_context *ctx, GLuint name)
 {
@@ -121,6 +124,7 @@ _mesa_new_framebuffer(struct gl_context *ctx, GLuint name)
  * window system-created framebuffers, not user-created framebuffers.
  * \sa _mesa_initialize_user_framebuffer
  */
+PUBLIC
 void
 _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
 				     const struct gl_config *visual)
@@ -166,6 +170,7 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
  * Initialize a user-created gl_framebuffer object.
  * \sa _mesa_initialize_window_framebuffer
  */
+PUBLIC
 void
 _mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name)
 {
@@ -205,6 +210,9 @@ _mesa_destroy_framebuffer(struct gl_framebuffer *fb)
  * Free all the data hanging off the given gl_framebuffer, but don't free
  * the gl_framebuffer object itself.
  */
+#if defined(HAVE_X11_DRIVER)
+PUBLIC
+#endif
 void
 _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
 {
@@ -235,6 +243,7 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
  * This is normally only called from the _mesa_reference_framebuffer() macro
  * when there's a real pointer change.
  */
+PUBLIC
 void
 _mesa_reference_framebuffer_(struct gl_framebuffer **ptr,
                              struct gl_framebuffer *fb)
@@ -276,6 +285,7 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr,
  * \note it's possible for ctx to be null since a window can be resized
  * without a currently bound rendering context.
  */
+PUBLIC
 void
 _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
                          GLuint width, GLuint height)
@@ -362,6 +372,7 @@ update_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb)
  * the scissor box, if it's enabled.
  * \param ctx  the GL context.
  */
+PUBLIC
 void
 _mesa_update_draw_buffer_bounds(struct gl_context *ctx)
 {
@@ -420,6 +431,7 @@ _mesa_update_draw_buffer_bounds(struct gl_context *ctx)
  * The former one is used to convert floating point depth values into
  * integer Z values.
  */
+PUBLIC
 void
 _mesa_update_framebuffer_visual(struct gl_context *ctx,
 				struct gl_framebuffer *fb)
@@ -652,6 +664,7 @@ update_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
 /**
  * Update state related to the current draw/read framebuffers.
  */
+PUBLIC
 void
 _mesa_update_framebuffer(struct gl_context *ctx)
 {
@@ -868,6 +881,7 @@ _mesa_get_color_read_type(struct gl_context *ctx)
 /**
  * Returns the read renderbuffer for the specified format.
  */
+PUBLIC
 struct gl_renderbuffer *
 _mesa_get_read_renderbuffer_for_format(const struct gl_context *ctx,
                                        GLenum format)
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index dfee6f1..33de5b7 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -25,6 +25,7 @@
  */
 
 
+#include "compiler.h"
 #include "context.h"
 #include "glformats.h"
 
@@ -70,6 +71,7 @@ _mesa_type_is_packed(GLenum type)
  * \return the size, in bytes, of the given data type, 0 if a GL_BITMAP, or -1
  * if an invalid type enum.
  */
+PUBLIC
 GLint
 _mesa_sizeof_type(GLenum type)
 {
@@ -221,6 +223,7 @@ _mesa_components_in_format(GLenum format)
  *
  * \return bytes per pixel, or -1 if a bad format or type was given.
  */
+PUBLIC
 GLint
 _mesa_bytes_per_pixel(GLenum format, GLenum type)
 {
@@ -318,6 +321,7 @@ _mesa_bytes_per_pixel(GLenum format, GLenum type)
  *
  * \return bytes per attribute, or -1 if a bad comps/type combination was given.
  */
+PUBLIC
 GLint
 _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type)
 {
@@ -445,6 +449,7 @@ _mesa_is_enum_format_signed_int(GLenum format)
 /**
  * Test if the given format is an integer (non-normalized) format.
  */
+PUBLIC
 GLboolean
 _mesa_is_enum_format_integer(GLenum format)
 {
@@ -520,6 +525,7 @@ _mesa_is_type_unsigned(GLenum type)
  * \param format  the image format value (may by an internal texture format)
  * \return GL_TRUE if its a color/RGBA format, GL_FALSE otherwise.
  */
+PUBLIC
 GLboolean
 _mesa_is_color_format(GLenum format)
 {
@@ -751,6 +757,7 @@ _mesa_is_color_format(GLenum format)
 /**
  * Test if the given image format is a depth component format.
  */
+PUBLIC
 GLboolean
 _mesa_is_depth_format(GLenum format)
 {
@@ -770,6 +777,7 @@ _mesa_is_depth_format(GLenum format)
 /**
  * Test if the given image format is a stencil format.
  */
+PUBLIC
 GLboolean
 _mesa_is_stencil_format(GLenum format)
 {
@@ -817,6 +825,7 @@ _mesa_is_depthstencil_format(GLenum format)
 /**
  * Test if the given image format is a depth or stencil format.
  */
+PUBLIC
 GLboolean
 _mesa_is_depth_or_stencil_format(GLenum format)
 {
@@ -862,6 +871,7 @@ _mesa_is_dudv_format(GLenum format)
  * \param format the internal format token provided by the user.
  * \return GL_TRUE if compressed, GL_FALSE if uncompressed
  */
+PUBLIC
 GLboolean
 _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
 {
@@ -939,6 +949,7 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
 /**
  * Convert various base formats to the cooresponding integer format.
  */
+PUBLIC
 GLenum
 _mesa_base_format_to_integer_format(GLenum format)
 {
@@ -975,6 +986,7 @@ _mesa_base_format_to_integer_format(GLenum format)
  * Does the given base texture/renderbuffer format have the channel
  * named by 'pname'?
  */
+PUBLIC
 GLboolean
 _mesa_base_format_has_channel(GLenum base_format, GLenum pname)
 {
@@ -1088,6 +1100,7 @@ _mesa_base_format_component_count(GLenum base_format)
  * If format is a generic compressed format, return the corresponding
  * non-compressed format.  For other formats, return the format as-is.
  */
+PUBLIC
 GLenum
 _mesa_generic_compressed_format_to_uncompressed_format(GLenum format)
 {
@@ -1208,6 +1221,7 @@ _mesa_get_nongeneric_internalformat(GLenum format)
 /**
  * Convert an sRGB internal format to linear.
  */
+PUBLIC
 GLenum
 _mesa_get_linear_internalformat(GLenum format)
 {
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index b31fd48..fda6a5d 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -34,6 +34,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "glapi/glthread.h"
@@ -341,6 +342,7 @@ _mesa_HashClone(const struct _mesa_HashTable *table)
  * \param userData  arbitrary pointer to pass along to the callback
  *                  (this is typically a struct gl_context pointer)
  */
+PUBLIC
 void
 _mesa_HashWalk(const struct _mesa_HashTable *table,
                void (*callback)(GLuint key, void *data, void *userData),
diff --git a/src/mesa/main/hash_table.c b/src/mesa/main/hash_table.c
index 008b4cd..5ba55ab 100644
--- a/src/mesa/main/hash_table.c
+++ b/src/mesa/main/hash_table.c
@@ -43,6 +43,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "compiler.h"
 #include "main/hash_table.h"
 #include "main/macros.h"
 #include "ralloc.h"
@@ -108,6 +109,7 @@ entry_is_present(const struct hash_table *ht, struct hash_entry *entry)
    return entry->key != NULL && entry->key != ht->deleted_key;
 }
 
+PUBLIC
 struct hash_table *
 _mesa_hash_table_create(void *mem_ctx,
                         bool (*key_equals_function)(const void *a,
@@ -144,6 +146,7 @@ _mesa_hash_table_create(void *mem_ctx,
  * If delete_function is passed, it gets called on each entry present before
  * freeing.
  */
+PUBLIC
 void
 _mesa_hash_table_destroy(struct hash_table *ht,
                          void (*delete_function)(struct hash_entry *entry))
@@ -183,6 +186,7 @@ _mesa_hash_table_set_deleted_key(struct hash_table *ht, const void *deleted_key)
  * Returns NULL if no entry is found.  Note that the data pointer may be
  * modified by the user.
  */
+PUBLIC
 struct hash_entry *
 _mesa_hash_table_search(struct hash_table *ht, uint32_t hash,
                         const void *key)
@@ -249,6 +253,7 @@ _mesa_hash_table_rehash(struct hash_table *ht, int new_size_index)
  * Note that insertion may rearrange the table on a resize or rehash,
  * so previously found hash_entries are no longer valid after this function.
  */
+PUBLIC
 struct hash_entry *
 _mesa_hash_table_insert(struct hash_table *ht, uint32_t hash,
                         const void *key, void *data)
@@ -313,6 +318,7 @@ _mesa_hash_table_insert(struct hash_table *ht, uint32_t hash,
  * Note that deletion doesn't otherwise modify the table, so an iteration over
  * the table deleting entries is safe.
  */
+PUBLIC
 void
 _mesa_hash_table_remove(struct hash_table *ht,
                         struct hash_entry *entry)
@@ -331,6 +337,7 @@ _mesa_hash_table_remove(struct hash_table *ht,
  * Pass in NULL for the first entry, as in the start of a for loop.  Note that
  * an iteration over the table is O(table_size) not O(entries).
  */
+PUBLIC
 struct hash_entry *
 _mesa_hash_table_next_entry(struct hash_table *ht,
                             struct hash_entry *entry)
@@ -394,6 +401,7 @@ _mesa_hash_table_random_entry(struct hash_table *ht,
  * it involves almost no code.  For an improvement on both, see Paul
  * Hsieh's http://www.azillionmonkeys.com/qed/hash.html
  */
+PUBLIC
 uint32_t
 _mesa_hash_data(const void *data, size_t size)
 {
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 4ea5f04..d0dd443 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "colormac.h"
 #include "glformats.h"
@@ -94,6 +95,7 @@ _mesa_swap4( GLuint *p, GLuint n )
  *
  * \sa gl_pixelstore_attrib.
  */
+PUBLIC
 GLintptr
 _mesa_image_offset( GLuint dimensions,
                     const struct gl_pixelstore_attrib *packing,
@@ -238,6 +240,7 @@ _mesa_image_address1d( const struct gl_pixelstore_attrib *packing,
 }
 
 
+PUBLIC
 GLvoid *
 _mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
                        const GLvoid *image,
@@ -250,6 +253,7 @@ _mesa_image_address2d( const struct gl_pixelstore_attrib *packing,
 }
 
 
+PUBLIC
 GLvoid *
 _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
                        const GLvoid *image,
@@ -273,6 +277,7 @@ _mesa_image_address3d( const struct gl_pixelstore_attrib *packing,
  * 
  * \return the stride in bytes for the given parameters, or -1 if error
  */
+PUBLIC
 GLint
 _mesa_image_row_stride( const struct gl_pixelstore_attrib *packing,
                         GLint width, GLenum format, GLenum type )
@@ -377,6 +382,7 @@ _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
  * \param destStride  row stride in dest buffer
  * \param onValue  if bit is 1, set destBuffer pixel to this value
  */
+PUBLIC
 void
 _mesa_expand_bitmap(GLsizei width, GLsizei height,
                     const struct gl_pixelstore_attrib *unpack,
@@ -455,6 +461,7 @@ _mesa_expand_bitmap(GLsizei width, GLsizei height,
  * Convert an array of RGBA colors from one datatype to another.
  * NOTE: src may equal dst.  In that case, we use a temporary buffer.
  */
+PUBLIC
 void
 _mesa_convert_colors(GLenum srcType, const GLvoid *src,
                      GLenum dstType, GLvoid *dst,
@@ -586,6 +593,7 @@ _mesa_convert_colors(GLenum srcType, const GLvoid *src,
  * \return  GL_TRUE if image is ready for drawing or
  *          GL_FALSE if image was completely clipped away (draw nothing)
  */
+PUBLIC
 GLboolean
 _mesa_clip_drawpixels(const struct gl_context *ctx,
                       GLint *destX, GLint *destY,
@@ -657,6 +665,7 @@ _mesa_clip_drawpixels(const struct gl_context *ctx,
  * \return  GL_TRUE if region to read is in bounds
  *          GL_FALSE if region is completely out of bounds (nothing to read)
  */
+PUBLIC
 GLboolean
 _mesa_clip_readpixels(const struct gl_context *ctx,
                       GLint *srcX, GLint *srcY,
@@ -707,6 +716,7 @@ _mesa_clip_readpixels(const struct gl_context *ctx,
  *
  * \return GL_FALSE if region is totally clipped, GL_TRUE otherwise.
  */
+PUBLIC
 GLboolean
 _mesa_clip_copytexsubimage(const struct gl_context *ctx,
                            GLint *destX, GLint *destY,
@@ -735,6 +745,7 @@ _mesa_clip_copytexsubimage(const struct gl_context *ctx,
  * specified by [xmin, xmax) and [ymin, ymax).
  * \return GL_FALSE if rect is totally clipped, GL_TRUE otherwise.
  */
+PUBLIC
 GLboolean
 _mesa_clip_to_region(GLint xmin, GLint ymin,
                      GLint xmax, GLint ymax,
@@ -850,6 +861,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
  *
  * \return GL_TRUE if anything is left to draw, GL_FALSE if totally clipped
  */
+PUBLIC
 GLboolean
 _mesa_clip_blit(struct gl_context *ctx,
                 GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index ca6b1d5..bed0e8d 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -44,6 +44,7 @@
 
 
 
+#include "compiler.h"
 #include "imports.h"
 #include "context.h"
 #include "mtypes.h"
@@ -78,6 +79,7 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
  *
  * \sa _mesa_align_free().
  */
+PUBLIC
 void *
 _mesa_align_malloc(size_t bytes, unsigned long alignment)
 {
@@ -117,6 +119,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
  * Same as _mesa_align_malloc(), but using calloc(1, ) instead of
  * malloc()
  */
+PUBLIC
 void *
 _mesa_align_calloc(size_t bytes, unsigned long alignment)
 {
@@ -169,6 +172,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
  * The actual address to free is stored in the word immediately before the
  * address the client sees.
  */
+PUBLIC
 void
 _mesa_align_free(void *ptr)
 {
@@ -208,6 +212,9 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
 
 
 /** Reallocate memory */
+#if defined(HAVE_X11_DRIVER)
+PUBLIC
+#endif
 void *
 _mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
 {
@@ -352,6 +359,7 @@ _mesa_round_to_even(float val)
  *     compile-time evaluation of constant packHalf2x16 GLSL expressions will
  *     result in the same value as if the expression were executed on the GPU.
  */
+PUBLIC
 GLhalfARB
 _mesa_float_to_half(float val)
 {
@@ -433,6 +441,7 @@ _mesa_float_to_half(float val)
  * Based on code from:
  * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
  */
+PUBLIC
 float
 _mesa_half_to_float(GLhalfARB val)
 {
@@ -525,6 +534,7 @@ _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size,
 /**
  * Wrapper for getenv().
  */
+PUBLIC
 char *
 _mesa_getenv( const char *var )
 {
@@ -546,6 +556,9 @@ _mesa_getenv( const char *var )
  * Implemented using malloc() and strcpy.
  * Note that NULL is handled accordingly.
  */
+#if defined(HAVE_X11_DRIVER)
+PUBLIC
+#endif
 char *
 _mesa_strdup( const char *s )
 {
@@ -604,6 +617,7 @@ _mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list args)
 }
 
 /** Wrapper around vsnprintf() */
+PUBLIC
 int
 _mesa_snprintf( char *str, size_t size, const char *fmt, ... )
 {
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index d8ef8f2..f054851 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -24,6 +24,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
@@ -618,6 +619,7 @@ _mesa_material_bitmask( struct gl_context *ctx, GLenum face, GLenum pname,
 
 /* Update derived values following a change in ctx->Light.Material
  */
+PUBLIC
 void
 _mesa_update_material( struct gl_context *ctx, GLuint bitmask )
 {
@@ -1084,6 +1086,7 @@ _mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state )
  * Drivers may need this if the hardware tnl unit doesn't support the
  * light-in-modelspace optimization.  It's also useful for debugging.
  */
+PUBLIC
 void
 _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag )
 {
diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c
index b213022..d4f9d37 100644
--- a/src/mesa/main/matrix.c
+++ b/src/mesa/main/matrix.c
@@ -35,6 +35,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
@@ -104,6 +105,7 @@ _mesa_Frustum( GLdouble left, GLdouble right,
  * the top matrix of the current matrix stack and sets
  * __struct gl_contextRec::NewState.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_Ortho( GLdouble left, GLdouble right,
              GLdouble bottom, GLdouble top,
@@ -144,6 +146,7 @@ _mesa_Ortho( GLdouble left, GLdouble right,
  * __struct gl_contextRec::CurrentStack and gl_transform_attrib::MatrixMode
  * with the specified matrix stack.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_MatrixMode( GLenum mode )
 {
@@ -299,6 +302,7 @@ _mesa_PopMatrix( void )
  * top-most matrix in the current stack.
  * Marks __struct gl_contextRec::NewState with the stack dirty flag.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_LoadIdentity( void )
 {
@@ -325,6 +329,7 @@ _mesa_LoadIdentity( void )
  * matrix in the current stack and the given matrix.
  * Marks __struct gl_contextRec::NewState with the dirty stack flag.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_LoadMatrixf( const GLfloat *m )
 {
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 180f891..dd1f6ce 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -27,6 +27,7 @@
  * \file mipmap.c  mipmap generation and teximage resizing functions.
  */
 
+#include "compiler.h"
 #include "imports.h"
 #include "formats.h"
 #include "glformats.h"
@@ -1812,6 +1813,7 @@ next_mipmap_level_size(GLenum target, GLint border,
  * for mipmap generation.  If not, (re) allocate it.
  * \return GL_TRUE if successful, GL_FALSE if mipmap generation should stop
  */
+PUBLIC
 GLboolean
 _mesa_prepare_mipmap_level(struct gl_context *ctx,
                            struct gl_texture_object *texObj, GLuint level,
@@ -2184,6 +2186,7 @@ end:
  * For cube maps, target will be one of
  * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z; never GL_TEXTURE_CUBE_MAP.
  */
+PUBLIC
 void
 _mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
                       struct gl_texture_object *texObj)
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index d976e5a..e488a8f 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -42,6 +42,7 @@
 #endif
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "colormac.h"
 #include "enums.h"
@@ -1254,6 +1255,7 @@ _mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4]
  * Note: the rgba values will be modified by this function when any pixel
  * transfer ops are enabled.
  */
+PUBLIC
 void
 _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
                            GLenum dstFormat, GLenum dstType,
@@ -4492,6 +4494,7 @@ _mesa_unpack_color_span_ubyte(struct gl_context *ctx,
  * Same as _mesa_unpack_color_span_ubyte(), but return GLfloat data
  * instead of GLubyte.
  */
+PUBLIC
 void
 _mesa_unpack_color_span_float( struct gl_context *ctx,
                                GLuint n, GLenum dstFormat, GLfloat dest[],
@@ -5144,6 +5147,7 @@ _mesa_pack_index_span( struct gl_context *ctx, GLuint n,
  *        srcPacking - pixel unpacking parameters
  *        transferOps - apply offset/bias/lookup ops?
  */
+PUBLIC
 void
 _mesa_unpack_stencil_span( struct gl_context *ctx, GLuint n,
                            GLenum dstType, GLvoid *dest,
@@ -5427,6 +5431,7 @@ _mesa_pack_stencil_span( struct gl_context *ctx, GLuint n,
  * \param depthMax  max value for returned GLushort or GLuint values
  *                  (ignored for GLfloat).
  */
+PUBLIC
 void
 _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
                          GLenum dstType, GLvoid *dest, GLuint depthMax,
diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c
index 400cec3..5538b19 100644
--- a/src/mesa/main/pbo.c
+++ b/src/mesa/main/pbo.c
@@ -31,6 +31,7 @@
 
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "bufferobj.h"
 #include "glformats.h"
@@ -63,6 +64,7 @@
  * \return GL_TRUE if the buffer access is OK, GL_FALSE if the access would
  *         go out of bounds.
  */
+PUBLIC
 GLboolean
 _mesa_validate_pbo_access(GLuint dimensions,
                           const struct gl_pixelstore_attrib *pack,
@@ -137,6 +139,7 @@ _mesa_validate_pbo_access(GLuint dimensions,
  *
  * \return NULL if error, else pointer to start of data
  */
+PUBLIC
 const GLvoid *
 _mesa_map_pbo_source(struct gl_context *ctx,
                      const struct gl_pixelstore_attrib *unpack,
@@ -215,6 +218,7 @@ _mesa_map_validate_pbo_source(struct gl_context *ctx,
 /**
  * Counterpart to _mesa_map_pbo_source()
  */
+PUBLIC
 void
 _mesa_unmap_pbo_source(struct gl_context *ctx,
                        const struct gl_pixelstore_attrib *unpack)
@@ -234,6 +238,7 @@ _mesa_unmap_pbo_source(struct gl_context *ctx,
  *
  * \return NULL if error, else pointer to start of data
  */
+PUBLIC
 void *
 _mesa_map_pbo_dest(struct gl_context *ctx,
                    const struct gl_pixelstore_attrib *pack,
@@ -311,6 +316,7 @@ _mesa_map_validate_pbo_dest(struct gl_context *ctx,
 /**
  * Counterpart to _mesa_map_pbo_dest()
  */
+PUBLIC
 void
 _mesa_unmap_pbo_dest(struct gl_context *ctx,
                      const struct gl_pixelstore_attrib *pack)
@@ -328,6 +334,7 @@ _mesa_unmap_pbo_dest(struct gl_context *ctx,
  * Any errors detected will be recorded.
  * The caller _must_ call _mesa_unmap_teximage_pbo() too!
  */
+PUBLIC
 const GLvoid *
 _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
 			    GLsizei width, GLsizei height, GLsizei depth,
@@ -369,6 +376,7 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
  * Any errors detected will be recorded.
  * The caller _must_ call _mesa_unmap_teximage_pbo() too!
  */
+PUBLIC
 const GLvoid *
 _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
                                  GLuint dimensions, GLsizei imageSize,
@@ -408,6 +416,7 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
  * This function must be called after either of the validate_pbo_*_teximage()
  * functions.  It unmaps the PBO buffer if it was mapped earlier.
  */
+PUBLIC
 void
 _mesa_unmap_teximage_pbo(struct gl_context *ctx,
                          const struct gl_pixelstore_attrib *unpack)
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 7162c6f..42e9726 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -28,6 +28,7 @@
  * Pixel transfer functions (glPixelZoom, glPixelMap, glPixelTransfer)
  */
 
+#include "compiler.h"
 #include "glheader.h"
 #include "bufferobj.h"
 #include "colormac.h"
@@ -490,6 +491,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
  * Implements glPixelTransfer[fi] whether called immediately or from a
  * display list.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_PixelTransferf( GLenum pname, GLfloat param )
 {
diff --git a/src/mesa/main/pixeltransfer.c b/src/mesa/main/pixeltransfer.c
index 8bbeeb8..9ec34ce 100644
--- a/src/mesa/main/pixeltransfer.c
+++ b/src/mesa/main/pixeltransfer.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "colormac.h"
 #include "pixeltransfer.h"
@@ -140,6 +141,7 @@ _mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n,
 }
 
 
+PUBLIC
 void
 _mesa_scale_and_bias_depth_uint(const struct gl_context *ctx, GLuint n,
                                 GLuint depthValues[])
@@ -159,6 +161,7 @@ _mesa_scale_and_bias_depth_uint(const struct gl_context *ctx, GLuint n,
  * Apply various pixel transfer operations to an array of RGBA pixels
  * as indicated by the transferOps bitmask
  */
+PUBLIC
 void
 _mesa_apply_rgba_transfer_ops(struct gl_context *ctx, GLbitfield transferOps,
                               GLuint n, GLfloat rgba[][4])
@@ -246,6 +249,7 @@ _mesa_apply_ci_transfer_ops(const struct gl_context *ctx,
  * Apply stencil index shift, offset and table lookup to an array
  * of stencil values.
  */
+PUBLIC
 void
 _mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n,
                                  GLubyte stencil[])
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index de26bf9..59af117 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -28,6 +28,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "context.h"
 #include "macros.h"
@@ -222,6 +223,7 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params)
  * Initializes __struct gl_contextRec::Point and point related constants in
  * __struct gl_contextRec::Const.
  */
+PUBLIC
 void
 _mesa_init_point(struct gl_context *ctx)
 {
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index 611cef6..2af5e8a 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -28,6 +28,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
@@ -123,6 +124,7 @@ _mesa_FrontFace( GLenum mode )
  * gl_polygon_attrib::BackMode. On change flushes the vertices and notifies the
  * driver via the dd_function_table::PolygonMode callback.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_PolygonMode( GLenum face, GLenum mode )
 {
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index a180133..19bdeb8 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "context.h"
 #include "enums.h"
@@ -131,6 +132,7 @@ _mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q)
 }
 
 
+PUBLIC
 void
 _mesa_init_query_object_functions(struct dd_function_table *driver)
 {
@@ -425,12 +427,14 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index)
    ctx->Driver.EndQuery(ctx, q);
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BeginQuery(GLenum target, GLuint id)
 {
    _mesa_BeginQueryIndexed(target, 0, id);
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_EndQuery(GLenum target)
 {
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 51a0b15..07cb5c1 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -22,6 +22,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "blend.h"
@@ -117,6 +118,7 @@ get_readpixels_transfer_ops(const struct gl_context *ctx, gl_format texFormat,
  * NOTE: This doesn't take swizzling and format conversions between
  *       the readbuffer and the pixel pack buffer into account.
  */
+PUBLIC
 GLboolean
 _mesa_readpixels_needs_slow_path(const struct gl_context *ctx, GLenum format,
                                  GLenum type, GLboolean uses_blit)
@@ -804,6 +806,7 @@ read_depth_stencil_pixels(struct gl_context *ctx,
  * Software fallback routine for ctx->Driver.ReadPixels().
  * By time we get here, all error checking will have been done.
  */
+PUBLIC
 void
 _mesa_readpixels(struct gl_context *ctx,
                  GLint x, GLint y, GLsizei width, GLsizei height,
@@ -1043,6 +1046,7 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
 			  format, type, &ctx->Pack, pixels);
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
 		  GLenum format, GLenum type, GLvoid *pixels )
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 2ff96e5..f372636 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
@@ -35,6 +36,7 @@
 /**
  * Initialize the fields of a gl_renderbuffer to default values.
  */
+PUBLIC
 void
 _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
 {
@@ -80,6 +82,7 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
  * own delete function.  But the driver might also call this function to
  * free the object in the end.
  */
+PUBLIC
 void
 _mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
 {
@@ -93,6 +96,7 @@ _mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
  * Attach a renderbuffer to a framebuffer.
  * \param bufferName  one of the BUFFER_x tokens
  */
+PUBLIC
 void
 _mesa_add_renderbuffer(struct gl_framebuffer *fb,
                        gl_buffer_index bufferName, struct gl_renderbuffer *rb)
@@ -127,6 +131,7 @@ _mesa_add_renderbuffer(struct gl_framebuffer *fb,
  * Remove the named renderbuffer from the given framebuffer.
  * \param bufferName  one of the BUFFER_x tokens
  */
+PUBLIC
 void
 _mesa_remove_renderbuffer(struct gl_framebuffer *fb,
                           gl_buffer_index bufferName)
@@ -144,6 +149,7 @@ _mesa_remove_renderbuffer(struct gl_framebuffer *fb,
  * This is normally only called from the _mesa_reference_renderbuffer() macro
  * when there's a real pointer change.
  */
+PUBLIC
 void
 _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
                               struct gl_renderbuffer *rb)
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index c3b612c..dff8a7e 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/dispatch.h"
@@ -137,6 +138,7 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
 /**
  * Fallback for ctx->Driver.NewSamplerObject();
  */
+PUBLIC
 struct gl_sampler_object *
 _mesa_new_sampler_object(struct gl_context *ctx, GLuint name)
 {
@@ -160,6 +162,7 @@ _mesa_delete_sampler_object(struct gl_context *ctx,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_GenSamplers(GLsizei count, GLuint *samplers)
 {
@@ -190,6 +193,7 @@ _mesa_GenSamplers(GLsizei count, GLuint *samplers)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
 {
@@ -249,6 +253,7 @@ _mesa_IsSampler(GLuint sampler)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BindSampler(GLuint unit, GLuint sampler)
 {
@@ -602,6 +607,7 @@ set_sampler_srgb_decode(struct gl_context *ctx,
    return GL_TRUE;
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
 {
@@ -1434,6 +1440,7 @@ invalid_pname:
 }
 
 
+PUBLIC
 void
 _mesa_init_sampler_object_functions(struct dd_function_table *driver)
 {
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index 0eddaa6..98aab10 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/mtypes.h"
@@ -32,6 +33,7 @@
 /**
  * Called via glScissor
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
 {
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 3014a97..df5e5cb 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -28,6 +28,7 @@
  * \author Ian Romanick <ian.d.romanick at intel.com>
  */
 
+#include "compiler.h"
 #include "main/core.h"
 #include "glsl_symbol_table.h"
 #include "ir.h"
@@ -39,6 +40,7 @@ extern "C" {
 #include "shaderapi.h"
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
                             const GLcharARB *name)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index a2386fb..d1dac41 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -37,6 +37,7 @@
  */
 
 
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/dispatch.h"
@@ -1054,6 +1055,7 @@ _mesa_AttachObjectARB(GLhandleARB program, GLhandleARB shader)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_AttachShader(GLuint program, GLuint shader)
 {
@@ -1062,6 +1064,7 @@ _mesa_AttachShader(GLuint program, GLuint shader)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_CompileShader(GLhandleARB shaderObj)
 {
@@ -1082,6 +1085,7 @@ _mesa_CreateShader(GLenum type)
 }
 
 
+PUBLIC
 GLhandleARB GLAPIENTRY
 _mesa_CreateShaderObjectARB(GLenum type)
 {
@@ -1100,6 +1104,7 @@ _mesa_CreateProgram(void)
 }
 
 
+PUBLIC
 GLhandleARB GLAPIENTRY
 _mesa_CreateProgramObjectARB(void)
 {
@@ -1108,6 +1113,7 @@ _mesa_CreateProgramObjectARB(void)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_DeleteObjectARB(GLhandleARB obj)
 {
@@ -1242,6 +1248,7 @@ _mesa_GetObjectParameterfvARB(GLhandleARB object, GLenum pname,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params)
 {
@@ -1250,6 +1257,7 @@ _mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
 {
@@ -1258,6 +1266,7 @@ _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
                         GLsizei *length, GLchar *infoLog)
@@ -1309,6 +1318,7 @@ _mesa_IsShader(GLuint name)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_LinkProgram(GLhandleARB programObj)
 {
@@ -1352,6 +1362,7 @@ read_shader(const char *fname)
  * Basically, concatenate the source code strings into one long string
  * and pass it to _mesa_shader_source().
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_ShaderSource(GLhandleARB shaderObj, GLsizei count,
                       const GLcharARB * const * string, const GLint * length)
@@ -1446,6 +1457,7 @@ _mesa_ShaderSource(GLhandleARB shaderObj, GLsizei count,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_UseProgram(GLhandleARB program)
 {
@@ -1738,6 +1750,7 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
                _mesa_lookup_enum_by_nr(pname));
 }
 
+PUBLIC
 void
 _mesa_use_shader_program(struct gl_context *ctx, GLenum type,
 			 struct gl_shader_program *shProg)
@@ -1854,6 +1867,7 @@ _mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
  * Copy program-specific data generated by linking from the gl_shader_program
  * object to a specific gl_program object.
  */
+PUBLIC
 void
 _mesa_copy_linked_program_data(gl_shader_type type,
                                const struct gl_shader_program *src,
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 0d794ad..4fd8495 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/hash.h"
@@ -91,6 +92,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
    }
 }
 
+PUBLIC
 void
 _mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader)
 {
@@ -191,6 +193,7 @@ _mesa_lookup_shader_err(struct gl_context *ctx, GLuint name, const char *caller)
  * if refcount hits zero).
  * Then set ptr to point to shProg, incrementing its refcount.
  */
+PUBLIC
 void
 _mesa_reference_shader_program(struct gl_context *ctx,
                                struct gl_shader_program **ptr,
@@ -234,6 +237,7 @@ _mesa_reference_shader_program(struct gl_context *ctx,
    }
 }
 
+PUBLIC
 void
 _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog)
 {
@@ -420,6 +424,7 @@ _mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
 }
 
 
+PUBLIC
 void
 _mesa_init_shader_object_functions(struct dd_function_table *driver)
 {
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 2392641..2c2e4a9 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -31,6 +31,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "mtypes.h"
 #include "arrayobj.h"
@@ -326,6 +327,7 @@ update_twoside(struct gl_context *ctx)
  * _mesa_update_buffer_bounds(),
  * _mesa_update_lighting() and _mesa_update_tnl_spaces().
  */
+PUBLIC
 void
 _mesa_update_state_locked( struct gl_context *ctx )
 {
@@ -435,6 +437,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
 
 /* This is the usual entrypoint for state updates:
  */
+PUBLIC
 void
 _mesa_update_state( struct gl_context *ctx )
 {
@@ -496,6 +499,7 @@ _mesa_set_varying_vp_inputs( struct gl_context *ctx,
  * prevent generated fragment programs from using state vars instead
  * of ordinary varyings/inputs.
  */
+PUBLIC
 void
 _mesa_set_vp_override(struct gl_context *ctx, GLboolean flag)
 {
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index f65116a..a25620b 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -47,6 +47,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
@@ -104,6 +105,7 @@ validate_stencil_func(struct gl_context *ctx, GLenum func)
  * flushes the vertices and notifies the driver via
  * the dd_function_table::ClearStencil callback.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_ClearStencil( GLint s )
 {
@@ -181,6 +183,7 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui
  * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
  * driver via the dd_function_table::StencilFunc callback.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
 {
@@ -246,6 +249,7 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
  * Updates gl_stencil_attrib::WriteMask. On change flushes the vertices and
  * notifies the driver via the dd_function_table::StencilMask callback.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_StencilMask( GLuint mask )
 {
@@ -301,6 +305,7 @@ _mesa_StencilMask( GLuint mask )
  * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
  * driver via the dd_function_table::StencilOp callback.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
 {
@@ -366,6 +371,7 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
 
 
 /* GL_EXT_stencil_two_side */
+PUBLIC
 void GLAPIENTRY
 _mesa_ActiveStencilFaceEXT(GLenum face)
 {
@@ -395,6 +401,7 @@ _mesa_ActiveStencilFaceEXT(GLenum face)
  * ctx->Driver.StencilOp function and use ctx->Driver.StencilOpSeparate
  * instead.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)
 {
@@ -452,6 +459,7 @@ _mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)
 
 
 /* OpenGL 2.0 */
+PUBLIC
 void GLAPIENTRY
 _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
 {
@@ -490,6 +498,7 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
 
 
 /* OpenGL 2.0 */
+PUBLIC
 void GLAPIENTRY
 _mesa_StencilMaskSeparate(GLenum face, GLuint mask)
 {
diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
index 987d4f5..415e0f2 100644
--- a/src/mesa/main/syncobj.c
+++ b/src/mesa/main/syncobj.c
@@ -56,6 +56,7 @@
  */
 
 #include <inttypes.h>
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "context.h"
@@ -127,6 +128,7 @@ _mesa_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj,
 }
 
 
+PUBLIC
 void
 _mesa_init_sync_object_functions(struct dd_function_table *driver)
 {
diff --git a/src/mesa/main/tests/Makefile.am b/src/mesa/main/tests/Makefile.am
index 9a00f0e..36e5987 100644
--- a/src/mesa/main/tests/Makefile.am
+++ b/src/mesa/main/tests/Makefile.am
@@ -19,7 +19,7 @@ main_test_SOURCES = \
 	enum_strings.cpp
 
 main_test_LDADD = \
-	$(top_builddir)/src/mesa/libmesa.la \
+	$(top_builddir)/src/mesa/libmesadri at VERSION@.la \
 	$(top_builddir)/src/gtest/libgtest.la \
 	$(GLAPI_LIB) \
 	$(PTHREAD_LIBS) \
diff --git a/src/mesa/main/tests/hash_table/Makefile.am b/src/mesa/main/tests/hash_table/Makefile.am
index 0330ebb..6d1e87c 100644
--- a/src/mesa/main/tests/hash_table/Makefile.am
+++ b/src/mesa/main/tests/hash_table/Makefile.am
@@ -24,7 +24,7 @@ AM_CPPFLAGS = \
 	$(DEFINES) $(INCLUDE_DIRS)
 
 LDADD = \
-	$(top_builddir)/src/mesa/libmesa.la \
+	$(top_builddir)/src/mesa/libmesacore at VERSION@.la \
 	$(PTHREAD_LIBS) \
 	$(DLOPEN_LIBS)
 
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index e71d0c4..808a893 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "colormac.h"
@@ -522,6 +523,7 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img,
  * Return a texel-fetch function for the given format, or NULL if
  * invalid format.
  */
+PUBLIC
 compressed_fetch_func
 _mesa_get_compressed_fetch_func(gl_format format)
 {
diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index a06d29f..8216fed 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -132,6 +132,7 @@ _mesa_texstore_etc1_rgb8(TEXSTORE_PARAMS)
  * \param src_height in pixels
  * \param dst_stride in bytes
  */
+PUBLIC
 void
 _mesa_etc1_unpack_rgba8888(uint8_t *dst_row,
                            unsigned dst_stride,
@@ -1168,6 +1169,7 @@ _mesa_texstore_etc2_srgb8_punchthrough_alpha1(TEXSTORE_PARAMS)
  * \param dst_stride in bytes
  */
 
+PUBLIC
 void
 _mesa_unpack_etc2_format(uint8_t *dst_row,
                          unsigned dst_stride,
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 1aadd7f..18c5335 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/blend.h"
@@ -536,6 +537,7 @@ _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
 
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_TexEnvi( GLenum target, GLenum pname, GLint param )
 {
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index d3aa477..03f0f48 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -33,6 +33,7 @@
  */
 
 
+#include "compiler.h"
 #include "context.h"
 #include "enums.h"
 #include "mtypes.h"
@@ -59,6 +60,7 @@
  * This is called via dd_function_table::ChooseTextureFormat.  Hardware
  * drivers may override this function with a specialized version.
  */
+PUBLIC
 gl_format
 _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
                         GLint internalFormat, GLenum format, GLenum type)
@@ -818,6 +820,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
    return MESA_FORMAT_NONE;
 }
 
+PUBLIC
 GLboolean
 _mesa_tex_target_is_array(GLenum target)
 {
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 7050f10..e582d77 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -29,6 +29,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "bufferobj.h"
 #include "enums.h"
@@ -617,6 +618,7 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
  * We'll call ctx->Driver.MapTextureImage() to access the data, then
  * unmap with ctx->Driver.UnmapTextureImage().
  */
+PUBLIC
 void
 _mesa_get_teximage(struct gl_context *ctx,
                    GLenum format, GLenum type, GLvoid *pixels,
@@ -674,6 +676,7 @@ _mesa_get_teximage(struct gl_context *ctx,
  * This is the software fallback for Driver.GetCompressedTexImage().
  * All error checking will have been done before this routine is called.
  */
+PUBLIC
 void
 _mesa_get_compressed_teximage(struct gl_context *ctx,
                               struct gl_texture_image *texImage,
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index b719fc8..a066287 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -30,6 +30,7 @@
  */
 
 #include <stdbool.h>
+#include "compiler.h"
 #include "glheader.h"
 #include "bufferobj.h"
 #include "context.h"
@@ -74,6 +75,7 @@
  * This is the format which is used during texture application (i.e. the
  * texture format and env mode determine the arithmetic used.
  */
+PUBLIC
 GLint
 _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
 {
@@ -572,6 +574,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
  * For cube map faces, return a face index in [0,5].
  * For other targets return 0;
  */
+PUBLIC
 GLuint
 _mesa_tex_target_to_face(GLenum target)
 {
@@ -638,6 +641,7 @@ _mesa_new_texture_image( struct gl_context *ctx )
  *
  * Free the texture image structure and the associated image data.
  */
+PUBLIC
 void
 _mesa_delete_texture_image(struct gl_context *ctx,
                            struct gl_texture_image *texImage)
@@ -740,6 +744,7 @@ _mesa_get_proxy_target(GLenum target)
  *
  * \return pointer to the texture object on success, or NULL on failure.
  */
+PUBLIC
 struct gl_texture_object *
 _mesa_select_tex_object(struct gl_context *ctx,
                         const struct gl_texture_unit *texUnit,
@@ -822,6 +827,7 @@ _mesa_select_tex_object(struct gl_context *ctx,
 /**
  * Return pointer to texture object for given target on current texture unit.
  */
+PUBLIC
 struct gl_texture_object *
 _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
 {
@@ -842,6 +848,7 @@ _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
  *
  * \return pointer to the texture image structure, or NULL on failure.
  */
+PUBLIC
 struct gl_texture_image *
 _mesa_select_tex_image(struct gl_context *ctx,
                        const struct gl_texture_object *texObj,
@@ -862,6 +869,7 @@ _mesa_select_tex_image(struct gl_context *ctx,
  * it and install it.  Only return NULL if passed a bad parameter or run
  * out of memory.
  */
+PUBLIC
 struct gl_texture_image *
 _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
                     GLenum target, GLint level)
@@ -1039,6 +1047,7 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
 /**
  * Return number of dimensions per mipmap level for the given texture target.
  */
+PUBLIC
 GLint
 _mesa_get_texture_dimensions(GLenum target)
 {
@@ -1088,6 +1097,7 @@ _mesa_get_texture_dimensions(GLenum target)
  * and the dimensions.
  * The dimensions are expected not to include the border.
  */
+PUBLIC
 GLsizei
 _mesa_get_tex_max_num_levels(GLenum target, GLsizei width, GLsizei height,
                              GLsizei depth)
@@ -1230,6 +1240,7 @@ clear_teximage_fields(struct gl_texture_image *img)
  * Fills in the fields of \p img with the given information.
  * Note: width, height and depth include the border.
  */
+PUBLIC
 void
 _mesa_init_teximage_fields(struct gl_context *ctx,
                            struct gl_texture_image *img,
@@ -1345,6 +1356,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
  * After the call, \p texImage will have no data associated with it.  Its
  * fields are cleared so that its parent object will test incomplete.
  */
+PUBLIC
 void
 _mesa_clear_texture_image(struct gl_context *ctx,
                           struct gl_texture_image *texImage)
@@ -1652,6 +1664,7 @@ error_check_subtexture_dimensions(struct gl_context *ctx,
  * \param border  as passed to glTexImage
  * \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable.
  */
+PUBLIC
 GLboolean
 _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
                           gl_format format,
@@ -2871,6 +2884,7 @@ override_internal_format(GLenum internalFormat, GLint width, GLint height)
  * for efficient texture memory layout/allocation.  In particular, this
  * comes up during automatic mipmap generation.
  */
+PUBLIC
 gl_format
 _mesa_choose_texture_format(struct gl_context *ctx,
                             struct gl_texture_object *texObj,
@@ -3195,6 +3209,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
                   GLsizei width, GLsizei height, GLint border,
@@ -3386,6 +3401,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_TexSubImage2D( GLenum target, GLint level,
                      GLint xoffset, GLint yoffset,
@@ -3582,6 +3598,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level,
 
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat,
                       GLint x, GLint y, GLsizei width, GLsizei height,
@@ -3669,6 +3686,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level,
 
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_CopyTexSubImage2D( GLenum target, GLint level,
                          GLint xoffset, GLint yoffset,
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index cc2c786..36d2e4d 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -28,6 +28,7 @@
  */
 
 
+#include "compiler.h"
 #include "bufferobj.h"
 #include "colortab.h"
 #include "context.h"
@@ -53,6 +54,7 @@
 /**
  * Return the gl_texture_object for a given ID.
  */
+PUBLIC
 struct gl_texture_object *
 _mesa_lookup_texture(struct gl_context *ctx, GLuint id)
 {
@@ -77,6 +79,7 @@ _mesa_lookup_texture(struct gl_context *ctx, GLuint id)
  *
  * \return pointer to new texture object.
  */
+PUBLIC
 struct gl_texture_object *
 _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
 {
@@ -94,6 +97,7 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
  * \param name  the texture name
  * \param target  the texture target
  */
+PUBLIC
 void
 _mesa_initialize_texture_object( struct gl_context *ctx,
                                  struct gl_texture_object *obj,
@@ -213,6 +217,7 @@ finish_texture_init(struct gl_context *ctx, GLenum target,
  * \param shared the shared GL state to which the object belongs.
  * \param texObj the texture object to delete.
  */
+PUBLIC
 void
 _mesa_delete_texture_object(struct gl_context *ctx,
                             struct gl_texture_object *texObj)
@@ -300,6 +305,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
  *
  * \sa _mesa_clear_texture_image().
  */
+PUBLIC
 void
 _mesa_clear_texture_object(struct gl_context *ctx,
                            struct gl_texture_object *texObj)
@@ -359,6 +365,7 @@ valid_texture_object(const struct gl_texture_object *tex)
  * This is normally only called from the _mesa_reference_texobj() macro
  * when there's a real pointer change.
  */
+PUBLIC
 void
 _mesa_reference_texobj_(struct gl_texture_object **ptr,
                         struct gl_texture_object *tex)
@@ -461,6 +468,7 @@ incomplete(struct gl_texture_object *t, enum base_mipmap bm,
  * According to the texture target, verifies that each of the mipmaps is
  * present and has the expected size.
  */
+PUBLIC
 void
 _mesa_test_texobj_completeness( const struct gl_context *ctx,
                                 struct gl_texture_object *t )
@@ -721,6 +729,7 @@ _mesa_cube_complete(const struct gl_texture_object *texObj)
  * \param texObj texture object.
  * \param invalidate_state also invalidate context state.
  */
+PUBLIC
 void
 _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
                    GLboolean invalidate_state)
@@ -738,6 +747,7 @@ _mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
  * That's the value a GLSL sampler should get when sampling from an
  * incomplete texture.
  */
+PUBLIC
 struct gl_texture_object *
 _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
 {
@@ -988,6 +998,7 @@ invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture,
  * IDs which are stored in \p textures.  Corresponding empty texture
  * objects are also generated.
  */ 
+PUBLIC
 void GLAPIENTRY
 _mesa_GenTextures( GLsizei n, GLuint *textures )
 {
@@ -1113,6 +1124,7 @@ unbind_texobj_from_texunits(struct gl_context *ctx,
  * Recall that texture objects can be shared among several rendering
  * contexts.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
 {
@@ -1236,6 +1248,7 @@ target_enum_to_index(struct gl_context *ctx, GLenum target)
  * calls dd_function_table::BindTexture. Decrements the old texture reference
  * count and deletes it if it reaches zero.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_BindTexture( GLenum target, GLuint texName )
 {
@@ -1468,6 +1481,7 @@ _mesa_IsTexture( GLuint texture )
  *
  * See also _mesa_lock/unlock_texture() in teximage.h
  */
+PUBLIC
 void
 _mesa_lock_context_textures( struct gl_context *ctx )
 {
@@ -1480,6 +1494,7 @@ _mesa_lock_context_textures( struct gl_context *ctx )
 }
 
 
+PUBLIC
 void
 _mesa_unlock_context_textures( struct gl_context *ctx )
 {
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 757ae80..988dd02 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -30,6 +30,7 @@
  */
 
 #include <stdbool.h>
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/blend.h"
 #include "main/colormac.h"
@@ -860,6 +861,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
 {
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index ad80dcf..67f084f 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -28,6 +28,7 @@
  * Texture state handling.
  */
 
+#include "compiler.h"
 #include "glheader.h"
 #include "bufferobj.h"
 #include "colormac.h"
@@ -284,6 +285,7 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
 
 
 /* GL_ARB_multitexture */
+PUBLIC
 void GLAPIENTRY
 _mesa_ActiveTexture(GLenum texture)
 {
@@ -321,6 +323,7 @@ _mesa_ActiveTexture(GLenum texture)
 
 
 /* GL_ARB_multitexture */
+PUBLIC
 void GLAPIENTRY
 _mesa_ClientActiveTexture(GLenum texture)
 {
diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 7bd8652..b3f188a 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -30,6 +30,7 @@
 
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "context.h"
 #include "enums.h"
@@ -254,6 +255,7 @@ _mesa_is_legal_tex_storage_format(struct gl_context *ctx, GLenum internalformat)
  * GL_ARB_texture_storage texture layouts is handled by texObj->Immutable
  * checks at glTexImage* time.
  */
+PUBLIC
 GLboolean
 _mesa_alloc_texture_storage(struct gl_context *ctx,
                             struct gl_texture_object *texObj,
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 04385e1..0a4209c 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -51,6 +51,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "bufferobj.h"
 #include "colormac.h"
@@ -3790,6 +3791,7 @@ _mesa_get_texstore_func(gl_format format)
 }
 
 
+PUBLIC
 GLboolean
 _mesa_texstore_needs_transfer_ops(struct gl_context *ctx,
                                   GLenum baseInternalFormat,
@@ -3820,6 +3822,7 @@ _mesa_texstore_needs_transfer_ops(struct gl_context *ctx,
 }
 
 
+PUBLIC
 GLboolean
 _mesa_texstore_can_use_memcpy(struct gl_context *ctx,
                               GLenum baseInternalFormat, gl_format dstFormat,
@@ -3865,6 +3868,7 @@ _mesa_texstore_memcpy(TEXSTORE_PARAMS)
  * Store user data into texture memory.
  * Called via glTex[Sub]Image1/2/3D()
  */
+PUBLIC
 GLboolean
 _mesa_texstore(TEXSTORE_PARAMS)
 {
@@ -4048,6 +4052,7 @@ store_texsubimage(struct gl_context *ctx,
  * Basically, allocate storage for the texture image, then copy the
  * user's image into it.
  */
+PUBLIC
 void
 _mesa_store_teximage(struct gl_context *ctx,
                      GLuint dims,
@@ -4075,6 +4080,7 @@ _mesa_store_teximage(struct gl_context *ctx,
 /*
  * Fallback for Driver.TexSubImage().
  */
+PUBLIC
 void
 _mesa_store_texsubimage(struct gl_context *ctx, GLuint dims,
                         struct gl_texture_image *texImage,
@@ -4092,6 +4098,7 @@ _mesa_store_texsubimage(struct gl_context *ctx, GLuint dims,
 /**
  * Fallback for Driver.CompressedTexImage()
  */
+PUBLIC
 void
 _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
                                 struct gl_texture_image *texImage,
@@ -4129,6 +4136,7 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
 /**
  * Fallback for Driver.CompressedTexSubImage()
  */
+PUBLIC
 void
 _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims,
                                    struct gl_texture_image *texImage,
diff --git a/src/mesa/main/texturebarrier.c b/src/mesa/main/texturebarrier.c
index 08ff561..27de863 100644
--- a/src/mesa/main/texturebarrier.c
+++ b/src/mesa/main/texturebarrier.c
@@ -28,6 +28,7 @@
  * \author Marek Olšák <maraeo at gmail.com>
  */
 
+#include "compiler.h"
 #include "context.h"
 #include "texturebarrier.h"
 
@@ -38,6 +39,7 @@ _mesa_texture_barrier(struct gl_context *ctx)
    /* no-op */
 }
 
+PUBLIC
 void
 _mesa_init_texture_barrier_functions(struct dd_function_table *driver)
 {
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 3f8a7f4..5b22225 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -31,6 +31,7 @@
  */
 
 
+#include "compiler.h"
 #include "buffers.h"
 #include "bufferobj.h"
 #include "context.h"
@@ -237,6 +238,7 @@ resume_transform_feedback(struct gl_context *ctx,
  * Plug in default device driver functions for transform feedback.
  * Most drivers will override some/all of these.
  */
+PUBLIC
 void
 _mesa_init_transform_feedback_functions(struct dd_function_table *driver)
 {
@@ -302,6 +304,7 @@ compute_transform_feedback_buffer_sizes(
  * Compute the maximum number of vertices that can be written to the currently
  * enabled transform feedback buffers without overflowing any of them.
  */
+PUBLIC
 unsigned
 _mesa_compute_max_transform_feedback_vertices(
       const struct gl_transform_feedback_object *obj,
@@ -889,6 +892,7 @@ _mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names)
  * Pause transform feedback.
  * Part of GL_ARB_transform_feedback2.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_PauseTransformFeedback(void)
 {
@@ -917,6 +921,7 @@ _mesa_PauseTransformFeedback(void)
  * Resume transform feedback.
  * Part of GL_ARB_transform_feedback2.
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_ResumeTransformFeedback(void)
 {
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index 1e6f7f4..4d72862 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -36,6 +36,7 @@
  * 2. Insert FLUSH_VERTICES calls in various places
  */
 
+#include "compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/dispatch.h"
@@ -62,6 +63,7 @@
  * TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc.
  * We'll use that info for state validation before rendering.
  */
+PUBLIC
 void
 _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
 				  struct gl_program *prog)
@@ -125,6 +127,7 @@ _mesa_uniform_attach_driver_storage(struct gl_uniform_storage *uni,
  * This function does \b not release any of the \c data pointers
  * previously passed in to \c _mesa_uniform_attach_driver_stoarge.
  */
+PUBLIC
 void
 _mesa_uniform_detach_all_driver_storage(struct gl_uniform_storage *uni)
 {
@@ -235,6 +238,7 @@ _mesa_Uniform3fv(GLint location, GLsizei count, const GLfloat * value)
    _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_FLOAT_VEC3);
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_Uniform4fv(GLint location, GLsizei count, const GLfloat * value)
 {
@@ -263,6 +267,7 @@ _mesa_Uniform3iv(GLint location, GLsizei count, const GLint * value)
    _mesa_uniform(ctx, ctx->Shader.ActiveProgram, location, count, value, GL_INT_VEC3);
 }
 
+PUBLIC
 void GLAPIENTRY
 _mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value)
 {
@@ -500,6 +505,7 @@ _mesa_GetUniformdv(GLhandleARB program, GLint location, GLdouble *params)
 }
 
 
+PUBLIC
 GLint GLAPIENTRY
 _mesa_GetUniformLocation(GLhandleARB programObj, const GLcharARB *name)
 {
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index dee476a..78b7445 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -24,6 +24,7 @@
  */
 
 
+#include "compiler.h"
 #include "glheader.h"
 #include "imports.h"
 #include "bufferobj.h"
@@ -289,6 +290,7 @@ update_array(struct gl_context *ctx,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
 {
@@ -327,6 +329,7 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
 {
@@ -398,6 +401,7 @@ _mesa_SecondaryColorPointer(GLint size, GLenum type,
 }
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
                       const GLvoid *ptr)
@@ -462,6 +466,7 @@ _mesa_PointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *ptr)
  * Note that these arrays DO NOT alias the conventional GL vertex arrays
  * (position, normal, color, fog, texcoord, etc).
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
                              GLboolean normalized,
@@ -516,6 +521,7 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type,
 
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_EnableVertexAttribArray(GLuint index)
 {
@@ -1165,6 +1171,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
 }
 
 
+PUBLIC
 unsigned
 _mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type)
 {
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 55411fa..4df6088 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "compiler.h"
 #include "imports.h"
 #include "mtypes.h"
 #include "version.h"
@@ -151,6 +152,7 @@ _mesa_override_gl_version(struct gl_context *ctx)
  *
  * version > 0 indicates there is an override requested
  */
+PUBLIC
 int
 _mesa_get_gl_version_override(void)
 {
@@ -167,6 +169,7 @@ _mesa_get_gl_version_override(void)
  * MESA_GLSL_VERSION_OVERRIDE is set. Valid values for
  * MESA_GLSL_VERSION_OVERRIDE are integers, such as "130".
  */
+PUBLIC
 void
 _mesa_override_glsl_version(struct gl_context *ctx)
 {
@@ -396,6 +399,7 @@ compute_version_es2(struct gl_context *ctx)
  * This should only be called once as part of context initialization
  * or to perform version check for GLX_ARB_create_context_profile.
  */
+PUBLIC
 void
 _mesa_compute_version(struct gl_context *ctx)
 {
diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c
index 91578ba..1142e10 100644
--- a/src/mesa/main/viewport.c
+++ b/src/mesa/main/viewport.c
@@ -29,6 +29,7 @@
  */
 
 
+#include "compiler.h"
 #include "context.h"
 #include "macros.h"
 #include "mtypes.h"
@@ -60,6 +61,7 @@ _mesa_Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
  * \param width width of the viewport rectangle.
  * \param height height of the viewport rectangle.
  */
+PUBLIC
 void
 _mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
                     GLsizei width, GLsizei height)
@@ -112,6 +114,7 @@ _mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
  * \param farval  specifies the Z buffer value which should correspond to
  *                the far clip plane
  */
+PUBLIC
 void GLAPIENTRY
 _mesa_DepthRange(GLclampd nearval, GLclampd farval)
 {
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index 336206f..c60fed1 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -25,6 +25,7 @@
  *    Keith Whitwell <keith at tungstengraphics.com> Gareth Hughes
  */
 
+#include "compiler.h"
 #include "glheader.h"
 #include "api_arrayelt.h"
 #include "context.h"
@@ -238,6 +239,7 @@ _mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
  *
  * This function depends on ctx->Version.
  */
+PUBLIC
 void
 _mesa_initialize_vbo_vtxfmt(struct gl_context *ctx)
 {
diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c
index 2902315..a081590 100644
--- a/src/mesa/math/m_matrix.c
+++ b/src/mesa/math/m_matrix.c
@@ -34,6 +34,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/macros.h"
@@ -231,6 +232,7 @@ static void matrix_multf( GLmatrix *mat, const GLfloat *m, GLuint flags )
  * Joins both flags and marks the type and inverse as dirty.  Calls matmul34()
  * if both matrices are 3D, or matmul4() otherwise.
  */
+PUBLIC
 void
 _math_matrix_mul_matrix( GLmatrix *dest, const GLmatrix *a, const GLmatrix *b )
 {
@@ -1109,6 +1111,7 @@ _math_matrix_translate( GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z )
  * Set matrix to do viewport and depthrange mapping.
  * Transforms Normalized Device Coords to window/Z values.
  */
+PUBLIC
 void
 _math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height,
                       GLfloat zNear, GLfloat zFar, GLfloat depthMax)
@@ -1132,6 +1135,7 @@ _math_matrix_viewport(GLmatrix *m, GLint x, GLint y, GLint width, GLint height,
  * Copies ::Identity into \p GLmatrix::m, and into GLmatrix::inv if not NULL.
  * Sets the matrix type to identity, and clear the dirty flags.
  */
+PUBLIC
 void
 _math_matrix_set_identity( GLmatrix *mat )
 {
@@ -1359,6 +1363,7 @@ static void analyse_from_flags( GLmatrix *mat )
  * are dirty or not, respectively. If the matrix has an inverse and it's dirty
  * then calls matrix_invert(). Finally clears the dirty flags.
  */
+PUBLIC
 void
 _math_matrix_analyse( GLmatrix *mat )
 {
@@ -1394,6 +1399,7 @@ _math_matrix_is_length_preserving( const GLmatrix *m )
  * Test if the given matrix does any rotation.
  * (or perhaps if the upper-left 3x3 is non-identity)
  */
+PUBLIC
 GLboolean
 _math_matrix_has_rotation( const GLmatrix *m )
 {
@@ -1407,6 +1413,7 @@ _math_matrix_has_rotation( const GLmatrix *m )
 }
 
 
+PUBLIC
 GLboolean
 _math_matrix_is_general_scale( const GLmatrix *m )
 {
@@ -1433,6 +1440,7 @@ _math_matrix_is_dirty( const GLmatrix *m )
  *
  * Copies all fields in GLmatrix, creating an inverse array if necessary.
  */
+PUBLIC
 void
 _math_matrix_copy( GLmatrix *to, const GLmatrix *from )
 {
@@ -1451,6 +1459,7 @@ _math_matrix_copy( GLmatrix *to, const GLmatrix *from )
  * Copies \p m into GLmatrix::m and marks the MAT_FLAG_GENERAL and MAT_DIRTY
  * flags.
  */
+PUBLIC
 void
 _math_matrix_loadf( GLmatrix *mat, const GLfloat *m )
 {
@@ -1465,6 +1474,7 @@ _math_matrix_loadf( GLmatrix *mat, const GLfloat *m )
  *
  * Initialize the GLmatrix fields.
  */
+PUBLIC
 void
 _math_matrix_ctr( GLmatrix *m )
 {
@@ -1485,6 +1495,7 @@ _math_matrix_ctr( GLmatrix *m )
  *
  * Frees the data in a GLmatrix.
  */
+PUBLIC
 void
 _math_matrix_dtr( GLmatrix *m )
 {
diff --git a/src/mesa/math/m_translate.c b/src/mesa/math/m_translate.c
index 0b8c858..574070b 100644
--- a/src/mesa/math/m_translate.c
+++ b/src/mesa/math/m_translate.c
@@ -28,6 +28,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/macros.h"
 #include "main/mtypes.h"		/* GLchan hack */
@@ -614,7 +615,7 @@ static void init_translate_raw(void)
 
 
 
-
+PUBLIC
 void _math_init_translate( void )
 {
    init_translate_raw();
@@ -712,6 +713,7 @@ void _math_trans_4us(GLushort (*to)[4],
 /**
  * Translate vector of values to GLfloat [4].
  */
+PUBLIC
 void _math_trans_4f(GLfloat (*to)[4],
 		    const void *ptr,
 		    GLuint stride,
diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c
index ff42396..7dda680 100644
--- a/src/mesa/math/m_vector.c
+++ b/src/mesa/math/m_vector.c
@@ -27,6 +27,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/macros.h"
@@ -39,6 +40,7 @@
  * Given a vector [count][4] of floats, set all the [][elt] values
  * to 0 (if elt = 0, 1, 2) or 1.0 (if elt = 3).
  */
+PUBLIC
 void
 _mesa_vector4f_clean_elem( GLvector4f *vec, GLuint count, GLuint elt )
 {
@@ -94,6 +96,7 @@ _mesa_vector4f_init( GLvector4f *v, GLbitfield flags, GLfloat (*storage)[4] )
  * \param count  number of elements to allocate in vector
  * \param alignment  desired memory alignment for the data (in bytes)
  */
+PUBLIC
 void
 _mesa_vector4f_alloc( GLvector4f *v, GLbitfield flags, GLuint count,
                       GLuint alignment )
@@ -114,6 +117,7 @@ _mesa_vector4f_alloc( GLvector4f *v, GLbitfield flags, GLuint count,
  * vector's storage field if the VEC_MALLOC flag is set.
  * DO NOT free the GLvector object itself, though.
  */
+PUBLIC
 void
 _mesa_vector4f_free( GLvector4f *v )
 {
diff --git a/src/mesa/program/Makefile.am b/src/mesa/program/Makefile.am
index ab565e2..10398a7 100644
--- a/src/mesa/program/Makefile.am
+++ b/src/mesa/program/Makefile.am
@@ -22,27 +22,17 @@
 include ../Makefile.sources
 
 AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
-AM_CFLAGS = $(VISIBILITY_CFLAGS)
-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
-libdricore_program_la_CFLAGS = $(NOVISIBILITY_CFLAGS)
-libdricore_program_la_CXXFLAGS = $(NOVISIBILITY_CXXFLAGS)
 
 SRCDIR = $(top_srcdir)/src/mesa/
 BUILDDIR = $(top_builddir)/src/mesa/
 
-if NEED_LIBDRICORE
-DRICORE_LIB = libdricore_program.la
-endif
-
-noinst_LTLIBRARIES = $(DRICORE_LIB)
-if NEED_LIBPROGRAM
-noinst_LTLIBRARIES += libprogram.la
+if NEED_LIBMESACORE
+noinst_LTLIBRARIES = libmesacore_program.la
 else
-check_LTLIBRARIES = libprogram.la
+check_LTLIBRARIES = libmesacore_program.la
 endif
 
-libprogram_la_SOURCES = $(PROGRAM_FILES)
-libdricore_program_la_SOURCES = $(PROGRAM_FILES)
+libmesacore_program_la_SOURCES = $(PROGRAM_FILES)
 
 lex.yy.c: program_lexer.l
 	$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index b1fd91a..0da802d 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -25,6 +25,7 @@
  *    Chia-I Wu <olv at lunarg.com>
  */
 
+#include "main/compiler.h"
 #include "main/mtypes.h"
 #include "main/context.h"
 #include "main/texobj.h"
@@ -882,6 +883,7 @@ static const struct st_api st_gl_api = {
    st_api_get_current,
 };
 
+PUBLIC
 struct st_api *
 st_gl_api_create(void)
 {
diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c
index c26b4be..c3b9a95 100644
--- a/src/mesa/swrast/s_clear.c
+++ b/src/mesa/swrast/s_clear.c
@@ -22,6 +22,7 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/accum.h"
 #include "main/condrender.h"
@@ -199,6 +200,7 @@ clear_color_buffers(struct gl_context *ctx)
  *                 renderbuffers are to be cleared.
  * \param all  if GL_TRUE, clear whole buffer, else clear specified region.
  */
+PUBLIC
 void
 _swrast_Clear(struct gl_context *ctx, GLbitfield buffers)
 {
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 8934088..ab1c474 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -25,6 +25,7 @@
  *    Keith Whitwell <keith at tungstengraphics.com> Brian Paul
  */
 
+#include "main/compiler.h"
 #include "main/imports.h"
 #include "main/bufferobj.h"
 #include "main/colormac.h"
@@ -545,7 +546,9 @@ _swrast_update_active_attribs(struct gl_context *ctx)
    }
 }
 
-
+#if defined(HAVE_X11_DRIVER)
+PUBLIC
+#endif
 void
 _swrast_validate_derived( struct gl_context *ctx )
 {
@@ -616,6 +619,7 @@ _swrast_Quad( struct gl_context *ctx,
    SWRAST_CONTEXT(ctx)->Triangle( ctx, v1, v2, v3 );
 }
 
+PUBLIC
 void
 _swrast_Triangle( struct gl_context *ctx, const SWvertex *v0,
                   const SWvertex *v1, const SWvertex *v2 )
@@ -629,6 +633,7 @@ _swrast_Triangle( struct gl_context *ctx, const SWvertex *v0,
    SWRAST_CONTEXT(ctx)->Triangle( ctx, v0, v1, v2 );
 }
 
+PUBLIC
 void
 _swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
 {
@@ -640,6 +645,7 @@ _swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
    SWRAST_CONTEXT(ctx)->Line( ctx, v0, v1 );
 }
 
+PUBLIC
 void
 _swrast_Point( struct gl_context *ctx, const SWvertex *v0 )
 {
@@ -650,6 +656,7 @@ _swrast_Point( struct gl_context *ctx, const SWvertex *v0 )
    SWRAST_CONTEXT(ctx)->Point( ctx, v0 );
 }
 
+PUBLIC
 void
 _swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state )
 {
@@ -659,6 +666,7 @@ _swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state )
    SWRAST_CONTEXT(ctx)->InvalidateState( ctx, new_state );
 }
 
+PUBLIC
 void
 _swrast_ResetLineStipple( struct gl_context *ctx )
 {
@@ -674,6 +682,7 @@ _swrast_SetFacing(struct gl_context *ctx, GLuint facing)
    SWRAST_CONTEXT(ctx)->PointLineFacing = facing;
 }
 
+PUBLIC
 void
 _swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
 {
@@ -684,6 +693,7 @@ _swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
    SWRAST_CONTEXT(ctx)->AllowVertexFog = value;
 }
 
+PUBLIC
 void
 _swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
 {
@@ -713,6 +723,7 @@ init_program_native_limits(struct gl_program_constants *prog)
 }
 
 
+PUBLIC
 GLboolean
 _swrast_CreateContext( struct gl_context *ctx )
 {
@@ -816,6 +827,7 @@ _swrast_CreateContext( struct gl_context *ctx )
    return GL_TRUE;
 }
 
+PUBLIC
 void
 _swrast_DestroyContext( struct gl_context *ctx )
 {
@@ -840,6 +852,7 @@ _swrast_DestroyContext( struct gl_context *ctx )
 }
 
 
+PUBLIC
 struct swrast_device_driver *
 _swrast_GetDeviceDriverReference( struct gl_context *ctx )
 {
@@ -847,6 +860,7 @@ _swrast_GetDeviceDriverReference( struct gl_context *ctx )
    return &swrast->Driver;
 }
 
+PUBLIC
 void
 _swrast_flush( struct gl_context *ctx )
 {
@@ -887,6 +901,7 @@ _swrast_span_render_finish(struct gl_context *ctx)
 }
 
 
+PUBLIC
 void
 _swrast_render_start( struct gl_context *ctx )
 {
@@ -896,6 +911,7 @@ _swrast_render_start( struct gl_context *ctx )
    swrast->PointSpan.end = 0;
 }
  
+PUBLIC
 void
 _swrast_render_finish( struct gl_context *ctx )
 {
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index d001734..58146cf 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/colormac.h"
@@ -619,6 +620,9 @@ map_readbuffer(struct gl_context *ctx, GLenum type)
  * Do software-based glCopyPixels.
  * By time we get here, all parameters will have been error-checked.
  */
+#if defined(HAVE_X11_DRIVER)
+PUBLIC
+#endif
 void
 _swrast_CopyPixels( struct gl_context *ctx,
 		    GLint srcx, GLint srcy, GLsizei width, GLsizei height,
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
index 1786de1..aef82a7 100644
--- a/src/mesa/swrast/s_drawpix.c
+++ b/src/mesa/swrast/s_drawpix.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/bufferobj.h"
 #include "main/colormac.h"
@@ -642,6 +643,7 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
  * Execute software-based glDrawPixels.
  * By time we get here, all error checking will have been done.
  */
+PUBLIC
 void
 _swrast_DrawPixels( struct gl_context *ctx,
 		    GLint x, GLint y,
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index 34b7c2d..20112c5 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/macros.h"
@@ -34,6 +35,7 @@
 /**
  * Used to convert current raster distance to a fog factor in [0,1].
  */
+PUBLIC
 GLfloat
 _swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z)
 {
diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c
index b63296a..ad4643f 100644
--- a/src/mesa/swrast/s_lines.c
+++ b/src/mesa/swrast/s_lines.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/colormac.h"
@@ -221,6 +222,7 @@ do {                                    \
  * Please update the summary flag _SWRAST_NEW_LINE if you add or remove
  * tests to this code.
  */
+PUBLIC
 void
 _swrast_choose_line( struct gl_context *ctx )
 {
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index b9bec23..6c9a434 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -23,6 +23,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/macros.h"
@@ -538,6 +539,9 @@ _swrast_add_spec_terms_point(struct gl_context *ctx, const SWvertex *v0)
 /**
  * Examine current state to determine which point drawing function to use.
  */
+#if defined(HAVE_X11_DRIVER)
+PUBLIC
+#endif
 void
 _swrast_choose_point(struct gl_context *ctx)
 {
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index e3f33de..7dc1ee5 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -30,6 +30,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/context.h"
@@ -174,6 +175,7 @@ soft_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb)
 }
 
 
+PUBLIC
 void
 _swrast_map_soft_renderbuffer(struct gl_context *ctx,
                               struct gl_renderbuffer *rb,
@@ -200,6 +202,7 @@ _swrast_map_soft_renderbuffer(struct gl_context *ctx,
 }
 
 
+PUBLIC
 void
 _swrast_unmap_soft_renderbuffer(struct gl_context *ctx,
                                 struct gl_renderbuffer *rb)
@@ -476,6 +479,7 @@ add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
  * This is a helper routine for device drivers.  Drivers can just as well
  * call the individual _mesa_add_*_renderbuffer() routines directly.
  */
+PUBLIC
 void
 _swrast_add_soft_renderbuffers(struct gl_framebuffer *fb,
                                GLboolean color,
diff --git a/src/mesa/swrast/s_texrender.c b/src/mesa/swrast/s_texrender.c
index 751d776..8b8f777 100644
--- a/src/mesa/swrast/s_texrender.c
+++ b/src/mesa/swrast/s_texrender.c
@@ -1,4 +1,5 @@
 
+#include "main/compiler.h"
 #include "main/context.h"
 #include "main/colormac.h"
 #include "main/fbobject.h"
@@ -75,6 +76,7 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
  *
  * \sa _mesa_framebuffer_renderbuffer
  */
+PUBLIC
 void
 _swrast_render_texture(struct gl_context *ctx,
                        struct gl_framebuffer *fb,
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 27803c5..a9c4d92 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -27,6 +27,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/context.h"
 #include "main/fbobject.h"
 #include "main/teximage.h"
@@ -122,6 +123,7 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
  *
  * Returns GL_TRUE on success, GL_FALSE on memory allocation failure.
  */
+PUBLIC
 GLboolean
 _swrast_init_texture_image(struct gl_texture_image *texImage)
 {
@@ -159,6 +161,7 @@ _swrast_init_texture_image(struct gl_texture_image *texImage)
 /**
  * Called via ctx->Driver.FreeTextureImageBuffer()
  */
+PUBLIC
 void
 _swrast_free_texture_image_buffer(struct gl_context *ctx,
                                   struct gl_texture_image *texImage)
@@ -257,6 +260,7 @@ _swrast_unmap_teximage(struct gl_context *ctx,
 }
 
 
+PUBLIC
 void
 _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
 {
@@ -308,6 +312,7 @@ _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
 }
 
 
+PUBLIC
 void
 _swrast_unmap_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
 {
@@ -340,6 +345,7 @@ _swrast_unmap_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
 /**
  * Map all textures for reading prior to software rendering.
  */
+PUBLIC
 void
 _swrast_map_textures(struct gl_context *ctx)
 {
@@ -360,6 +366,7 @@ _swrast_map_textures(struct gl_context *ctx)
 /**
  * Unmap all textures for reading prior to software rendering.
  */
+PUBLIC
 void
 _swrast_unmap_textures(struct gl_context *ctx)
 {
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index 085021b..0be4cbb 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -29,6 +29,7 @@
  * functions to draw triangles.
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/colormac.h"
@@ -997,6 +998,7 @@ do {						\
  * Please update the summary flag _SWRAST_NEW_TRIANGLE if you add or
  * remove tests to this code.
  */
+PUBLIC
 void
 _swrast_choose_triangle( struct gl_context *ctx )
 {
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index 6ef1a57..ae4ed9b 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -25,6 +25,7 @@
  *    Keith Whitwell <keith at tungstengraphics.com>
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/colormac.h"
@@ -46,6 +47,7 @@
 #define VARYING_EMIT_STYLE  EMIT_4F
 
 
+PUBLIC
 GLboolean
 _swsetup_CreateContext( struct gl_context *ctx )
 {
@@ -66,6 +68,7 @@ _swsetup_CreateContext( struct gl_context *ctx )
    return GL_TRUE;
 }
 
+PUBLIC
 void
 _swsetup_DestroyContext( struct gl_context *ctx )
 {
@@ -218,6 +221,7 @@ _swsetup_RenderFinish( struct gl_context *ctx )
    _swrast_render_finish( ctx );
 }
 
+PUBLIC
 void
 _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state )
 {
@@ -227,6 +231,7 @@ _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state )
 }
 
 
+PUBLIC
 void
 _swsetup_Wakeup( struct gl_context *ctx )
 {
@@ -262,6 +267,7 @@ _swsetup_Wakeup( struct gl_context *ctx )
 /**
  * Populate a swrast SWvertex from an attrib-style vertex.
  */
+PUBLIC
 void 
 _swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest )
 {
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 0877759..4faae54 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -26,6 +26,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/context.h"
@@ -42,6 +43,7 @@
 
 #include "vbo/vbo.h"
 
+PUBLIC
 GLboolean
 _tnl_CreateContext( struct gl_context *ctx )
 {
@@ -102,6 +104,7 @@ _tnl_CreateContext( struct gl_context *ctx )
 }
 
 
+PUBLIC
 void
 _tnl_DestroyContext( struct gl_context *ctx )
 {
@@ -121,6 +124,7 @@ _tnl_DestroyContext( struct gl_context *ctx )
 }
 
 
+PUBLIC
 void
 _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
 {
@@ -185,6 +189,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
 }
 
 
+PUBLIC
 void
 _tnl_wakeup( struct gl_context *ctx )
 {
@@ -208,6 +213,7 @@ _tnl_wakeup( struct gl_context *ctx )
  * it wants Normalized Device Coords (NDC) computed.  I.e. whether
  * we should "Divide-by-W".  Software renders will want that.
  */
+PUBLIC
 void
 _tnl_need_projected_coords( struct gl_context *ctx, GLboolean mode )
 {
@@ -215,6 +221,7 @@ _tnl_need_projected_coords( struct gl_context *ctx, GLboolean mode )
    tnl->NeedNdcCoords = mode;
 }
 
+PUBLIC
 void
 _tnl_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
 {
@@ -225,6 +232,7 @@ _tnl_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
 
 }
 
+PUBLIC
 void
 _tnl_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
 {
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 637ac6f..583460b 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -25,6 +25,7 @@
  *    Keith Whitwell <keith at tungstengraphics.com>
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/bufferobj.h"
 #include "main/condrender.h"
@@ -408,6 +409,7 @@ static void unmap_vbos( struct gl_context *ctx,
 }
 
 
+PUBLIC
 void _tnl_vbo_draw_prims(struct gl_context *ctx,
 			 const struct _mesa_prim *prim,
 			 GLuint nr_prims,
@@ -429,6 +431,7 @@ void _tnl_vbo_draw_prims(struct gl_context *ctx,
  * module.  In a regular swtnl driver, this can be plugged straight
  * into the vbo->Driver.DrawPrims() callback.
  */
+PUBLIC
 void _tnl_draw_prims( struct gl_context *ctx,
 		      const struct gl_client_array *arrays[],
 		      const struct _mesa_prim *prim,
diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c
index bfb1b6e..6f5141a 100644
--- a/src/mesa/tnl/t_pipeline.c
+++ b/src/mesa/tnl/t_pipeline.c
@@ -25,6 +25,7 @@
  *    Keith Whitwell <keith at tungstengraphics.com>
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/imports.h"
@@ -35,6 +36,7 @@
 #include "t_vp_build.h"
 #include "t_vertex.h"
 
+PUBLIC
 void _tnl_install_pipeline( struct gl_context *ctx,
 			    const struct tnl_pipeline_stage **stages )
 {
@@ -55,6 +57,7 @@ void _tnl_install_pipeline( struct gl_context *ctx,
    tnl->pipeline.nr_stages = i;
 }
 
+PUBLIC
 void _tnl_destroy_pipeline( struct gl_context *ctx )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -113,6 +116,7 @@ static GLuint check_output_changes( struct gl_context *ctx )
 }
 
 
+PUBLIC
 void _tnl_run_pipeline( struct gl_context *ctx )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c
index 17deaaa..f7cdc0c 100644
--- a/src/mesa/tnl/t_vb_fog.c
+++ b/src/mesa/tnl/t_vb_fog.c
@@ -26,6 +26,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/macros.h"
@@ -265,6 +266,7 @@ free_fog_data(struct tnl_pipeline_stage *stage)
 }
 
 
+PUBLIC
 const struct tnl_pipeline_stage _tnl_fog_coordinate_stage =
 {
    "build fog coordinates",	/* name */
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index ee80f1b..5a23e49 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -24,6 +24,7 @@
 
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/light.h"
@@ -169,6 +170,7 @@ validate_shine_table( struct gl_context *ctx, GLuint side, GLfloat shininess )
 }
 
 
+PUBLIC
 void
 _tnl_validate_shine_tables( struct gl_context *ctx )
 {
@@ -462,6 +464,7 @@ static void dtr( struct tnl_pipeline_stage *stage )
    }
 }
 
+PUBLIC
 const struct tnl_pipeline_stage _tnl_lighting_stage =
 {
    "lighting",			/* name */
diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c
index b62368c..2ddb70f 100644
--- a/src/mesa/tnl/t_vb_normals.c
+++ b/src/mesa/tnl/t_vb_normals.c
@@ -26,6 +26,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/macros.h"
@@ -176,6 +177,7 @@ free_normal_data(struct tnl_pipeline_stage *stage)
 }
 
 
+PUBLIC
 const struct tnl_pipeline_stage _tnl_normal_transform_stage =
 {
    "normal transform",		/* name */
diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c
index 5f6c258..99d7b49 100644
--- a/src/mesa/tnl/t_vb_points.c
+++ b/src/mesa/tnl/t_vb_points.c
@@ -25,6 +25,7 @@
  *    Brian Paul
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/mtypes.h"
 #include "main/dd.h"
@@ -103,6 +104,7 @@ free_point_data(struct tnl_pipeline_stage *stage)
 }
 
 
+PUBLIC
 const struct tnl_pipeline_stage _tnl_point_attenuation_stage =
 {
    "point size attenuation",	/* name */
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index e43d5d9..e241e38 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -31,6 +31,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/macros.h"
@@ -209,6 +210,7 @@ vp_fetch_texel(struct gl_context *ctx, const GLfloat texcoord[4], GLfloat lambda
  * Called via ctx->Driver.ProgramStringNotify() after a new vertex program
  * string has been parsed.
  */
+PUBLIC
 GLboolean
 _tnl_program_string(struct gl_context *ctx, GLenum target, struct gl_program *program)
 {
@@ -528,6 +530,7 @@ validate_vp_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
 /**
  * Public description of this pipeline stage.
  */
+PUBLIC
 const struct tnl_pipeline_stage _tnl_vertex_program_stage =
 {
    "vertex-program",
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index 528f8b5..24e8231 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -38,6 +38,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/enums.h"
@@ -218,7 +219,7 @@ static void clip_elt_triangles( struct gl_context *ctx,
 
 #define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
 #define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RENDER_TAB_QUALIFIER
+#define RENDER_TAB_QUALIFIER PUBLIC
 #define PRESERVE_VB_DEFS
 #include "t_vb_rendertmp.h"
 
@@ -235,6 +236,7 @@ static void clip_elt_triangles( struct gl_context *ctx,
 /*              Helper functions for drivers                  */
 /**********************************************************************/
 
+PUBLIC
 void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -246,6 +248,7 @@ void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLui
    VB->Elts = tmp;
 }
 
+PUBLIC
 void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -337,6 +340,7 @@ static GLboolean run_render( struct gl_context *ctx,
 
 
 
+PUBLIC
 const struct tnl_pipeline_stage _tnl_render_stage =
 {
    "render",			/* name */
diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c
index 592f9af..e2746da 100644
--- a/src/mesa/tnl/t_vb_texgen.c
+++ b/src/mesa/tnl/t_vb_texgen.c
@@ -34,6 +34,7 @@
  * including any use thereof or modifications thereto.
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/macros.h"
@@ -597,6 +598,7 @@ static void free_texgen_data( struct tnl_pipeline_stage *stage )
 
 
 
+PUBLIC
 const struct tnl_pipeline_stage _tnl_texgen_stage =
 {
    "texgen",			/* name */
diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c
index c3f6a26..37b9015 100644
--- a/src/mesa/tnl/t_vb_texmat.c
+++ b/src/mesa/tnl/t_vb_texmat.c
@@ -26,6 +26,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/macros.h"
@@ -117,6 +118,7 @@ static void free_texmat_data( struct tnl_pipeline_stage *stage )
 
 
 
+PUBLIC
 const struct tnl_pipeline_stage _tnl_texture_transform_stage =
 {
    "texture transform",			/* name */
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c
index 7c57f17..2c2a3d1 100644
--- a/src/mesa/tnl/t_vb_vertex.c
+++ b/src/mesa/tnl/t_vb_vertex.c
@@ -26,6 +26,7 @@
  */
 
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/colormac.h"
 #include "main/macros.h"
@@ -272,6 +273,7 @@ static void dtr( struct tnl_pipeline_stage *stage )
 }
 
 
+PUBLIC
 const struct tnl_pipeline_stage _tnl_vertex_transform_stage =
 {
    "modelview/project/cliptest/divide",
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c
index c7a745e..fa8516a 100644
--- a/src/mesa/tnl/t_vertex.c
+++ b/src/mesa/tnl/t_vertex.c
@@ -25,6 +25,7 @@
  *    Keith Whitwell <keithw at tungstengraphics.com>
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/colormac.h"
@@ -195,6 +196,7 @@ static void choose_copy_pv_func(  struct gl_context *ctx, GLuint edst, GLuint es
 
 /* Interpolate between two vertices to produce a third:
  */
+PUBLIC
 void _tnl_interp( struct gl_context *ctx,
 		  GLfloat t,
 		  GLuint edst, GLuint eout, GLuint ein,
@@ -206,6 +208,7 @@ void _tnl_interp( struct gl_context *ctx,
 
 /* Copy colors from one vertex to another:
  */
+PUBLIC
 void _tnl_copy_pv(  struct gl_context *ctx, GLuint edst, GLuint esrc )
 {
    struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
@@ -265,6 +268,7 @@ void _tnl_set_attr( struct gl_context *ctx, void *vout,
 }
 
 
+PUBLIC
 void *_tnl_get_vertex( struct gl_context *ctx, GLuint nr )
 {
    struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
@@ -272,6 +276,7 @@ void *_tnl_get_vertex( struct gl_context *ctx, GLuint nr )
    return vtx->vertex_buf + nr * vtx->vertex_size;
 }
 
+PUBLIC
 void _tnl_invalidate_vertex_state( struct gl_context *ctx, GLuint new_state )
 {
    /* if two-sided lighting changes or filled/unfilled polygon state changes */
@@ -291,6 +296,7 @@ static void invalidate_funcs( struct tnl_clipspace *vtx )
    vtx->new_inputs = ~0;
 }
 
+PUBLIC
 GLuint _tnl_install_attrs( struct gl_context *ctx, const struct tnl_attr_map *map,
 			   GLuint nr, const GLfloat *vp, 
 			   GLuint unpacked_size )
@@ -366,6 +372,7 @@ GLuint _tnl_install_attrs( struct gl_context *ctx, const struct tnl_attr_map *ma
 
 
 
+PUBLIC
 void _tnl_invalidate_vertices( struct gl_context *ctx, GLuint newinputs )
 {
    struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
@@ -430,6 +437,7 @@ static void update_input_ptrs( struct gl_context *ctx, GLuint start )
 }
 
 
+PUBLIC
 void _tnl_build_vertices( struct gl_context *ctx,
 			  GLuint start,
 			  GLuint end,
@@ -445,6 +453,7 @@ void _tnl_build_vertices( struct gl_context *ctx,
 /* Emit VB vertices start..end to dest.  Note that VB vertex at
  * postion start will be emitted to dest at position zero.
  */
+PUBLIC
 void *_tnl_emit_vertices_to_buffer( struct gl_context *ctx,
 				    GLuint start,
 				    GLuint end,
@@ -488,6 +497,7 @@ void *_tnl_emit_indexed_vertices_to_buffer( struct gl_context *ctx,
 }
 
 
+PUBLIC
 void _tnl_init_vertices( struct gl_context *ctx, 
 			GLuint vb_size,
 			GLuint max_vertex_size )
@@ -539,6 +549,7 @@ void _tnl_init_vertices( struct gl_context *ctx,
 }
 
 
+PUBLIC
 void _tnl_free_vertices( struct gl_context *ctx )
 {
    TNLcontext *tnl = TNL_CONTEXT(ctx);
diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c
index 44d6250..d19a487 100644
--- a/src/mesa/tnl/t_vertex_generic.c
+++ b/src/mesa/tnl/t_vertex_generic.c
@@ -26,6 +26,7 @@
  *    Keith Whitwell <keithw at tungstengraphics.com>
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/colormac.h"
@@ -759,6 +760,7 @@ static void extract_1ub_1f( const struct tnl_clipspace_attr *a, GLfloat *out, co
 }
 
 
+PUBLIC
 const struct tnl_format_info _tnl_format_info[EMIT_MAX] = 
 {
    { "1f",
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index b280627..983970b 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -25,6 +25,7 @@
  *    Keith Whitwell <keith at tungstengraphics.com>
  */
 
+#include "main/compiler.h"
 #include "main/imports.h"
 #include "main/mtypes.h"
 #include "main/api_arrayelt.h"
@@ -148,6 +149,7 @@ static void init_mat_currval(struct gl_context *ctx)
 }
 
 
+PUBLIC
 GLboolean _vbo_CreateContext( struct gl_context *ctx )
 {
    struct vbo_context *vbo = CALLOC_STRUCT(vbo_context);
@@ -198,12 +200,14 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
 }
 
 
+PUBLIC
 void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state )
 {
    vbo_exec_invalidate_state(ctx, new_state);
 }
 
 
+PUBLIC
 void _vbo_DestroyContext( struct gl_context *ctx )
 {
    struct vbo_context *vbo = vbo_context(ctx);
@@ -229,6 +233,7 @@ void _vbo_DestroyContext( struct gl_context *ctx )
 }
 
 
+PUBLIC
 void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func)
 {
    struct vbo_context *vbo = vbo_context(ctx);
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 600398c..419511f 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -30,6 +30,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
  *   Keith Whitwell <keith at tungstengraphics.com>
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/bufferobj.h"
 #include "main/context.h"
@@ -976,6 +977,7 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
  * This replaces the malloced buffer which was created in
  * vb_exec_vtx_init() below.
  */
+PUBLIC
 void vbo_use_buffer_objects(struct gl_context *ctx)
 {
    struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
@@ -1010,6 +1012,7 @@ void vbo_use_buffer_objects(struct gl_context *ctx)
  * Otherwise, if a simple command like glColor3f() is called and we flush,
  * the current VBO may be left mapped.
  */
+PUBLIC
 void
 vbo_always_unmap_buffers(struct gl_context *ctx)
 {
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 1670409..cee47f4 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -26,6 +26,7 @@
  * 
  **************************************************************************/
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/state.h"
@@ -184,6 +185,7 @@ vbo_get_minmax_index(struct gl_context *ctx,
 /**
  * Compute min and max elements for nr_prims
  */
+PUBLIC
 void
 vbo_get_minmax_indices(struct gl_context *ctx,
                        const struct _mesa_prim *prims,
@@ -1608,6 +1610,7 @@ vbo_initialize_exec_dispatch(const struct gl_context *ctx,
  */
 
 
+PUBLIC
 void GLAPIENTRY
 _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count)
 {
diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c
index 418f882..8361427 100644
--- a/src/mesa/vbo/vbo_primitive_restart.c
+++ b/src/mesa/vbo/vbo_primitive_restart.c
@@ -28,6 +28,7 @@
  *
  */
 
+#include "main/compiler.h"
 #include "main/imports.h"
 #include "main/bufferobj.h"
 #include "main/macros.h"
@@ -159,6 +160,7 @@ find_sub_primitives(const void *elements, unsigned element_size,
  * This function breaks up calls into the driver so primitive restart
  * support is not required in the driver.
  */
+PUBLIC
 void
 vbo_sw_primitive_restart(struct gl_context *ctx,
                          const struct _mesa_prim *prims,
diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c
index e825872..667e1f5 100644
--- a/src/mesa/vbo/vbo_rebase.c
+++ b/src/mesa/vbo/vbo_rebase.c
@@ -46,6 +46,7 @@
  * of zero.
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/mtypes.h"
@@ -73,6 +74,7 @@ REBASE(GLuint)
 REBASE(GLushort)
 REBASE(GLubyte)
 
+PUBLIC
 GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] )
 {
    GLuint i;
@@ -115,6 +117,7 @@ GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] )
  *    - can't save time by trying to upload half a vbo - typically it is
  *      all or nothing.
  */
+PUBLIC
 void vbo_rebase_prims( struct gl_context *ctx,
 		       const struct gl_client_array *arrays[],
 		       const struct _mesa_prim *prim,
diff --git a/src/mesa/vbo/vbo_split.c b/src/mesa/vbo/vbo_split.c
index 7cc6fbb..1bde60f 100644
--- a/src/mesa/vbo/vbo_split.c
+++ b/src/mesa/vbo/vbo_split.c
@@ -47,6 +47,7 @@
  * limitations on drivers which want to use it as a fallback path.
  */
 
+#include "main/compiler.h"
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/mtypes.h"
@@ -98,6 +99,7 @@ GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr)
 
 
 
+PUBLIC
 void vbo_split_prims( struct gl_context *ctx,
 		      const struct gl_client_array *arrays[],
 		      const struct _mesa_prim *prim,
diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c
index 3c1adc9..cc80f87 100644
--- a/src/mesa/x86/common_x86.c
+++ b/src/mesa/x86/common_x86.c
@@ -48,11 +48,13 @@
 #include <machine/cpu.h>
 #endif
 
+#include "main/compiler.h"
 #include "main/imports.h"
 #include "common_x86_asm.h"
 
 
 /** Bitmask of X86_FEATURE_x bits */
+PUBLIC
 int _mesa_x86_cpu_features = 0x0;
 
 static int detection_debug = GL_FALSE;
@@ -202,6 +204,7 @@ void _mesa_check_os_sse_support( void )
  * Initialize the _mesa_x86_cpu_features bitfield.
  * This is a no-op if called more than once.
  */
+PUBLIC
 void
 _mesa_get_x86_features(void)
 {
diff --git a/src/mesa/x86/read_rgba_span_x86.S b/src/mesa/x86/read_rgba_span_x86.S
index 3be4515..e0f6238 100644
--- a/src/mesa/x86/read_rgba_span_x86.S
+++ b/src/mesa/x86/read_rgba_span_x86.S
@@ -77,9 +77,6 @@
  */
 
 .globl _generic_read_RGBA_span_BGRA8888_REV_MMX
-#ifndef USE_DRICORE
-.hidden _generic_read_RGBA_span_BGRA8888_REV_MMX
-#endif
 	.type	_generic_read_RGBA_span_BGRA8888_REV_MMX, @function
 _generic_read_RGBA_span_BGRA8888_REV_MMX:
 	pushl	%ebx
@@ -174,9 +171,6 @@ _generic_read_RGBA_span_BGRA8888_REV_MMX:
  */
 
 .globl _generic_read_RGBA_span_BGRA8888_REV_SSE
-#ifndef USE_DRICORE
-.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE
-#endif
 	.type	_generic_read_RGBA_span_BGRA8888_REV_SSE, @function
 _generic_read_RGBA_span_BGRA8888_REV_SSE:
 	pushl	%esi
@@ -339,9 +333,6 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE:
 
 	.text
 .globl _generic_read_RGBA_span_BGRA8888_REV_SSE2
-#ifndef USE_DRICORE
-.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE2
-#endif
 	.type	_generic_read_RGBA_span_BGRA8888_REV_SSE2, @function
 _generic_read_RGBA_span_BGRA8888_REV_SSE2:
 	pushl	%esi
@@ -500,9 +491,6 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE2:
 
 	.text
 	.globl	_generic_read_RGBA_span_RGB565_MMX
-#ifndef USE_DRICORE
-        .hidden _generic_read_RGBA_span_RGB565_MMX
-#endif
 	.type	_generic_read_RGBA_span_RGB565_MMX, @function
 
 _generic_read_RGBA_span_RGB565_MMX:
-- 
1.8.1.4



More information about the mesa-dev mailing list