[Mesa-dev] [PATCH 07/21] gallium/auxiliary: Build libgallium shared.

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


---
 configure.ac                                       | 139 +++++++++++----------
 src/gallium/auxiliary/Makefile.am                  |  18 ++-
 src/gallium/auxiliary/cso_cache/cso_context.c      |  76 ++++++++---
 src/gallium/auxiliary/cso_cache/cso_hash.c         |  13 ++
 src/gallium/auxiliary/draw/draw_context.c          |  41 ++++--
 src/gallium/auxiliary/draw/draw_fs.c               |   6 +-
 src/gallium/auxiliary/draw/draw_gs.c               |   5 +
 src/gallium/auxiliary/draw/draw_pipe_aaline.c      |   2 +
 src/gallium/auxiliary/draw/draw_pipe_aapoint.c     |   2 +
 src/gallium/auxiliary/draw/draw_pipe_pstipple.c    |   2 +
 src/gallium/auxiliary/draw/draw_pipe_vbuf.c        |   3 +
 src/gallium/auxiliary/draw/draw_pt.c               |   2 +
 src/gallium/auxiliary/draw/draw_vertex.c           |   2 +
 src/gallium/auxiliary/draw/draw_vs.c               |   9 +-
 src/gallium/auxiliary/gallivm/lp_bld_arit.c        |  14 ++-
 src/gallium/auxiliary/gallivm/lp_bld_bitarit.c     |   4 +
 src/gallium/auxiliary/gallivm/lp_bld_const.c       |  11 +-
 src/gallium/auxiliary/gallivm/lp_bld_conv.c        |   5 +
 src/gallium/auxiliary/gallivm/lp_bld_debug.cpp     |   3 +-
 src/gallium/auxiliary/gallivm/lp_bld_flow.c        |  12 +-
 .../auxiliary/gallivm/lp_bld_format_float.c        |   4 +
 src/gallium/auxiliary/gallivm/lp_bld_format_soa.c  |   2 +
 src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c |   3 +
 src/gallium/auxiliary/gallivm/lp_bld_gather.c      |   2 +
 src/gallium/auxiliary/gallivm/lp_bld_init.c        |  12 +-
 src/gallium/auxiliary/gallivm/lp_bld_intr.c        |   7 +-
 src/gallium/auxiliary/gallivm/lp_bld_logic.c       |   7 ++
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp      |   3 +
 src/gallium/auxiliary/gallivm/lp_bld_pack.c        |   7 ++
 src/gallium/auxiliary/gallivm/lp_bld_quad.c        |   2 +
 src/gallium/auxiliary/gallivm/lp_bld_sample.c      |   3 +
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c  |   4 +
 src/gallium/auxiliary/gallivm/lp_bld_struct.c      |   4 +
 src/gallium/auxiliary/gallivm/lp_bld_swizzle.c     |   8 ++
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.c        |  11 +-
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c |   3 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c   |   2 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c    |   6 +-
 src/gallium/auxiliary/gallivm/lp_bld_type.c        |  13 +-
 src/gallium/auxiliary/hud/hud_context.c            |   5 +
 src/gallium/auxiliary/indices/u_indices.c          |   4 +-
 src/gallium/auxiliary/indices/u_unfilled_indices.c |   4 +-
 src/gallium/auxiliary/os/os_process.c              |   3 +-
 src/gallium/auxiliary/os/os_time.c                 |   2 +
 .../auxiliary/pipebuffer/pb_buffer_fenced.c        |   2 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c |   2 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c |   4 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c    |   3 +-
 src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c  |   2 +-
 src/gallium/auxiliary/pipebuffer/pb_validate.c     |  10 +-
 src/gallium/auxiliary/postprocess/pp_celshade.c    |   3 +
 src/gallium/auxiliary/postprocess/pp_colors.c      |   8 +-
 src/gallium/auxiliary/postprocess/pp_init.c        |   3 +
 src/gallium/auxiliary/postprocess/pp_mlaa.c        |   5 +
 src/gallium/auxiliary/postprocess/pp_run.c         |   3 +
 src/gallium/auxiliary/rbug/rbug_connection.c       |   5 +
 src/gallium/auxiliary/rbug/rbug_context.c          |   4 +
 src/gallium/auxiliary/rbug/rbug_core.c             |   3 +
 src/gallium/auxiliary/rbug/rbug_shader.c           |   3 +
 src/gallium/auxiliary/rbug/rbug_texture.c          |   4 +
 src/gallium/auxiliary/tgsi/tgsi_build.c            |   4 +
 src/gallium/auxiliary/tgsi/tgsi_dump.c             |   3 +
 src/gallium/auxiliary/tgsi/tgsi_exec.c             |   8 +-
 src/gallium/auxiliary/tgsi/tgsi_info.c             |   6 +-
 src/gallium/auxiliary/tgsi/tgsi_parse.c            |   8 +-
 src/gallium/auxiliary/tgsi/tgsi_scan.c             |   2 +
 src/gallium/auxiliary/tgsi/tgsi_strings.c          |   4 +-
 src/gallium/auxiliary/tgsi/tgsi_text.c             |   2 +
 src/gallium/auxiliary/tgsi/tgsi_transform.c        |   3 +
 src/gallium/auxiliary/tgsi/tgsi_ureg.c             |  59 ++++++---
 src/gallium/auxiliary/tgsi/tgsi_util.c             |   6 +-
 src/gallium/auxiliary/translate/translate.c        |   2 +
 src/gallium/auxiliary/util/u_bitmask.c             |   8 +-
 src/gallium/auxiliary/util/u_blit.c                |   4 +
 src/gallium/auxiliary/util/u_blitter.c             |  22 ++++
 src/gallium/auxiliary/util/u_cpu_detect.c          |   3 +
 src/gallium/auxiliary/util/u_debug.c               |  10 +-
 src/gallium/auxiliary/util/u_debug_describe.c      |   6 +
 src/gallium/auxiliary/util/u_debug_refcnt.c        |   3 +
 src/gallium/auxiliary/util/u_debug_stack.c         |   4 +-
 src/gallium/auxiliary/util/u_dl.c                  |   4 +-
 src/gallium/auxiliary/util/u_draw_quad.c           |   3 +
 src/gallium/auxiliary/util/u_dump_defines.c        |   3 +
 src/gallium/auxiliary/util/u_dump_state.c          |   2 +-
 src/gallium/auxiliary/util/u_format.c              |  26 +++-
 src/gallium/auxiliary/util/u_format.h              |   2 +-
 src/gallium/auxiliary/util/u_format_etc.c          |   1 +
 src/gallium/auxiliary/util/u_format_s3tc.c         |   4 +-
 src/gallium/auxiliary/util/u_format_srgb.py        |   2 +
 src/gallium/auxiliary/util/u_framebuffer.c         |   5 +-
 src/gallium/auxiliary/util/u_gen_mipmap.c          |   4 +
 src/gallium/auxiliary/util/u_handle_table.c        |  12 +-
 src/gallium/auxiliary/util/u_hash.c                |   2 +
 src/gallium/auxiliary/util/u_hash_table.c          |  12 +-
 src/gallium/auxiliary/util/u_helpers.c             |   3 +
 src/gallium/auxiliary/util/u_index_modify.c        |   4 +
 src/gallium/auxiliary/util/u_math.c                |   6 +
 src/gallium/auxiliary/util/u_network.c             |   6 +
 src/gallium/auxiliary/util/u_pstipple.c            |   5 +
 src/gallium/auxiliary/util/u_resource.c            |   2 +
 src/gallium/auxiliary/util/u_ringbuffer.c          |   6 +-
 src/gallium/auxiliary/util/u_sampler.c             |   2 +
 src/gallium/auxiliary/util/u_simple_shaders.c      |   5 +
 src/gallium/auxiliary/util/u_slab.c                |   4 +
 src/gallium/auxiliary/util/u_suballoc.c            |   4 +
 src/gallium/auxiliary/util/u_surface.c             |  12 +-
 src/gallium/auxiliary/util/u_tile.c                |  18 ++-
 src/gallium/auxiliary/util/u_transfer.c            |  12 +-
 src/gallium/auxiliary/util/u_upload_mgr.c          |  10 +-
 src/gallium/auxiliary/vl/vl_compositor.c           |  16 +++
 src/gallium/auxiliary/vl/vl_csc.c                  |   3 +
 src/gallium/auxiliary/vl/vl_decoder.c              |   4 +
 src/gallium/auxiliary/vl/vl_matrix_filter.c        |   4 +
 src/gallium/auxiliary/vl/vl_median_filter.c        |   4 +
 src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c     |   3 +
 src/gallium/auxiliary/vl/vl_mpeg12_decoder.c       |   3 +
 src/gallium/auxiliary/vl/vl_video_buffer.c         |   9 ++
 src/gallium/auxiliary/vl/vl_zscan.c                |   3 +
 src/gallium/drivers/llvmpipe/Makefile.am           |   3 +-
 src/gallium/drivers/r600/r600_pipe.h               |   3 +
 src/gallium/targets/dri-freedreno/Makefile.am      |   2 -
 src/gallium/targets/dri-i915/Makefile.am           |   6 +-
 src/gallium/targets/dri-ilo/Makefile.am            |   3 +-
 src/gallium/targets/dri-nouveau/Makefile.am        |   8 +-
 src/gallium/targets/dri-r300/Makefile.am           |   7 +-
 src/gallium/targets/dri-r600/Makefile.am           |   9 +-
 src/gallium/targets/dri-radeonsi/Makefile.am       |   4 +-
 src/gallium/targets/dri-swrast/Makefile.am         |   5 +-
 src/gallium/targets/dri-vmwgfx/Makefile.am         |   4 +-
 src/gallium/targets/egl-static/Makefile.am         |  22 +---
 src/gallium/targets/gbm/Makefile.am                |  16 +--
 src/gallium/targets/libgl-xlib/Makefile.am         |  15 +--
 src/gallium/targets/opencl/Makefile.am             |  12 +-
 src/gallium/targets/osmesa/Makefile.am             |   5 -
 src/gallium/targets/pipe-loader/Makefile.am        |  38 +-----
 src/gallium/targets/vdpau-nouveau/Makefile.am      |   7 +-
 src/gallium/targets/vdpau-r300/Makefile.am         |   7 +-
 src/gallium/targets/vdpau-r600/Makefile.am         |  16 +--
 src/gallium/targets/vdpau-radeonsi/Makefile.am     |   8 +-
 src/gallium/targets/vdpau-softpipe/Makefile.am     |  14 +--
 src/gallium/targets/xa-vmwgfx/Makefile.am          |   7 +-
 src/gallium/targets/xorg-i915/Makefile.am          |  14 +--
 src/gallium/targets/xorg-nouveau/Makefile.am       |   8 +-
 src/gallium/targets/xorg-r600/Makefile.am          |  16 +--
 src/gallium/targets/xorg-radeonsi/Makefile.am      |   9 +-
 src/gallium/targets/xvmc-nouveau/Makefile.am       |   8 +-
 src/gallium/targets/xvmc-r300/Makefile.am          |   6 +-
 src/gallium/targets/xvmc-r600/Makefile.am          |  16 +--
 src/gallium/targets/xvmc-softpipe/Makefile.am      |  12 +-
 src/gallium/tests/trivial/Makefile.am              |   2 +-
 src/gallium/tests/unit/Makefile.am                 |   2 +-
 151 files changed, 823 insertions(+), 442 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3407c3d..987d1b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -585,9 +585,7 @@ AC_ARG_ENABLE([vdpau],
    [enable_vdpau=auto])
 AC_ARG_ENABLE([opencl],
    [AS_HELP_STRING([--enable-opencl],
-         [enable OpenCL library NOTE: Enabling this option will also enable
-          --with-llvm-shared-libs
-          @<:@default=no@:>@])],
+         [enable OpenCL library @<:@default=no@:>@])],
    [],
    [enable_opencl=no])
 AC_ARG_ENABLE([xlib-glx],
@@ -1356,7 +1354,6 @@ AC_SUBST([LLVM_CFLAGS])
 AC_SUBST([LLVM_CPPFLAGS])
 AC_SUBST([LLVM_CXXFLAGS])
 AC_SUBST([LLVM_LIBDIR])
-AC_SUBST([LLVM_LIBS])
 AC_SUBST([LLVM_LDFLAGS])
 AC_SUBST([LLVM_INCLUDEDIR])
 AC_SUBST([LLVM_VERSION])
@@ -1498,17 +1495,6 @@ AC_ARG_ENABLE([gallium-llvm],
     [enable_gallium_llvm="$enableval"],
     [enable_gallium_llvm=auto])
 
-AC_ARG_WITH([llvm-shared-libs],
-    [AS_HELP_STRING([--with-llvm-shared-libs],
-        [link with LLVM shared libraries @<:@default=disabled@:>@])],
-    [],
-    [with_llvm_shared_libs=no])
-AS_IF([test x$enable_opencl = xyes],
-    [
-        AC_MSG_WARN([OpenCL required, forcing LLVM shared libraries])
-        with_llvm_shared_libs=yes
-    ])
-
 AC_ARG_WITH([llvm-prefix],
     [AS_HELP_STRING([--with-llvm-prefix],
         [Prefix for LLVM installations in non-standard locations])],
@@ -1567,20 +1553,27 @@ if test "x$enable_gallium_llvm" = xyes; then
             LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
         fi
 
-        LLVM_COMPONENTS="engine bitwriter"
-        if $LLVM_CONFIG --components | grep -qw 'mcjit'; then
-            LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit"
-        fi
+	LLVM_GALLIUM_COMPONENTS="engine bitwriter"
+	case "$target_cpu" in
+	    ppc64)
+		LLVM_GALLIUM_COMPONENTS="${LLVM_GALLIUM_COMPONENTS} mcjit"
+		;;
+	    *)
+		if test $LLVM_VERSION_INT -eq 302; then
+		    LLVM_GALLIUM_COMPONENTS="${LLVM_GALLIUM_COMPONENTS} mcjit"
+		fi
+		;;
+        esac
 
         if test "x$enable_opencl" = xyes; then
-            LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
+	    LLVM_OPENCL_COMPONENTS="ipo linker instrumentation"
             # LLVM 3.3 >= 177971 requires IRReader
             if $LLVM_CONFIG --components | grep -qw 'irreader'; then
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader"
+                LLVM_OPENCL_COMPONENTS="${LLVM_OPENCL_COMPONENTS} irreader"
             fi
             # LLVM 3.4 requires Option
             if $LLVM_CONFIG --components | grep -qw 'option'; then
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} option"
+                LLVM_OPENCL_COMPONENTS="${LLVM_OPENCL_COMPONENTS} option"
             fi
         fi
         DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT"
@@ -1699,7 +1692,7 @@ radeon_llvm_check() {
                       sources with the --enable-experimental-targets=R600
                       configure flag])
     fi
-    LLVM_COMPONENTS="${LLVM_COMPONENTS} r600 bitreader ipo"
+    LLVM_RADEON_COMPONENTS="r600 bitreader ipo"
     NEED_RADEON_LLVM=yes
     AC_CHECK_LIB([elf], [elf_memory], [ELF_LIB=-lelf],
                                  [AC_MSG_ERROR([radeonsi and r600g require libelf when using LLVM])])
@@ -1754,13 +1747,14 @@ if test "x$with_gallium_drivers" != x; then
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
             if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
                 radeon_llvm_check
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
-            fi
-            if test "x$enable_r600_llvm" = xyes; then
-                USE_R600_LLVM_COMPILER=yes;
-            fi
-            if test "x$enable_opencl" = xyes; then
-                LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
+                if test "x$enable_r600_llvm" = xyes; then
+                    USE_R600_LLVM_COMPILER=yes;
+                    LLVM_R600_COMPONENTS="ipo"
+                fi
+                if test "x$enable_opencl" = xyes; then
+                    LLVM_OPENCL_COMPONENTS="${LLVM_OPENCL_COMPONENTS} bitreader asmparser"
+                    LLVM_R600_COMPONENTS="asmparser bitreader ipo"
+                fi
             fi
             gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600"
             ;;
@@ -1816,48 +1810,63 @@ if test "x$with_gallium_drivers" != x; then
     done
 fi
 
-dnl Set LLVM_LIBS - This is done after the driver configuration so
-dnl that drivers can add additonal components to LLVM_COMPONENTS.
-dnl Previously, gallium drivers were updating LLVM_LIBS directly
-dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
-dnl this was causing the same libraries to be appear multiple times
-dnl in LLVM_LIBS.
+function strip_llvm_libs() {
+    _libs=`$2`
+    for i in $1; do
+        _libs=$(echo $_libs | sed "s/$i\>//g")
+    done
+    echo $_libs
+}
 
 if test "x$MESA_LLVM" != x0; then
-
-    LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
-
-    if test "x$with_llvm_shared_libs" = xyes; then
-        dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
         LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
-        AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.so"], [llvm_have_one_so=yes])
-
-        if test "x$llvm_have_one_so" = xyes; then
-            dnl LLVM was built using auto*, so there is only one shared object.
-            LLVM_LIBS="-l$LLVM_SO_NAME"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: trying to link -l$LLVM_SO_NAME" >&5
+$as_echo_n "trying to link -l$LLVM_SO_NAME ... " >&6; }
+if ${ac_cv_lib__llvm_one_shared_lib+:} false; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$LLVM_SO_NAME"
+echo "int main () { return; }" >conftest.$ac_ext
+if ac_fn_c_try_link "$LINENO"; then
+  ac_cv_lib__llvm_one_shared_lib=yes
+else
+  ac_cv_lib__llvm_one_shared_lib=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib__llvm_one_shared_lib" >&5
+$as_echo "$ac_cv_lib__llvm_one_shared_lib" >&6; }
+if test "x$ac_cv_lib__llvm_one_shared_lib" = xyes; then
+    if test -n "$LLVM_GALLIUM_COMPONENTS"; then
+        LLVM_GALLIUM_LIBS="-l$LLVM_SO_NAME"
+    fi
+else
+    if test -n "$LLVM_GALLIUM_COMPONENTS"; then
+        LLVM_GALLIUM_LIBS=`$LLVM_CONFIG --libs $LLVM_GALLIUM_COMPONENTS`
+    fi
+    if test -n "$LLVM_OPENCL_COMPONENTS"; then
+        LLVM_OPENCL_LIBS=`strip_llvm_libs "$LLVM_GALLIUM_LIBS" "$LLVM_CONFIG --libs $LLVM_OPENCL_COMPONENTS"`
+    fi
+    if test -n "$LLVM_RADEON_COMPONENTS"; then
+        LLVM_RADEON_LIBS=`strip_llvm_libs "$LLVM_GALLIUM_LIBS" "$LLVM_CONFIG --libs $LLVM_RADEON_COMPONENTS"`
+    fi
+    if test -n "$LLVM_R600_COMPONENTS"; then
+        if test "x$NEED_RADEON_LLVM" = xyes; then
+            LLVM_R600_LIBS=`strip_llvm_libs "$LLVM_GALLIUM_LIBS" "$LLVM_CONFIG --libs $LLVM_R600_COMPONENTS $LLVM_RADEON_COMPONENTS"`
         else
-            dnl If LLVM was built with CMake, there will be one shared object per
-            dnl component.
-            AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.so"],
-                    [AC_MSG_ERROR([Could not find llvm shared libraries:
-	Please make sure you have built llvm with the --enable-shared option
-	and that your llvm libraries are installed in $LLVM_LIBDIR
-	If you have installed your llvm libraries to a different directory you
-	can use the --with-llvm-prefix= configure flag to specify this directory.
-	NOTE: Mesa is attempting to use llvm shared libraries because you have
-	passed one of the following options to configure:
-		--with-llvm-shared-libs
-		--enable-opencl
-	If you do not want to build with llvm shared libraries and instead want to
-	use llvm static libraries then remove these options from your configure
-	invocation and reconfigure.])])
-
-           dnl We don't need to update LLVM_LIBS in this case because the LLVM
-           dnl install uses a shared object for each compoenent and we have
-           dnl already added all of these objects to LLVM_LIBS.
+            LLVM_R600_LIBS=`strip_llvm_libs "$LLVM_GALLIUM_LIBS" "$LLVM_CONFIG --libs $LLVM_R600_COMPONENTS"`
         fi
     fi
 fi
+fi
+
+AC_SUBST([LLVM_GALLIUM_LIBS])
+AC_SUBST([LLVM_OPENCL_LIBS])
+AC_SUBST([LLVM_RADEON_LIBS])
+AC_SUBST([LLVM_R600_LIBS])
 
 AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
index 670e124..acf1440 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -3,7 +3,11 @@ AUTOMAKE_OPTIONS = subdir-objects
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
-noinst_LTLIBRARIES = libgallium.la
+lib_LTLIBRARIES = libgallium at VERSION@.la
+
+libgallium at VERSION@_la_LDFLAGS = -Wl,--no-undefined -shared -avoid-version
+
+libgallium at VERSION@_la_LIBADD = $(DLOPEN_LIBS) $(CLOCK_LIB)
 
 AM_CFLAGS = \
 	-I$(top_srcdir)/src/gallium/auxiliary/util \
@@ -12,12 +16,11 @@ AM_CFLAGS = \
 
 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
 
-libgallium_la_SOURCES = \
+libgallium at VERSION@_la_SOURCES = \
 	$(C_SOURCES) \
 	$(GENERATED_SOURCES)
 
 if HAVE_MESA_LLVM
-
 AM_CFLAGS += \
 	$(LLVM_CFLAGS)
 
@@ -26,15 +29,18 @@ AM_CXXFLAGS += \
 	$(LLVM_CXXFLAGS)
 
 if LLVM_NEEDS_FNORTTI
-
 AM_CXXFLAGS += -fno-rtti
-
 endif
 
-libgallium_la_SOURCES += \
+libgallium at VERSION@_la_SOURCES += \
 	$(GALLIVM_SOURCES) \
 	$(GALLIVM_CPP_SOURCES)
 
+libgallium at VERSION@_la_LDFLAGS += \
+	$(LLVM_LDFLAGS)
+
+libgallium at VERSION@_la_LIBADD += \
+	$(LLVM_GALLIUM_LIBS)
 endif
 
 indices/u_indices_gen.c: $(srcdir)/indices/u_indices_gen.py
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 6805427..4d3f7f3 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -35,6 +35,7 @@
   * @author Keith Whitwell <keith at tungstengraphics.com>
   */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_state.h"
 #include "util/u_draw.h"
 #include "util/u_framebuffer.h"
@@ -255,6 +256,7 @@ static void cso_init_vbuf(struct cso_context *cso)
    }
 }
 
+PUBLIC
 struct cso_context *cso_create_context( struct pipe_context *pipe )
 {
    struct cso_context *ctx = CALLOC_STRUCT(cso_context);
@@ -297,6 +299,7 @@ out:
 /**
  * Prior to context destruction, this function unbinds all state objects.
  */
+PUBLIC
 void cso_release_all( struct cso_context *ctx )
 {
    unsigned i, shader;
@@ -354,6 +357,7 @@ void cso_release_all( struct cso_context *ctx )
  * Free the CSO context.  NOTE: the state tracker should have previously called
  * cso_release_all().
  */
+PUBLIC
 void cso_destroy_context( struct cso_context *ctx )
 {
    if (ctx) {
@@ -374,6 +378,7 @@ void cso_destroy_context( struct cso_context *ctx )
  * the data member of the cso to be the template itself.
  */
 
+PUBLIC
 enum pipe_error cso_set_blend(struct cso_context *ctx,
                               const struct pipe_blend_state *templ)
 {
@@ -418,12 +423,14 @@ enum pipe_error cso_set_blend(struct cso_context *ctx,
    return PIPE_OK;
 }
 
+PUBLIC
 void cso_save_blend(struct cso_context *ctx)
 {
    assert(!ctx->blend_saved);
    ctx->blend_saved = ctx->blend;
 }
 
+PUBLIC
 void cso_restore_blend(struct cso_context *ctx)
 {
    if (ctx->blend != ctx->blend_saved) {
@@ -433,8 +440,7 @@ void cso_restore_blend(struct cso_context *ctx)
    ctx->blend_saved = NULL;
 }
 
-
-
+PUBLIC
 enum pipe_error
 cso_set_depth_stencil_alpha(struct cso_context *ctx,
                             const struct pipe_depth_stencil_alpha_state *templ)
@@ -481,12 +487,14 @@ cso_set_depth_stencil_alpha(struct cso_context *ctx,
    return PIPE_OK;
 }
 
+PUBLIC
 void cso_save_depth_stencil_alpha(struct cso_context *ctx)
 {
    assert(!ctx->depth_stencil_saved);
    ctx->depth_stencil_saved = ctx->depth_stencil;
 }
 
+PUBLIC
 void cso_restore_depth_stencil_alpha(struct cso_context *ctx)
 {
    if (ctx->depth_stencil != ctx->depth_stencil_saved) {
@@ -497,8 +505,7 @@ void cso_restore_depth_stencil_alpha(struct cso_context *ctx)
    ctx->depth_stencil_saved = NULL;
 }
 
-
-
+PUBLIC
 enum pipe_error cso_set_rasterizer(struct cso_context *ctx,
                                    const struct pipe_rasterizer_state *templ)
 {
@@ -540,12 +547,14 @@ enum pipe_error cso_set_rasterizer(struct cso_context *ctx,
    return PIPE_OK;
 }
 
+PUBLIC
 void cso_save_rasterizer(struct cso_context *ctx)
 {
    assert(!ctx->rasterizer_saved);
    ctx->rasterizer_saved = ctx->rasterizer;
 }
 
+PUBLIC
 void cso_restore_rasterizer(struct cso_context *ctx)
 {
    if (ctx->rasterizer != ctx->rasterizer_saved) {
@@ -555,7 +564,7 @@ void cso_restore_rasterizer(struct cso_context *ctx)
    ctx->rasterizer_saved = NULL;
 }
 
-
+PUBLIC
 void cso_set_fragment_shader_handle(struct cso_context *ctx, void *handle )
 {
    if (ctx->fragment_shader != handle) {
@@ -564,6 +573,7 @@ void cso_set_fragment_shader_handle(struct cso_context *ctx, void *handle )
    }
 }
 
+PUBLIC
 void cso_delete_fragment_shader(struct cso_context *ctx, void *handle )
 {
    if (handle == ctx->fragment_shader) {
@@ -574,12 +584,14 @@ void cso_delete_fragment_shader(struct cso_context *ctx, void *handle )
    ctx->pipe->delete_fs_state(ctx->pipe, handle);
 }
 
+PUBLIC
 void cso_save_fragment_shader(struct cso_context *ctx)
 {
    assert(!ctx->fragment_shader_saved);
    ctx->fragment_shader_saved = ctx->fragment_shader;
 }
 
+PUBLIC
 void cso_restore_fragment_shader(struct cso_context *ctx)
 {
    if (ctx->fragment_shader_saved != ctx->fragment_shader) {
@@ -589,7 +601,7 @@ void cso_restore_fragment_shader(struct cso_context *ctx)
    ctx->fragment_shader_saved = NULL;
 }
 
-
+PUBLIC
 void cso_set_vertex_shader_handle(struct cso_context *ctx, void *handle)
 {
    if (ctx->vertex_shader != handle) {
@@ -598,6 +610,7 @@ void cso_set_vertex_shader_handle(struct cso_context *ctx, void *handle)
    }
 }
 
+PUBLIC
 void cso_delete_vertex_shader(struct cso_context *ctx, void *handle )
 {
    if (handle == ctx->vertex_shader) {
@@ -608,12 +621,14 @@ void cso_delete_vertex_shader(struct cso_context *ctx, void *handle )
    ctx->pipe->delete_vs_state(ctx->pipe, handle);
 }
 
+PUBLIC
 void cso_save_vertex_shader(struct cso_context *ctx)
 {
    assert(!ctx->vertex_shader_saved);
    ctx->vertex_shader_saved = ctx->vertex_shader;
 }
 
+PUBLIC
 void cso_restore_vertex_shader(struct cso_context *ctx)
 {
    if (ctx->vertex_shader_saved != ctx->vertex_shader) {
@@ -623,7 +638,7 @@ void cso_restore_vertex_shader(struct cso_context *ctx)
    ctx->vertex_shader_saved = NULL;
 }
 
-
+PUBLIC
 void cso_set_framebuffer(struct cso_context *ctx,
                          const struct pipe_framebuffer_state *fb)
 {
@@ -633,11 +648,13 @@ void cso_set_framebuffer(struct cso_context *ctx,
    }
 }
 
+PUBLIC
 void cso_save_framebuffer(struct cso_context *ctx)
 {
    util_copy_framebuffer_state(&ctx->fb_saved, &ctx->fb);
 }
 
+PUBLIC
 void cso_restore_framebuffer(struct cso_context *ctx)
 {
    if (memcmp(&ctx->fb, &ctx->fb_saved, sizeof(ctx->fb))) {
@@ -647,7 +664,7 @@ void cso_restore_framebuffer(struct cso_context *ctx)
    }
 }
 
-
+PUBLIC
 void cso_set_viewport(struct cso_context *ctx,
                       const struct pipe_viewport_state *vp)
 {
@@ -657,12 +674,14 @@ void cso_set_viewport(struct cso_context *ctx,
    }
 }
 
+PUBLIC
 void cso_save_viewport(struct cso_context *ctx)
 {
    ctx->vp_saved = ctx->vp;
 }
 
 
+PUBLIC
 void cso_restore_viewport(struct cso_context *ctx)
 {
    if (memcmp(&ctx->vp, &ctx->vp_saved, sizeof(ctx->vp))) {
@@ -672,6 +691,7 @@ void cso_restore_viewport(struct cso_context *ctx)
 }
 
 
+PUBLIC
 void cso_set_blend_color(struct cso_context *ctx,
                          const struct pipe_blend_color *bc)
 {
@@ -681,6 +701,7 @@ void cso_set_blend_color(struct cso_context *ctx,
    }
 }
 
+PUBLIC
 void cso_set_sample_mask(struct cso_context *ctx, unsigned sample_mask)
 {
    if (ctx->sample_mask != sample_mask) {
@@ -689,16 +710,19 @@ void cso_set_sample_mask(struct cso_context *ctx, unsigned sample_mask)
    }
 }
 
+PUBLIC
 void cso_save_sample_mask(struct cso_context *ctx)
 {
    ctx->sample_mask_saved = ctx->sample_mask;
 }
 
+PUBLIC
 void cso_restore_sample_mask(struct cso_context *ctx)
 {
    cso_set_sample_mask(ctx, ctx->sample_mask_saved);
 }
 
+PUBLIC
 void cso_set_stencil_ref(struct cso_context *ctx,
                          const struct pipe_stencil_ref *sr)
 {
@@ -708,12 +732,14 @@ void cso_set_stencil_ref(struct cso_context *ctx,
    }
 }
 
+PUBLIC
 void cso_save_stencil_ref(struct cso_context *ctx)
 {
    ctx->stencil_ref_saved = ctx->stencil_ref;
 }
 
 
+PUBLIC
 void cso_restore_stencil_ref(struct cso_context *ctx)
 {
    if (memcmp(&ctx->stencil_ref, &ctx->stencil_ref_saved,
@@ -723,6 +749,7 @@ void cso_restore_stencil_ref(struct cso_context *ctx)
    }
 }
 
+PUBLIC
 void cso_set_render_condition(struct cso_context *ctx,
                               struct pipe_query *query,
                               boolean condition, uint mode)
@@ -753,6 +780,7 @@ void cso_restore_render_condition(struct cso_context *ctx)
                             ctx->render_condition_mode_saved);
 }
 
+PUBLIC
 void cso_set_geometry_shader_handle(struct cso_context *ctx, void *handle)
 {
    assert(ctx->has_geometry_shader || !handle);
@@ -763,6 +791,7 @@ void cso_set_geometry_shader_handle(struct cso_context *ctx, void *handle)
    }
 }
 
+PUBLIC
 void cso_delete_geometry_shader(struct cso_context *ctx, void *handle)
 {
     if (handle == ctx->geometry_shader) {
@@ -773,6 +802,7 @@ void cso_delete_geometry_shader(struct cso_context *ctx, void *handle)
    ctx->pipe->delete_gs_state(ctx->pipe, handle);
 }
 
+PUBLIC
 void cso_save_geometry_shader(struct cso_context *ctx)
 {
    if (!ctx->has_geometry_shader) {
@@ -783,6 +813,7 @@ void cso_save_geometry_shader(struct cso_context *ctx)
    ctx->geometry_shader_saved = ctx->geometry_shader;
 }
 
+PUBLIC
 void cso_restore_geometry_shader(struct cso_context *ctx)
 {
    if (!ctx->has_geometry_shader) {
@@ -812,6 +843,7 @@ clip_state_cmp(const struct pipe_clip_state *a,
    return memcmp(a->ucp, b->ucp, sizeof(a->ucp));
 }
 
+PUBLIC
 void
 cso_set_clip(struct cso_context *ctx,
              const struct pipe_clip_state *clip)
@@ -837,6 +869,7 @@ cso_restore_clip(struct cso_context *ctx)
    }
 }
 
+PUBLIC
 enum pipe_error
 cso_set_vertex_elements(struct cso_context *ctx,
                         unsigned count,
@@ -897,6 +930,7 @@ cso_set_vertex_elements(struct cso_context *ctx,
    return PIPE_OK;
 }
 
+PUBLIC
 void cso_save_vertex_elements(struct cso_context *ctx)
 {
    struct u_vbuf *vbuf = ctx->vbuf;
@@ -910,6 +944,7 @@ void cso_save_vertex_elements(struct cso_context *ctx)
    ctx->velements_saved = ctx->velements;
 }
 
+PUBLIC
 void cso_restore_vertex_elements(struct cso_context *ctx)
 {
    struct u_vbuf *vbuf = ctx->vbuf;
@@ -928,6 +963,7 @@ void cso_restore_vertex_elements(struct cso_context *ctx)
 
 /* vertex buffers */
 
+PUBLIC
 void cso_set_vertex_buffers(struct cso_context *ctx,
                             unsigned start_slot, unsigned count,
                             const struct pipe_vertex_buffer *buffers)
@@ -962,6 +998,7 @@ void cso_set_vertex_buffers(struct cso_context *ctx,
    ctx->pipe->set_vertex_buffers(ctx->pipe, start_slot, count, buffers);
 }
 
+PUBLIC
 void cso_save_aux_vertex_buffer_slot(struct cso_context *ctx)
 {
    struct u_vbuf *vbuf = ctx->vbuf;
@@ -977,6 +1014,7 @@ void cso_save_aux_vertex_buffer_slot(struct cso_context *ctx)
           sizeof(struct pipe_vertex_buffer));
 }
 
+PUBLIC
 void cso_restore_aux_vertex_buffer_slot(struct cso_context *ctx)
 {
    struct u_vbuf *vbuf = ctx->vbuf;
@@ -991,6 +1029,7 @@ void cso_restore_aux_vertex_buffer_slot(struct cso_context *ctx)
    pipe_resource_reference(&ctx->aux_vertex_buffer_saved.buffer, NULL);
 }
 
+PUBLIC
 unsigned cso_get_aux_vertex_buffer_slot(struct cso_context *ctx)
 {
    return ctx->aux_vertex_buffer_index;
@@ -1044,6 +1083,7 @@ single_sampler(struct cso_context *ctx,
    return PIPE_OK;
 }
 
+PUBLIC
 enum pipe_error
 cso_single_sampler(struct cso_context *ctx,
                    unsigned shader_stage,
@@ -1053,8 +1093,6 @@ cso_single_sampler(struct cso_context *ctx,
    return single_sampler(ctx, &ctx->samplers[shader_stage], idx, templ);
 }
 
-
-
 static void
 single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
 {
@@ -1101,6 +1139,7 @@ single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
    }
 }
 
+PUBLIC
 void
 cso_single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
 {
@@ -1113,6 +1152,7 @@ cso_single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
  * last one. Done to always try to set as many samplers
  * as possible.
  */
+PUBLIC
 enum pipe_error
 cso_set_samplers(struct cso_context *ctx,
                  unsigned shader_stage,
@@ -1143,6 +1183,7 @@ cso_set_samplers(struct cso_context *ctx,
    return error;
 }
 
+PUBLIC
 void
 cso_save_samplers(struct cso_context *ctx, unsigned shader_stage)
 {
@@ -1151,7 +1192,7 @@ cso_save_samplers(struct cso_context *ctx, unsigned shader_stage)
    memcpy(info->samplers_saved, info->samplers, sizeof(info->samplers));
 }
 
-
+PUBLIC
 void
 cso_restore_samplers(struct cso_context *ctx, unsigned shader_stage)
 {
@@ -1161,7 +1202,7 @@ cso_restore_samplers(struct cso_context *ctx, unsigned shader_stage)
    single_sampler_done(ctx, shader_stage);
 }
 
-
+PUBLIC
 void
 cso_set_sampler_views(struct cso_context *ctx,
                       unsigned shader_stage,
@@ -1198,7 +1239,7 @@ cso_set_sampler_views(struct cso_context *ctx,
    }
 }
 
-
+PUBLIC
 void
 cso_save_sampler_views(struct cso_context *ctx, unsigned shader_stage)
 {
@@ -1214,6 +1255,7 @@ cso_save_sampler_views(struct cso_context *ctx, unsigned shader_stage)
 }
 
 
+PUBLIC
 void
 cso_restore_sampler_views(struct cso_context *ctx, unsigned shader_stage)
 {
@@ -1249,7 +1291,7 @@ cso_restore_sampler_views(struct cso_context *ctx, unsigned shader_stage)
    info->nr_views_saved = 0;
 }
 
-
+PUBLIC
 void
 cso_set_stream_outputs(struct cso_context *ctx,
                        unsigned num_targets,
@@ -1283,6 +1325,7 @@ cso_set_stream_outputs(struct cso_context *ctx,
    ctx->nr_so_targets = num_targets;
 }
 
+PUBLIC
 void
 cso_save_stream_outputs(struct cso_context *ctx)
 {
@@ -1300,6 +1343,7 @@ cso_save_stream_outputs(struct cso_context *ctx)
    }
 }
 
+PUBLIC
 void
 cso_restore_stream_outputs(struct cso_context *ctx)
 {
@@ -1335,6 +1379,7 @@ cso_restore_stream_outputs(struct cso_context *ctx)
 
 /* constant buffers */
 
+PUBLIC
 void
 cso_set_constant_buffer(struct cso_context *cso, unsigned shader_stage,
                         unsigned index, struct pipe_constant_buffer *cb)
@@ -1386,6 +1431,7 @@ cso_restore_constant_buffer_slot0(struct cso_context *cso,
 
 /* drawing */
 
+PUBLIC
 void
 cso_set_index_buffer(struct cso_context *cso,
                      const struct pipe_index_buffer *ib)
@@ -1400,6 +1446,7 @@ cso_set_index_buffer(struct cso_context *cso,
    }
 }
 
+PUBLIC
 void
 cso_draw_vbo(struct cso_context *cso,
              const struct pipe_draw_info *info)
@@ -1414,6 +1461,7 @@ cso_draw_vbo(struct cso_context *cso,
    }
 }
 
+PUBLIC
 void
 cso_draw_arrays(struct cso_context *cso, uint mode, uint start, uint count)
 {
diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.c b/src/gallium/auxiliary/cso_cache/cso_hash.c
index 288cef7..a692310 100644
--- a/src/gallium/auxiliary/cso_cache/cso_hash.c
+++ b/src/gallium/auxiliary/cso_cache/cso_hash.c
@@ -30,6 +30,7 @@
   *   Zack Rusin <zack at tungstengraphics.com>
   */
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 
@@ -215,6 +216,7 @@ static struct cso_node **cso_hash_find_node(struct cso_hash *hash, unsigned akey
    return node;
 }
 
+PUBLIC
 struct cso_hash_iter cso_hash_insert(struct cso_hash *hash,
                                        unsigned key, void *data)
 {
@@ -235,6 +237,7 @@ struct cso_hash_iter cso_hash_insert(struct cso_hash *hash,
    }
 }
 
+PUBLIC
 struct cso_hash * cso_hash_create(void)
 {
    struct cso_hash *hash = MALLOC_STRUCT(cso_hash);
@@ -258,6 +261,7 @@ struct cso_hash * cso_hash_create(void)
    return hash;
 }
 
+PUBLIC
 void cso_hash_delete(struct cso_hash *hash)
 {
    struct cso_node *e_for_x = (struct cso_node *)(hash->data.d);
@@ -276,6 +280,7 @@ void cso_hash_delete(struct cso_hash *hash)
    FREE(hash);
 }
 
+PUBLIC
 struct cso_hash_iter cso_hash_find(struct cso_hash *hash,
                                      unsigned key)
 {
@@ -291,6 +296,7 @@ unsigned cso_hash_iter_key(struct cso_hash_iter iter)
    return iter.node->key;
 }
 
+PUBLIC
 void * cso_hash_iter_data(struct cso_hash_iter iter)
 {
    if (!iter.node || iter.hash->data.e == iter.node)
@@ -366,12 +372,14 @@ static struct cso_node *cso_hash_data_prev(struct cso_node *node)
    return a.e;
 }
 
+PUBLIC
 struct cso_hash_iter cso_hash_iter_next(struct cso_hash_iter iter)
 {
    struct cso_hash_iter next = {iter.hash, cso_hash_data_next(iter.node)};
    return next;
 }
 
+PUBLIC
 int cso_hash_iter_is_null(struct cso_hash_iter iter)
 {
    if (!iter.node || iter.node == iter.hash->data.e)
@@ -379,6 +387,7 @@ int cso_hash_iter_is_null(struct cso_hash_iter iter)
    return 0;
 }
 
+PUBLIC
 void * cso_hash_take(struct cso_hash *hash,
                       unsigned akey)
 {
@@ -402,17 +411,20 @@ struct cso_hash_iter cso_hash_iter_prev(struct cso_hash_iter iter)
    return prev;
 }
 
+PUBLIC
 struct cso_hash_iter cso_hash_first_node(struct cso_hash *hash)
 {
    struct cso_hash_iter iter = {hash, cso_data_first_node(hash->data.d)};
    return iter;
 }
 
+PUBLIC
 int cso_hash_size(struct cso_hash *hash)
 {
    return hash->data.d->size;
 }
 
+PUBLIC
 struct cso_hash_iter cso_hash_erase(struct cso_hash *hash, struct cso_hash_iter iter)
 {
    struct cso_hash_iter ret = iter;
@@ -432,6 +444,7 @@ struct cso_hash_iter cso_hash_erase(struct cso_hash *hash, struct cso_hash_iter
    return ret;
 }
 
+PUBLIC
 boolean cso_hash_contains(struct cso_hash *hash, unsigned key)
 {
    struct cso_node **node = cso_hash_find_node(hash, key);
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 641dd82..d4c060e 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -31,6 +31,7 @@
   */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
@@ -112,6 +113,7 @@ err_out:
 /**
  * Create new draw module context, with LLVM JIT.
  */
+PUBLIC
 struct draw_context *
 draw_create(struct pipe_context *pipe)
 {
@@ -122,6 +124,7 @@ draw_create(struct pipe_context *pipe)
 /**
  * Create a new draw context, without LLVM JIT.
  */
+PUBLIC
 struct draw_context *
 draw_create_no_llvm(struct pipe_context *pipe)
 {
@@ -180,7 +183,7 @@ void draw_new_instance(struct draw_context *draw)
    draw_geometry_shader_new_instance(draw->gs.geometry_shader);
 }
 
-
+PUBLIC
 void draw_destroy( struct draw_context *draw )
 {
    struct pipe_context *pipe;
@@ -225,7 +228,7 @@ void draw_destroy( struct draw_context *draw )
 }
 
 
-
+PUBLIC
 void draw_flush( struct draw_context *draw )
 {
    draw_do_flush( draw, DRAW_FLUSH_BACKEND );
@@ -239,6 +242,7 @@ void draw_flush( struct draw_context *draw )
  * values between vertex shading and rasterization.  It will vary
  * from one driver to another.
  */
+PUBLIC
 void draw_set_mrd(struct draw_context *draw, double mrd)
 {
    draw->mrd = mrd;
@@ -260,6 +264,7 @@ static void update_clip_flags( struct draw_context *draw )
  * Register new primitive rasterization/rendering state.
  * This causes the drawing pipeline to be rebuilt.
  */
+PUBLIC
 void draw_set_rasterizer_state( struct draw_context *draw,
                                 const struct pipe_rasterizer_state *raster,
                                 void *rast_handle )
@@ -280,6 +285,7 @@ void draw_set_rasterizer_state( struct draw_context *draw,
  * hardware with a TNL unit can do its own clipping, even if it is
  * relying on the draw module for some other reason.
  */
+PUBLIC
 void draw_set_driver_clipping( struct draw_context *draw,
                                boolean bypass_clip_xy,
                                boolean bypass_clip_z,
@@ -299,6 +305,7 @@ void draw_set_driver_clipping( struct draw_context *draw,
  * stage in the drawing pipeline).
  * This is provided by the device driver.
  */
+PUBLIC
 void draw_set_rasterize_stage( struct draw_context *draw,
                                struct draw_stage *stage )
 {
@@ -311,6 +318,7 @@ void draw_set_rasterize_stage( struct draw_context *draw,
 /**
  * Set the draw module's clipping state.
  */
+PUBLIC
 void draw_set_clip_state( struct draw_context *draw,
                           const struct pipe_clip_state *clip )
 {
@@ -323,6 +331,7 @@ void draw_set_clip_state( struct draw_context *draw,
 /**
  * Set the draw module's viewport state.
  */
+PUBLIC
 void draw_set_viewport_states( struct draw_context *draw,
                                unsigned start_slot,
                                unsigned num_viewports,
@@ -348,8 +357,7 @@ void draw_set_viewport_states( struct draw_context *draw,
        viewport->translate[3] == 0.0f);
 }
 
-
-
+PUBLIC
 void
 draw_set_vertex_buffers(struct draw_context *draw,
                         unsigned start_slot, unsigned count,
@@ -362,7 +370,7 @@ draw_set_vertex_buffers(struct draw_context *draw,
                                  buffers, start_slot, count);
 }
 
-
+PUBLIC
 void
 draw_set_vertex_elements(struct draw_context *draw,
                          unsigned count,
@@ -382,6 +390,7 @@ draw_set_vertex_elements(struct draw_context *draw,
 /**
  * Tell drawing context where to find mapped vertex buffers.
  */
+PUBLIC
 void
 draw_set_mapped_vertex_buffer(struct draw_context *draw,
                               unsigned attr, const void *buffer,
@@ -391,7 +400,7 @@ draw_set_mapped_vertex_buffer(struct draw_context *draw,
    draw->pt.user.vbuffer[attr].size = size;
 }
 
-
+PUBLIC
 void
 draw_set_mapped_constant_buffer(struct draw_context *draw,
                                 unsigned shader_type,
@@ -424,6 +433,7 @@ draw_set_mapped_constant_buffer(struct draw_context *draw,
  * Tells the draw module to draw points with triangles if their size
  * is greater than this threshold.
  */
+PUBLIC
 void
 draw_wide_point_threshold(struct draw_context *draw, float threshold)
 {
@@ -435,6 +445,7 @@ draw_wide_point_threshold(struct draw_context *draw, float threshold)
 /**
  * Should the draw module handle point->quad conversion for drawing sprites?
  */
+PUBLIC
 void
 draw_wide_point_sprites(struct draw_context *draw, boolean draw_sprite)
 {
@@ -447,6 +458,7 @@ draw_wide_point_sprites(struct draw_context *draw, boolean draw_sprite)
  * Tells the draw module to draw lines with triangles if their width
  * is greater than this threshold.
  */
+PUBLIC
 void
 draw_wide_line_threshold(struct draw_context *draw, float threshold)
 {
@@ -458,6 +470,7 @@ draw_wide_line_threshold(struct draw_context *draw, float threshold)
 /**
  * Tells the draw module whether or not to implement line stipple.
  */
+PUBLIC
 void
 draw_enable_line_stipple(struct draw_context *draw, boolean enable)
 {
@@ -469,6 +482,7 @@ draw_enable_line_stipple(struct draw_context *draw, boolean enable)
 /**
  * Tells draw module whether to convert points to quads for sprite mode.
  */
+PUBLIC
 void
 draw_enable_point_sprites(struct draw_context *draw, boolean enable)
 {
@@ -558,6 +572,7 @@ draw_get_shader_info(const struct draw_context *draw)
  * inject another shader output which passes the original
  * face side information to the backend.
  */
+PUBLIC
 void
 draw_prepare_shader_outputs(struct draw_context *draw)
 {
@@ -586,6 +601,7 @@ draw_prepare_shader_outputs(struct draw_context *draw)
  * be used by any of the attributes, because position is not
  * required to be attribute 0 or even at all present.
  */
+PUBLIC
 int
 draw_find_shader_output(const struct draw_context *draw,
                         uint semantic_name, uint semantic_index)
@@ -620,6 +636,7 @@ draw_find_shader_output(const struct draw_context *draw,
  * If geometry shader is present, its output will be returned,
  * if not vertex shader is used.
  */
+PUBLIC
 uint
 draw_num_shader_outputs(const struct draw_context *draw)
 {
@@ -672,6 +689,7 @@ draw_total_gs_outputs(const struct draw_context *draw)
  * texture fetches.  This state only needs to be set once per context.
  * This might only be used by software drivers for the time being.
  */
+PUBLIC
 void
 draw_texture_sampler(struct draw_context *draw,
                      uint shader,
@@ -687,7 +705,7 @@ draw_texture_sampler(struct draw_context *draw,
 
 
 
-
+PUBLIC
 void draw_set_render( struct draw_context *draw, 
 		      struct vbuf_render *render )
 {
@@ -702,6 +720,7 @@ void draw_set_render( struct draw_context *draw,
  * Note: the caller must apply the pipe_index_buffer::offset value to
  * the address.  The draw module doesn't do that.
  */
+PUBLIC
 void
 draw_set_indexes(struct draw_context *draw,
                  const void *elements, unsigned elem_size,
@@ -873,6 +892,7 @@ draw_get_rasterizer_no_cull( struct draw_context *draw,
    return draw->rasterizer_no_cull[scissor][flatshade];
 }
 
+PUBLIC
 void
 draw_set_mapped_so_targets(struct draw_context *draw,
                            int num_targets,
@@ -888,6 +908,7 @@ draw_set_mapped_so_targets(struct draw_context *draw,
    draw->so.num_targets = num_targets;
 }
 
+PUBLIC
 void
 draw_set_sampler_views(struct draw_context *draw,
                        unsigned shader_stage,
@@ -909,6 +930,7 @@ draw_set_sampler_views(struct draw_context *draw,
    draw->num_sampler_views[shader_stage] = num;
 }
 
+PUBLIC
 void
 draw_set_samplers(struct draw_context *draw,
                   unsigned shader_stage,
@@ -935,6 +957,7 @@ draw_set_samplers(struct draw_context *draw,
 #endif
 }
 
+PUBLIC
 void
 draw_set_mapped_texture(struct draw_context *draw,
                         unsigned shader_stage,
@@ -961,6 +984,7 @@ draw_set_mapped_texture(struct draw_context *draw,
  * XXX: Results for PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS because there are two
  * different ways of setting textures, and drivers typically only support one.
  */
+PUBLIC
 int
 draw_get_shader_param_no_llvm(unsigned shader, enum pipe_shader_cap param)
 {
@@ -977,6 +1001,7 @@ draw_get_shader_param_no_llvm(unsigned shader, enum pipe_shader_cap param)
  * XXX: Results for PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS because there are two
  * different ways of setting textures, and drivers typically only support one.
  */
+PUBLIC
 int
 draw_get_shader_param(unsigned shader, enum pipe_shader_cap param)
 {
@@ -1006,6 +1031,7 @@ draw_get_shader_param(unsigned shader, enum pipe_shader_cap param)
  * The actual data will be emitted through the VBUF interface,
  * the 'pipeline_statistics' callback to be exact.
  */
+PUBLIC
 void
 draw_collect_pipeline_statistics(struct draw_context *draw,
                                  boolean enable)
@@ -1048,6 +1074,7 @@ draw_stats_clipper_primitives(struct draw_context *draw,
  * outputs. This is done to preserve the front-facing
  * info when decomposing primitives into wireframes.
  */
+PUBLIC
 boolean
 draw_will_inject_frontface(const struct draw_context *draw)
 {
diff --git a/src/gallium/auxiliary/draw/draw_fs.c b/src/gallium/auxiliary/draw/draw_fs.c
index 1543bd8..5b01526 100644
--- a/src/gallium/auxiliary/draw/draw_fs.c
+++ b/src/gallium/auxiliary/draw/draw_fs.c
@@ -25,6 +25,7 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_shader_tokens.h"
 
 #include "util/u_math.h"
@@ -38,6 +39,7 @@
 #include "draw_context.h"
 
 
+PUBLIC
 struct draw_fragment_shader *
 draw_create_fragment_shader(struct draw_context *draw,
                             const struct pipe_shader_state *shader)
@@ -53,7 +55,7 @@ draw_create_fragment_shader(struct draw_context *draw,
    return dfs;
 }
 
-
+PUBLIC
 void
 draw_bind_fragment_shader(struct draw_context *draw,
                           struct draw_fragment_shader *dfs)
@@ -63,7 +65,7 @@ draw_bind_fragment_shader(struct draw_context *draw,
    draw->fs.fragment_shader = dfs;
 }
 
-
+PUBLIC
 void
 draw_delete_fragment_shader(struct draw_context *draw,
                             struct draw_fragment_shader *dfs)
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 13d3d3b..fa6e551 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -25,6 +25,8 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
+
 #include "draw_gs.h"
 
 #include "draw_private.h"
@@ -704,6 +706,7 @@ void draw_gs_destroy( struct draw_context *draw )
    }
 }
 
+PUBLIC
 struct draw_geometry_shader *
 draw_create_geometry_shader(struct draw_context *draw,
                             const struct pipe_shader_state *state)
@@ -840,6 +843,7 @@ draw_create_geometry_shader(struct draw_context *draw,
    return gs;
 }
 
+PUBLIC
 void draw_bind_geometry_shader(struct draw_context *draw,
                                struct draw_geometry_shader *dgs)
 {
@@ -857,6 +861,7 @@ void draw_bind_geometry_shader(struct draw_context *draw,
    }
 }
 
+PUBLIC
 void draw_delete_geometry_shader(struct draw_context *draw,
                                  struct draw_geometry_shader *dgs)
 {
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 8483bd7..6c5024d 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -32,6 +32,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
@@ -971,6 +972,7 @@ draw_aaline_prepare_outputs(struct draw_context *draw,
  * into the draw module's pipeline.  This will not be used if the
  * hardware has native support for AA lines.
  */
+PUBLIC
 boolean
 draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe)
 {
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
index 7ae1ddd..10d8827 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c
@@ -38,6 +38,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
@@ -891,6 +892,7 @@ aapoint_delete_fs_state(struct pipe_context *pipe, void *fs)
  * into the draw module's pipeline.  This will not be used if the
  * hardware has native support for AA points.
  */
+PUBLIC
 boolean
 draw_install_aapoint_stage(struct draw_context *draw,
                            struct pipe_context *pipe)
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index f38addd..dc64424 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -35,6 +35,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
@@ -763,6 +764,7 @@ pstip_set_polygon_stipple(struct pipe_context *pipe,
  * into the draw module's pipeline.  This will not be used if the
  * hardware has native support for polygon stipple.
  */
+PUBLIC
 boolean
 draw_install_pstipple_stage(struct draw_context *draw,
                             struct pipe_context *pipe)
diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index 092440e..aef3ddf 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -34,6 +34,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
@@ -422,6 +424,7 @@ static void vbuf_destroy( struct draw_stage *stage )
 /**
  * Create a new primitive vbuf/render stage.
  */
+PUBLIC
 struct draw_stage *draw_vbuf_stage( struct draw_context *draw,
                                     struct vbuf_render *render )
 {
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 5b16bc7..8ba5952 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -30,6 +30,7 @@
   *   Keith Whitwell <keith at tungstengraphics.com>
   */
 
+#include "pipe/p_compiler.h"
 #include "draw/draw_context.h"
 #include "draw/draw_gs.h"
 #include "draw/draw_private.h"
@@ -452,6 +453,7 @@ resolve_draw_info(const struct pipe_draw_info *raw_info,
  * primitive, the draw_set_indexes() function should have already been called
  * to specify the element/index buffer information.
  */
+PUBLIC
 void
 draw_vbo(struct draw_context *draw,
          const struct pipe_draw_info *info)
diff --git a/src/gallium/auxiliary/draw/draw_vertex.c b/src/gallium/auxiliary/draw/draw_vertex.c
index a1b2b8f..94e5443 100644
--- a/src/gallium/auxiliary/draw/draw_vertex.c
+++ b/src/gallium/auxiliary/draw/draw_vertex.c
@@ -34,6 +34,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "draw/draw_private.h"
 #include "draw/draw_vertex.h"
 
@@ -42,6 +43,7 @@
  * Compute the size of a vertex, in dwords/floats, to update the
  * vinfo->size field.
  */
+PUBLIC
 void
 draw_compute_vertex_size(struct vertex_info *vinfo)
 {
diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index bbccbe4..36b107d 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -31,6 +31,8 @@
   *   Brian Paul
   */
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
@@ -49,6 +51,7 @@
 DEBUG_GET_ONCE_BOOL_OPTION(gallium_dump_vs, "GALLIUM_DUMP_VS", FALSE)
 
 
+PUBLIC
 struct draw_vertex_shader *
 draw_create_vertex_shader(struct draw_context *draw,
                           const struct pipe_shader_state *shader)
@@ -103,7 +106,7 @@ draw_create_vertex_shader(struct draw_context *draw,
    return vs;
 }
 
-
+PUBLIC
 void
 draw_bind_vertex_shader(struct draw_context *draw,
                         struct draw_vertex_shader *dvs)
@@ -127,7 +130,7 @@ draw_bind_vertex_shader(struct draw_context *draw,
    }
 }
 
-
+PUBLIC
 void
 draw_delete_vertex_shader(struct draw_context *draw,
                           struct draw_vertex_shader *dvs)
@@ -242,6 +245,7 @@ draw_vs_get_emit( struct draw_context *draw,
    return draw->vs.emit;
 }
 
+PUBLIC
 void
 draw_vs_attach_so(struct draw_vertex_shader *dvs,
                   const struct pipe_stream_output_info *info)
@@ -249,6 +253,7 @@ draw_vs_attach_so(struct draw_vertex_shader *dvs,
    dvs->state.stream_output = *info;
 }
 
+PUBLIC
 void
 draw_vs_reset_so(struct draw_vertex_shader *dvs)
 {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 09107ff..a7a72e2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -47,6 +47,8 @@
 
 #include <float.h>
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_memory.h"
 #include "util/u_debug.h"
 #include "util/u_math.h"
@@ -420,6 +422,7 @@ lp_build_max_simple(struct lp_build_context *bld,
 /**
  * Generate 1 - a, or ~a depending on bld->type.
  */
+PUBLIC
 LLVMValueRef
 lp_build_comp(struct lp_build_context *bld,
               LLVMValueRef a)
@@ -457,6 +460,7 @@ lp_build_comp(struct lp_build_context *bld,
 /**
  * Generate a + b
  */
+PUBLIC
 LLVMValueRef
 lp_build_add(struct lp_build_context *bld,
              LLVMValueRef a,
@@ -738,6 +742,7 @@ lp_build_hadd_partial4(struct lp_build_context *bld,
 /**
  * Generate a - b
  */
+PUBLIC
 LLVMValueRef
 lp_build_sub(struct lp_build_context *bld,
              LLVMValueRef a,
@@ -906,6 +911,7 @@ lp_build_mul_norm(struct gallivm_state *gallivm,
 /**
  * Generate a * b
  */
+PUBLIC
 LLVMValueRef
 lp_build_mul(struct lp_build_context *bld,
              LLVMValueRef a,
@@ -983,6 +989,7 @@ lp_build_mul(struct lp_build_context *bld,
 /**
  * Small vector x scale multiplication optimization.
  */
+PUBLIC
 LLVMValueRef
 lp_build_mul_imm(struct lp_build_context *bld,
                  LLVMValueRef a,
@@ -1158,6 +1165,7 @@ lp_build_lerp_simple(struct lp_build_context *bld,
 /**
  * Linear interpolation.
  */
+PUBLIC
 LLVMValueRef
 lp_build_lerp(struct lp_build_context *bld,
               LLVMValueRef x,
@@ -1260,6 +1268,7 @@ lp_build_lerp_3d(struct lp_build_context *bld,
  * Generate min(a, b)
  * Do checks for special cases but not for nans.
  */
+PUBLIC
 LLVMValueRef
 lp_build_min(struct lp_build_context *bld,
              LLVMValueRef a,
@@ -1329,6 +1338,7 @@ lp_build_min_ext(struct lp_build_context *bld,
  * Generate max(a, b)
  * Do checks for special cases, but NaN behavior is undefined.
  */
+PUBLIC
 LLVMValueRef
 lp_build_max(struct lp_build_context *bld,
              LLVMValueRef a,
@@ -1401,6 +1411,7 @@ lp_build_max_ext(struct lp_build_context *bld,
  * Generate clamp(a, min, max)
  * Do checks for special cases.
  */
+PUBLIC
 LLVMValueRef
 lp_build_clamp(struct lp_build_context *bld,
                LLVMValueRef a,
@@ -1420,6 +1431,7 @@ lp_build_clamp(struct lp_build_context *bld,
 /**
  * Generate abs(a)
  */
+PUBLIC
 LLVMValueRef
 lp_build_abs(struct lp_build_context *bld,
              LLVMValueRef a)
@@ -2385,7 +2397,7 @@ lp_build_rcp_refine(struct lp_build_context *bld,
    return res;
 }
 
-
+PUBLIC
 LLVMValueRef
 lp_build_rcp(struct lp_build_context *bld,
              LLVMValueRef a)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_bitarit.c b/src/gallium/auxiliary/gallivm/lp_bld_bitarit.c
index 9892d7a..89d83ba 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_bitarit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_bitarit.c
@@ -26,6 +26,8 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 
 #include "lp_bld_type.h"
@@ -91,6 +93,7 @@ lp_build_xor(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 /**
  * Return (a & b)
  */
+PUBLIC
 LLVMValueRef
 lp_build_and(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 {
@@ -120,6 +123,7 @@ lp_build_and(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 /**
  * Return (a & ~b)
  */
+PUBLIC
 LLVMValueRef
 lp_build_andnot(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
 {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index 0f5a8f8..ec865b8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -35,6 +35,8 @@
 
 #include <float.h>
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 #include "util/u_math.h"
 #include "util/u_half.h"
@@ -220,7 +222,7 @@ lp_const_eps(struct lp_type type)
    }
 }
 
-
+PUBLIC
 LLVMValueRef
 lp_build_undef(struct gallivm_state *gallivm, struct lp_type type)
 {
@@ -228,7 +230,7 @@ lp_build_undef(struct gallivm_state *gallivm, struct lp_type type)
    return LLVMGetUndef(vec_type);
 }
                
-
+PUBLIC
 LLVMValueRef
 lp_build_zero(struct gallivm_state *gallivm, struct lp_type type)
 {
@@ -321,6 +323,7 @@ lp_build_const_elem(struct gallivm_state *gallivm,
 /**
  * Build constant-valued vector from a scalar value.
  */
+PUBLIC
 LLVMValueRef
 lp_build_const_vec(struct gallivm_state *gallivm, struct lp_type type,
                    double val)
@@ -337,7 +340,7 @@ lp_build_const_vec(struct gallivm_state *gallivm, struct lp_type type,
    }
 }
 
-
+PUBLIC
 LLVMValueRef
 lp_build_const_int_vec(struct gallivm_state *gallivm, struct lp_type type,
                        long long val)
@@ -391,6 +394,7 @@ lp_build_const_aos(struct gallivm_state *gallivm,
 /**
  * @param mask TGSI_WRITEMASK_xxx
  */
+PUBLIC
 LLVMValueRef
 lp_build_const_mask_aos(struct gallivm_state *gallivm,
                         struct lp_type type,
@@ -418,6 +422,7 @@ lp_build_const_mask_aos(struct gallivm_state *gallivm,
 /**
  * Performs lp_build_const_mask_aos, but first swizzles the mask
  */
+PUBLIC
 LLVMValueRef
 lp_build_const_mask_aos_swizzled(struct gallivm_state *gallivm,
                                  struct lp_type type,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c
index 712ce5f..bd319d9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c
@@ -61,6 +61,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 #include "util/u_math.h"
 #include "util/u_half.h"
@@ -221,6 +223,7 @@ lp_build_float_to_half(struct gallivm_state *gallivm,
  * Ex: src = { float, float, float, float }
  * return { i32, i32, i32, i32 } where each value is in [0, 2^dst_width-1].
  */
+PUBLIC
 LLVMValueRef
 lp_build_clamped_float_to_unsigned_norm(struct gallivm_state *gallivm,
                                         struct lp_type src_type,
@@ -424,6 +427,7 @@ lp_build_unsigned_norm_to_float(struct gallivm_state *gallivm,
  *
  * Returns the number of dsts created from src
  */
+PUBLIC
 int lp_build_conv_auto(struct gallivm_state *gallivm,
                        struct lp_type src_type,
                        struct lp_type* dst_type,
@@ -498,6 +502,7 @@ int lp_build_conv_auto(struct gallivm_state *gallivm,
  * TODO: Take a precision argument, or even better, add a new precision member
  * to the lp_type union.
  */
+PUBLIC
 void
 lp_build_conv(struct gallivm_state *gallivm,
               struct lp_type src_type,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
index 1c886ea..6b7e6f7 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
@@ -60,6 +60,7 @@
 #include <llvm/ADT/OwningPtr.h>
 #endif
 
+#include "pipe/p_compiler.h"
 #include "util/u_math.h"
 #include "util/u_debug.h"
 
@@ -80,7 +81,7 @@
  * and stack variables would often make the check a no op, defeating the
  * whole purpose of the exercise.
  */
-extern "C" boolean
+extern "C" PUBLIC boolean
 lp_check_alignment(const void *ptr, unsigned alignment)
 {
    assert(util_is_power_of_two(alignment));
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
index f3b3eab..9075a8d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
@@ -31,6 +31,8 @@
  * @author Jose Fonseca <jfonseca at vmware.com>
  */
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 
@@ -122,6 +124,7 @@ lp_build_flow_skip_end(struct lp_build_skip_context *skip)
 /**
  * Check if the mask predicate is zero.  If so, jump to the end of the block.
  */
+PUBLIC
 void
 lp_build_mask_check(struct lp_build_mask_context *mask)
 {
@@ -159,6 +162,7 @@ lp_build_mask_check(struct lp_build_mask_context *mask)
  * \param type  the type of the mask
  * \param value  storage for the mask
  */
+PUBLIC
 void
 lp_build_mask_begin(struct lp_build_mask_context *mask,
                     struct gallivm_state *gallivm,
@@ -177,7 +181,7 @@ lp_build_mask_begin(struct lp_build_mask_context *mask,
    lp_build_flow_skip_begin(&mask->skip, gallivm);
 }
 
-
+PUBLIC
 LLVMValueRef
 lp_build_mask_value(struct lp_build_mask_context *mask)
 {
@@ -190,6 +194,7 @@ lp_build_mask_value(struct lp_build_mask_context *mask)
  * Typically used to update the quad's pixel alive/killed mask
  * after depth testing, alpha testing, TGSI_OPCODE_KILL_IF, etc.
  */
+PUBLIC
 void
 lp_build_mask_update(struct lp_build_mask_context *mask,
                      LLVMValueRef value)
@@ -204,6 +209,7 @@ lp_build_mask_update(struct lp_build_mask_context *mask,
 /**
  * End section of code which is predicated on a mask.
  */
+PUBLIC
 LLVMValueRef
 lp_build_mask_end(struct lp_build_mask_context *mask)
 {
@@ -285,6 +291,7 @@ lp_build_loop_end(struct lp_build_loop_state *state,
  * \param end        value used to compare against iterator
  * \param step       value added to iterator at end of each loop
  */
+PUBLIC
 void
 lp_build_for_loop_begin(struct lp_build_for_loop_state *state,
                         struct gallivm_state *gallivm,
@@ -318,6 +325,7 @@ lp_build_for_loop_begin(struct lp_build_for_loop_state *state,
 /**
  * End the for loop.
  */
+PUBLIC
 void
 lp_build_for_loop_end(struct lp_build_for_loop_state *state)
 {
@@ -469,6 +477,7 @@ lp_build_endif(struct lp_build_if_state *ifthen)
  * See also:
  * - http://www.llvm.org/docs/tutorial/OCamlLangImpl7.html#memory
  */
+PUBLIC
 LLVMValueRef
 lp_build_alloca(struct gallivm_state *gallivm,
                 LLVMTypeRef type,
@@ -511,6 +520,7 @@ lp_build_alloca(struct gallivm_state *gallivm,
  * See also:
  * - http://www.llvm.org/docs/tutorial/OCamlLangImpl7.html#memory
  */
+PUBLIC
 LLVMValueRef
 lp_build_array_alloca(struct gallivm_state *gallivm,
                       LLVMTypeRef type,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_float.c b/src/gallium/auxiliary/gallivm/lp_bld_format_float.c
index f68a617..54d7e4f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_float.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_float.c
@@ -34,6 +34,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 
 #include "lp_bld_type.h"
@@ -233,6 +235,7 @@ lp_build_float_to_smallfloat(struct gallivm_state *gallivm,
  *
  * @param src   SoA float (vector) values to convert.
  */
+PUBLIC
 LLVMValueRef
 lp_build_float_to_r11g11b10(struct gallivm_state *gallivm,
                             LLVMValueRef *src)
@@ -355,6 +358,7 @@ lp_build_smallfloat_to_float(struct gallivm_state *gallivm,
  * @param src   packed AoS r11g11b10 values (as (vector) int32)
  * @param dst   pointer to the SoA result values
  */
+PUBLIC
 void
 lp_build_r11g11b10_to_float(struct gallivm_state *gallivm,
                             LLVMValueRef src,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index 81cd2b0..a5dfaa8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 
 #include "util/u_format.h"
@@ -106,6 +107,7 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc,
  * \param packed  the incoming vector of packed pixels
  * \param rgba_out  returns the SoA R,G,B,A vectors
  */
+PUBLIC
 void
 lp_build_unpack_rgba_soa(struct gallivm_state *gallivm,
                          const struct util_format_description *format_desc,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c b/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c
index 2b1fe64..131cad1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c
@@ -67,6 +67,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 
 #include "lp_bld_type.h"
@@ -304,6 +306,7 @@ lp_build_linear_to_srgb(struct gallivm_state *gallivm,
  *
  * @param src   float SoA (vector) values to convert.
  */
+PUBLIC
 LLVMValueRef
 lp_build_float_to_srgb_packed(struct gallivm_state *gallivm,
                               const struct util_format_description *dst_fmt,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_gather.c b/src/gallium/auxiliary/gallivm/lp_bld_gather.c
index 9155d81..9806dfa 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_gather.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_gather.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "lp_bld_debug.h"
 #include "lp_bld_const.h"
@@ -167,6 +168,7 @@ lp_build_gather(struct gallivm_state *gallivm,
    return res;
 }
 
+PUBLIC
 LLVMValueRef
 lp_build_gather_values(struct gallivm_state * gallivm,
                        LLVMValueRef * values,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 61b561f..e36f8d8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -70,6 +70,7 @@ void LLVMLinkInMCJIT();
 
 
 #ifdef DEBUG
+PUBLIC
 unsigned gallivm_debug = 0;
 
 static const struct debug_named_value lp_bld_debug_flags[] = {
@@ -91,6 +92,7 @@ DEBUG_GET_ONCE_FLAGS_OPTION(gallivm_debug, "GALLIVM_DEBUG", lp_bld_debug_flags,
 
 static boolean gallivm_initialized = FALSE;
 
+PUBLIC
 unsigned lp_native_vector_width;
 
 
@@ -418,7 +420,7 @@ fail:
    return FALSE;
 }
 
-
+PUBLIC
 void
 lp_build_init(void)
 {
@@ -522,6 +524,7 @@ lp_build_init(void)
  * Create a new gallivm_state object.
  * Note that we return a singleton.
  */
+PUBLIC
 struct gallivm_state *
 gallivm_create(void)
 {
@@ -552,6 +555,7 @@ gallivm_create(void)
 /**
  * Destroy a gallivm_state object.
  */
+PUBLIC
 void
 gallivm_destroy(struct gallivm_state *gallivm)
 {
@@ -594,6 +598,7 @@ gallivm_optimize_function(struct gallivm_state *gallivm,
 /**
  * Validate a function.
  */
+PUBLIC
 void
 gallivm_verify_function(struct gallivm_state *gallivm,
                         LLVMValueRef func)
@@ -616,7 +621,7 @@ gallivm_verify_function(struct gallivm_state *gallivm,
    }
 }
 
-
+PUBLIC
 void
 gallivm_compile_module(struct gallivm_state *gallivm)
 {
@@ -643,7 +648,7 @@ gallivm_compile_module(struct gallivm_state *gallivm)
 }
 
 
-
+PUBLIC
 func_pointer
 gallivm_jit_function(struct gallivm_state *gallivm,
                      LLVMValueRef func)
@@ -676,6 +681,7 @@ gallivm_jit_function(struct gallivm_state *gallivm,
 /**
  * Free the function (and its machine code).
  */
+PUBLIC
 void
 gallivm_free_function(struct gallivm_state *gallivm,
                       LLVMValueRef func,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.c b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
index 2bf1211..3ba9542 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_intr.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.c
@@ -44,6 +44,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 
 #include "lp_bld_const.h"
@@ -52,6 +54,7 @@
 #include "lp_bld_pack.h"
 
 
+PUBLIC
 LLVMValueRef
 lp_declare_intrinsic(LLVMModuleRef module,
                      const char *name,
@@ -75,7 +78,7 @@ lp_declare_intrinsic(LLVMModuleRef module,
    return function;
 }
 
-
+PUBLIC
 LLVMValueRef
 lp_build_intrinsic(LLVMBuilderRef builder,
                    const char *name,
@@ -104,7 +107,7 @@ lp_build_intrinsic(LLVMBuilderRef builder,
    return LLVMBuildCall(builder, function, args, num_args, "");
 }
 
-
+PUBLIC
 LLVMValueRef
 lp_build_intrinsic_unary(LLVMBuilderRef builder,
                          const char *name,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index fc7a728..f2ca5de 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -33,6 +33,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_cpu_detect.h"
 #include "util/u_memory.h"
 #include "util/u_debug.h"
@@ -221,6 +223,7 @@ lp_build_compare_ext(struct gallivm_state *gallivm,
  * \param func  one of PIPE_FUNC_x
  * The result values will be 0 for false or ~0 for true.
  */
+PUBLIC
 LLVMValueRef
 lp_build_compare(struct gallivm_state *gallivm,
                  const struct lp_type type,
@@ -420,6 +423,7 @@ lp_build_cmp_ordered(struct lp_build_context *bld,
  * operand is a NaN or the specified condition evaluates to true.
  * The result values will be 0 for false or ~0 for true.
  */
+PUBLIC
 LLVMValueRef
 lp_build_cmp(struct lp_build_context *bld,
              unsigned func,
@@ -433,6 +437,7 @@ lp_build_cmp(struct lp_build_context *bld,
 /**
  * Return (mask & a) | (~mask & b);
  */
+PUBLIC
 LLVMValueRef
 lp_build_select_bitwise(struct lp_build_context *bld,
                         LLVMValueRef mask,
@@ -482,6 +487,7 @@ lp_build_select_bitwise(struct lp_build_context *bld,
  * mask is a bitwise mask, composed of 0 or ~0 for each element. Any other value
  * will yield unpredictable results.
  */
+PUBLIC
 LLVMValueRef
 lp_build_select(struct lp_build_context *bld,
                 LLVMValueRef mask,
@@ -603,6 +609,7 @@ lp_build_select(struct lp_build_context *bld,
  *
  * mask is a TGSI_WRITEMASK_xxx.
  */
+PUBLIC
 LLVMValueRef
 lp_build_select_aos(struct lp_build_context *bld,
                     unsigned mask,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index e8d2db2..e89f912 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -73,6 +73,7 @@
 #include <llvm/Support/CBindingWrapping.h>
 #endif
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_config.h"
 #include "util/u_debug.h"
 #include "util/u_cpu_detect.h"
@@ -225,6 +226,7 @@ lp_build_load_volatile(LLVMBuilderRef B, LLVMValueRef PointerVal,
 
 
 extern "C"
+PUBLIC
 void
 lp_set_load_alignment(LLVMValueRef Inst,
                        unsigned Align)
@@ -233,6 +235,7 @@ lp_set_load_alignment(LLVMValueRef Inst,
 }
 
 extern "C"
+PUBLIC
 void
 lp_set_store_alignment(LLVMValueRef Inst,
 		       unsigned Align)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
index 22a4f5a8..ca0f2cc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
@@ -66,6 +66,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 #include "util/u_math.h"
 #include "util/u_cpu_detect.h"
@@ -155,6 +157,7 @@ lp_build_const_pack_shuffle(struct gallivm_state *gallivm, unsigned n)
  * Most useful for getting half the values out of a 256bit sized vector,
  * otherwise may cause data rearrangement to happen.
  */
+PUBLIC
 LLVMValueRef
 lp_build_extract_range(struct gallivm_state *gallivm,
                        LLVMValueRef src,
@@ -183,6 +186,7 @@ lp_build_extract_range(struct gallivm_state *gallivm,
  * into a larger one.
  * Most useful for building up a 256bit sized vector out of two 128bit ones.
  */
+PUBLIC
 LLVMValueRef
 lp_build_concat(struct gallivm_state *gallivm,
                 LLVMValueRef src[],
@@ -227,6 +231,7 @@ lp_build_concat(struct gallivm_state *gallivm,
  *          num_dsts = 1  dst = [xyzw]    return = 4
  *          num_dsts = 2  dst = [xy, zw]  return = 2
  */
+PUBLIC
 int
 lp_build_concat_n(struct gallivm_state *gallivm,
                   struct lp_type src_type,
@@ -262,6 +267,7 @@ lp_build_concat_n(struct gallivm_state *gallivm,
  * Matches the PUNPCKLxx and PUNPCKHxx SSE instructions
  * (but not for 256bit AVX vectors).
  */
+PUBLIC
 LLVMValueRef
 lp_build_interleave2(struct gallivm_state *gallivm,
                      struct lp_type type,
@@ -827,6 +833,7 @@ lp_build_resize(struct gallivm_state *gallivm,
 /**
  * Expands src vector from src.length to dst_length
  */
+PUBLIC
 LLVMValueRef
 lp_build_pad_vector(struct gallivm_state *gallivm,
                     LLVMValueRef src,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_quad.c b/src/gallium/auxiliary/gallivm/lp_bld_quad.c
index f2a762a..53e11aa 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_quad.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_quad.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
 #include "lp_bld_type.h"
 #include "lp_bld_arit.h"
 #include "lp_bld_const.h"
@@ -167,6 +168,7 @@ lp_build_packed_ddx_ddy_twocoord(struct lp_build_context *bld,
  * ######### #########      #################
  *
  */
+PUBLIC
 void
 lp_bld_quad_twiddle(struct gallivm_state *gallivm,
                     struct lp_type lp_dst_type,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 9b0a92c..39cf13b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -32,6 +32,7 @@
  * @author Jose Fonseca <jfonseca at vmware.com>
  */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
 #include "util/u_format.h"
@@ -93,6 +94,7 @@ lp_sampler_wrap_mode_uses_border_color(unsigned mode,
  * texture/sampler_view state (this contains the parts which are
  * considered static).
  */
+PUBLIC
 void
 lp_sampler_static_texture_state(struct lp_static_texture_state *state,
                                 const struct pipe_sampler_view *view)
@@ -129,6 +131,7 @@ lp_sampler_static_texture_state(struct lp_static_texture_state *state,
  * Initialize lp_sampler_static_sampler_state object with the gallium sampler
  * state (this contains the parts which are considered static).
  */
+PUBLIC
 void
 lp_sampler_static_sampler_state(struct lp_static_sampler_state *state,
                                 const struct pipe_sampler_state *sampler)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 7e98919..e5b6670 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -33,6 +33,7 @@
  * @author Brian Paul <brianp at vmware.com>
  */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
 #include "pipe/p_shader_tokens.h"
@@ -2004,6 +2005,7 @@ lp_build_fetch_texel(struct lp_build_sample_context *bld,
  * Just set texels to white instead of actually sampling the texture.
  * For debugging.
  */
+PUBLIC
 void
 lp_build_sample_nop(struct gallivm_state *gallivm,
                     struct lp_type type,
@@ -2027,6 +2029,7 @@ lp_build_sample_nop(struct gallivm_state *gallivm,
  * \param is_fetch  if this is a texel fetch instruction.
  * \param derivs  partial derivatives of (s,t,r,q) with respect to x and y
  */
+PUBLIC
 void
 lp_build_sample_soa(struct gallivm_state *gallivm,
                     const struct lp_static_texture_state *static_texture_state,
@@ -2482,6 +2485,7 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
    }
 }
 
+PUBLIC
 void
 lp_build_size_query_soa(struct gallivm_state *gallivm,
                         const struct lp_static_texture_state *static_state,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_struct.c b/src/gallium/auxiliary/gallivm/lp_bld_struct.c
index cc248d1..17b5d8f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_struct.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_struct.c
@@ -34,6 +34,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 
@@ -42,6 +44,7 @@
 #include "lp_bld_struct.h"
 
 
+PUBLIC
 LLVMValueRef
 lp_build_struct_get_ptr(struct gallivm_state *gallivm,
                         LLVMValueRef ptr,
@@ -60,6 +63,7 @@ lp_build_struct_get_ptr(struct gallivm_state *gallivm,
 }
 
 
+PUBLIC
 LLVMValueRef
 lp_build_struct_get(struct gallivm_state *gallivm,
                     LLVMValueRef ptr,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index 79116bc..637f468 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -33,6 +33,7 @@
  */
 
 #include <inttypes.h>  /* for PRIx64 macro */
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 
 #include "lp_bld_type.h"
@@ -43,6 +44,7 @@
 #include "lp_bld_pack.h"
 
 
+PUBLIC
 LLVMValueRef
 lp_build_broadcast(struct gallivm_state *gallivm,
                    LLVMTypeRef vec_type,
@@ -85,6 +87,7 @@ lp_build_broadcast(struct gallivm_state *gallivm,
 /**
  * Broadcast
  */
+PUBLIC
 LLVMValueRef
 lp_build_broadcast_scalar(struct lp_build_context *bld,
                           LLVMValueRef scalar)
@@ -98,6 +101,7 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
 /**
  * Combined extract and broadcast (mere shuffle in most cases)
  */
+PUBLIC
 LLVMValueRef
 lp_build_extract_broadcast(struct gallivm_state *gallivm,
                            struct lp_type src_type,
@@ -161,6 +165,7 @@ lp_build_extract_broadcast(struct gallivm_state *gallivm,
 /**
  * Swizzle one channel into other channels.
  */
+PUBLIC
 LLVMValueRef
 lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
                             LLVMValueRef a,
@@ -333,6 +338,7 @@ lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
  * @param num_swizzles    the number of elements in swizzles
  * @param dst_len         the length of the result
  */
+PUBLIC
 LLVMValueRef
 lp_build_swizzle_aos_n(struct gallivm_state* gallivm,
                        LLVMValueRef src,
@@ -651,6 +657,7 @@ lp_build_swizzle_soa_inplace(struct lp_build_context *bld,
  * @param src              the 4 * n pixel input
  * @param dst              the 4 * n pixel output
  */
+PUBLIC
 void
 lp_build_transpose_aos(struct gallivm_state *gallivm,
                        struct lp_type single_type_lp,
@@ -697,6 +704,7 @@ lp_build_transpose_aos(struct gallivm_state *gallivm,
 /**
  * Transpose from AOS <-> SOA for num_srcs
  */
+PUBLIC
 void
 lp_build_transpose_aos_n(struct gallivm_state *gallivm,
                          struct lp_type type,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
index 5a9e8d0..49c4d85 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c
@@ -28,6 +28,8 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
+
 #include "gallivm/lp_bld_tgsi.h"
 
 #include "gallivm/lp_bld_arit.h"
@@ -95,6 +97,7 @@ lp_build_action_set_dst_type(
    }
 }
 
+PUBLIC
 void
 lp_build_tgsi_intrinsic(
  const struct lp_build_tgsi_action * action,
@@ -107,6 +110,7 @@ lp_build_tgsi_intrinsic(
                emit_data->dst_type, emit_data->args, emit_data->arg_count);
 }
 
+PUBLIC
 LLVMValueRef
 lp_build_emit_llvm(
    struct lp_build_tgsi_context *bld_base,
@@ -123,6 +127,7 @@ lp_build_emit_llvm(
    return emit_data->output[0];
 }
 
+PUBLIC
 LLVMValueRef
 lp_build_emit_llvm_unary(
    struct lp_build_tgsi_context *bld_base,
@@ -135,6 +140,7 @@ lp_build_emit_llvm_unary(
    return lp_build_emit_llvm(bld_base, tgsi_opcode, &emit_data);
 }
 
+PUBLIC
 LLVMValueRef
 lp_build_emit_llvm_binary(
    struct lp_build_tgsi_context *bld_base,
@@ -149,6 +155,7 @@ lp_build_emit_llvm_binary(
    return lp_build_emit_llvm(bld_base, tgsi_opcode, &emit_data);
 }
 
+PUBLIC
 LLVMValueRef
 lp_build_emit_llvm_ternary(
    struct lp_build_tgsi_context *bld_base,
@@ -276,7 +283,7 @@ lp_build_tgsi_inst_llvm(
    return TRUE;
 }
 
-
+PUBLIC
 LLVMValueRef
 lp_build_emit_fetch(
    struct lp_build_tgsi_context *bld_base,
@@ -421,7 +428,7 @@ lp_build_emit_fetch_texoffset(
 
 }
 
-
+PUBLIC
 boolean
 lp_build_tgsi_llvm(
    struct lp_build_tgsi_context * bld_base,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
index 86c3249..aad8b22 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
@@ -39,6 +39,8 @@
  */
 
 
+#include "pipe/p_compiler.h"
+
 #include "lp_bld_tgsi_action.h"
 
 #include "lp_bld_tgsi.h"
@@ -844,6 +846,7 @@ const struct lp_build_tgsi_action xpd_action = {
    xpd_emit	 /* emit */
 };
 
+PUBLIC
 void
 lp_set_default_actions(struct lp_build_tgsi_context * bld_base)
 {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
index 184790b..fbdaade 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
 #include "tgsi/tgsi_parse.h"
@@ -482,6 +483,7 @@ dump_info(const struct tgsi_token *tokens,
 /**
  * Detect any direct relationship between the output color
  */
+PUBLIC
 void
 lp_build_tgsi_info(const struct tgsi_token *tokens,
                    struct lp_tgsi_info *info)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index e50f1d1..ea6ed83 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -36,6 +36,7 @@
  * Brian Paul, and others.
  */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_config.h"
 #include "pipe/p_shader_tokens.h"
 #include "util/u_debug.h"
@@ -670,6 +671,7 @@ static void lp_exec_mask_endsub(struct lp_exec_mask *mask, int *pc)
  * \param index  which temporary register
  * \param chan  which channel of the temp register.
  */
+PUBLIC
 LLVMValueRef
 lp_get_temp_ptr_soa(struct lp_build_tgsi_soa_context *bld,
              unsigned index,
@@ -692,6 +694,7 @@ lp_get_temp_ptr_soa(struct lp_build_tgsi_soa_context *bld,
  * \param index  which output register
  * \param chan  which channel of the output register.
  */
+PUBLIC
 LLVMValueRef
 lp_get_output_ptr(struct lp_build_tgsi_soa_context *bld,
                unsigned index,
@@ -2343,7 +2346,7 @@ emit_dump_temps(struct lp_build_tgsi_soa_context *bld)
 }
 
 
-
+PUBLIC
 void
 lp_emit_declaration_soa(
    struct lp_build_tgsi_context *bld_base,
@@ -3260,6 +3263,7 @@ static void emit_epilogue(struct lp_build_tgsi_context * bld_base)
    }
 }
 
+PUBLIC
 void
 lp_build_tgsi_soa(struct gallivm_state *gallivm,
                   const struct tgsi_token *tokens,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.c b/src/gallium/auxiliary/gallivm/lp_bld_type.c
index 6c3aa38..d444466 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_type.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_type.c
@@ -25,6 +25,7 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 
 #include "util/u_debug.h"
 
@@ -33,6 +34,7 @@
 #include "lp_bld_init.h"
 
 
+PUBLIC
 LLVMTypeRef
 lp_build_elem_type(struct gallivm_state *gallivm, struct lp_type type)
 {
@@ -57,7 +59,7 @@ lp_build_elem_type(struct gallivm_state *gallivm, struct lp_type type)
    }
 }
 
-
+PUBLIC
 LLVMTypeRef
 lp_build_vec_type(struct gallivm_state *gallivm,struct lp_type type)
 {
@@ -140,7 +142,7 @@ lp_check_vec_type(struct lp_type type, LLVMTypeRef vec_type)
    return lp_check_elem_type(type, elem_type);
 }
 
-
+PUBLIC
 boolean
 lp_check_value(struct lp_type type, LLVMValueRef val) 
 {
@@ -162,7 +164,7 @@ lp_build_int_elem_type(struct gallivm_state *gallivm, struct lp_type type)
    return LLVMIntTypeInContext(gallivm->context, type.width);
 }
 
-
+PUBLIC
 LLVMTypeRef
 lp_build_int_vec_type(struct gallivm_state *gallivm, struct lp_type type)
 {
@@ -193,6 +195,7 @@ lp_elem_type(struct lp_type type)
 /**
  * Create unsigned integer type variation of given type.
  */
+PUBLIC
 struct lp_type
 lp_uint_type(struct lp_type type)
 {
@@ -210,6 +213,7 @@ lp_uint_type(struct lp_type type)
 /**
  * Create signed integer type variation of given type.
  */
+PUBLIC
 struct lp_type
 lp_int_type(struct lp_type type)
 {
@@ -369,7 +373,7 @@ lp_dump_llvmtype(LLVMTypeRef t)
    }
 }
 
-
+PUBLIC
 void
 lp_build_context_init(struct lp_build_context *bld,
                       struct gallivm_state *gallivm,
@@ -402,6 +406,7 @@ lp_build_context_init(struct lp_build_context *bld,
 /**
  * Count the number of instructions in a function.
  */
+PUBLIC
 unsigned
 lp_build_count_instructions(LLVMValueRef function)
 {
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index c4a4f18..33e7be0 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -35,6 +35,8 @@
 
 #include <stdio.h>
 
+#include "pipe/p_compiler.h"
+
 #include "hud/hud_context.h"
 #include "hud/hud_private.h"
 #include "hud/font.h"
@@ -392,6 +394,7 @@ hud_alloc_vertices(struct hud_context *hud, struct vertex_queue *v,
  * Draw the HUD to the texture \p tex.
  * The texture is usually the back buffer being displayed.
  */
+PUBLIC
 void
 hud_draw(struct hud_context *hud, struct pipe_resource *tex)
 {
@@ -915,6 +918,7 @@ print_help(struct pipe_screen *screen)
    puts("");
 }
 
+PUBLIC
 struct hud_context *
 hud_create(struct pipe_context *pipe, struct cso_context *cso)
 {
@@ -1072,6 +1076,7 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso)
    return hud;
 }
 
+PUBLIC
 void
 hud_destroy(struct hud_context *hud)
 {
diff --git a/src/gallium/auxiliary/indices/u_indices.c b/src/gallium/auxiliary/indices/u_indices.c
index 72c46f7..beab13f 100644
--- a/src/gallium/auxiliary/indices/u_indices.c
+++ b/src/gallium/auxiliary/indices/u_indices.c
@@ -22,6 +22,7 @@
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "pipe/p_compiler.h"
 #include "u_indices.h"
 #include "u_indices_priv.h"
 
@@ -39,7 +40,7 @@ static void translate_memcpy_uint( const void *in,
    memcpy(out, in, nr*sizeof(int));
 }
                               
-
+PUBLIC
 int u_index_translator( unsigned hw_mask,
                         unsigned prim,
                         unsigned in_index_size,
@@ -170,6 +171,7 @@ int u_index_translator( unsigned hw_mask,
  * \param out_nr  returns new number of vertices to draw
  * \param out_generate  returns pointer to the generator function
  */
+PUBLIC
 int u_index_generator( unsigned hw_mask,
                        unsigned prim,
                        unsigned start,
diff --git a/src/gallium/auxiliary/indices/u_unfilled_indices.c b/src/gallium/auxiliary/indices/u_unfilled_indices.c
index 25c61d9..6fa8038 100644
--- a/src/gallium/auxiliary/indices/u_unfilled_indices.c
+++ b/src/gallium/auxiliary/indices/u_unfilled_indices.c
@@ -22,6 +22,7 @@
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "pipe/p_compiler.h"
 #include "u_indices.h"
 #include "u_indices_priv.h"
 
@@ -99,7 +100,7 @@ static unsigned nr_lines( unsigned prim,
 }
                               
 
-
+PUBLIC
 int u_unfilled_translator( unsigned prim,
                         unsigned in_index_size,
                         unsigned nr,
@@ -159,6 +160,7 @@ int u_unfilled_translator( unsigned prim,
  * different front/back fill modes, that can be handled with the
  * 'draw' module.
  */
+PUBLIC
 int u_unfilled_generator( unsigned prim,
                           unsigned start,
                           unsigned nr,
diff --git a/src/gallium/auxiliary/os/os_process.c b/src/gallium/auxiliary/os/os_process.c
index 0557689..813b60f 100644
--- a/src/gallium/auxiliary/os/os_process.c
+++ b/src/gallium/auxiliary/os/os_process.c
@@ -25,7 +25,7 @@
  *
  **************************************************************************/
 
-
+#include "pipe/p_compiler.h"
 #include "pipe/p_config.h"
 #include "os/os_process.h"
 #include "util/u_memory.h"
@@ -47,6 +47,7 @@
  * \param size  size of the procname buffer
  * \return  TRUE or FALSE for success, failure
  */
+PUBLIC
 boolean
 os_get_process_name(char *procname, size_t size)
 {
diff --git a/src/gallium/auxiliary/os/os_time.c b/src/gallium/auxiliary/os/os_time.c
index f7e4ca4..aea17d0 100644
--- a/src/gallium/auxiliary/os/os_time.c
+++ b/src/gallium/auxiliary/os/os_time.c
@@ -33,6 +33,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_config.h"
 
 #if defined(PIPE_OS_UNIX)
@@ -47,6 +48,7 @@
 #include "os_time.h"
 
 
+PUBLIC
 int64_t
 os_time_get_nano(void)
 {
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 9e0cace..5baabc8 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -1032,7 +1032,7 @@ fenced_bufmgr_destroy(struct pb_manager *mgr)
    FREE(fenced_mgr);
 }
 
-
+PUBLIC
 struct pb_manager *
 fenced_bufmgr_create(struct pb_manager *provider,
                      struct pb_fence_ops *ops,
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 0e6896a..08e314f 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -384,7 +384,7 @@ pb_cache_manager_destroy(struct pb_manager *mgr)
    FREE(mgr);
 }
 
-
+PUBLIC
 struct pb_manager *
 pb_cache_manager_create(struct pb_manager *provider, 
                      	unsigned usecs) 
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 567303a..75aa172 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -455,7 +455,7 @@ pb_debug_manager_destroy(struct pb_manager *_mgr)
    FREE(mgr);
 }
 
-
+PUBLIC
 struct pb_manager *
 pb_debug_manager_create(struct pb_manager *provider, 
                         pb_size underflow_size, pb_size overflow_size) 
@@ -485,7 +485,7 @@ pb_debug_manager_create(struct pb_manager *provider,
 
 #else /* !DEBUG */
 
-
+PUBLIC
 struct pb_manager *
 pb_debug_manager_create(struct pb_manager *provider, 
                         pb_size underflow_size, pb_size overflow_size) 
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index 453cf45..77db4e6 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -33,6 +33,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 #include "util/u_debug.h"
 #include "os/os_thread.h"
@@ -291,7 +292,7 @@ if(mm->heap)
    return NULL;
 }
 
-
+PUBLIC
 struct pb_manager *
 mm_bufmgr_create(struct pb_manager *provider, 
                  pb_size size, pb_size align2) 
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index bd84b62..dba75a7 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -530,7 +530,7 @@ pb_slab_range_manager_destroy(struct pb_manager *_mgr)
    FREE(mgr);
 }
 
-
+PUBLIC
 struct pb_manager *
 pb_slab_range_manager_create(struct pb_manager *provider,
                              pb_size minBufSize,
diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c b/src/gallium/auxiliary/pipebuffer/pb_validate.c
index b585422..48ec2f5 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_validate.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c
@@ -59,7 +59,7 @@ struct pb_validate
    unsigned size;
 };
 
-
+PUBLIC
 enum pipe_error
 pb_validate_add_buffer(struct pb_validate *vl,
                        struct pb_buffer *buf,
@@ -127,7 +127,7 @@ pb_validate_foreach(struct pb_validate *vl,
    return PIPE_OK;
 }
 
-
+PUBLIC
 enum pipe_error
 pb_validate_validate(struct pb_validate *vl) 
 {
@@ -146,7 +146,7 @@ pb_validate_validate(struct pb_validate *vl)
    return PIPE_OK;
 }
 
-
+PUBLIC
 void
 pb_validate_fence(struct pb_validate *vl,
                   struct pipe_fence_handle *fence)
@@ -159,7 +159,7 @@ pb_validate_fence(struct pb_validate *vl,
    vl->used = 0;
 }
 
-
+PUBLIC
 void
 pb_validate_destroy(struct pb_validate *vl)
 {
@@ -170,7 +170,7 @@ pb_validate_destroy(struct pb_validate *vl)
    FREE(vl);
 }
 
-
+PUBLIC
 struct pb_validate *
 pb_validate_create()
 {
diff --git a/src/gallium/auxiliary/postprocess/pp_celshade.c b/src/gallium/auxiliary/postprocess/pp_celshade.c
index 471ec38..2ced3a9 100644
--- a/src/gallium/auxiliary/postprocess/pp_celshade.c
+++ b/src/gallium/auxiliary/postprocess/pp_celshade.c
@@ -25,11 +25,13 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "postprocess/postprocess.h"
 #include "postprocess/pp_celshade.h"
 #include "postprocess/pp_filters.h"
 
 /** Init function */
+PUBLIC
 bool
 pp_celshade_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
 {
@@ -40,6 +42,7 @@ pp_celshade_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
 }
 
 /** Free function */
+PUBLIC
 void
 pp_celshade_free(struct pp_queue_t *ppq, unsigned int n)
 {
diff --git a/src/gallium/auxiliary/postprocess/pp_colors.c b/src/gallium/auxiliary/postprocess/pp_colors.c
index c30e92e..a810528 100644
--- a/src/gallium/auxiliary/postprocess/pp_colors.c
+++ b/src/gallium/auxiliary/postprocess/pp_colors.c
@@ -25,11 +25,13 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "postprocess/postprocess.h"
 #include "postprocess/pp_colors.h"
 #include "postprocess/pp_filters.h"
 
 /** The run function of the color filters */
+PUBLIC
 void
 pp_nocolor(struct pp_queue_t *ppq, struct pipe_resource *in,
            struct pipe_resource *out, unsigned int n)
@@ -57,6 +59,7 @@ pp_nocolor(struct pp_queue_t *ppq, struct pipe_resource *in,
 
 /* Init functions */
 
+PUBLIC
 bool
 pp_nored_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
 {
@@ -66,7 +69,7 @@ pp_nored_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
    return (ppq->shaders[n][1] != NULL) ? TRUE : FALSE;
 }
 
-
+PUBLIC
 bool
 pp_nogreen_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
 {
@@ -76,7 +79,7 @@ pp_nogreen_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
    return (ppq->shaders[n][1] != NULL) ? TRUE : FALSE;
 }
 
-
+PUBLIC
 bool
 pp_noblue_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
 {
@@ -87,6 +90,7 @@ pp_noblue_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
 }
 
 /* Free functions */
+PUBLIC
 void
 pp_nocolor_free(struct pp_queue_t *ppq, unsigned int n)
 {
diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c
index a49a23d..52019f8 100644
--- a/src/gallium/auxiliary/postprocess/pp_init.c
+++ b/src/gallium/auxiliary/postprocess/pp_init.c
@@ -37,6 +37,7 @@
 #include "cso_cache/cso_context.h"
 
 /** Initialize the post-processing queue. */
+PUBLIC
 struct pp_queue_t *
 pp_init(struct pipe_context *pipe, const unsigned int *enabled,
         struct cso_context *cso)
@@ -164,6 +165,7 @@ pp_free_fbos(struct pp_queue_t *ppq)
  * Free the pp queue. Called on context termination and failure in
  * pp_init.
  */
+PUBLIC
 void
 pp_free(struct pp_queue_t *ppq)
 {
@@ -251,6 +253,7 @@ pp_debug(const char *fmt, ...)
 }
 
 /** Allocate the temp FBOs. Called on makecurrent and resize. */
+PUBLIC
 void
 pp_init_fbos(struct pp_queue_t *ppq, unsigned int w,
              unsigned int h)
diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c
index b299c66..6fa3aaf 100644
--- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
+++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
@@ -308,6 +308,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned int n,
 }
 
 /** Short wrapper to init the depth version. */
+PUBLIC
 bool
 pp_jimenezmlaa_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
 {
@@ -315,6 +316,7 @@ pp_jimenezmlaa_init(struct pp_queue_t *ppq, unsigned int n, unsigned int val)
 }
 
 /** Short wrapper to init the color version. */
+PUBLIC
 bool
 pp_jimenezmlaa_init_color(struct pp_queue_t *ppq, unsigned int n,
                           unsigned int val)
@@ -323,6 +325,7 @@ pp_jimenezmlaa_init_color(struct pp_queue_t *ppq, unsigned int n,
 }
 
 /** Short wrapper to run the depth version. */
+PUBLIC
 void
 pp_jimenezmlaa(struct pp_queue_t *ppq, struct pipe_resource *in,
                struct pipe_resource *out, unsigned int n)
@@ -331,6 +334,7 @@ pp_jimenezmlaa(struct pp_queue_t *ppq, struct pipe_resource *in,
 }
 
 /** Short wrapper to run the color version. */
+PUBLIC
 void
 pp_jimenezmlaa_color(struct pp_queue_t *ppq, struct pipe_resource *in,
                      struct pipe_resource *out, unsigned int n)
@@ -343,6 +347,7 @@ pp_jimenezmlaa_color(struct pp_queue_t *ppq, struct pipe_resource *in,
  * Short wrapper to free the mlaa filter resources. Shaders are freed in
  * the common code in pp_free.
  */
+PUBLIC
 void
 pp_jimenezmlaa_free(struct pp_queue_t *ppq, unsigned int n)
 {
diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c
index 81b538c..d5d5d58 100644
--- a/src/gallium/auxiliary/postprocess/pp_run.c
+++ b/src/gallium/auxiliary/postprocess/pp_run.c
@@ -25,6 +25,8 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
+
 #include "postprocess.h"
 
 #include "postprocess/pp_filters.h"
@@ -78,6 +80,7 @@ pp_blit(struct pipe_context *pipe,
 *	Runs all requested filters in order and handles shuffling the temp
 *	buffers in between.
 */
+PUBLIC
 void
 pp_run(struct pp_queue_t *ppq, struct pipe_resource *in,
        struct pipe_resource *out, struct pipe_resource *indepth)
diff --git a/src/gallium/auxiliary/rbug/rbug_connection.c b/src/gallium/auxiliary/rbug/rbug_connection.c
index 1c578d0..09b856b 100644
--- a/src/gallium/auxiliary/rbug/rbug_connection.c
+++ b/src/gallium/auxiliary/rbug/rbug_connection.c
@@ -22,6 +22,7 @@
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#include "pipe/p_compiler.h"
 #include "rbug.h"
 #include "rbug_internal.h"
 
@@ -41,6 +42,7 @@ struct rbug_connection
  * Result:
  *    A new allocated connection using socket as communication path
  */
+PUBLIC
 struct rbug_connection *
 rbug_from_socket(int socket)
 {
@@ -52,6 +54,7 @@ rbug_from_socket(int socket)
 /**
  * Free a connection, also closes socket.
  */
+PUBLIC
 void
 rbug_disconnect(struct rbug_connection *c)
 {
@@ -66,6 +69,7 @@ rbug_disconnect(struct rbug_connection *c)
  * Result:
  *    demarshaled message on success, NULL on connection error
  */
+PUBLIC
 struct rbug_header *
 rbug_get_message(struct rbug_connection *c, uint32_t *serial)
 {
@@ -115,6 +119,7 @@ rbug_get_message(struct rbug_connection *c, uint32_t *serial)
 /**
  * Frees a message and associated data.
  */
+PUBLIC
 void
 rbug_free_header(struct rbug_header *header)
 {
diff --git a/src/gallium/auxiliary/rbug/rbug_context.c b/src/gallium/auxiliary/rbug/rbug_context.c
index cff5cfd..944ed76 100644
--- a/src/gallium/auxiliary/rbug/rbug_context.c
+++ b/src/gallium/auxiliary/rbug/rbug_context.c
@@ -34,6 +34,7 @@
  * Functions ending with _reply are replies to requests.
  */
 
+#include "pipe/p_compiler.h"
 #include "rbug_internal.h"
 #include "rbug_context.h"
 
@@ -324,6 +325,7 @@ int rbug_send_context_flush(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_context_list_reply(struct rbug_connection *__con,
                                  uint32_t serial,
                                  rbug_context_t *contexts,
@@ -366,6 +368,7 @@ int rbug_send_context_list_reply(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_context_info_reply(struct rbug_connection *__con,
                                  uint32_t serial,
                                  rbug_shader_t vertex,
@@ -427,6 +430,7 @@ int rbug_send_context_info_reply(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_context_draw_blocked(struct rbug_connection *__con,
                                    rbug_context_t context,
                                    rbug_block_t block,
diff --git a/src/gallium/auxiliary/rbug/rbug_core.c b/src/gallium/auxiliary/rbug/rbug_core.c
index 767dd38..3acc688 100644
--- a/src/gallium/auxiliary/rbug/rbug_core.c
+++ b/src/gallium/auxiliary/rbug/rbug_core.c
@@ -34,6 +34,7 @@
  * Functions ending with _reply are replies to requests.
  */
 
+#include "pipe/p_compiler.h"
 #include "rbug_internal.h"
 #include "rbug_core.h"
 
@@ -145,6 +146,7 @@ int rbug_send_error(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_ping_reply(struct rbug_connection *__con,
                          uint32_t serial,
                          uint32_t *__serial)
@@ -183,6 +185,7 @@ int rbug_send_ping_reply(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_error_reply(struct rbug_connection *__con,
                           uint32_t serial,
                           uint32_t error,
diff --git a/src/gallium/auxiliary/rbug/rbug_shader.c b/src/gallium/auxiliary/rbug/rbug_shader.c
index 7765f76..a670698 100644
--- a/src/gallium/auxiliary/rbug/rbug_shader.c
+++ b/src/gallium/auxiliary/rbug/rbug_shader.c
@@ -34,6 +34,7 @@
  * Functions ending with _reply are replies to requests.
  */
 
+#include "pipe/p_compiler.h"
 #include "rbug_internal.h"
 #include "rbug_shader.h"
 
@@ -205,6 +206,7 @@ int rbug_send_shader_replace(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_shader_list_reply(struct rbug_connection *__con,
                                 uint32_t serial,
                                 rbug_shader_t *shaders,
@@ -247,6 +249,7 @@ int rbug_send_shader_list_reply(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_shader_info_reply(struct rbug_connection *__con,
                                 uint32_t serial,
                                 uint32_t *original,
diff --git a/src/gallium/auxiliary/rbug/rbug_texture.c b/src/gallium/auxiliary/rbug/rbug_texture.c
index ca05147..2269ae9 100644
--- a/src/gallium/auxiliary/rbug/rbug_texture.c
+++ b/src/gallium/auxiliary/rbug/rbug_texture.c
@@ -34,6 +34,7 @@
  * Functions ending with _reply are replies to requests.
  */
 
+#include "pipe/p_compiler.h"
 #include "rbug_internal.h"
 #include "rbug_texture.h"
 
@@ -235,6 +236,7 @@ int rbug_send_texture_read(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_texture_list_reply(struct rbug_connection *__con,
                                  uint32_t serial,
                                  rbug_texture_t *textures,
@@ -277,6 +279,7 @@ int rbug_send_texture_list_reply(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_texture_info_reply(struct rbug_connection *__con,
                                  uint32_t serial,
                                  uint32_t target,
@@ -351,6 +354,7 @@ int rbug_send_texture_info_reply(struct rbug_connection *__con,
 	return __ret;
 }
 
+PUBLIC
 int rbug_send_texture_read_reply(struct rbug_connection *__con,
                                  uint32_t serial,
                                  uint32_t format,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index f4add02..b309883 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -25,6 +25,7 @@
  * 
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "pipe/p_format.h"
 #include "pipe/p_shader_tokens.h"
@@ -355,6 +356,7 @@ tgsi_build_declaration_array(unsigned arrayid,
    return da;
 }
 
+PUBLIC
 struct tgsi_full_declaration
 tgsi_default_full_declaration( void )
 {
@@ -602,6 +604,7 @@ tgsi_build_full_immediate(
  * instruction
  */
 
+PUBLIC
 struct tgsi_instruction
 tgsi_default_instruction( void )
 {
@@ -998,6 +1001,7 @@ tgsi_default_full_dst_register( void )
    return full_dst_register;
 }
 
+PUBLIC
 struct tgsi_full_instruction
 tgsi_default_full_instruction( void )
 {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 7f6a3d8..07e7612 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -25,6 +25,7 @@
  * 
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "util/u_string.h"
 #include "util/u_math.h"
@@ -638,6 +639,7 @@ prolog(
    return TRUE;
 }
 
+PUBLIC
 void
 tgsi_dump(
    const struct tgsi_token *tokens,
@@ -692,6 +694,7 @@ str_dump_ctx_printf(struct dump_ctx *ctx, const char *format, ...)
    }
 }
 
+PUBLIC
 void
 tgsi_dump_str(
    const struct tgsi_token *tokens,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 0750a50..f4af133 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -562,7 +562,7 @@ print_temp(const struct tgsi_exec_machine *mach, uint index)
 }
 #endif
 
-
+PUBLIC
 void
 tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach,
                                unsigned num_bufs,
@@ -637,6 +637,7 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst)
  * allocating temporary storage, setting up constants, etc.
  * After this, we can call tgsi_exec_machine_run() many times.
  */
+PUBLIC
 void 
 tgsi_exec_machine_bind_shader(
    struct tgsi_exec_machine *mach,
@@ -806,7 +807,7 @@ tgsi_exec_machine_bind_shader(
    mach->NumInstructions = numInstructions;
 }
 
-
+PUBLIC
 struct tgsi_exec_machine *
 tgsi_exec_machine_create( void )
 {
@@ -859,7 +860,7 @@ fail:
    return NULL;
 }
 
-
+PUBLIC
 void
 tgsi_exec_machine_destroy(struct tgsi_exec_machine *mach)
 {
@@ -4408,6 +4409,7 @@ exec_instruction(
  * Run TGSI interpreter.
  * \return bitmask of "alive" quad components
  */
+PUBLIC
 uint
 tgsi_exec_machine_run( struct tgsi_exec_machine *mach )
 {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 7a5d18f..4d9cffb 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -25,6 +25,7 @@
  * 
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "tgsi_info.h"
@@ -221,6 +222,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
    { 1, 3, 1, 0, 0, 0, OTHR, "TXL2", TGSI_OPCODE_TXL2 },
 };
 
+PUBLIC
 const struct tgsi_opcode_info *
 tgsi_get_opcode_info( uint opcode )
 {
@@ -240,7 +242,7 @@ tgsi_get_opcode_info( uint opcode )
    return NULL;
 }
 
-
+PUBLIC
 const char *
 tgsi_get_opcode_name( uint opcode )
 {
@@ -326,6 +328,7 @@ tgsi_opcode_infer_type( uint opcode )
 /*
  * infer the source type of a TGSI opcode.
  */
+PUBLIC
 enum tgsi_opcode_type
 tgsi_opcode_infer_src_type( uint opcode )
 {
@@ -361,6 +364,7 @@ tgsi_opcode_infer_src_type( uint opcode )
 /*
  * infer the destination type of a TGSI opcode.
  */
+PUBLIC
 enum tgsi_opcode_type
 tgsi_opcode_infer_dst_type( uint opcode )
 {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c
index 70c1cb2..22d02f1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
@@ -25,11 +25,13 @@
  * 
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_parse.h"
 #include "util/u_memory.h"
 
+PUBLIC
 unsigned
 tgsi_parse_init(
    struct tgsi_parse_context *ctx,
@@ -49,12 +51,14 @@ tgsi_parse_init(
    return TGSI_PARSE_OK;
 }
 
+PUBLIC
 void
 tgsi_parse_free(
    struct tgsi_parse_context *ctx )
 {
 }
 
+PUBLIC
 boolean
 tgsi_parse_end_of_tokens(
    struct tgsi_parse_context *ctx )
@@ -89,7 +93,7 @@ next_token(
    ctx->Position++;
 }
 
-
+PUBLIC
 void
 tgsi_parse_token(
    struct tgsi_parse_context *ctx )
@@ -268,6 +272,7 @@ tgsi_parse_token(
 /**
  * Make a new copy of a token array.
  */
+PUBLIC
 struct tgsi_token *
 tgsi_dup_tokens(const struct tgsi_token *tokens)
 {
@@ -283,6 +288,7 @@ tgsi_dup_tokens(const struct tgsi_token *tokens)
 /**
  * Allocate memory for num_tokens tokens.
  */
+PUBLIC
 struct tgsi_token *
 tgsi_alloc_tokens(unsigned num_tokens)
 {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 05b7111..86c8967 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -34,6 +34,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
@@ -50,6 +51,7 @@
  * registers used, special instructions used, etc.
  * \return info  the result of the scan
  */
+PUBLIC
 void
 tgsi_scan_shader(const struct tgsi_token *tokens,
                  struct tgsi_shader_info *info)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c
index 6f244e5..f913be6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -56,7 +56,7 @@ static const char *tgsi_file_names[] =
    "SVIEW"
 };
 
-const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
+PUBLIC const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
 {
    "POSITION",
    "COLOR",
@@ -189,7 +189,7 @@ tgsi_strings_check(void)
    (void) tgsi_fs_coord_pixel_center_names;
 }
 
-
+PUBLIC
 const char *
 tgsi_file_name(unsigned file)
 {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 4c5ae4f..d954872 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -25,6 +25,7 @@
  * 
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "util/u_prim.h"
@@ -1570,6 +1571,7 @@ static boolean translate( struct translate_ctx *ctx )
    return TRUE;
 }
 
+PUBLIC
 boolean
 tgsi_text_translate(
    const char *text,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c
index ae875f2..de2e84d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_transform.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c
@@ -31,6 +31,8 @@
  * Authors:  Brian Paul
  */
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_debug.h"
 
 #include "tgsi_transform.h"
@@ -102,6 +104,7 @@ emit_property(struct tgsi_transform_context *ctx,
  *
  * \return number of tokens emitted
  */
+PUBLIC
 int
 tgsi_transform_shader(const struct tgsi_token *tokens_in,
                       struct tgsi_token *tokens_out,
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 432ed00..d1671d4 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "tgsi/tgsi_ureg.h"
@@ -275,6 +276,7 @@ ureg_dst_register( unsigned file,
 }
 
 
+PUBLIC
 void
 ureg_property_gs_input_prim(struct ureg_program *ureg,
                             unsigned input_prim)
@@ -282,6 +284,7 @@ ureg_property_gs_input_prim(struct ureg_program *ureg,
    ureg->property_gs_input_prim = input_prim;
 }
 
+PUBLIC
 void
 ureg_property_gs_output_prim(struct ureg_program *ureg,
                              unsigned output_prim)
@@ -289,6 +292,7 @@ ureg_property_gs_output_prim(struct ureg_program *ureg,
    ureg->property_gs_output_prim = output_prim;
 }
 
+PUBLIC
 void
 ureg_property_gs_max_vertices(struct ureg_program *ureg,
                               unsigned max_vertices)
@@ -296,6 +300,7 @@ ureg_property_gs_max_vertices(struct ureg_program *ureg,
    ureg->property_gs_max_vertices = max_vertices;
 }
 
+PUBLIC
 void
 ureg_property_fs_coord_origin(struct ureg_program *ureg,
                             unsigned fs_coord_origin)
@@ -303,6 +308,7 @@ ureg_property_fs_coord_origin(struct ureg_program *ureg,
    ureg->property_fs_coord_origin = fs_coord_origin;
 }
 
+PUBLIC
 void
 ureg_property_fs_coord_pixel_center(struct ureg_program *ureg,
                             unsigned fs_coord_pixel_center)
@@ -310,6 +316,7 @@ ureg_property_fs_coord_pixel_center(struct ureg_program *ureg,
    ureg->property_fs_coord_pixel_center = fs_coord_pixel_center;
 }
 
+PUBLIC
 void
 ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg,
                             unsigned fs_color0_writes_all_cbufs)
@@ -317,6 +324,7 @@ ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg,
    ureg->property_fs_color0_writes_all_cbufs = fs_color0_writes_all_cbufs;
 }
 
+PUBLIC
 void
 ureg_property_fs_depth_layout(struct ureg_program *ureg,
                               unsigned fs_depth_layout)
@@ -324,6 +332,7 @@ ureg_property_fs_depth_layout(struct ureg_program *ureg,
    ureg->property_fs_depth_layout = fs_depth_layout;
 }
 
+PUBLIC
 struct ureg_src
 ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg,
                        unsigned semantic_name,
@@ -356,7 +365,7 @@ out:
    return ureg_src_register(TGSI_FILE_INPUT, i);
 }
 
-
+PUBLIC
 struct ureg_src 
 ureg_DECL_vs_input( struct ureg_program *ureg,
                     unsigned index )
@@ -367,7 +376,7 @@ ureg_DECL_vs_input( struct ureg_program *ureg,
    return ureg_src_register( TGSI_FILE_INPUT, index );
 }
 
-
+PUBLIC
 struct ureg_src
 ureg_DECL_gs_input(struct ureg_program *ureg,
                    unsigned index,
@@ -387,7 +396,7 @@ ureg_DECL_gs_input(struct ureg_program *ureg,
    return ureg_src_register(TGSI_FILE_INPUT, index);
 }
 
-
+PUBLIC
 struct ureg_src
 ureg_DECL_system_value(struct ureg_program *ureg,
                        unsigned index,
@@ -439,7 +448,7 @@ out:
    return ureg_dst_register( TGSI_FILE_OUTPUT, i );
 }
 
-
+PUBLIC
 struct ureg_dst 
 ureg_DECL_output( struct ureg_program *ureg,
                   unsigned name,
@@ -459,6 +468,7 @@ ureg_DECL_output( struct ureg_program *ureg,
  * value or manage any constant_buffer contents -- that's the
  * resposibility of the calling code.
  */
+PUBLIC
 void
 ureg_DECL_constant2D(struct ureg_program *ureg,
                      unsigned first,
@@ -483,6 +493,7 @@ ureg_DECL_constant2D(struct ureg_program *ureg,
  * Constant operands declared with this function must be addressed
  * with a one-dimensional index.
  */
+PUBLIC
 struct ureg_src
 ureg_DECL_constant(struct ureg_program *ureg,
                    unsigned index)
@@ -572,16 +583,19 @@ static struct ureg_dst alloc_temporary( struct ureg_program *ureg,
    return ureg_dst_register( TGSI_FILE_TEMPORARY, i );
 }
 
+PUBLIC
 struct ureg_dst ureg_DECL_temporary( struct ureg_program *ureg )
 {
    return alloc_temporary(ureg, FALSE);
 }
 
+PUBLIC
 struct ureg_dst ureg_DECL_local_temporary( struct ureg_program *ureg )
 {
    return alloc_temporary(ureg, TRUE);
 }
 
+PUBLIC
 struct ureg_dst ureg_DECL_array_temporary( struct ureg_program *ureg,
                                            unsigned size,
                                            boolean local )
@@ -608,6 +622,7 @@ struct ureg_dst ureg_DECL_array_temporary( struct ureg_program *ureg,
    return dst;
 }
 
+PUBLIC
 void ureg_release_temporary( struct ureg_program *ureg,
                              struct ureg_dst tmp )
 {
@@ -618,6 +633,7 @@ void ureg_release_temporary( struct ureg_program *ureg,
 
 /* Allocate a new address register.
  */
+PUBLIC
 struct ureg_dst ureg_DECL_address( struct ureg_program *ureg )
 {
    if (ureg->nr_addrs < UREG_MAX_ADDR)
@@ -642,6 +658,7 @@ ureg_DECL_predicate(struct ureg_program *ureg)
 
 /* Allocate a new sampler.
  */
+PUBLIC
 struct ureg_src ureg_DECL_sampler( struct ureg_program *ureg,
                                    unsigned nr )
 {
@@ -792,7 +809,7 @@ out:
                        (swizzle >> 6) & 0x3);
 }
 
-
+PUBLIC
 struct ureg_src
 ureg_DECL_immediate( struct ureg_program *ureg,
                      const float *v,
@@ -811,7 +828,7 @@ ureg_DECL_immediate( struct ureg_program *ureg,
    return decl_immediate(ureg, fu.u, nr, TGSI_IMM_FLOAT32);
 }
 
-
+PUBLIC
 struct ureg_src
 ureg_DECL_immediate_uint( struct ureg_program *ureg,
                           const unsigned *v,
@@ -849,7 +866,7 @@ ureg_DECL_immediate_block_uint( struct ureg_program *ureg,
    return ureg_src_register(TGSI_FILE_IMMEDIATE, index);
 }
 
-
+PUBLIC
 struct ureg_src
 ureg_DECL_immediate_int( struct ureg_program *ureg,
                          const int *v,
@@ -858,7 +875,7 @@ ureg_DECL_immediate_int( struct ureg_program *ureg,
    return decl_immediate(ureg, (const unsigned *)v, nr, TGSI_IMM_INT32);
 }
 
-
+PUBLIC
 void
 ureg_emit_src( struct ureg_program *ureg,
                struct ureg_src src )
@@ -916,7 +933,7 @@ ureg_emit_src( struct ureg_program *ureg,
    assert(n == size);
 }
 
-
+PUBLIC
 void 
 ureg_emit_dst( struct ureg_program *ureg,
                struct ureg_dst dst )
@@ -969,6 +986,7 @@ static void validate( unsigned opcode,
 #endif
 }
 
+PUBLIC
 struct ureg_emit_insn_result
 ureg_emit_insn(struct ureg_program *ureg,
                unsigned opcode,
@@ -1036,6 +1054,7 @@ ureg_emit_label(struct ureg_program *ureg,
 /* Will return a number which can be used in a label to point to the
  * next instruction to be emitted.
  */
+PUBLIC
 unsigned
 ureg_get_instruction_number( struct ureg_program *ureg )
 {
@@ -1045,6 +1064,7 @@ ureg_get_instruction_number( struct ureg_program *ureg )
 /* Patch a given label (expressed as a token number) to point to a
  * given instruction (expressed as an instruction number).
  */
+PUBLIC
 void
 ureg_fixup_label(struct ureg_program *ureg,
                  unsigned label_token,
@@ -1055,7 +1075,7 @@ ureg_fixup_label(struct ureg_program *ureg,
    out->insn_label.Label = instruction_number;
 }
 
-
+PUBLIC
 void
 ureg_emit_texture(struct ureg_program *ureg,
                   unsigned extended_token,
@@ -1086,7 +1106,7 @@ ureg_emit_texture_offset(struct ureg_program *ureg,
    
 }
 
-
+PUBLIC
 void
 ureg_fixup_insn_size(struct ureg_program *ureg,
                      unsigned insn )
@@ -1097,7 +1117,7 @@ ureg_fixup_insn_size(struct ureg_program *ureg,
    out->insn.NrTokens = ureg->domain[DOMAIN_INSN].count - insn - 1;
 }
 
-
+PUBLIC
 void
 ureg_insn(struct ureg_program *ureg,
           unsigned opcode,
@@ -1144,6 +1164,7 @@ ureg_insn(struct ureg_program *ureg,
    ureg_fixup_insn_size( ureg, insn.insn_token );
 }
 
+PUBLIC
 void
 ureg_tex_insn(struct ureg_program *ureg,
               unsigned opcode,
@@ -1198,7 +1219,7 @@ ureg_tex_insn(struct ureg_program *ureg,
    ureg_fixup_insn_size( ureg, insn.insn_token );
 }
 
-
+PUBLIC
 void
 ureg_label_insn(struct ureg_program *ureg,
                 unsigned opcode,
@@ -1645,7 +1666,7 @@ emit_header( struct ureg_program *ureg )
    out[1].processor.Padding = 0;
 }
 
-
+PUBLIC
 const struct tgsi_token *ureg_finalize( struct ureg_program *ureg )
 {
    const struct tgsi_token *tokens;
@@ -1682,7 +1703,7 @@ const struct tgsi_token *ureg_finalize( struct ureg_program *ureg )
    return tokens;
 }
 
-
+PUBLIC
 void *ureg_create_shader( struct ureg_program *ureg,
                           struct pipe_context *pipe,
                           const struct pipe_stream_output_info *so )
@@ -1704,7 +1725,7 @@ void *ureg_create_shader( struct ureg_program *ureg,
       return pipe->create_fs_state( pipe, &state );
 }
 
-
+PUBLIC
 const struct tgsi_token *ureg_get_tokens( struct ureg_program *ureg,
                                           unsigned *nr_tokens )
 {
@@ -1725,13 +1746,13 @@ const struct tgsi_token *ureg_get_tokens( struct ureg_program *ureg,
    return tokens;
 }
 
-
+PUBLIC
 void ureg_free_tokens( const struct tgsi_token *tokens )
 {
    FREE((struct tgsi_token *)tokens);
 }
 
-
+PUBLIC
 struct ureg_program *ureg_create( unsigned processor )
 {
    struct ureg_program *ureg = CALLOC_STRUCT( ureg_program );
@@ -1776,7 +1797,7 @@ ureg_get_nr_outputs( const struct ureg_program *ureg )
    return ureg->nr_outputs;
 }
 
-
+PUBLIC
 void ureg_destroy( struct ureg_program *ureg )
 {
    unsigned i;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c
index b3bc8f2..873dc40 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_util.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_util.c
@@ -25,6 +25,7 @@
  * 
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "pipe/p_shader_tokens.h"
 #include "tgsi_parse.h"
@@ -48,6 +49,7 @@ tgsi_align_128bit(
    return ph.pointer;
 }
 
+PUBLIC
 unsigned
 tgsi_util_get_src_register_swizzle(
    const struct tgsi_src_register *reg,
@@ -68,7 +70,7 @@ tgsi_util_get_src_register_swizzle(
    return 0;
 }
 
-
+PUBLIC
 unsigned
 tgsi_util_get_full_src_register_swizzle(
    const struct tgsi_full_src_register  *reg,
@@ -350,6 +352,7 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
 /**
  * Convert a tgsi_ind_register into a tgsi_src_register
  */
+PUBLIC
 struct tgsi_src_register
 tgsi_util_get_src_from_ind(const struct tgsi_ind_register *reg)
 {
@@ -370,6 +373,7 @@ tgsi_util_get_src_from_ind(const struct tgsi_ind_register *reg)
  * textures), as well as the location of the shadow reference value or the
  * sample index.
  */
+PUBLIC
 int
 tgsi_util_get_texture_coord_dim(int tgsi_tex, int *shadow_or_sample)
 {
diff --git a/src/gallium/auxiliary/translate/translate.c b/src/gallium/auxiliary/translate/translate.c
index 73287b6..0b6441d 100644
--- a/src/gallium/auxiliary/translate/translate.c
+++ b/src/gallium/auxiliary/translate/translate.c
@@ -30,10 +30,12 @@
   *   Keith Whitwell <keith at tungstengraphics.com>
   */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_config.h"
 #include "pipe/p_state.h"
 #include "translate.h"
 
+PUBLIC
 struct translate *translate_create( const struct translate_key *key )
 {
    struct translate *translate = NULL;
diff --git a/src/gallium/auxiliary/util/u_bitmask.c b/src/gallium/auxiliary/util/u_bitmask.c
index 23c93a3..839f74a 100644
--- a/src/gallium/auxiliary/util/u_bitmask.c
+++ b/src/gallium/auxiliary/util/u_bitmask.c
@@ -59,7 +59,7 @@ struct util_bitmask
    unsigned filled;
 };
 
-
+PUBLIC
 struct util_bitmask *
 util_bitmask_create(void)
 {
@@ -155,7 +155,7 @@ util_bitmask_filled_unset(struct util_bitmask *bm,
       bm->filled = index;
 }
 
-
+PUBLIC
 unsigned
 util_bitmask_add(struct util_bitmask *bm)
 {
@@ -219,7 +219,7 @@ util_bitmask_set(struct util_bitmask *bm,
    return index;
 }
 
-
+PUBLIC
 void
 util_bitmask_clear(struct util_bitmask *bm, 
                    unsigned index)
@@ -316,7 +316,7 @@ util_bitmask_get_first_index(struct util_bitmask *bm)
    return util_bitmask_get_next_index(bm, 0);
 }
 
-
+PUBLIC
 void
 util_bitmask_destroy(struct util_bitmask *bm)
 {
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 8cc080c..ac98ccd 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -33,6 +33,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "util/u_debug.h"
 #include "pipe/p_defines.h"
@@ -86,6 +87,7 @@ struct blit_state
  * Create state object for blit.
  * Intended to be created once and re-used for many blit() calls.
  */
+PUBLIC
 struct blit_state *
 util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
 {
@@ -162,6 +164,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
 /**
  * Destroy a blit context
  */
+PUBLIC
 void
 util_destroy_blit(struct blit_state *ctx)
 {
@@ -816,6 +819,7 @@ util_blit_pixels(struct blit_state *ctx,
  * mipmap level to use.
  * XXX need some control over blitting Z and/or stencil.
  */
+PUBLIC
 void
 util_blit_pixels_tex(struct blit_state *ctx,
                      struct pipe_sampler_view *src_sampler_view,
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index be839d4..a779c86 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -32,6 +32,7 @@
  * @author Marek Olšák
  */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
@@ -131,6 +132,7 @@ static struct pipe_surface *
 util_blitter_get_next_surface_layer(struct pipe_context *pipe,
                                     struct pipe_surface *surf);
 
+PUBLIC
 struct blitter_context *util_blitter_create(struct pipe_context *pipe)
 {
    struct blitter_context_priv *ctx;
@@ -319,6 +321,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
    return &ctx->base;
 }
 
+PUBLIC
 void util_blitter_destroy(struct blitter_context *blitter)
 {
    struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
@@ -370,6 +373,7 @@ void util_blitter_destroy(struct blitter_context *blitter)
    FREE(ctx);
 }
 
+PUBLIC
 void util_blitter_set_texture_multisample(struct blitter_context *blitter,
                                           boolean supported)
 {
@@ -858,6 +862,7 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
    }
 }
 
+PUBLIC
 void util_blitter_cache_all_shaders(struct blitter_context *blitter)
 {
    struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
@@ -928,6 +933,7 @@ static void blitter_draw(struct blitter_context_priv *ctx,
    pipe_resource_reference(&buf, NULL);
 }
 
+PUBLIC
 void util_blitter_draw_rectangle(struct blitter_context *blitter,
                                  int x1, int y1, int x2, int y2, float depth,
                                  enum blitter_attrib_type type,
@@ -1005,6 +1011,7 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
    blitter_unset_running_flag(ctx);
 }
 
+PUBLIC
 void util_blitter_clear(struct blitter_context *blitter,
                         unsigned width, unsigned height,
                         unsigned clear_buffers,
@@ -1016,6 +1023,7 @@ void util_blitter_clear(struct blitter_context *blitter,
                              NULL, NULL);
 }
 
+PUBLIC
 void util_blitter_custom_clear_depth(struct blitter_context *blitter,
                                      unsigned width, unsigned height,
                                      double depth, void *custom_dsa)
@@ -1025,6 +1033,7 @@ void util_blitter_custom_clear_depth(struct blitter_context *blitter,
                               NULL, custom_dsa);
 }
 
+PUBLIC
 void util_blitter_default_dst_texture(struct pipe_surface *dst_templ,
                                       struct pipe_resource *dst,
                                       unsigned dstlevel,
@@ -1052,6 +1061,7 @@ util_blitter_get_next_surface_layer(struct pipe_context *pipe,
    return pipe->create_surface(pipe, surf->texture, &dst_templ);
 }
 
+PUBLIC
 void util_blitter_default_src_texture(struct pipe_sampler_view *src_templ,
                                       struct pipe_resource *src,
                                       unsigned srclevel)
@@ -1133,6 +1143,7 @@ static boolean is_blit_generic_supported(struct blitter_context *blitter,
    return TRUE;
 }
 
+PUBLIC
 boolean util_blitter_is_copy_supported(struct blitter_context *blitter,
                                        const struct pipe_resource *dst,
                                        const struct pipe_resource *src,
@@ -1142,6 +1153,7 @@ boolean util_blitter_is_copy_supported(struct blitter_context *blitter,
                                     src, src->format, mask);
 }
 
+PUBLIC
 boolean util_blitter_is_blit_supported(struct blitter_context *blitter,
 				       const struct pipe_blit_info *info)
 {
@@ -1151,6 +1163,7 @@ boolean util_blitter_is_blit_supported(struct blitter_context *blitter,
                                     info->mask);
 }
 
+PUBLIC
 void util_blitter_copy_texture(struct blitter_context *blitter,
                                struct pipe_resource *dst,
                                unsigned dst_level,
@@ -1190,6 +1203,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
    pipe_sampler_view_reference(&src_view, NULL);
 }
 
+PUBLIC
 void util_blitter_blit_generic(struct blitter_context *blitter,
                                struct pipe_surface *dst,
                                const struct pipe_box *dstbox,
@@ -1435,6 +1449,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
    blitter_unset_running_flag(ctx);
 }
 
+PUBLIC
 void
 util_blitter_blit(struct blitter_context *blitter,
 		  const struct pipe_blit_info *info)
@@ -1468,6 +1483,7 @@ util_blitter_blit(struct blitter_context *blitter,
 }
 
 /* Clear a region of a color surface to a constant value. */
+PUBLIC
 void util_blitter_clear_render_target(struct blitter_context *blitter,
                                       struct pipe_surface *dstsurf,
                                       const union pipe_color_union *color,
@@ -1517,6 +1533,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
 }
 
 /* Clear a region of a depth stencil surface. */
+PUBLIC
 void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
                                       struct pipe_surface *dstsurf,
                                       unsigned clear_flags,
@@ -1586,6 +1603,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
 }
 
 /* draw a rectangle across a region using a custom dsa stage - for r600g */
+PUBLIC
 void util_blitter_custom_depth_stencil(struct blitter_context *blitter,
 				       struct pipe_surface *zsurf,
 				       struct pipe_surface *cbsurf,
@@ -1641,6 +1659,7 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter,
    blitter_unset_running_flag(ctx);
 }
 
+PUBLIC
 void util_blitter_copy_buffer(struct blitter_context *blitter,
                               struct pipe_resource *dst,
                               unsigned dstx,
@@ -1703,6 +1722,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
    pipe_so_target_reference(&so_target, NULL);
 }
 
+PUBLIC
 void util_blitter_clear_buffer(struct blitter_context *blitter,
                                struct pipe_resource *dst,
                                unsigned offset, unsigned size,
@@ -1764,6 +1784,7 @@ void util_blitter_clear_buffer(struct blitter_context *blitter,
 }
 
 /* probably radeon specific */
+PUBLIC
 void util_blitter_custom_resolve_color(struct blitter_context *blitter,
 				       struct pipe_resource *dst,
 				       unsigned dst_level,
@@ -1828,6 +1849,7 @@ void util_blitter_custom_resolve_color(struct blitter_context *blitter,
    pipe_surface_reference(&dstsurf, NULL);
 }
 
+PUBLIC
 void util_blitter_custom_color(struct blitter_context *blitter,
                                struct pipe_surface *dstsurf,
                                void *custom_blend)
diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c
index d2d1313..2c6cf68 100644
--- a/src/gallium/auxiliary/util/u_cpu_detect.c
+++ b/src/gallium/auxiliary/util/u_cpu_detect.c
@@ -32,6 +32,7 @@
  * @author Based on the work of Eric Anholt <anholt at FreeBSD.org>
  */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_config.h"
 
 #include "u_debug.h"
@@ -78,6 +79,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(dump_cpu, "GALLIUM_DUMP_CPU", FALSE)
 #endif
 
 
+PUBLIC
 struct util_cpu_caps util_cpu_caps;
 
 #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
@@ -295,6 +297,7 @@ static INLINE boolean sse2_has_daz(void)
 
 #endif /* X86 or X86_64 */
 
+PUBLIC
 void
 util_cpu_detect(void)
 {
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index f4670f2..7cc3264 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -46,6 +46,7 @@
 #include <limits.h> /* CHAR_BIT */
 #include <ctype.h> /* isalnum */
 
+PUBLIC
 void _debug_vprintf(const char *format, va_list ap)
 {
    static char buf[4096] = {'\0'};
@@ -100,6 +101,7 @@ debug_get_option_should_print(void)
    return value;
 }
 
+PUBLIC
 const char *
 debug_get_option(const char *name, const char *dfault)
 {
@@ -115,6 +117,7 @@ debug_get_option(const char *name, const char *dfault)
    return result;
 }
 
+PUBLIC
 boolean
 debug_get_bool_option(const char *name, boolean dfault)
 {
@@ -146,7 +149,7 @@ debug_get_bool_option(const char *name, boolean dfault)
    return result;
 }
 
-
+PUBLIC
 long
 debug_get_num_option(const char *name, long dfault)
 {
@@ -224,6 +227,7 @@ static boolean str_has_option(const char *str, const char *name)
    return FALSE;
 }
 
+PUBLIC
 unsigned long
 debug_get_flags_option(const char *name, 
                        const struct debug_named_value *flags,
@@ -268,6 +272,7 @@ debug_get_flags_option(const char *name,
 }
 
 
+PUBLIC
 void _debug_assert_fail(const char *expr, 
                         const char *file, 
                         unsigned line, 
@@ -366,6 +371,7 @@ debug_dump_flags(const struct debug_named_value *names,
 
 
 #ifdef DEBUG
+PUBLIC
 void debug_print_format(const char *msg, unsigned fmt )
 {
    debug_printf("%s: %s\n", msg, util_format_name(fmt));
@@ -394,7 +400,7 @@ static const struct debug_named_value pipe_prim_names[] = {
    DEBUG_NAMED_VALUE_END
 };
 
-
+PUBLIC
 const char *u_prim_name( unsigned prim )
 {
    return debug_dump_enum(pipe_prim_names, prim);
diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c
index df73ed8..b92b66e 100644
--- a/src/gallium/auxiliary/util/u_debug_describe.c
+++ b/src/gallium/auxiliary/util/u_debug_describe.c
@@ -24,17 +24,20 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_state.h"
 #include "util/u_format.h"
 #include "util/u_debug_describe.h"
 #include "util/u_string.h"
 
+PUBLIC
 void
 debug_describe_reference(char* buf, const struct pipe_reference*ptr)
 {
    strcpy(buf, "pipe_object");
 }
 
+PUBLIC
 void
 debug_describe_resource(char* buf, const struct pipe_resource *ptr)
 {
@@ -64,6 +67,7 @@ debug_describe_resource(char* buf, const struct pipe_resource *ptr)
    }
 }
 
+PUBLIC
 void
 debug_describe_surface(char* buf, const struct pipe_surface *ptr)
 {
@@ -72,6 +76,7 @@ debug_describe_surface(char* buf, const struct pipe_surface *ptr)
    util_sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->u.tex.level, ptr->u.tex.first_layer, ptr->u.tex.last_layer);
 }
 
+PUBLIC
 void
 debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr)
 {
@@ -80,6 +85,7 @@ debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr)
    util_sprintf(buf, "pipe_sampler_view<%s,%s>", res, util_format_short_name(ptr->format));
 }
 
+PUBLIC
 void
 debug_describe_so_target(char* buf,
                          const struct pipe_stream_output_target *ptr)
diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c
index a51b4c5..17ef81e 100644
--- a/src/gallium/auxiliary/util/u_debug_refcnt.c
+++ b/src/gallium/auxiliary/util/u_debug_refcnt.c
@@ -32,6 +32,7 @@
 
 #include <stdio.h>
 
+#include "pipe/p_compiler.h"
 #include "util/u_debug.h"
 #include "util/u_debug_refcnt.h"
 #include "util/u_debug_stack.h"
@@ -40,6 +41,7 @@
 #include "util/u_hash_table.h"
 #include "os/os_thread.h"
 
+PUBLIC
 int debug_refcnt_state;
 
 FILE* stream;
@@ -122,6 +124,7 @@ static void dump_stack(const char* symbols[STACK_LEN])
    fprintf(stream, "\n");
 }
 
+PUBLIC
 void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change)
 {
    if(debug_refcnt_state < 0)
diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c
index 68961d3..653ec41 100644
--- a/src/gallium/auxiliary/util/u_debug_stack.c
+++ b/src/gallium/auxiliary/util/u_debug_stack.c
@@ -32,6 +32,7 @@
  * @author Jose Fonseca <jfonseca at vmware.com>
  */
 
+#include "pipe/p_compiler.h"
 #include "u_debug.h"
 #include "u_debug_symbol.h"
 #include "u_debug_stack.h"
@@ -47,6 +48,7 @@
  * NOTE: The implementation of this function is quite big, but it is important not to
  * break it down in smaller functions to avoid adding new frames to the calling stack.
  */
+PUBLIC
 void
 debug_backtrace_capture(struct debug_stack_frame *backtrace,
                         unsigned start_frame, 
@@ -145,7 +147,7 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
    }
 }
    
-
+PUBLIC
 void
 debug_backtrace_dump(const struct debug_stack_frame *backtrace, 
                      unsigned nr_frames)
diff --git a/src/gallium/auxiliary/util/u_dl.c b/src/gallium/auxiliary/util/u_dl.c
index aca435d..59f42a7 100644
--- a/src/gallium/auxiliary/util/u_dl.c
+++ b/src/gallium/auxiliary/util/u_dl.c
@@ -41,6 +41,7 @@
 #include "u_pointer.h"
 
 
+PUBLIC
 struct util_dl_library *
 util_dl_open(const char *filename)
 {
@@ -54,6 +55,7 @@ util_dl_open(const char *filename)
 }
 
 
+PUBLIC
 util_dl_proc
 util_dl_get_proc_address(struct util_dl_library *library,
                          const char *procname)
@@ -67,7 +69,7 @@ util_dl_get_proc_address(struct util_dl_library *library,
 #endif
 }
 
-
+PUBLIC
 void
 util_dl_close(struct util_dl_library *library)
 {
diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c
index 3fe324a..55ba3b8 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.c
+++ b/src/gallium/auxiliary/util/u_draw_quad.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
@@ -38,6 +39,7 @@
  * Draw a simple vertex buffer / primitive.
  * Limited to float[4] vertex attribs, tightly packed.
  */
+PUBLIC
 void 
 util_draw_vertex_buffer(struct pipe_context *pipe,
                         struct cso_context *cso,
@@ -74,6 +76,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
  * Draw a simple vertex buffer / primitive.
  * Limited to float[4] vertex attribs, tightly packed.
  */
+PUBLIC
 void
 util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer,
                              uint prim_type, uint num_verts, uint num_attribs)
diff --git a/src/gallium/auxiliary/util/u_dump_defines.c b/src/gallium/auxiliary/util/u_dump_defines.c
index cc62687..cfcd330 100644
--- a/src/gallium/auxiliary/util/u_dump_defines.c
+++ b/src/gallium/auxiliary/util/u_dump_defines.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
 #include "util/u_memory.h"
 #include "util/u_debug.h" 
 #include "util/u_dump.h"
@@ -63,6 +64,7 @@ util_dump_enum_continuous(unsigned value,
 
 
 #define DEFINE_UTIL_DUMP_CONTINUOUS(_name) \
+   PUBLIC \
    const char * \
    util_dump_##_name(unsigned value, boolean shortened) \
    { \
@@ -299,6 +301,7 @@ util_dump_tex_target_short_names[] = {
    "cube_array",
 };
 
+PUBLIC
 DEFINE_UTIL_DUMP_CONTINUOUS_COUNT(tex_target, PIPE_MAX_TEXTURE_TYPES)
 
 
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index 12f1d2d..ff53476 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -711,7 +711,7 @@ util_dump_vertex_buffer(FILE *stream, const struct pipe_vertex_buffer *state)
    util_dump_struct_end(stream);
 }
 
-
+PUBLIC
 void
 util_dump_vertex_element(FILE *stream, const struct pipe_vertex_element *state)
 {
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index 08ef6ab..2a5af9f 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -38,9 +38,11 @@
 #include "u_format.h"
 #include "u_format_s3tc.h"
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 
 
+PUBLIC
 boolean
 util_format_is_float(enum pipe_format format)
 {
@@ -62,6 +64,7 @@ util_format_is_float(enum pipe_format format)
 
 
 /** Test if the format contains RGB, but not alpha */
+PUBLIC
 boolean
 util_format_has_alpha(enum pipe_format format)
 {
@@ -73,7 +76,7 @@ util_format_has_alpha(enum pipe_format format)
           desc->swizzle[3] != UTIL_FORMAT_SWIZZLE_1;
 }
 
-
+PUBLIC
 boolean
 util_format_is_luminance(enum pipe_format format)
 {
@@ -91,6 +94,7 @@ util_format_is_luminance(enum pipe_format format)
    return FALSE;
 }
 
+PUBLIC
 boolean
 util_format_is_pure_integer(enum pipe_format format)
 {
@@ -105,6 +109,7 @@ util_format_is_pure_integer(enum pipe_format format)
    return desc->channel[i].pure_integer ? TRUE : FALSE;
 }
 
+PUBLIC
 boolean
 util_format_is_pure_sint(enum pipe_format format)
 {
@@ -118,6 +123,7 @@ util_format_is_pure_sint(enum pipe_format format)
    return (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED && desc->channel[i].pure_integer) ? TRUE : FALSE;
 }
 
+PUBLIC
 boolean
 util_format_is_pure_uint(enum pipe_format format)
 {
@@ -134,6 +140,7 @@ util_format_is_pure_uint(enum pipe_format format)
 /**
  * Returns true if all non-void channels are normalized signed.
  */
+PUBLIC
 boolean
 util_format_is_snorm(enum pipe_format format)
 {
@@ -152,6 +159,7 @@ util_format_is_snorm(enum pipe_format format)
           desc->channel[i].normalized;
 }
 
+PUBLIC
 boolean
 util_format_is_luminance_alpha(enum pipe_format format)
 {
@@ -169,7 +177,7 @@ util_format_is_luminance_alpha(enum pipe_format format)
    return FALSE;
 }
 
-
+PUBLIC
 boolean
 util_format_is_intensity(enum pipe_format format)
 {
@@ -187,7 +195,7 @@ util_format_is_intensity(enum pipe_format format)
    return FALSE;
 }
 
-
+PUBLIC
 boolean
 util_format_is_supported(enum pipe_format format, unsigned bind)
 {
@@ -207,7 +215,7 @@ util_format_is_supported(enum pipe_format format, unsigned bind)
    return TRUE;
 }
 
-
+PUBLIC
 void
 util_format_read_4f(enum pipe_format format,
                     float *dst, unsigned dst_stride,
@@ -229,7 +237,7 @@ util_format_read_4f(enum pipe_format format,
    format_desc->unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h);
 }
 
-
+PUBLIC
 void
 util_format_write_4f(enum pipe_format format,
                      const float *src, unsigned src_stride,
@@ -270,7 +278,7 @@ util_format_read_4ub(enum pipe_format format, uint8_t *dst, unsigned dst_stride,
    format_desc->unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
 }
 
-
+PUBLIC
 void
 util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_stride, void *dst, unsigned dst_stride, unsigned x, unsigned y, unsigned w, unsigned h)
 {
@@ -310,6 +318,7 @@ util_format_read_4ui(enum pipe_format format,
    format_desc->unpack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, h);
 }
 
+PUBLIC
 void
 util_format_write_4ui(enum pipe_format format,
                       const unsigned int *src, unsigned src_stride,
@@ -352,6 +361,7 @@ util_format_read_4i(enum pipe_format format,
    format_desc->unpack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
 }
 
+PUBLIC
 void
 util_format_write_4i(enum pipe_format format,
                       const int *src, unsigned src_stride,
@@ -373,6 +383,7 @@ util_format_write_4i(enum pipe_format format,
    format_desc->pack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
 }
 
+PUBLIC
 boolean
 util_is_format_compatible(const struct util_format_description *src_desc,
                           const struct util_format_description *dst_desc)
@@ -640,6 +651,7 @@ util_format_translate(enum pipe_format dst_format,
    }
 }
 
+PUBLIC
 void util_format_compose_swizzles(const unsigned char swz1[4],
                                   const unsigned char swz2[4],
                                   unsigned char dst[4])
@@ -652,6 +664,7 @@ void util_format_compose_swizzles(const unsigned char swz1[4],
    }
 }
 
+PUBLIC
 void util_format_apply_color_swizzle(union pipe_color_union *dst,
                                      const union pipe_color_union *src,
                                      const unsigned char swz[4],
@@ -701,6 +714,7 @@ void util_format_swizzle_4f(float *dst, const float *src,
    }
 }
 
+PUBLIC
 void util_format_unswizzle_4f(float *dst, const float *src,
                               const unsigned char swz[4])
 {
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 28527f5..99538b9 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -411,7 +411,7 @@ struct util_format_description
 extern const struct util_format_description 
 util_format_description_table[];
 
-
+PUBLIC
 const struct util_format_description *
 util_format_description(enum pipe_format format);
 
diff --git a/src/gallium/auxiliary/util/u_format_etc.c b/src/gallium/auxiliary/util/u_format_etc.c
index f909b16..0f99534 100644
--- a/src/gallium/auxiliary/util/u_format_etc.c
+++ b/src/gallium/auxiliary/util/u_format_etc.c
@@ -10,6 +10,7 @@
 #undef TAG
 #undef UINT8_TYPE
 
+PUBLIC
 void
 util_format_etc1_rgb8_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c
index 11b4602..dbae012 100644
--- a/src/gallium/auxiliary/util/u_format_s3tc.c
+++ b/src/gallium/auxiliary/util/u_format_s3tc.c
@@ -23,6 +23,7 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "u_dl.h"
 #include "u_math.h"
 #include "u_format.h"
@@ -91,6 +92,7 @@ util_format_dxtn_pack_stub(int src_comps,
 }
 
 
+PUBLIC
 boolean util_format_s3tc_enabled = FALSE;
 
 util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = util_format_dxt1_rgb_fetch_stub;
@@ -100,7 +102,7 @@ util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = util_format_dxt5_rgba_fet
 
 util_format_dxtn_pack_t util_format_dxtn_pack = util_format_dxtn_pack_stub;
 
-
+PUBLIC
 void
 util_format_s3tc_init(void)
 {
diff --git a/src/gallium/auxiliary/util/u_format_srgb.py b/src/gallium/auxiliary/util/u_format_srgb.py
index c6c02f0..b2bfabe 100644
--- a/src/gallium/auxiliary/util/u_format_srgb.py
+++ b/src/gallium/auxiliary/util/u_format_srgb.py
@@ -129,6 +129,7 @@ def generate_srgb_tables():
 
         valtable.append((int_a << 16) + int_b)
 
+    print 'PUBLIC'
     print 'const unsigned'
     print 'util_format_linear_to_srgb_helper_table[104] = {'
 
@@ -146,6 +147,7 @@ def main():
     # This will print the copyright message on the top of this file
     print CopyRight.strip()
     print
+    print '#include "pipe/p_compiler.h"'
     print '#include "u_format_srgb.h"'
     print
     generate_srgb_tables()    
diff --git a/src/gallium/auxiliary/util/u_framebuffer.c b/src/gallium/auxiliary/util/u_framebuffer.c
index 7803ec6..b91384a 100644
--- a/src/gallium/auxiliary/util/u_framebuffer.c
+++ b/src/gallium/auxiliary/util/u_framebuffer.c
@@ -32,6 +32,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
@@ -45,6 +46,7 @@
  * Compare pipe_framebuffer_state objects.
  * \return TRUE if same, FALSE if different
  */
+PUBLIC
 boolean
 util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst,
                              const struct pipe_framebuffer_state *src)
@@ -76,6 +78,7 @@ util_framebuffer_state_equal(const struct pipe_framebuffer_state *dst,
 /**
  * Copy framebuffer state from src to dst, updating refcounts.
  */
+PUBLIC
 void
 util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
                             const struct pipe_framebuffer_state *src)
@@ -96,7 +99,7 @@ util_copy_framebuffer_state(struct pipe_framebuffer_state *dst,
    pipe_surface_reference(&dst->zsbuf, src->zsbuf);
 }
 
-
+PUBLIC
 void
 util_unreference_framebuffer_state(struct pipe_framebuffer_state *fb)
 {
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index a885f2b..3b3f647 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -34,6 +34,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "util/u_debug.h"
 #include "pipe/p_defines.h"
@@ -1242,6 +1243,7 @@ fallback_gen_mipmap(struct gen_mipmap_state *ctx,
  * The idea is to create one of these and re-use it each time we need to
  * generate a mipmap.
  */
+PUBLIC
 struct gen_mipmap_state *
 util_create_gen_mipmap(struct pipe_context *pipe,
                        struct cso_context *cso)
@@ -1460,6 +1462,7 @@ set_vertex_data(struct gen_mipmap_state *ctx,
 /**
  * Destroy a mipmap generation context
  */
+PUBLIC
 void
 util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
 {
@@ -1494,6 +1497,7 @@ util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
  * \param filter  the minification filter used to generate mipmap levels with
  * \param filter  one of PIPE_TEX_FILTER_LINEAR, PIPE_TEX_FILTER_NEAREST
  */
+PUBLIC
 void
 util_gen_mipmap(struct gen_mipmap_state *ctx,
                 struct pipe_sampler_view *psv,
diff --git a/src/gallium/auxiliary/util/u_handle_table.c b/src/gallium/auxiliary/util/u_handle_table.c
index 3703718..e8b1153 100644
--- a/src/gallium/auxiliary/util/u_handle_table.c
+++ b/src/gallium/auxiliary/util/u_handle_table.c
@@ -57,7 +57,7 @@ struct handle_table
    void (*destroy)(void *object);
 };
 
-
+PUBLIC
 struct handle_table *
 handle_table_create(void)
 {
@@ -147,7 +147,7 @@ handle_table_clear(struct handle_table *ht,
    }   
 }
 
-
+PUBLIC
 unsigned
 handle_table_add(struct handle_table *ht, 
                  void *object)
@@ -215,7 +215,7 @@ handle_table_set(struct handle_table *ht,
    return handle;
 }
 
-
+PUBLIC
 void *
 handle_table_get(struct handle_table *ht, 
                  unsigned handle)
@@ -232,7 +232,7 @@ handle_table_get(struct handle_table *ht,
    return object;
 }
 
-
+PUBLIC
 void
 handle_table_remove(struct handle_table *ht, 
                     unsigned handle)
@@ -271,14 +271,14 @@ handle_table_get_next_handle(struct handle_table *ht,
    return 0;
 }
 
-
+PUBLIC
 unsigned
 handle_table_get_first_handle(struct handle_table *ht)
 {
    return handle_table_get_next_handle(ht, 0);
 }
 
-
+PUBLIC
 void
 handle_table_destroy(struct handle_table *ht)
 {
diff --git a/src/gallium/auxiliary/util/u_hash.c b/src/gallium/auxiliary/util/u_hash.c
index b67653e..971e48f 100644
--- a/src/gallium/auxiliary/util/u_hash.c
+++ b/src/gallium/auxiliary/util/u_hash.c
@@ -33,6 +33,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "u_hash.h"
 
 
@@ -108,6 +109,7 @@ util_crc32_table[256] = {
 /**
  * @sa http://www.w3.org/TR/PNG/#D-CRCAppendix
  */
+PUBLIC
 uint32_t
 util_hash_crc32(const void *data, size_t size)
 {
diff --git a/src/gallium/auxiliary/util/u_hash_table.c b/src/gallium/auxiliary/util/u_hash_table.c
index 5604e3a..43624c8 100644
--- a/src/gallium/auxiliary/util/u_hash_table.c
+++ b/src/gallium/auxiliary/util/u_hash_table.c
@@ -74,7 +74,7 @@ util_hash_table_item(struct cso_hash_iter iter)
    return (struct util_hash_table_item *)cso_hash_iter_data(iter);
 }
 
-
+PUBLIC
 struct util_hash_table *
 util_hash_table_create(unsigned (*hash)(void *key),
                        int (*compare)(void *key1, void *key2))
@@ -137,7 +137,7 @@ util_hash_table_find_item(struct util_hash_table *ht,
    return NULL;
 }
 
-
+PUBLIC
 enum pipe_error
 util_hash_table_set(struct util_hash_table *ht,
                     void *key,
@@ -176,7 +176,7 @@ util_hash_table_set(struct util_hash_table *ht,
    return PIPE_OK;
 }
 
-
+PUBLIC
 void *
 util_hash_table_get(struct util_hash_table *ht,
                     void *key)
@@ -197,7 +197,7 @@ util_hash_table_get(struct util_hash_table *ht,
    return item->value;
 }
 
-
+PUBLIC
 void
 util_hash_table_remove(struct util_hash_table *ht,
                        void *key)
@@ -242,7 +242,7 @@ util_hash_table_clear(struct util_hash_table *ht)
    }
 }
 
-
+PUBLIC
 enum pipe_error
 util_hash_table_foreach(struct util_hash_table *ht,
                      enum pipe_error (*callback)
@@ -269,7 +269,7 @@ util_hash_table_foreach(struct util_hash_table *ht,
    return PIPE_OK;
 }
 
-
+PUBLIC
 void
 util_hash_table_destroy(struct util_hash_table *ht)
 {
diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c
index ac1edcd..0dcba67 100644
--- a/src/gallium/auxiliary/util/u_helpers.c
+++ b/src/gallium/auxiliary/util/u_helpers.c
@@ -25,6 +25,7 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
 
@@ -37,6 +38,7 @@
  *
  * \sa util_copy_framebuffer_state
  */
+PUBLIC
 void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst,
                                   uint32_t *enabled_buffers,
                                   const struct pipe_vertex_buffer *src,
@@ -76,6 +78,7 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst,
  * Same as util_set_vertex_buffers_mask, but it only returns the number
  * of bound buffers.
  */
+PUBLIC
 void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst,
                                    unsigned *dst_count,
                                    const struct pipe_vertex_buffer *src,
diff --git a/src/gallium/auxiliary/util/u_index_modify.c b/src/gallium/auxiliary/util/u_index_modify.c
index 5e3fd46..b5d8a7d 100644
--- a/src/gallium/auxiliary/util/u_index_modify.c
+++ b/src/gallium/auxiliary/util/u_index_modify.c
@@ -20,12 +20,14 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "util/u_index_modify.h"
 #include "util/u_inlines.h"
 
 /* Ubyte indices. */
 
+PUBLIC
 void util_shorten_ubyte_elts_to_userptr(struct pipe_context *context,
 					struct pipe_index_buffer *ib,
 					int index_bias,
@@ -87,6 +89,7 @@ void util_shorten_ubyte_elts(struct pipe_context *context,
 
 /* Ushort indices. */
 
+PUBLIC
 void util_rebuild_ushort_elts_to_userptr(struct pipe_context *context,
 					 struct pipe_index_buffer *ib,
 					 int index_bias,
@@ -146,6 +149,7 @@ void util_rebuild_ushort_elts(struct pipe_context *context,
 
 /* Uint indices. */
 
+PUBLIC
 void util_rebuild_uint_elts_to_userptr(struct pipe_context *context,
 				       struct pipe_index_buffer *ib,
 				       int index_bias,
diff --git a/src/gallium/auxiliary/util/u_math.c b/src/gallium/auxiliary/util/u_math.c
index 6981ee9..803b818 100644
--- a/src/gallium/auxiliary/util/u_math.c
+++ b/src/gallium/auxiliary/util/u_math.c
@@ -27,6 +27,7 @@
 
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_config.h"
 #include "util/u_math.h"
 #include "util/u_cpu_detect.h"
@@ -53,6 +54,7 @@ init_pow2_table(void)
 
 
 /** log2(x), for x in [1.0, 2.0) */
+PUBLIC
 float log2_table[LOG2_TABLE_SIZE];
 
 
@@ -68,6 +70,7 @@ init_log2_table(void)
 /**
  * One time init for math utilities.
  */
+PUBLIC
 void
 util_init_math(void)
 {
@@ -84,6 +87,7 @@ util_init_math(void)
  *
  * On platforms without support for it just returns 0.
  */
+PUBLIC
 unsigned
 util_fpstate_get(void)
 {
@@ -104,6 +108,7 @@ util_fpstate_get(void)
  *
  * This is the behavior required by D3D10. OpenGL doesn't care.
  */
+PUBLIC
 unsigned
 util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
 {
@@ -126,6 +131,7 @@ util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
  *
  * On platforms without support for it's a noop.
  */
+PUBLIC
 void
 util_fpstate_set(unsigned mxcsr)
 {
diff --git a/src/gallium/auxiliary/util/u_network.c b/src/gallium/auxiliary/util/u_network.c
index 45b3691..f71f378 100644
--- a/src/gallium/auxiliary/util/u_network.c
+++ b/src/gallium/auxiliary/util/u_network.c
@@ -17,6 +17,7 @@
 #  warning "No socket implementation"
 #endif
 
+PUBLIC
 boolean
 u_socket_init()
 {
@@ -41,6 +42,7 @@ u_socket_init()
 #endif
 }
 
+PUBLIC
 void
 u_socket_stop()
 {
@@ -49,6 +51,7 @@ u_socket_stop()
 #endif
 }
 
+PUBLIC
 void
 u_socket_close(int s)
 {
@@ -67,6 +70,7 @@ u_socket_close(int s)
 #endif
 }
 
+PUBLIC
 int u_socket_accept(int s)
 {
 #if defined(PIPE_HAVE_SOCKETS)
@@ -139,6 +143,7 @@ u_socket_connect(const char *hostname, uint16_t port)
 #endif
 }
 
+PUBLIC
 int
 u_socket_listen_on_port(uint16_t portnum)
 {
@@ -168,6 +173,7 @@ u_socket_listen_on_port(uint16_t portnum)
 #endif
 }
 
+PUBLIC
 void
 u_socket_block(int s, boolean block)
 {
diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c
index 640305f..ef22dc7 100644
--- a/src/gallium/auxiliary/util/u_pstipple.c
+++ b/src/gallium/auxiliary/util/u_pstipple.c
@@ -40,6 +40,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
@@ -99,6 +100,7 @@ util_pstipple_update_stipple_texture(struct pipe_context *pipe,
 /**
  * Create a 32x32 alpha8 texture that encodes the given stipple pattern.
  */
+PUBLIC
 struct pipe_resource *
 util_pstipple_create_stipple_texture(struct pipe_context *pipe,
                                      const uint32_t pattern[32])
@@ -128,6 +130,7 @@ util_pstipple_create_stipple_texture(struct pipe_context *pipe,
 /**
  * Create sampler view to sample the stipple texture.
  */
+PUBLIC
 struct pipe_sampler_view *
 util_pstipple_create_sampler_view(struct pipe_context *pipe,
                                   struct pipe_resource *tex)
@@ -144,6 +147,7 @@ util_pstipple_create_sampler_view(struct pipe_context *pipe,
 /**
  * Create the sampler CSO that'll be used for stippling.
  */
+PUBLIC
 void *
 util_pstipple_create_sampler(struct pipe_context *pipe)
 {
@@ -399,6 +403,7 @@ pstip_transform_inst(struct tgsi_transform_context *ctx,
  * Given a fragment shader, return a new fragment shader which
  * samples a stipple texture and executes KILL.
  */
+PUBLIC
 struct pipe_shader_state *
 util_pstipple_create_fragment_shader(struct pipe_context *pipe,
                                      struct pipe_shader_state *fs,
diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c
index 66caaae..ac71316 100644
--- a/src/gallium/auxiliary/util/u_resource.c
+++ b/src/gallium/auxiliary/util/u_resource.c
@@ -24,6 +24,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
 #include "util/u_format.h"
@@ -34,6 +35,7 @@
 /**
  * Return the size of the resource in bytes.
  */
+PUBLIC
 unsigned
 util_resource_size(const struct pipe_resource *res)
 {
diff --git a/src/gallium/auxiliary/util/u_ringbuffer.c b/src/gallium/auxiliary/util/u_ringbuffer.c
index 648b105..3f6d97a 100644
--- a/src/gallium/auxiliary/util/u_ringbuffer.c
+++ b/src/gallium/auxiliary/util/u_ringbuffer.c
@@ -1,4 +1,5 @@
 
+#include "pipe/p_compiler.h"
 #include "os/os_thread.h"
 #include "pipe/p_defines.h"
 #include "util/u_ringbuffer.h"
@@ -20,7 +21,7 @@ struct util_ringbuffer
    pipe_mutex mutex;
 };
 
-
+PUBLIC
 struct util_ringbuffer *util_ringbuffer_create( unsigned dwords )
 {
    struct util_ringbuffer *ring = CALLOC_STRUCT(util_ringbuffer);
@@ -45,6 +46,7 @@ fail:
    return NULL;
 }
 
+PUBLIC
 void util_ringbuffer_destroy( struct util_ringbuffer *ring )
 {
    pipe_condvar_destroy(ring->change);
@@ -69,6 +71,7 @@ static INLINE boolean util_ringbuffer_empty( const struct util_ringbuffer *ring
    return util_ringbuffer_space(ring) == ring->mask;
 }
 
+PUBLIC
 void util_ringbuffer_enqueue( struct util_ringbuffer *ring,
                               const struct util_packet *packet )
 {
@@ -106,6 +109,7 @@ void util_ringbuffer_enqueue( struct util_ringbuffer *ring,
    pipe_mutex_unlock(ring->mutex);
 }
 
+PUBLIC
 enum pipe_error util_ringbuffer_dequeue( struct util_ringbuffer *ring,
                                          struct util_packet *packet,
                                          unsigned max_dwords,
diff --git a/src/gallium/auxiliary/util/u_sampler.c b/src/gallium/auxiliary/util/u_sampler.c
index 227641b..2cce82a 100644
--- a/src/gallium/auxiliary/util/u_sampler.c
+++ b/src/gallium/auxiliary/util/u_sampler.c
@@ -26,6 +26,7 @@
  **************************************************************************/
 
 
+#include "pipe/p_compiler.h"
 #include "u_format.h"
 #include "u_sampler.h"
 
@@ -84,6 +85,7 @@ default_template(struct pipe_sampler_view *view,
    }
 }
 
+PUBLIC
 void
 u_sampler_view_default_template(struct pipe_sampler_view *view,
                                 const struct pipe_resource *texture,
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c
index c93d754..6edcc0f 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -35,6 +35,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "pipe/p_shader_tokens.h"
 #include "pipe/p_state.h"
@@ -55,6 +56,7 @@
  * \param semantic_names  array of semantic names for each attribute
  * \param semantic_indexes  array of semantic indexes for each attribute
  */
+PUBLIC
 void *
 util_make_vertex_passthrough_shader(struct pipe_context *pipe,
                                     uint num_attribs,
@@ -158,6 +160,7 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe,
  * taken from a texture.
  * \param tex_target  one of PIPE_TEXTURE_x
  */
+PUBLIC
 void *
 util_make_fragment_tex_shader(struct pipe_context *pipe, unsigned tex_target,
                               unsigned interp_mode)
@@ -319,6 +322,7 @@ util_make_fragment_tex_shader_writestencil(struct pipe_context *pipe,
  * Make simple fragment color pass-through shader that replicates OUT[0]
  * to all bound colorbuffers.
  */
+PUBLIC
 void *
 util_make_fragment_passthrough_shader(struct pipe_context *pipe,
                                       int input_semantic,
@@ -370,6 +374,7 @@ util_make_empty_fragment_shader(struct pipe_context *pipe)
 /**
  * Make a fragment shader that copies the input color to N output colors.
  */
+PUBLIC
 void *
 util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs,
                                      int input_semantic,
diff --git a/src/gallium/auxiliary/util/u_slab.c b/src/gallium/auxiliary/util/u_slab.c
index dbdebc6..f501934 100644
--- a/src/gallium/auxiliary/util/u_slab.c
+++ b/src/gallium/auxiliary/util/u_slab.c
@@ -20,6 +20,8 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_slab.h"
 
 #include "util/u_math.h"
@@ -134,6 +136,7 @@ void util_slab_set_thread_safety(struct util_slab_mempool *pool,
    }
 }
 
+PUBLIC
 void util_slab_create(struct util_slab_mempool *pool,
                       unsigned item_size,
                       unsigned num_blocks,
@@ -156,6 +159,7 @@ void util_slab_create(struct util_slab_mempool *pool,
    util_slab_set_thread_safety(pool, threading);
 }
 
+PUBLIC
 void util_slab_destroy(struct util_slab_mempool *pool)
 {
    struct util_slab_page *page, *temp;
diff --git a/src/gallium/auxiliary/util/u_suballoc.c b/src/gallium/auxiliary/util/u_suballoc.c
index efa9a0c..f827c70 100644
--- a/src/gallium/auxiliary/util/u_suballoc.c
+++ b/src/gallium/auxiliary/util/u_suballoc.c
@@ -28,6 +28,7 @@
 
 /* A simple allocator that suballocates memory from a large buffer. */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 #include "pipe/p_context.h"
@@ -57,6 +58,7 @@ struct u_suballocator {
  * \p zero_buffer_memory determines whether the buffer contents should be
  * cleared to 0 after the allocation.
  */
+PUBLIC
 struct u_suballocator *
 u_suballocator_create(struct pipe_context *pipe, unsigned size,
                       unsigned alignment, unsigned bind, unsigned usage,
@@ -75,6 +77,7 @@ u_suballocator_create(struct pipe_context *pipe, unsigned size,
    return allocator;
 }
 
+PUBLIC
 void
 u_suballocator_destroy(struct u_suballocator *allocator)
 {
@@ -82,6 +85,7 @@ u_suballocator_destroy(struct u_suballocator *allocator)
    FREE(allocator);
 }
 
+PUBLIC
 void
 u_suballocator_alloc(struct u_suballocator *allocator, unsigned size,
                      unsigned *out_offset, struct pipe_resource **outbuf)
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 07997d2..e21a682 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -32,6 +32,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_state.h"
@@ -47,6 +48,7 @@
  * Initialize a pipe_surface object.  'view' is considered to have
  * uninitialized contents.
  */
+PUBLIC
 void
 u_surface_default_template(struct pipe_surface *surf,
                            const struct pipe_resource *texture)
@@ -62,6 +64,7 @@ u_surface_default_template(struct pipe_surface *surf,
  * Position and sizes are in pixels.
  * src_stride may be negative to do vertical flip of pixels from source.
  */
+PUBLIC
 void
 util_copy_rect(ubyte * dst,
                enum pipe_format format,
@@ -114,6 +117,7 @@ util_copy_rect(ubyte * dst,
  * Copy 3D box from one place to another.
  * Position and sizes are in pixels.
  */
+PUBLIC
 void
 util_copy_box(ubyte * dst,
               enum pipe_format format,
@@ -142,7 +146,7 @@ util_copy_box(ubyte * dst,
    }
 }
 
-
+PUBLIC
 void
 util_fill_rect(ubyte * dst,
                enum pipe_format format,
@@ -213,7 +217,7 @@ util_fill_rect(ubyte * dst,
    }
 }
 
-
+PUBLIC
 void
 util_fill_box(ubyte * dst,
               enum pipe_format format,
@@ -242,6 +246,7 @@ util_fill_box(ubyte * dst,
  * Fallback function for pipe->resource_copy_region().
  * Note: (X,Y)=(0,0) is always the upper-left corner.
  */
+PUBLIC
 void
 util_resource_copy_region(struct pipe_context *pipe,
                           struct pipe_resource *dst,
@@ -333,6 +338,7 @@ no_src_map:
  * multisampled surfaces for instance.
  * Clears all bound layers.
  */
+PUBLIC
 void
 util_clear_render_target(struct pipe_context *pipe,
                          struct pipe_surface *dst,
@@ -415,6 +421,7 @@ util_clear_render_target(struct pipe_context *pipe,
  * multisampled surfaces for instance.
  * Clears all bound layers.
  */
+PUBLIC
 void
 util_clear_depth_stencil(struct pipe_context *pipe,
                          struct pipe_surface *dst,
@@ -626,6 +633,7 @@ get_sample_count(const struct pipe_resource *res)
  * It returns FALSE otherwise and the caller must fall back to a more generic
  * codepath for the blit operation. (e.g. by using u_blitter)
  */
+PUBLIC
 boolean
 util_try_blit_via_copy_region(struct pipe_context *ctx,
                               const struct pipe_blit_info *blit)
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 62298cd..9157afc 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -31,6 +31,7 @@
  */
 
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 
@@ -44,6 +45,7 @@
 /**
  * Move raw block of pixels from transfer object to user memory.
  */
+PUBLIC
 void
 pipe_get_tile_raw(struct pipe_transfer *pt,
                   const void *src,
@@ -63,6 +65,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
 /**
  * Move raw block of pixels from user memory to transfer object.
  */
+PUBLIC
 void
 pipe_put_tile_raw(struct pipe_transfer *pt,
                   void *dst,
@@ -424,6 +427,7 @@ pipe_tile_raw_to_signed(enum pipe_format format,
                       0, 0, w, h);
 }
 
+PUBLIC
 void
 pipe_get_tile_rgba(struct pipe_transfer *pt,
                    const void *src,
@@ -433,7 +437,7 @@ pipe_get_tile_rgba(struct pipe_transfer *pt,
    pipe_get_tile_rgba_format(pt, src, x, y, w, h, pt->resource->format, p);
 }
 
-
+PUBLIC
 void
 pipe_get_tile_rgba_format(struct pipe_transfer *pt,
                           const void *src,
@@ -464,7 +468,7 @@ pipe_get_tile_rgba_format(struct pipe_transfer *pt,
    FREE(packed);
 }
 
-
+PUBLIC
 void
 pipe_put_tile_rgba(struct pipe_transfer *pt,
                    void *dst,
@@ -474,7 +478,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
    pipe_put_tile_rgba_format(pt, dst, x, y, w, h, pt->resource->format, p);
 }
 
-
+PUBLIC
 void
 pipe_put_tile_rgba_format(struct pipe_transfer *pt,
                           void *dst,
@@ -526,6 +530,7 @@ pipe_put_tile_rgba_format(struct pipe_transfer *pt,
    FREE(packed);
 }
 
+PUBLIC
 void
 pipe_put_tile_i_format(struct pipe_transfer *pt,
                        void *dst,
@@ -554,6 +559,7 @@ pipe_put_tile_i_format(struct pipe_transfer *pt,
    FREE(packed);
 }
 
+PUBLIC
 void
 pipe_put_tile_ui_format(struct pipe_transfer *pt,
                         void *dst,
@@ -585,6 +591,7 @@ pipe_put_tile_ui_format(struct pipe_transfer *pt,
 /**
  * Get a block of Z values, converted to 32-bit range.
  */
+PUBLIC
 void
 pipe_get_tile_z(struct pipe_transfer *pt,
                 const void *src,
@@ -705,7 +712,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
    }
 }
 
-
+PUBLIC
 void
 pipe_put_tile_z(struct pipe_transfer *pt,
                 void *dst,
@@ -833,6 +840,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
 }
 
 
+PUBLIC
 void
 pipe_get_tile_ui_format(struct pipe_transfer *pt,
                         const void *src,
@@ -863,7 +871,7 @@ pipe_get_tile_ui_format(struct pipe_transfer *pt,
    FREE(packed);
 }
 
-
+PUBLIC
 void
 pipe_get_tile_i_format(struct pipe_transfer *pt,
                        const void *src,
diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c
index 7804f2a..e997cf5 100644
--- a/src/gallium/auxiliary/util/u_transfer.c
+++ b/src/gallium/auxiliary/util/u_transfer.c
@@ -1,3 +1,4 @@
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 #include "util/u_surface.h"
 #include "util/u_inlines.h"
@@ -7,6 +8,7 @@
 /* One-shot transfer operation with data supplied in a user
  * pointer.  XXX: strides??
  */
+PUBLIC
 void u_default_transfer_inline_write( struct pipe_context *pipe,
                                       struct pipe_resource *resource,
                                       unsigned level,
@@ -66,7 +68,7 @@ void u_default_transfer_inline_write( struct pipe_context *pipe,
    pipe_transfer_unmap(pipe, transfer);
 }
 
-
+PUBLIC
 boolean u_default_resource_get_handle(struct pipe_screen *screen,
                                       struct pipe_resource *resource,
                                       struct winsys_handle *handle)
@@ -75,7 +77,7 @@ boolean u_default_resource_get_handle(struct pipe_screen *screen,
 }
 
 
-
+PUBLIC
 void u_default_transfer_flush_region( struct pipe_context *pipe,
                                       struct pipe_transfer *transfer,
                                       const struct pipe_box *box)
@@ -96,6 +98,7 @@ u_resource( struct pipe_resource *res )
    return (struct u_resource *)res;
 }
 
+PUBLIC
 boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
                                    struct pipe_resource *resource,
                                    struct winsys_handle *handle)
@@ -104,6 +107,7 @@ boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
    return ur->vtbl->resource_get_handle(screen, resource, handle);
 }
 
+PUBLIC
 void u_resource_destroy_vtbl(struct pipe_screen *screen,
                              struct pipe_resource *resource)
 {
@@ -111,6 +115,7 @@ void u_resource_destroy_vtbl(struct pipe_screen *screen,
    ur->vtbl->resource_destroy(screen, resource);
 }
 
+PUBLIC
 void *u_transfer_map_vtbl(struct pipe_context *context,
                           struct pipe_resource *resource,
                           unsigned level,
@@ -123,6 +128,7 @@ void *u_transfer_map_vtbl(struct pipe_context *context,
                                  transfer);
 }
 
+PUBLIC
 void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
                                    struct pipe_transfer *transfer,
                                    const struct pipe_box *box)
@@ -131,6 +137,7 @@ void u_transfer_flush_region_vtbl( struct pipe_context *pipe,
    ur->vtbl->transfer_flush_region(pipe, transfer, box);
 }
 
+PUBLIC
 void u_transfer_unmap_vtbl( struct pipe_context *pipe,
                             struct pipe_transfer *transfer )
 {
@@ -138,6 +145,7 @@ void u_transfer_unmap_vtbl( struct pipe_context *pipe,
    ur->vtbl->transfer_unmap(pipe, transfer);
 }
 
+PUBLIC
 void u_transfer_inline_write_vtbl( struct pipe_context *pipe,
                                    struct pipe_resource *resource,
                                    unsigned level,
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 6859751..b4cfb28 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -29,6 +29,7 @@
  * coalescing small buffers into larger ones.
  */
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
 #include "pipe/p_context.h"
@@ -53,7 +54,7 @@ struct u_upload_mgr {
                      * at the first unused byte. */
 };
 
-
+PUBLIC
 struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
                                       unsigned default_size,
                                       unsigned alignment,
@@ -72,6 +73,7 @@ struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
    return upload;
 }
 
+PUBLIC
 void u_upload_unmap( struct u_upload_mgr *upload )
 {
    if (upload->transfer) {
@@ -96,6 +98,7 @@ void u_upload_unmap( struct u_upload_mgr *upload )
  * Can improve this with a change to pipe_buffer_write to use the
  * DONT_WAIT bit, but for now, it's easiest just to grab a new buffer.
  */
+PUBLIC
 void u_upload_flush( struct u_upload_mgr *upload )
 {
    /* Unmap and unreference the upload buffer. */
@@ -104,7 +107,7 @@ void u_upload_flush( struct u_upload_mgr *upload )
    upload->size = 0;
 }
 
-
+PUBLIC
 void u_upload_destroy( struct u_upload_mgr *upload )
 {
    u_upload_flush( upload );
@@ -152,6 +155,7 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
    return PIPE_OK;
 }
 
+PUBLIC
 enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
                                 unsigned min_out_offset,
                                 unsigned size,
@@ -209,6 +213,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
    return PIPE_OK;
 }
 
+PUBLIC
 enum pipe_error u_upload_data( struct u_upload_mgr *upload,
                                unsigned min_out_offset,
                                unsigned size,
@@ -233,6 +238,7 @@ enum pipe_error u_upload_data( struct u_upload_mgr *upload,
  * buffers if you have an app that does lots of small vertex buffer
  * renders or DrawElements calls.
  */
+PUBLIC
 enum pipe_error u_upload_buffer( struct u_upload_mgr *upload,
                                  unsigned min_out_offset,
                                  unsigned offset,
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index 4b83087..00a021d 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -742,6 +742,7 @@ draw_layers(struct vl_compositor *c, struct vl_compositor_state *s, struct u_rec
    }
 }
 
+PUBLIC
 void
 vl_compositor_reset_dirty_area(struct u_rect *dirty)
 {
@@ -751,6 +752,7 @@ vl_compositor_reset_dirty_area(struct u_rect *dirty)
    dirty->x1 = dirty->y1 = MAX_DIRTY;
 }
 
+PUBLIC
 void
 vl_compositor_set_clear_color(struct vl_compositor_state *s, union pipe_color_union *color)
 {
@@ -760,6 +762,7 @@ vl_compositor_set_clear_color(struct vl_compositor_state *s, union pipe_color_un
    s->clear_color = *color;
 }
 
+PUBLIC
 void
 vl_compositor_get_clear_color(struct vl_compositor_state *s, union pipe_color_union *color)
 {
@@ -769,6 +772,7 @@ vl_compositor_get_clear_color(struct vl_compositor_state *s, union pipe_color_un
    *color = s->clear_color;
 }
 
+PUBLIC
 void
 vl_compositor_clear_layers(struct vl_compositor_state *s)
 {
@@ -794,6 +798,7 @@ vl_compositor_clear_layers(struct vl_compositor_state *s)
    }
 }
 
+PUBLIC
 void
 vl_compositor_cleanup(struct vl_compositor *c)
 {
@@ -804,6 +809,7 @@ vl_compositor_cleanup(struct vl_compositor *c)
    cleanup_pipe_state(c);
 }
 
+PUBLIC
 void
 vl_compositor_set_csc_matrix(struct vl_compositor_state *s, vl_csc_matrix const *matrix)
 {
@@ -823,6 +829,7 @@ vl_compositor_set_csc_matrix(struct vl_compositor_state *s, vl_csc_matrix const
    pipe_buffer_unmap(s->pipe, buf_transfer);
 }
 
+PUBLIC
 void
 vl_compositor_set_dst_clip(struct vl_compositor_state *s, struct u_rect *dst_clip)
 {
@@ -837,6 +844,7 @@ vl_compositor_set_dst_clip(struct vl_compositor_state *s, struct u_rect *dst_cli
    }
 }
 
+PUBLIC
 void
 vl_compositor_set_layer_blend(struct vl_compositor_state *s,
                               unsigned layer, void *blend,
@@ -850,6 +858,7 @@ vl_compositor_set_layer_blend(struct vl_compositor_state *s,
    s->layers[layer].blend = blend;
 }
 
+PUBLIC
 void
 vl_compositor_set_layer_dst_area(struct vl_compositor_state *s,
                                  unsigned layer, struct u_rect *dst_area)
@@ -867,6 +876,7 @@ vl_compositor_set_layer_dst_area(struct vl_compositor_state *s,
    }
 }
 
+PUBLIC
 void
 vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
                                struct vl_compositor *c,
@@ -920,6 +930,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
       s->layers[layer].fs = c->fs_video_buffer;
 }
 
+PUBLIC
 void
 vl_compositor_set_palette_layer(struct vl_compositor_state *s,
                                 struct vl_compositor *c,
@@ -950,6 +961,7 @@ vl_compositor_set_palette_layer(struct vl_compositor_state *s,
                     dst_rect ? *dst_rect : default_rect(&s->layers[layer]));
 }
 
+PUBLIC
 void
 vl_compositor_set_rgba_layer(struct vl_compositor_state *s,
                              struct vl_compositor *c,
@@ -982,6 +994,7 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *s,
          s->layers[layer].colors[i] = colors[i];
 }
 
+PUBLIC
 void
 vl_compositor_render(struct vl_compositor_state *s,
                      struct vl_compositor       *c,
@@ -1025,6 +1038,7 @@ vl_compositor_render(struct vl_compositor_state *s,
    draw_layers(c, s, dirty_area);
 }
 
+PUBLIC
 bool
 vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
 {
@@ -1051,6 +1065,7 @@ vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe)
    return true;
 }
 
+PUBLIC
 bool
 vl_compositor_init_state(struct vl_compositor_state *s, struct pipe_context *pipe)
 {
@@ -1086,6 +1101,7 @@ vl_compositor_init_state(struct vl_compositor_state *s, struct pipe_context *pip
    return true;
 }
 
+PUBLIC
 void
 vl_compositor_cleanup_state(struct vl_compositor_state *s)
 {
diff --git a/src/gallium/auxiliary/vl/vl_csc.c b/src/gallium/auxiliary/vl/vl_csc.c
index 2ce6907..2592505 100644
--- a/src/gallium/auxiliary/vl/vl_csc.c
+++ b/src/gallium/auxiliary/vl/vl_csc.c
@@ -25,6 +25,7 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "util/u_math.h"
 #include "util/u_debug.h"
 
@@ -164,6 +165,7 @@ static const vl_csc_matrix identity =
    { 0.0f, 0.0f, 1.0f, 0.0f, }
 };
 
+PUBLIC
 const struct vl_procamp vl_default_procamp = {
    0.0f,  /* brightness */
    1.0f,  /* contrast   */
@@ -171,6 +173,7 @@ const struct vl_procamp vl_default_procamp = {
    0.0f   /* hue        */
 };
 
+PUBLIC
 void vl_csc_get_matrix(enum VL_CSC_COLOR_STANDARD cs,
                        struct vl_procamp *procamp,
                        bool full_range,
diff --git a/src/gallium/auxiliary/vl/vl_decoder.c b/src/gallium/auxiliary/vl/vl_decoder.c
index b325b8c..e49a64f 100644
--- a/src/gallium/auxiliary/vl/vl_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_decoder.c
@@ -25,6 +25,7 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_video_codec.h"
 
 #include "util/u_video.h"
@@ -32,6 +33,7 @@
 #include "vl_decoder.h"
 #include "vl_mpeg12_decoder.h"
 
+PUBLIC
 bool
 vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile,
                      enum pipe_video_entrypoint entrypoint)
@@ -45,6 +47,7 @@ vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile
    }
 }
 
+PUBLIC
 int
 vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile)
 {
@@ -60,6 +63,7 @@ vl_level_supported(struct pipe_screen *screen, enum pipe_video_profile profile)
    }
 }
 
+PUBLIC
 struct pipe_video_codec *
 vl_create_decoder(struct pipe_context *pipe,
                   const struct pipe_video_codec *templat)
diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c
index 9bd7ed1..705fa1c 100644
--- a/src/gallium/auxiliary/vl/vl_matrix_filter.c
+++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 
 #include "tgsi/tgsi_ureg.h"
@@ -147,6 +148,7 @@ create_frag_shader(struct vl_matrix_filter *filter, unsigned num_offsets,
    return ureg_create_shader_and_destroy(shader, filter->pipe);
 }
 
+PUBLIC
 bool
 vl_matrix_filter_init(struct vl_matrix_filter *filter, struct pipe_context *pipe,
                       unsigned video_width, unsigned video_height,
@@ -267,6 +269,7 @@ error_rs_state:
    return false;
 }
 
+PUBLIC
 void
 vl_matrix_filter_cleanup(struct vl_matrix_filter *filter)
 {
@@ -282,6 +285,7 @@ vl_matrix_filter_cleanup(struct vl_matrix_filter *filter)
    filter->pipe->delete_fs_state(filter->pipe, filter->fs);
 }
 
+PUBLIC
 void
 vl_matrix_filter_render(struct vl_matrix_filter *filter,
                         struct pipe_sampler_view *src,
diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c
index 158751a..a5c2698 100644
--- a/src/gallium/auxiliary/vl/vl_median_filter.c
+++ b/src/gallium/auxiliary/vl/vl_median_filter.c
@@ -25,6 +25,7 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_context.h"
 
 #include "tgsi/tgsi_ureg.h"
@@ -234,6 +235,7 @@ generate_offsets(enum vl_median_filter_shape shape, unsigned size,
    assert(i == *num_offsets);
 }
 
+PUBLIC
 bool
 vl_median_filter_init(struct vl_median_filter *filter, struct pipe_context *pipe,
                       unsigned width, unsigned height, unsigned size,
@@ -346,6 +348,7 @@ error_rs_state:
    return false;
 }
 
+PUBLIC
 void
 vl_median_filter_cleanup(struct vl_median_filter *filter)
 {
@@ -361,6 +364,7 @@ vl_median_filter_cleanup(struct vl_median_filter *filter)
    filter->pipe->delete_fs_state(filter->pipe, filter->fs);
 }
 
+PUBLIC
 void
 vl_median_filter_render(struct vl_median_filter *filter,
                         struct pipe_sampler_view *src,
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
index cfa5eab..fc3e4c5 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
@@ -26,6 +26,7 @@
  *
  **************************************************************************/
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_video_codec.h"
 #include "util/u_memory.h"
 
@@ -964,6 +965,7 @@ decode_slice(struct vl_mpg12_bs *bs, struct pipe_video_buffer *target)
    bs->decoder->decode_macroblock(bs->decoder, target, &bs->desc->base, &mb.base, 1);
 }
 
+PUBLIC
 void
 vl_mpg12_bs_init(struct vl_mpg12_bs *bs, struct pipe_video_codec *decoder)
 {
@@ -981,6 +983,7 @@ vl_mpg12_bs_init(struct vl_mpg12_bs *bs, struct pipe_video_codec *decoder)
    }
 }
 
+PUBLIC
 void
 vl_mpg12_bs_decode(struct vl_mpg12_bs *bs,
                    struct pipe_video_buffer *target,
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index f838e74..bccdcac 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -28,6 +28,8 @@
 #include <math.h>
 #include <assert.h>
 
+#include "pipe/p_compiler.h"
+
 #include "util/u_memory.h"
 #include "util/u_rect.h"
 #include "util/u_sampler.h"
@@ -1016,6 +1018,7 @@ mc_frag_shader_callback(void *priv, struct vl_mc *mc,
    }
 }
 
+PUBLIC
 struct pipe_video_codec *
 vl_create_mpeg12_decoder(struct pipe_context *context,
                          const struct pipe_video_codec *templat)
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index d2e9a04..d93b714 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -27,6 +27,7 @@
 
 #include <assert.h>
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
@@ -86,6 +87,7 @@ const unsigned const_resource_plane_order_YVU[3] = {
    1
 };
 
+PUBLIC
 const enum pipe_format *
 vl_video_buffer_formats(struct pipe_screen *screen, enum pipe_format format)
 {
@@ -144,6 +146,7 @@ vl_video_buffer_surface_format(enum pipe_format format)
    return format;
 }
 
+PUBLIC
 boolean
 vl_video_buffer_is_format_supported(struct pipe_screen *screen,
                                     enum pipe_format format,
@@ -175,6 +178,7 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen,
    return true;
 }
 
+PUBLIC
 unsigned
 vl_video_buffer_max_size(struct pipe_screen *screen)
 {
@@ -185,6 +189,7 @@ vl_video_buffer_max_size(struct pipe_screen *screen)
    return 1 << (max_2d_texture_level-1);
 }
 
+PUBLIC
 void
 vl_video_buffer_set_associated_data(struct pipe_video_buffer *vbuf,
                                     struct pipe_video_codec *vcodec,
@@ -203,6 +208,7 @@ vl_video_buffer_set_associated_data(struct pipe_video_buffer *vbuf,
    vbuf->destroy_associated_data = destroy_associated_data;
 }
 
+PUBLIC
 void *
 vl_video_buffer_get_associated_data(struct pipe_video_buffer *vbuf,
                                     struct pipe_video_codec *vcodec)
@@ -213,6 +219,7 @@ vl_video_buffer_get_associated_data(struct pipe_video_buffer *vbuf,
       return NULL;
 }
 
+PUBLIC
 void
 vl_video_buffer_template(struct pipe_resource *templ,
                          const struct pipe_video_buffer *tmpl,
@@ -392,6 +399,7 @@ error:
    return NULL;
 }
 
+PUBLIC
 struct pipe_video_buffer *
 vl_video_buffer_create(struct pipe_context *pipe,
                        const struct pipe_video_buffer *tmpl)
@@ -483,6 +491,7 @@ error:
    return NULL;
 }
 
+PUBLIC
 struct pipe_video_buffer *
 vl_video_buffer_create_ex2(struct pipe_context *pipe,
                            const struct pipe_video_buffer *tmpl,
diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c
index 33baa3d..6cdc43c 100644
--- a/src/gallium/auxiliary/vl/vl_zscan.c
+++ b/src/gallium/auxiliary/vl/vl_zscan.c
@@ -27,6 +27,7 @@
 
 #include <assert.h>
 
+#include "pipe/p_compiler.h"
 #include "pipe/p_screen.h"
 #include "pipe/p_context.h"
 
@@ -62,6 +63,7 @@ const int vl_zscan_linear[] =
    56,57,58,59,60,61,62,63
 };
 
+PUBLIC
 const int vl_zscan_normal[] =
 {
    /* Zig-Zag scan pattern */
@@ -75,6 +77,7 @@ const int vl_zscan_normal[] =
    53,60,61,54,47,55,62,63
 };
 
+PUBLIC
 const int vl_zscan_alternate[] =
 {
    /* Alternate scan pattern */
diff --git a/src/gallium/drivers/llvmpipe/Makefile.am b/src/gallium/drivers/llvmpipe/Makefile.am
index 9059053..1897483 100644
--- a/src/gallium/drivers/llvmpipe/Makefile.am
+++ b/src/gallium/drivers/llvmpipe/Makefile.am
@@ -86,8 +86,7 @@ TESTS = $(check_PROGRAMS)
 
 TEST_LIBS = \
 	    libllvmpipe.la \
-	    $(top_builddir)/src/gallium/auxiliary/libgallium.la \
-	    $(LLVM_LIBS) \
+	    $(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	    $(DLOPEN_LIBS) \
 	    $(PTHREAD_LIBS)
 
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 2ba0251..6e24840 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -29,7 +29,10 @@
 #include "../radeon/r600_pipe_common.h"
 #include "../radeon/r600_cs.h"
 
+#if defined R600_USE_LLVM || defined HAVE_OPENCL
 #include "r600_llvm.h"
+#endif
+
 #include "r600_public.h"
 #include "r600_resource.h"
 
diff --git a/src/gallium/targets/dri-freedreno/Makefile.am b/src/gallium/targets/dri-freedreno/Makefile.am
index ac7460a..b46e9b0 100644
--- a/src/gallium/targets/dri-freedreno/Makefile.am
+++ b/src/gallium/targets/dri-freedreno/Makefile.am
@@ -60,12 +60,10 @@ COMMON_LDFLAGS += $(LLVM_LDFLAGS)
 COMMON_LIBADD += $(LLVM_LIBS)
 endif
 
-nodist_EXTRA_kgsl_dri_la_SOURCES = dummy.cpp
 kgsl_dri_la_SOURCES = target-kgsl.c
 kgsl_dri_la_LDFLAGS = $(COMMON_LDFLAGS)
 kgsl_dri_la_LIBADD  = $(COMMON_LIBADD)
 
-nodist_EXTRA_msm_dri_la_SOURCES = dummy.cpp
 msm_dri_la_SOURCES  = target-msm.c
 msm_dri_la_LDFLAGS  = $(COMMON_LDFLAGS)
 msm_dri_la_LIBADD   = $(COMMON_LIBADD)
diff --git a/src/gallium/targets/dri-i915/Makefile.am b/src/gallium/targets/dri-i915/Makefile.am
index e1c6eca..d9ac274 100644
--- a/src/gallium/targets/dri-i915/Makefile.am
+++ b/src/gallium/targets/dri-i915/Makefile.am
@@ -26,6 +26,7 @@ AM_CFLAGS = \
 	$(GALLIUM_CFLAGS) \
 	$(PTHREAD_CFLAGS) \
 	$(LIBDRM_CFLAGS)
+
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/gallium/drivers \
 	-I$(top_srcdir)/src/gallium/winsys \
@@ -38,6 +39,7 @@ AM_CPPFLAGS = \
 	-DGALLIUM_SOFTPIPE
 
 dridir = $(DRI_DRIVER_INSTALL_DIR)
+
 dri_LTLIBRARIES = i915_dri.la
 
 i915_dri_la_SOURCES = target.c
@@ -47,7 +49,7 @@ 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.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 \
@@ -63,7 +65,7 @@ nodist_EXTRA_i915_dri_la_SOURCES = dummy.cpp
 
 if HAVE_MESA_LLVM
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
-i915_dri_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
+i915_dri_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/dri-ilo/Makefile.am b/src/gallium/targets/dri-ilo/Makefile.am
index 88233f6..8273c3b 100644
--- a/src/gallium/targets/dri-ilo/Makefile.am
+++ b/src/gallium/targets/dri-ilo/Makefile.am
@@ -48,7 +48,7 @@ ilo_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
 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.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 \
@@ -63,7 +63,6 @@ nodist_EXTRA_ilo_dri_la_SOURCES = dummy-cpp.cpp
 
 if HAVE_MESA_LLVM
 ilo_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
-ilo_dri_la_LIBADD += $(LLVM_LIBS)
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/dri-nouveau/Makefile.am b/src/gallium/targets/dri-nouveau/Makefile.am
index a02394e..bebb21e 100644
--- a/src/gallium/targets/dri-nouveau/Makefile.am
+++ b/src/gallium/targets/dri-nouveau/Makefile.am
@@ -39,6 +39,7 @@ dridir = $(DRI_DRIVER_INSTALL_DIR)
 dri_LTLIBRARIES = nouveau_dri.la
 
 nodist_EXTRA_nouveau_dri_la_SOURCES = dummy.cpp
+
 nouveau_dri_la_SOURCES = target.c
 
 nouveau_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
@@ -46,7 +47,7 @@ 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.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 \
@@ -56,11 +57,6 @@ nouveau_dri_la_LIBADD = \
 	$(LIBDRM_LIBS) \
 	$(NOUVEAU_LIBS)
 
-if HAVE_MESA_LLVM
-nouveau_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
-nouveau_dri_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: nouveau_dri.la
diff --git a/src/gallium/targets/dri-r300/Makefile.am b/src/gallium/targets/dri-r300/Makefile.am
index 60ac69e..0295712 100644
--- a/src/gallium/targets/dri-r300/Makefile.am
+++ b/src/gallium/targets/dri-r300/Makefile.am
@@ -47,7 +47,7 @@ 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.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 \
@@ -57,11 +57,6 @@ r300_dri_la_LIBADD = \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(RADEON_LIBS)
 
-if HAVE_MESA_LLVM
-r300_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
-r300_dri_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: r300_dri.la
diff --git a/src/gallium/targets/dri-r600/Makefile.am b/src/gallium/targets/dri-r600/Makefile.am
index c63aa0c..6081075 100644
--- a/src/gallium/targets/dri-r600/Makefile.am
+++ b/src/gallium/targets/dri-r600/Makefile.am
@@ -37,6 +37,7 @@ AM_CPPFLAGS = \
 	-DGALLIUM_NOOP
 
 dridir = $(DRI_DRIVER_INSTALL_DIR)
+
 dri_LTLIBRARIES = r600_dri.la
 
 r600_dri_la_SOURCES = target.c
@@ -46,7 +47,7 @@ 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.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 \
@@ -54,17 +55,13 @@ r600_dri_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/noop/libnoop.la \
+	$(LLVM_R600_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
 
 nodist_EXTRA_r600_dri_la_SOURCES = dummy.cpp
 
-if HAVE_MESA_LLVM
-r600_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
-r600_dri_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: r600_dri.la
diff --git a/src/gallium/targets/dri-radeonsi/Makefile.am b/src/gallium/targets/dri-radeonsi/Makefile.am
index eb21ac7..b2f4312 100644
--- a/src/gallium/targets/dri-radeonsi/Makefile.am
+++ b/src/gallium/targets/dri-radeonsi/Makefile.am
@@ -47,7 +47,7 @@ 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.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 \
@@ -55,12 +55,12 @@ radeonsi_dri_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/noop/libnoop.la \
+	$(LLVM_RADEON_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(RADEON_LIBS)
 
 if HAVE_MESA_LLVM
 radeonsi_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
-radeonsi_dri_la_LIBADD += $(LLVM_LIBS)
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/dri-swrast/Makefile.am b/src/gallium/targets/dri-swrast/Makefile.am
index 1104379..0473225 100644
--- a/src/gallium/targets/dri-swrast/Makefile.am
+++ b/src/gallium/targets/dri-swrast/Makefile.am
@@ -46,11 +46,12 @@ swrast_dri_la_SOURCES = \
 	$(top_srcdir)/src/mesa/drivers/dri/common/drisw_util.c \
 	$(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
 
+
 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.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 \
@@ -63,7 +64,7 @@ nodist_EXTRA_swrast_dri_la_SOURCES = dummy.cpp
 if HAVE_MESA_LLVM
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 swrast_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
-swrast_dri_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
+swrast_dri_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/dri-vmwgfx/Makefile.am b/src/gallium/targets/dri-vmwgfx/Makefile.am
index f7008ab..fdd12af 100644
--- a/src/gallium/targets/dri-vmwgfx/Makefile.am
+++ b/src/gallium/targets/dri-vmwgfx/Makefile.am
@@ -47,7 +47,7 @@ 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.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 \
@@ -56,13 +56,11 @@ vmwgfx_dri_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/svga/libsvga.la \
 	$(GALLIUM_DRI_LIB_DEPS)
 
-vmwgfx_dri_la_LINK = $(CXXLINK) $(vmwgfx_dri_la_LDFLAGS)
 # Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
 nodist_EXTRA_vmwgfx_dri_la_SOURCES = dummy-cpp.cpp
 
 if HAVE_MESA_LLVM
 vmwgfx_dri_la_LDFLAGS += $(LLVM_LDFLAGS)
-vmwgfx_dri_la_LIBADD += $(LLVM_LIBS)
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am
index 74cb9de..1e8ec4d 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -52,7 +52,7 @@ egl_gallium_la_SOURCES = \
 	egl_st.c
 
 egl_gallium_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/drivers/identity/libidentity.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
@@ -122,7 +122,7 @@ st_GL_la_LDFLAGS = -Wl,--no-undefined -avoid-version -module
 # st_GL, built only when shared glapi is not enabled
 st_GL_la_LIBADD = \
 	$(top_builddir)/src/mesa/libmesagallium.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/mapi/glapi/libglapi.la \
 	$(CLOCK_LIB) \
 	$(DLOPEN_LIBS) \
@@ -184,7 +184,8 @@ if HAVE_GALLIUM_R600
 AM_CPPFLAGS += -D_EGL_PIPE_R600=1
 egl_gallium_la_LIBADD += \
 	$(top_builddir)/src/gallium/drivers/r600/libr600.la \
-	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la
+	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
+	$(LLVM_R600_LIBS)
 endif
 if HAVE_GALLIUM_RADEONSI
 AM_CPPFLAGS += -D_EGL_PIPE_RADEONSI=1
@@ -192,7 +193,8 @@ egl_gallium_la_LIBADD += \
 	$(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la
 if !HAVE_GALLIUM_R600
 egl_gallium_la_LIBADD += \
-	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la
+	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
+	$(LLVM_RADEON_LIBS)
 endif
 endif
 egl_gallium_la_LIBADD += \
@@ -228,18 +230,6 @@ egl_gallium_la_LIBADD += \
 	$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 endif
 
-if HAVE_MESA_LLVM
-egl_gallium_la_LIBADD += $(LLVM_LIBS)
-egl_gallium_la_LDFLAGS += $(LLVM_LDFLAGS)
-
-if HAVE_OPENGL
-if !HAVE_SHARED_GLAPI
-st_GL_la_LIBADD += $(LLVM_LIBS)
-st_GL_la_LDFLAGS += $(LLVM_LDFLAGS)
-endif
-endif
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 if HAVE_OPENGL
diff --git a/src/gallium/targets/gbm/Makefile.am b/src/gallium/targets/gbm/Makefile.am
index a3b0aae..5f05d32 100644
--- a/src/gallium/targets/gbm/Makefile.am
+++ b/src/gallium/targets/gbm/Makefile.am
@@ -46,23 +46,9 @@ gbm_gallium_drm_la_LIBADD = \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/state_trackers/gbm/libgbm.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(LIBUDEV_LIBS) \
 	$(LIBDRM_LIBS) \
 	-lm
 
 gbm_gallium_drm_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
-
-# FIXME: this shouldn't be needed
-if HAVE_MESA_LLVM
-gbm_gallium_drm_la_LINK = $(CXXLINK) $(gbm_gallium_drm_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_gbm_gallium_drm_la_SOURCES = dummy-cpp.cpp
-
-gbm_gallium_drm_la_LIBADD += $(LLVM_LIBS)
-gbm_gallium_drm_la_LDFLAGS += $(LLVM_LDFLAGS)
-else
-gbm_gallium_drm_la_LINK = $(CXXLINK) $(gbm_gallium_drm_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_gbm_gallium_drm_la_SOURCES = dummy-c.c
-endif
diff --git a/src/gallium/targets/libgl-xlib/Makefile.am b/src/gallium/targets/libgl-xlib/Makefile.am
index cca0da4..ee2afd4 100644
--- a/src/gallium/targets/libgl-xlib/Makefile.am
+++ b/src/gallium/targets/libgl-xlib/Makefile.am
@@ -53,22 +53,17 @@ libGL_la_LIBADD = \
 	$(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.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(GL_LIB_DEPS) \
+	$(PTHREAD_LIBS) \
 	$(CLOCK_LIB)
 
-if HAVE_MESA_LLVM
-libGL_la_LINK = $(CXXLINK) $(libGL_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libGL_la_SOURCES = dummy-cpp.cpp
+nodist_EXTRA_libGL_la_SOURCES = dummy.cpp
 
-libGL_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
+if HAVE_MESA_LLVM
+libGL_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 libGL_la_LDFLAGS += $(LLVM_LDFLAGS)
-else
-libGL_la_LINK = $(CXXLINK) $(libGL_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libGL_la_SOURCES = dummy-c.c
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am
index 43fda3b..820a6be 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -4,16 +4,14 @@ lib_LTLIBRARIES = libOpenCL.la
 
 libOpenCL_la_LDFLAGS = \
 	$(LLVM_LDFLAGS) \
-	-Wl,--no-undefined \
-	-shared \
-	-version-number 1:0
+	-Wl,--no-undefined -shared -version-number 1:0
 
 libOpenCL_la_LIBADD = \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/state_trackers/clover/libclover.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
-	$(GALLIUM_PIPE_LOADER_LIBS) $(LIBUDEV_LIBS) \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
+	$(GALLIUM_PIPE_LOADER_LIBS) $(LIBUDEV_LIBS) $(LLVM_OPENCL_LIBS) \
 	-ldl \
 	-lclangCodeGen \
 	-lclangFrontendTool \
@@ -27,9 +25,7 @@ libOpenCL_la_LIBADD = \
 	-lclangAST \
 	-lclangEdit \
 	-lclangLex \
-	-lclangBasic \
-	$(LLVM_LIBS)
-
+	-lclangBasic
 
 libOpenCL_la_SOURCES =
 
diff --git a/src/gallium/targets/osmesa/Makefile.am b/src/gallium/targets/osmesa/Makefile.am
index 26bf2ab..dea3d88 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -56,17 +56,12 @@ lib at OSMESA_LIB@_la_LIBADD = \
 	$(OSMESA_LIB_DEPS) \
 	$(CLOCK_LIB)
 
-
-nodist_EXTRA_lib at OSMESA_LIB@_la_SOURCES = dummy.cpp
-
 if HAVE_MESA_LLVM
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 lib at OSMESA_LIB@_la_LDFLAGS += $(LLVM_LDFLAGS)
 lib at OSMESA_LIB@_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
 endif
 
-
-
 if BUILD_SHARED
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am
index 3a4c305..70ef1c0 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -36,7 +36,7 @@ pipedir = $(libdir)/gallium-pipe
 pipe_LTLIBRARIES =
 
 PIPE_LIBS = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
@@ -55,33 +55,22 @@ pipe_i915_la_LIBADD = \
 	$(LIBDRM_LIBS) \
 	$(INTEL_LIBS)
 pipe_i915_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
-if HAVE_MESA_LLVM
-nodist_EXTRA_pipe_i915_la_SOURCES = dummy.cpp
-pipe_i915_la_LIBADD += $(LLVM_LIBS)
-pipe_i915_la_LDFLAGS += $(LLVM_LDFLAGS)
-endif
 endif
 
 if HAVE_GALLIUM_NOUVEAU
 pipe_LTLIBRARIES += pipe_nouveau.la
 pipe_nouveau_la_SOURCES = pipe_nouveau.c
-nodist_EXTRA_pipe_nouveau_la_SOURCES = dummy.cpp
 pipe_nouveau_la_LIBADD = \
 	$(PIPE_LIBS) \
 	$(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
 	$(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
 	$(NOUVEAU_LIBS)
 pipe_nouveau_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
-if HAVE_MESA_LLVM
-pipe_nouveau_la_LIBADD += $(LLVM_LIBS)
-pipe_nouveau_la_LDFLAGS += $(LLVM_LDFLAGS)
-endif
 endif
 
 if HAVE_GALLIUM_R300
 pipe_LTLIBRARIES += pipe_r300.la
 pipe_r300_la_SOURCES = pipe_r300.c
-nodist_EXTRA_pipe_r300_la_SOURCES = dummy.cpp
 pipe_r300_la_LIBADD = \
 	$(PIPE_LIBS) \
 	$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
@@ -90,10 +79,6 @@ pipe_r300_la_LIBADD = \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
 pipe_r300_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
-if HAVE_MESA_LLVM
-pipe_r300_la_LIBADD += $(LLVM_LIBS)
-pipe_r300_la_LDFLAGS += $(LLVM_LDFLAGS)
-endif
 endif
 
 if HAVE_GALLIUM_R600
@@ -104,32 +89,24 @@ pipe_r600_la_LIBADD = \
 	$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
 	$(top_builddir)/src/gallium/drivers/r600/libr600.la \
 	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
+	$(LLVM_R600_LIBS) \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
 pipe_r600_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
-if HAVE_MESA_LLVM
-nodist_EXTRA_pipe_r600_la_SOURCES = dummy.cpp
-pipe_r600_la_LIBADD += $(LLVM_LIBS)
-pipe_r600_la_LDFLAGS += $(LLVM_LDFLAGS)
-endif
 endif
 
 if HAVE_GALLIUM_RADEONSI
 pipe_LTLIBRARIES += pipe_radeonsi.la
 pipe_radeonsi_la_SOURCES = pipe_radeonsi.c
-nodist_EXTRA_pipe_radeonsi_la_SOURCES = dummy.cpp
 pipe_radeonsi_la_LIBADD = \
 	$(PIPE_LIBS) \
 	$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
 	$(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
 	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
+	$(LLVM_RADEON_LIBS) \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
 pipe_radeonsi_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
-if HAVE_MESA_LLVM
-pipe_radeonsi_la_LIBADD += $(LLVM_LIBS)
-pipe_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
-endif
 endif
 
 if HAVE_GALLIUM_SVGA
@@ -141,21 +118,14 @@ pipe_vmwgfx_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/svga/libsvga.la \
 	$(LIBDRM_LIBS)
 pipe_vmwgfx_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
-if HAVE_MESA_LLVM
-nodist_EXTRA_pipe_vmwgfx_la_SOURCES = dummy.cpp
-pipe_vmwgfx_la_LIBADD += $(LLVM_LIBS)
-pipe_vmwgfx_la_LDFLAGS += $(LLVM_LDFLAGS)
-endif
 endif
 
 if HAVE_GALLIUM_LLVMPIPE
 pipe_LTLIBRARIES += pipe_swrast.la
 pipe_swrast_la_SOURCES = pipe_swrast.c
-nodist_EXTRA_pipe_swrast_la_SOURCES = dummy.cpp
 pipe_swrast_la_LIBADD = \
 	$(PIPE_LIBS) \
-	$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la \
-	$(LLVM_LIBS)
+	$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 pipe_swrast_la_LDFLAGS = -Wl,--no-undefined -shared -module -avoid-version
 else
 if HAVE_GALLIUM_SOFTPIPE
diff --git a/src/gallium/targets/vdpau-nouveau/Makefile.am b/src/gallium/targets/vdpau-nouveau/Makefile.am
index 213725a..2fa35b2 100644
--- a/src/gallium/targets/vdpau-nouveau/Makefile.am
+++ b/src/gallium/targets/vdpau-nouveau/Makefile.am
@@ -45,7 +45,7 @@ libvdpau_nouveau_la_LDFLAGS = \
 	-no-undefined
 
 libvdpau_nouveau_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
 	$(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
 	$(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
@@ -55,11 +55,6 @@ libvdpau_nouveau_la_LIBADD = \
 	$(LIBDRM_LIBS) \
 	$(NOUVEAU_LIBS)
 
-if HAVE_MESA_LLVM
-libvdpau_nouveau_la_LDFLAGS += $(LLVM_LDFLAGS)
-libvdpau_nouveau_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: libvdpau_nouveau.la
diff --git a/src/gallium/targets/vdpau-r300/Makefile.am b/src/gallium/targets/vdpau-r300/Makefile.am
index 350f6f8..578068d 100644
--- a/src/gallium/targets/vdpau-r300/Makefile.am
+++ b/src/gallium/targets/vdpau-r300/Makefile.am
@@ -45,7 +45,7 @@ libvdpau_r300_la_LDFLAGS = \
 	-no-undefined
 
 libvdpau_r300_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/drivers/r300/libr300-helper.la \
 	$(top_builddir)/src/gallium/drivers/r300/libr300.la \
 	$(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
@@ -58,11 +58,6 @@ libvdpau_r300_la_LIBADD = \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
 
-if HAVE_MESA_LLVM
-libvdpau_r300_la_LDFLAGS += $(LLVM_LDFLAGS)
-libvdpau_r300_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: libvdpau_r300.la
diff --git a/src/gallium/targets/vdpau-r600/Makefile.am b/src/gallium/targets/vdpau-r600/Makefile.am
index 4bc39ed..4e1a726 100644
--- a/src/gallium/targets/vdpau-r600/Makefile.am
+++ b/src/gallium/targets/vdpau-r600/Makefile.am
@@ -44,30 +44,18 @@ libvdpau_r600_la_LDFLAGS = \
 	-no-undefined
 
 libvdpau_r600_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.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/vdpau/libvdpautracker.la \
 	$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
+	$(LLVM_R600_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(VDPAU_LIBS) \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
 
-if HAVE_MESA_LLVM
-libvdpau_r600_la_LINK = $(CXXLINK) $(libvdpau_r600_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libvdpau_r600_la_SOURCES = dummy-cpp.cpp
-
-libvdpau_r600_la_LDFLAGS += $(LLVM_LDFLAGS)
-libvdpau_r600_la_LIBADD += $(LLVM_LIBS)
-else
-libvdpau_r600_la_LINK = $(LINK) $(libvdpau_r600_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libvdpau_r600_la_SOURCES = dummy-c.c
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: libvdpau_r600.la
diff --git a/src/gallium/targets/vdpau-radeonsi/Makefile.am b/src/gallium/targets/vdpau-radeonsi/Makefile.am
index d79cd51..307f833 100644
--- a/src/gallium/targets/vdpau-radeonsi/Makefile.am
+++ b/src/gallium/targets/vdpau-radeonsi/Makefile.am
@@ -45,7 +45,7 @@ libvdpau_radeonsi_la_LDFLAGS = \
 	-no-undefined
 
 libvdpau_radeonsi_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.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/vdpau/libvdpautracker.la \
@@ -53,16 +53,12 @@ libvdpau_radeonsi_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
 	$(top_builddir)/src/gallium/drivers/noop/libnoop.la \
+	$(LLVM_RADEON_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(VDPAU_LIBS) \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
 
-if HAVE_MESA_LLVM
-libvdpau_radeonsi_la_LDFLAGS += $(LLVM_LDFLAGS)
-libvdpau_radeonsi_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: libvdpau_radeonsi.la
diff --git a/src/gallium/targets/vdpau-softpipe/Makefile.am b/src/gallium/targets/vdpau-softpipe/Makefile.am
index 7bde2f8..6212ed8 100644
--- a/src/gallium/targets/vdpau-softpipe/Makefile.am
+++ b/src/gallium/targets/vdpau-softpipe/Makefile.am
@@ -44,7 +44,7 @@ libvdpau_softpipe_la_LDFLAGS = \
 	-no-undefined
 
 libvdpau_softpipe_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
 	$(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
 	$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
@@ -52,17 +52,11 @@ libvdpau_softpipe_la_LIBADD = \
 	$(DLOPEN_LIBS) \
 	$(LIBDRM_LIBS)
 
-if HAVE_MESA_LLVM
-libvdpau_softpipe_la_LINK = $(CXXLINK) $(libvdpau_softpipe_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libvdpau_softpipe_la_SOURCES = dummy-cpp.cpp
+nodist_EXTRA_libvdpau_softpipe_la_SOURCES = dummy.cpp
 
+if HAVE_MESA_LLVM
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
-libvdpau_softpipe_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
-else
-libvdpau_softpipe_la_LINK = $(LINK) $(libvdpau_softpipe_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libvdpau_softpipe_la_SOURCES = dummy-c.c
+libvdpau_softpipe_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/xa-vmwgfx/Makefile.am b/src/gallium/targets/xa-vmwgfx/Makefile.am
index 6fe0510..eaa6d92 100644
--- a/src/gallium/targets/xa-vmwgfx/Makefile.am
+++ b/src/gallium/targets/xa-vmwgfx/Makefile.am
@@ -40,7 +40,7 @@ libxatracker_la_SOURCES = vmw_target.c
 libxatracker_la_LDFLAGS = -version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY)
 
 libxatracker_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/xa/libxatracker.la \
 	$(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \
 	$(top_builddir)/src/gallium/drivers/svga/libsvga.la \
@@ -49,11 +49,6 @@ libxatracker_la_LIBADD = \
 
 nodist_EXTRA_libxatracker_la_SOURCES = dummy.cpp
 
-if HAVE_MESA_LLVM
-libxatracker_la_LDFLAGS += $(LLVM_LDFLAGS)
-libxatracker_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: libxatracker.la
diff --git a/src/gallium/targets/xorg-i915/Makefile.am b/src/gallium/targets/xorg-i915/Makefile.am
index ed2ab8a..8bdbb66 100644
--- a/src/gallium/targets/xorg-i915/Makefile.am
+++ b/src/gallium/targets/xorg-i915/Makefile.am
@@ -44,7 +44,7 @@ i915_drv_la_SOURCES = \
 i915_drv_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 i915_drv_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/xorg/libxorgtracker.la \
 	$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
 	$(top_builddir)/src/gallium/drivers/i915/libi915.la \
@@ -56,17 +56,11 @@ i915_drv_la_LIBADD = \
 	$(LIBKMS_XORG_LIBS) \
 	$(INTEL_LIBS)
 
-if HAVE_MESA_LLVM
-i915_drv_la_LINK = $(CXXLINK) $(i915_drv_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_i915_drv_la_SOURCES = dummy-cpp.cpp
+nodist_EXTRA_i915_drv_la_SOURCES = dummy.cpp
 
+if HAVE_MESA_LLVM
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
-i915_drv_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
-else
-i915_drv_la_LINK = $(LINK) $(i915_drv_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_i915_drv_la_SOURCES = dummy-c.c
+i915_drv_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/xorg-nouveau/Makefile.am b/src/gallium/targets/xorg-nouveau/Makefile.am
index 210d4a2..f39cd57 100644
--- a/src/gallium/targets/xorg-nouveau/Makefile.am
+++ b/src/gallium/targets/xorg-nouveau/Makefile.am
@@ -44,7 +44,7 @@ nouveau2_drv_la_SOURCES = \
 nouveau2_drv_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 nouveau2_drv_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/xorg/libxorgtracker.la \
 	$(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
 	$(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
@@ -55,12 +55,6 @@ nouveau2_drv_la_LIBADD = \
 	$(LIBKMS_XORG_LIBS) \
 	$(NOUVEAU_LIBS)
 
-if HAVE_MESA_LLVM
-AM_CFLAGS += $(LLVM_CFLAGS)
-nouveau2_drv_la_LDFLAGS += $(LLVM_LDFLAGS)
-nouveau2_drv_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: nouveau2_drv.la
diff --git a/src/gallium/targets/xorg-r600/Makefile.am b/src/gallium/targets/xorg-r600/Makefile.am
index fc6e56e..4f660c7 100644
--- a/src/gallium/targets/xorg-r600/Makefile.am
+++ b/src/gallium/targets/xorg-r600/Makefile.am
@@ -44,7 +44,7 @@ r600g_drv_la_SOURCES = \
 r600g_drv_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 r600g_drv_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/xorg/libxorgtracker.la \
 	$(top_builddir)/src/gallium/drivers/r600/libr600.la \
 	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
@@ -52,24 +52,12 @@ r600g_drv_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
+	$(LLVM_R600_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(LIBDRM_XORG_LIBS) \
 	$(LIBKMS_XORG_LIBS) \
 	$(RADEON_LIBS)
 
-if HAVE_MESA_LLVM
-r600g_drv_la_LINK = $(CXXLINK) $(r600g_drv_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_r600g_drv_la_SOURCES = dummy-cpp.cpp
-
-r600g_drv_la_LDFLAGS += $(LLVM_LDFLAGS)
-r600g_drv_la_LIBADD += $(LLVM_LIBS)
-else
-r600g_drv_la_LINK = $(LINK) $(r600g_drv_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_r600g_drv_la_SOURCES = dummy-c.c
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: r600g_drv.la
diff --git a/src/gallium/targets/xorg-radeonsi/Makefile.am b/src/gallium/targets/xorg-radeonsi/Makefile.am
index 51d9612..b8e3c13 100644
--- a/src/gallium/targets/xorg-radeonsi/Makefile.am
+++ b/src/gallium/targets/xorg-radeonsi/Makefile.am
@@ -45,7 +45,7 @@ radeonsi_drv_la_SOURCES = \
 radeonsi_drv_la_LDFLAGS = -module -avoid-version -shared -no-undefined
 
 radeonsi_drv_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/xorg/libxorgtracker.la \
 	$(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
 	$(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
@@ -53,17 +53,12 @@ radeonsi_drv_la_LIBADD = \
 	$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
+	$(LLVM_RADEON_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(LIBDRM_XORG_LIBS) \
 	$(LIBKMS_XORG_LIBS) \
 	$(RADEON_LIBS)
 
-if HAVE_MESA_LLVM
-AM_CFLAGS += $(LLVM_CFLAGS)
-radeonsi_drv_la_LDFLAGS += $(LLVM_LDFLAGS)
-radeonsi_drv_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: radeonsi_drv.la
diff --git a/src/gallium/targets/xvmc-nouveau/Makefile.am b/src/gallium/targets/xvmc-nouveau/Makefile.am
index ab980d4..d7daeab 100644
--- a/src/gallium/targets/xvmc-nouveau/Makefile.am
+++ b/src/gallium/targets/xvmc-nouveau/Makefile.am
@@ -33,7 +33,6 @@ AM_CPPFLAGS = \
 xvmcdir = $(XVMC_LIB_INSTALL_DIR)
 xvmc_LTLIBRARIES = libXvMCnouveau.la
 
-nodist_EXTRA_libXvMCnouveau_la_SOURCES = dummy.cpp
 libXvMCnouveau_la_SOURCES = \
 	target.c \
 	$(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -44,7 +43,7 @@ libXvMCnouveau_la_LDFLAGS = \
 	-no-undefined
 
 libXvMCnouveau_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \
 	$(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
 	$(top_builddir)/src/gallium/drivers/nouveau/libnouveau.la \
@@ -54,11 +53,6 @@ libXvMCnouveau_la_LIBADD = \
 	$(LIBDRM_LIBS) \
 	$(NOUVEAU_LIBS)
 
-if HAVE_MESA_LLVM
-libXvMCnouveau_la_LDFLAGS += $(LLVM_LDFLAGS)
-libXvMCnouveau_la_LIBADD += $(LLVM_LIBS)
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: libXvMCnouveau.la
diff --git a/src/gallium/targets/xvmc-r300/Makefile.am b/src/gallium/targets/xvmc-r300/Makefile.am
index 4346b68..1eaa0a7 100644
--- a/src/gallium/targets/xvmc-r300/Makefile.am
+++ b/src/gallium/targets/xvmc-r300/Makefile.am
@@ -26,14 +26,15 @@ AM_CFLAGS = \
 	$(GALLIUM_CFLAGS) \
 	$(PTHREAD_CFLAGS) \
 	$(LIBDRM_CFLAGS)
+
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/gallium/drivers \
 	-I$(top_srcdir)/src/gallium/winsys
 
 xvmcdir = $(XVMC_LIB_INSTALL_DIR)
+
 xvmc_LTLIBRARIES = libXvMCr300.la
 
-nodist_EXTRA_libXvMCr300_la_SOURCES = dummy.cpp
 libXvMCr300_la_SOURCES = \
 	target.c \
 	$(top_srcdir)/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -45,7 +46,7 @@ libXvMCr300_la_LDFLAGS = \
 	-no-undefined
 
 libXvMCr300_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
         $(top_builddir)/src/gallium/drivers/r300/libr300-helper.la \
         $(top_builddir)/src/gallium/drivers/r300/libr300.la \
 	$(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \
@@ -58,7 +59,6 @@ libXvMCr300_la_LIBADD = \
 
 if HAVE_MESA_LLVM
 libXvMCr300_la_LDFLAGS += $(LLVM_LDFLAGS)
-libXvMCr300_la_LIBADD += $(LLVM_LIBS)
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/targets/xvmc-r600/Makefile.am b/src/gallium/targets/xvmc-r600/Makefile.am
index 68d8150..3eee8f5 100644
--- a/src/gallium/targets/xvmc-r600/Makefile.am
+++ b/src/gallium/targets/xvmc-r600/Makefile.am
@@ -44,30 +44,18 @@ libXvMCr600_la_LDFLAGS = \
 	-no-undefined
 
 libXvMCr600_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.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/xvmc/libxvmctracker.la \
 	$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
+	$(LLVM_R600_LIBS) \
 	$(GALLIUM_DRI_LIB_DEPS) \
 	$(XVMC_LIBS) \
 	$(LIBDRM_LIBS) \
 	$(RADEON_LIBS)
 
-if HAVE_MESA_LLVM
-libXvMCr600_la_LINK = $(CXXLINK) $(libXvMCr600_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libXvMCr600_la_SOURCES = dummy-cpp.cpp
-
-libXvMCr600_la_LDFLAGS += $(LLVM_LDFLAGS)
-libXvMCr600_la_LIBADD += $(LLVM_LIBS)
-else
-libXvMCr600_la_LINK = $(LINK) $(libXvMCr600_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libXvMCr600_la_SOURCES = dummy-c.c
-endif
-
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
 all-local: libXvMCr600.la
diff --git a/src/gallium/targets/xvmc-softpipe/Makefile.am b/src/gallium/targets/xvmc-softpipe/Makefile.am
index eea6700..819c7dd 100644
--- a/src/gallium/targets/xvmc-softpipe/Makefile.am
+++ b/src/gallium/targets/xvmc-softpipe/Makefile.am
@@ -44,7 +44,7 @@ libXvMCsoftpipe_la_LDFLAGS = \
 	-no-undefined
 
 libXvMCsoftpipe_la_LIBADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \
 	$(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
 	$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
@@ -53,16 +53,8 @@ libXvMCsoftpipe_la_LIBADD = \
 	$(LIBDRM_LIBS)
 
 if HAVE_MESA_LLVM
-libXvMCsoftpipe_la_LINK = $(CXXLINK) $(libXvMCsoftpipe_la_LDFLAGS)
-# Mention a dummy pure C++ file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libXvMCsoftpipe_la_SOURCES = dummy-cpp.cpp
-
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
-libXvMCsoftpipe_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la $(LLVM_LIBS)
-else
-libXvMCsoftpipe_la_LINK = $(LINK) $(libXvMCsoftpipe_la_LDFLAGS)
-# Mention a dummy pure C file to trigger generation of the $(LINK) variable
-nodist_EXTRA_libXvMCsoftpipe_la_SOURCES = dummy-c.c
+libXvMCsoftpipe_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
 endif
 
 # Provide compatibility with scripts for the old Mesa build system for
diff --git a/src/gallium/tests/trivial/Makefile.am b/src/gallium/tests/trivial/Makefile.am
index d65eb86..6b95b2e 100644
--- a/src/gallium/tests/trivial/Makefile.am
+++ b/src/gallium/tests/trivial/Makefile.am
@@ -14,7 +14,7 @@ AM_CPPFLAGS = \
 LDADD = $(GALLIUM_PIPE_LOADER_LIBS) \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(LIBUDEV_LIBS) \
 	$(DLOPEN_LIBS) \
 	$(PTHREAD_LIBS) \
diff --git a/src/gallium/tests/unit/Makefile.am b/src/gallium/tests/unit/Makefile.am
index c157cc0..cf9e060 100644
--- a/src/gallium/tests/unit/Makefile.am
+++ b/src/gallium/tests/unit/Makefile.am
@@ -10,7 +10,7 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/gallium/winsys
 
 LDADD = \
-	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+	$(top_builddir)/src/gallium/auxiliary/libgallium at VERSION@.la \
 	$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
 	$(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \
 	$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
-- 
1.8.1.4



More information about the mesa-dev mailing list