targets/xvmc-nouveau: Convert to automake
[mesa.git] / configure.ac
index 0e66823e7735d41f25db567a046dc2ce570fb1fc..87a71587331663d00fa870ff5cecb77896109ade 100644 (file)
@@ -10,7 +10,7 @@ AC_INIT([Mesa], [9.1.0],
     [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
 AC_CONFIG_AUX_DIR([bin])
 AC_CONFIG_MACRO_DIR([m4])
-AC_CANONICAL_HOST
+AC_CANONICAL_SYSTEM
 AM_INIT_AUTOMAKE([foreign])
 
 dnl http://people.gnome.org/~walters/docs/build-api.txt
@@ -24,16 +24,13 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 
-LT_PREREQ([2.2])
-LT_INIT([disable-static])
-
 dnl Set internal versions
 OSMESA_VERSION=8
 AC_SUBST([OSMESA_VERSION])
 
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
-LIBDRM_RADEON_REQUIRED=2.4.39
+LIBDRM_RADEON_REQUIRED=2.4.40
 LIBDRM_INTEL_REQUIRED=2.4.38
 LIBDRM_NVVIEUX_REQUIRED=2.4.33
 LIBDRM_NOUVEAU_REQUIRED=2.4.33
@@ -45,7 +42,9 @@ LIBKMS_XORG_REQUIRED=1.0.0
 dnl Check for progs
 AC_PROG_CPP
 AC_PROG_CC
+AX_PROG_CC_FOR_BUILD
 AC_PROG_CXX
+AX_PROG_CXX_FOR_BUILD
 AM_PROG_CC_C_O
 AM_PROG_AS
 AC_CHECK_PROGS([MAKE], [gmake make])
@@ -54,6 +53,9 @@ AC_PROG_SED
 AC_PROG_MKDIR_P
 AC_PATH_PROG([MKDEP], [makedepend])
 
+LT_PREREQ([2.2])
+LT_INIT([disable-static])
+
 if test "x$MKDEP" = "x"; then
     AC_MSG_ERROR([makedepend is required to build Mesa])
 fi
@@ -71,7 +73,7 @@ AC_PATH_PROG([PERL], [perl])
 
 AC_CHECK_PROG(INDENT, indent, indent, cat)
 if test "x$INDENT" != "xcat"; then
-    AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool')
+    AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
 fi
 
 dnl Our fallback install-sh is a symlink to minstall. Use the existing
@@ -155,24 +157,47 @@ dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
 _SAVE_LDFLAGS="$LDFLAGS"
 _SAVE_CPPFLAGS="$CPPFLAGS"
 
+dnl build host compiler macros
+DEFINES_FOR_BUILD=""
+AC_SUBST([DEFINES_FOR_BUILD])
+case "$build_os" in
+linux*|*-gnu*|gnu*)
+    DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -D_GNU_SOURCE"
+    ;;
+solaris*)
+    DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DSVR4"
+    ;;
+cygwin*)
+    DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD"
+    ;;
+esac
+
 dnl Compiler macros
 DEFINES=""
 AC_SUBST([DEFINES])
 case "$host_os" in
 linux*|*-gnu*|gnu*)
-    DEFINES="$DEFINES -D_GNU_SOURCE"
+    DEFINES="$DEFINES -D_GNU_SOURCE -DHAVE_PTHREAD"
     ;;
 solaris*)
-    DEFINES="$DEFINES -DSVR4"
+    DEFINES="$DEFINES -DHAVE_PTHREAD -DSVR4"
     ;;
 cygwin*)
-    DEFINES="$DEFINES"
+    DEFINES="$DEFINES -DHAVE_PTHREAD"
     ;;
 esac
 
 dnl Add flags for gcc and g++
 if test "x$GCC" = xyes; then
-    CFLAGS="$CFLAGS -Wall -std=c99"
+    case "$host_os" in
+    cygwin*)
+        CFLAGS="$CFLAGS -Wall -std=gnu99"
+        ;;
+    *)
+        CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -Wall -std=c99"
+        CFLAGS="$CFLAGS -Wall -std=c99"
+        ;;
+    esac
 
     # Enable -Werror=implicit-function-declaration and
     # -Werror=missing-prototypes, if available, or otherwise, just
@@ -199,13 +224,16 @@ if test "x$GCC" = xyes; then
     CFLAGS=$save_CFLAGS
 
     # Work around aliasing bugs - developers should comment this out
+    CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-strict-aliasing"
     CFLAGS="$CFLAGS -fno-strict-aliasing"
 
     # gcc's builtin memcmp is slower than glibc's
     # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
+    CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-builtin-memcmp"
     CFLAGS="$CFLAGS -fno-builtin-memcmp"
 fi
 if test "x$GXX" = xyes; then
+    CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -Wall"
     CXXFLAGS="$CXXFLAGS -Wall"
 
     # Enable -fvisibility=hidden if using a gcc that supports it
@@ -222,10 +250,12 @@ if test "x$GXX" = xyes; then
     CXXFLAGS=$save_CXXFLAGS
 
     # Work around aliasing bugs - developers should comment this out
+    CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-strict-aliasing"
     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
 
     # gcc's builtin memcmp is slower than glibc's
     # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
+    CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-builtin-memcmp"
     CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
 fi
 
@@ -309,12 +339,20 @@ AC_ARG_ENABLE([debug],
     [enable_debug=no]
 )
 if test "x$enable_debug" = xyes; then
+    DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DDEBUG"
+    if test "x$GCC_FOR_BUILD" = xyes; then
+        CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -g -O0"
+    fi
+    if test "x$GXX_FOR_BUILD" = xyes; then
+        CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -g -O0"
+    fi
+
     DEFINES="$DEFINES -DDEBUG"
     if test "x$GCC" = xyes; then
-        CFLAGS="$CFLAGS -g"
+        CFLAGS="$CFLAGS -g -O0"
     fi
     if test "x$GXX" = xyes; then
-        CXXFLAGS="$CXXFLAGS -g"
+        CXXFLAGS="$CXXFLAGS -g -O0"
     fi
 fi
 
@@ -497,16 +535,14 @@ AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
        [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
 AC_SUBST([DLOPEN_LIBS])
 
+AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
+               [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
+                             [AC_MSG_ERROR([Couldn't find clock_gettime])])])
+AC_SUBST([CLOCK_LIB])
+
 dnl See if posix_memalign is available
 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
 
-dnl signbit() is a macro in glibc's math.h, so AC_CHECK_FUNC fails. To handle
-dnl this, use AC_CHECK_DECLS and fallback to AC_CHECK_FUNC in case it fails.
-AC_CHECK_DECLS([signbit],[],
-               AC_CHECK_FUNC([signbit],[],
-                             AC_MSG_ERROR([could not find signbit()])),
-               [#include <math.h>])
-
 dnl Check for pthreads
 AX_PTHREAD
 dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
@@ -606,11 +642,6 @@ AC_ARG_ENABLE([vdpau],
          [enable vdpau library @<:@default=auto@:>@])],
    [enable_vdpau="$enableval"],
    [enable_vdpau=auto])
-AC_ARG_ENABLE([va],
-   [AS_HELP_STRING([--enable-va],
-         [enable va library @<:@default=auto@:>@])],
-   [enable_va="$enableval"],
-   [enable_va=auto])
 AC_ARG_ENABLE([opencl],
    [AS_HELP_STRING([--enable-opencl],
          [enable OpenCL library @<:@default=no@:>@])],
@@ -675,7 +706,6 @@ if test "x$enable_opengl" = xno -a \
         "x$enable_d3d1x" = xno -a \
         "x$enable_xvmc" = xno -a \
         "x$enable_vdpau" = xno -a \
-        "x$enable_va" = xno -a \
         "x$enable_opencl" = xno; then
     AC_MSG_ERROR([at least one API should be enabled])
 fi
@@ -823,7 +853,7 @@ if test "x$enable_dri" = xyes; then
 fi
 
 dnl Find out if X is available.
-PKG_CHECK_MODULES([X11], [x11])
+PKG_CHECK_MODULES([X11], [x11], [no_x=no], [no_x=yes])
 
 dnl Try to tell the user that the --x-* options are only used when
 dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
@@ -836,10 +866,6 @@ if test "x$enable_glx" = xyes -a "x$no_x" = xyes; then
     AC_MSG_ERROR([X11 development libraries needed for GLX])
 fi
 
-if test "x$enable_glx" = xyes; then
-    DEFINES="$DEFINES -DUSE_XCB"
-fi
-
 dnl Direct rendering or just indirect rendering
 case "$host_os" in
 gnu*)
@@ -856,7 +882,7 @@ cygwin*)
 esac
 AC_ARG_ENABLE([driglx-direct],
     [AS_HELP_STRING([--disable-driglx-direct],
-        [enable direct rendering in GLX and EGL for DRI \
+        [disable direct rendering in GLX and EGL for DRI \
             @<:@default=auto@:>@])],
     [driglx_direct="$enableval"],
     [driglx_direct="$driglx_direct_default"])
@@ -886,7 +912,7 @@ xyesno)
     fi
 
     # find the DRI deps for libGL
-    dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx >= 1.8.1"
+    dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8"
 
     # add xf86vidmode if available
     PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
@@ -956,7 +982,7 @@ AC_ARG_ENABLE([glx-tls],
 AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
 
 AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
-      [DEFINES="${DEFINES} -DGLX_USE_TLS"])
+      [DEFINES="${DEFINES} -DGLX_USE_TLS -DHAVE_PTHREAD"])
 
 dnl
 dnl More DRI setup
@@ -1040,7 +1066,7 @@ if test "x$enable_dri" = xyes; then
         esac
         ;;
     freebsd* | dragonfly* | *netbsd*)
-        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
+        DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
         DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
 
         if test "x$DRI_DIRS" = "xyes"; then
@@ -1100,8 +1126,9 @@ if test "x$enable_dri" = xyes; then
 
     # put all the necessary libs together
     DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
-    GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
+    GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
 fi
+AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS")
 AC_SUBST([DRI_DIRS])
 AC_SUBST([EXPAT_INCLUDES])
 AC_SUBST([DRI_LIB_DEPS])
@@ -1231,8 +1258,6 @@ if test "x$enable_gbm" = xyes; then
         if test "x$enable_shared_glapi" = xno; then
             AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
         fi
-        PKG_CHECK_MODULES([LIBKMS], [libkms], [],
-                          AC_MSG_ERROR([gbm needs libkms]))
     fi
 fi
 GBM_PC_REQ_PRIV="libudev"
@@ -1253,10 +1278,6 @@ if test "x$enable_egl" = xyes; then
 
     if test "$enable_static" != yes; then
         # build egl_glx when libGL is built
-        if test "x$enable_glx" = xyes; then
-           HAVE_EGL_DRIVER_GLX=1
-        fi
-
         PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
                           [have_libudev=yes],[have_libudev=no])
         if test "$have_libudev" = yes; then
@@ -1374,7 +1395,7 @@ if test "x$enable_openvg" = xyes; then
     CORE_DIRS="$CORE_DIRS mapi/vgapi"
     GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
     HAVE_ST_VEGA=yes
-    VG_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
+    VG_PC_LIB_PRIV="-lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
     AC_SUBST([VG_PC_LIB_PRIV])
 fi
 
@@ -1411,12 +1432,6 @@ if test "x$enable_gallium_g3dvl" = xyes; then
     if test "x$enable_vdpau" = xauto; then
        PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no])
     fi
-
-    if test "x$enable_va" = xauto; then
-       #don't enable vaapi state tracker even if package exists
-       #PKG_CHECK_EXISTS([libva], [enable_vdpau=yes], [enable_vdpau=no])
-        enable_va=no
-    fi
 fi
 
 if test "x$enable_xvmc" = xyes; then
@@ -1431,30 +1446,33 @@ if test "x$enable_vdpau" = xyes; then
     HAVE_ST_VDPAU="yes"
 fi
 
-if test "x$enable_va" = xyes; then
-    PKG_CHECK_MODULES([LIBVA], [libva = 0.31.1 x11-xcb xcb-dri2 >= 1.8])
-    AC_MSG_WARN([vaapi state tracker currently unmaintained])
-    GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS va"
-    HAVE_ST_VA="yes"
-fi
-
 dnl
 dnl OpenCL configuration
 dnl
 
 AC_ARG_WITH([libclc-path],
    [AS_HELP_STRING([--with-libclc-path],
-         [Path to libclc builtins library.  Example: --with-libclc-path=\$HOME/libclc/])],
+         [DEPRECATED: See http://dri.freedesktop.org/wiki/GalliumCompute#How_to_Install])],
    [LIBCLC_PATH="$withval"],
    [LIBCLC_PATH=""])
 
+if test "x$LIBCLC_PATH" != x; then
+   AC_MSG_ERROR([The --with-libclc-path option has been deprecated.
+                  Please review the updated build instructions for clover:
+                 http://dri.freedesktop.org/wiki/GalliumCompute])
+fi
+
+
 AC_ARG_WITH([clang-libdir],
    [AS_HELP_STRING([--with-clang-libdir],
          [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
    [CLANG_LIBDIR="$withval"],
    [CLANG_LIBDIR=""])
 
-AC_SUBST([LIBCLC_PATH])
+LIBCLC_INCLUDEDIR=`pkg-config --variable=includedir libclc`
+LIBCLC_LIBEXECDIR=`pkg-config --variable=libexecdir libclc`
+AC_SUBST([LIBCLC_INCLUDEDIR])
+AC_SUBST([LIBCLC_LIBEXECDIR])
 
 if test "x$enable_opencl" = xyes; then
     if test "x$with_gallium_drivers" = x; then
@@ -1465,6 +1483,10 @@ if test "x$enable_opencl" = xyes; then
         AC_MSG_ERROR([gcc >= 4.6 is required to build clover])
     fi
 
+    if test "x$LIBCLC_INCLUDEDIR" == x || test "x$LIBCLC_LIBEXECDIR" == x; then
+        AC_MSG_ERROR([pkg-config cannot use libclc.pc which is required to build clover])
+    fi
+
     GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS clover"
     GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS opencl"
     enable_gallium_loader=yes
@@ -1527,8 +1549,7 @@ for plat in $egl_platforms; do
                ;;
 
        wayland)
-               PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
-                                 [AC_MSG_ERROR([cannot find libwayland-client])])
+               PKG_CHECK_MODULES([WAYLAND], [wayland-client >= 1.0.2 wayland-server >= 1.0.2])
                GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
 
                 WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
@@ -1537,12 +1558,11 @@ for plat in $egl_platforms; do
                ;;
 
        x11)
-               PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes])
-               # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
-               save_LIBS="$LIBS"
-               AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
-                            [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"])
-               LIBS="$save_LIBS"
+               PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 >= 1.8 xcb-xfixes])
+
+                if test "x$enable_glx" = xyes; then
+                        HAVE_EGL_DRIVER_GLX=1
+                fi
                ;;
 
        drm)
@@ -1639,6 +1659,21 @@ AC_ARG_WITH([llvm-prefix],
     [llvm_prefix=""])
 
 
+# Call this inside ` ` to get the return value.
+# $1 is the llvm-config command with arguments.
+strip_unwanted_llvm_flags() {
+    # Use \> (marks the end of the word)
+    echo `$1` | sed \
+       -e 's/-DNDEBUG\>//g' \
+       -e 's/-pedantic\>//g' \
+       -e 's/-Wcovered-switch-default\>//g' \
+       -e 's/-O.\>//g' \
+       -e 's/-g\>//g' \
+       -e 's/-Wall\>//g' \
+       -e 's/-fomit-frame-pointer\>//g'
+}
+
+
 if test "x$with_gallium_drivers" = x; then
     enable_gallium_llvm=no
 fi
@@ -1656,8 +1691,8 @@ if test "x$enable_gallium_llvm" = xyes; then
 
     if test "x$LLVM_CONFIG" != xno; then
        LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
-       LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e 's/-pedantic//g' -e 's/-Wcovered-switch-default//g'`
-       if test "x$with_llvm_shared_libs" = xyes; then
+       LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
+        if test "x$with_llvm_shared_libs" = xyes; then
            dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
            LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
        else
@@ -1673,11 +1708,12 @@ if test "x$enable_gallium_llvm" = xyes; then
        fi
        LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
        LLVM_BINDIR=`$LLVM_CONFIG --bindir`
-       LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags`
-       LLVM_CPPFLAGS=`$LLVM_CONFIG --cppflags`
+       LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
+       LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
+       LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
        LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
        LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
-       DEFINES="${DEFINES} -DHAVE_LLVM=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/0x0\10\2/g'`"
+       DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT"
        MESA_LLVM=1
 
        dnl Check for Clang interanl headers
@@ -1691,9 +1727,11 @@ if test "x$enable_gallium_llvm" = xyes; then
         fi
     else
        MESA_LLVM=0
+       LLVM_VERSION_INT=0
     fi
 else
     MESA_LLVM=0
+    LLVM_VERSION_INT=0
 fi
 
 dnl Directory for XVMC libs
@@ -1720,14 +1758,6 @@ AC_ARG_WITH([vdpau-libdir],
     [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
 AC_SUBST([VDPAU_LIB_INSTALL_DIR])
 
-dnl Directory for VA libs
-AC_ARG_WITH([va-libdir],
-    [AS_HELP_STRING([--with-va-libdir=DIR],
-        [directory for the VA libraries @<:@default=${libdir}/va@:>@])],
-    [VA_LIB_INSTALL_DIR="$withval"],
-    [VA_LIB_INSTALL_DIR='${libdir}/va'])
-AC_SUBST([VA_LIB_INSTALL_DIR])
-
 dnl Directory for OpenCL libs
 AC_ARG_WITH([opencl-libdir],
     [AS_HELP_STRING([--with-opencl-libdir=DIR],
@@ -1742,7 +1772,7 @@ dnl
 gallium_check_st() {
     if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes ||
         test "x$HAVE_ST_XA" = xyes || test "x$HAVE_ST_XVMC" = xyes ||
-        test "x$HAVE_ST_VDPAU" = xyes || test "x$HAVE_ST_VA" = xyes; then
+        test "x$HAVE_ST_VDPAU" = xyes; then
          if test "x$have_libdrm" != xyes; then
             AC_MSG_ERROR([DRI or Xorg DDX requires libdrm >= $LIBDRM_REQUIRED])
          fi
@@ -1763,9 +1793,6 @@ gallium_check_st() {
     if test "x$HAVE_ST_VDPAU" = xyes && test "x$6" != x; then
          GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
     fi
-    if test "x$HAVE_ST_VA" = xyes && test "x$7" != x; then
-         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
-    fi
 }
 
 gallium_require_llvm() {
@@ -1779,7 +1806,7 @@ gallium_require_llvm() {
 gallium_require_drm_loader() {
     if test "x$enable_gallium_loader" = xyes; then
         PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
-                          AC_MSG_ERROR([Gallium drm loader requrires libudev]))
+                          AC_MSG_ERROR([Gallium drm loader requires libudev]))
         if test "x$have_libdrm" != xyes; then
             AC_MSG_ERROR([Gallium drm loader requires libdrm >= $LIBDRM_REQUIRED])
         fi
@@ -1788,18 +1815,21 @@ gallium_require_drm_loader() {
 }
 
 radeon_llvm_check() {
-    LLVM_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1`
-    if test "$LLVM_VERSION_MAJOR" -lt "3" -o "x$LLVM_VERSION" = "x3.0"; then
-        AC_MSG_ERROR([LLVM 3.1 or newer is required for the r600/radeonsi llvm compiler.])
+    LLVM_REQUIRED_VERSION_MAJOR="3"
+    LLVM_REQUIRED_VERSION_MINOR="2"
+    if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
+        AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer with R600 target enabled is required.
+                     To use the r600/radeonsi LLVM backend, you need to fetch the LLVM source from:
+                     git://people.freedesktop.org/~tstellar/llvm master
+                     and build with --enable-experimental-targets=R600])
     fi
-    if test "$LLVM_VERSION_MAJOR" -ge "3" -a "x$LLVM_VERSION" != "x3.1" && $LLVM_CONFIG --targets-built | grep -qv '\<AMDGPU\>' ; then
-        AC_MSG_ERROR([To use the r600/radeonsi LLVM backend with LLVM 3.2 and newer, you need to fetch the LLVM source from:
-                      git://people.freedesktop.org/~tstellar/llvm master
-                      and build with --enable-experimental-targets==AMDGPU])
-    fi
-    if test "x$LLVM_VERSION" = "x3.2"; then
-        LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`"
+    if test true && $LLVM_CONFIG --targets-built | grep -qv '\<R600\>' ; then
+        AC_MSG_ERROR([LLVM R600 Target not enabled.  You can enable it when building the LLVM
+                      sources with the --enable-experimental-targets=R600
+                      configure flag])
     fi
+    AC_MSG_WARN([Please ensure you use the latest llvm tree from git://people.freedesktop.org/~tstellar/llvm master before submitting a bug])
+    LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs r600`"
 }
 
 dnl Gallium drivers
@@ -1809,10 +1839,12 @@ if test "x$with_gallium_drivers" != x; then
     for driver in $gallium_drivers; do
         case "x$driver" in
         xsvga)
+            HAVE_GALLIUM_SVGA=yes
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
             gallium_check_st "svga/drm" "dri-vmwgfx" "" "xa-vmwgfx"
             ;;
         xi915)
+            HAVE_GALLIUM_I915=yes
             PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 softpipe"
             if test "x$MESA_LLVM" = x1; then
@@ -1822,12 +1854,14 @@ if test "x$with_gallium_drivers" != x; then
             gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
             ;;
         xr300)
+            HAVE_GALLIUM_R300=yes
             PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
             gallium_require_llvm "Gallium R300"
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
-            gallium_check_st "radeon/drm" "dri-r300" "xorg-r300" "" "xvmc-r300" "vdpau-r300" "va-r300"
+            gallium_check_st "radeon/drm" "dri-r300" "xorg-r300" "" "xvmc-r300" "vdpau-r300"
             ;;
         xr600)
+            HAVE_GALLIUM_R600=yes
             PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
             gallium_require_drm_loader
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
@@ -1841,9 +1875,10 @@ if test "x$with_gallium_drivers" != x; then
             if test "x$enable_opencl" = xyes -a "x$with_llvm_shared_libs" = xno; then
                 LLVM_LIBS="${LLVM_LIBS} `$LLVM_CONFIG --libs bitreader asmparser`"
             fi
-            gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600" "va-r600"
+            gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600"
             ;;
         xradeonsi)
+            HAVE_GALLIUM_RADEONSI=yes
             PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
             gallium_require_drm_loader
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
@@ -1852,14 +1887,17 @@ if test "x$with_gallium_drivers" != x; then
             gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi" "" "" "vdpau-radeonsi" ""
             ;;
         xnouveau)
+            HAVE_GALLIUM_NOUVEAU=yes
             PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
             gallium_require_drm_loader
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv50 nvc0"
             gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau"
             ;;
         xswrast)
+            HAVE_GALLIUM_SOFTPIPE=yes
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
             if test "x$MESA_LLVM" = x1; then
+                HAVE_GALLIUM_LLVMPIPE=yes
                 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
             fi
 
@@ -1872,12 +1910,8 @@ if test "x$with_gallium_drivers" != x; then
             if test "x$HAVE_ST_XVMC" = xyes; then
                 GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS xvmc-softpipe"
             fi
-            if test "x$HAVE_ST_VA" = xyes; then
-                GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS va-softpipe"
-            fi
             if test "x$HAVE_ST_VDPAU" = xyes ||
-               test "x$HAVE_ST_XVMC" = xyes ||
-               test "x$HAVE_ST_VA" = xyes; then
+               test "x$HAVE_ST_XVMC" = xyes; then
                if test "x$HAVE_WINSYS_XLIB" != xyes; then
                   GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
                fi
@@ -1889,6 +1923,14 @@ if test "x$with_gallium_drivers" != x; then
         esac
     done
 fi
+AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
+AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
 
 if test "x$enable_gallium_loader" = xyes; then
     GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
@@ -1941,14 +1983,26 @@ AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
 AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
 AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
+AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
+AM_CONDITIONAL(LLVM_NEEDS_FNORTTI, test $LLVM_VERSION_INT -ge 302)
+
 AC_SUBST([GALLIUM_MAKE_DIRS])
 
+AM_CONDITIONAL(NEED_LIBPROGRAM, test "x$with_gallium_drivers" != x -o \
+                                     "x$enable_xlib_glx" = xyes -o \
+                                     "x$enable_osmesa" = xyes)
 AM_CONDITIONAL(HAVE_X11_DRIVER, echo "$DRIVER_DIRS" | grep 'x11' >/dev/null 2>&1)
 
 AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
 
+AC_SUBST([VDPAU_MAJOR], 1)
+AC_SUBST([VDPAU_MINOR], 0)
+
+AC_SUBST([XVMC_MAJOR], 1)
+AC_SUBST([XVMC_MINOR], 0)
+
 dnl prepend CORE_DIRS to SRC_DIRS
 SRC_DIRS="$CORE_DIRS $SRC_DIRS"
 
@@ -1963,6 +2017,7 @@ CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
 dnl Substitute the config
 AC_CONFIG_FILES([configs/current
                Makefile
+               src/Makefile
                src/egl/Makefile
                src/egl/drivers/Makefile
                src/egl/drivers/dri2/Makefile
@@ -1974,21 +2029,79 @@ AC_CONFIG_FILES([configs/current
                src/egl/wayland/wayland-egl/Makefile
                src/egl/wayland/wayland-egl/wayland-egl.pc
                src/gallium/Makefile
+               src/gallium/auxiliary/Makefile
                src/gallium/auxiliary/pipe-loader/Makefile
                src/gallium/drivers/Makefile
+               src/gallium/drivers/i915/Makefile
+               src/gallium/drivers/llvmpipe/Makefile
+               src/gallium/drivers/nouveau/Makefile
+               src/gallium/drivers/nv30/Makefile
+               src/gallium/drivers/nv50/Makefile
+               src/gallium/drivers/nvc0/Makefile
                src/gallium/drivers/r300/Makefile
                src/gallium/drivers/r600/Makefile
+               src/gallium/drivers/radeon/Makefile
+               src/gallium/drivers/radeonsi/Makefile
+               src/gallium/drivers/rbug/Makefile
+               src/gallium/drivers/softpipe/Makefile
+               src/gallium/drivers/svga/Makefile
+               src/gallium/drivers/trace/Makefile
+               src/gallium/state_trackers/Makefile
                src/gallium/state_trackers/clover/Makefile
+               src/gallium/state_trackers/dri/Makefile
+               src/gallium/state_trackers/dri/drm/Makefile
+               src/gallium/state_trackers/dri/sw/Makefile
+               src/gallium/state_trackers/egl/Makefile
+               src/gallium/state_trackers/gbm/Makefile
+               src/gallium/state_trackers/glx/Makefile
+               src/gallium/state_trackers/vdpau/Makefile
+               src/gallium/state_trackers/vega/Makefile
+               src/gallium/state_trackers/xa/Makefile
+               src/gallium/state_trackers/xorg/Makefile
+               src/gallium/state_trackers/xvmc/Makefile
+               src/gallium/targets/Makefile
+               src/gallium/targets/dri-i915/Makefile
+               src/gallium/targets/dri-nouveau/Makefile
+               src/gallium/targets/dri-r300/Makefile
+               src/gallium/targets/dri-r600/Makefile
+               src/gallium/targets/dri-radeonsi/Makefile
+               src/gallium/targets/dri-swrast/Makefile
+               src/gallium/targets/dri-vmwgfx/Makefile
                src/gallium/targets/opencl/Makefile
+               src/gallium/targets/libgl-xlib/Makefile
+               src/gallium/targets/vdpau-nouveau/Makefile
+               src/gallium/targets/vdpau-r300/Makefile
+               src/gallium/targets/vdpau-r600/Makefile
+               src/gallium/targets/vdpau-radeonsi/Makefile
+               src/gallium/targets/vdpau-softpipe/Makefile
+               src/gallium/targets/xorg-i915/Makefile
+               src/gallium/targets/xorg-nouveau/Makefile
+               src/gallium/targets/xorg-r300/Makefile
+               src/gallium/targets/xorg-r600/Makefile
+               src/gallium/targets/xorg-radeonsi/Makefile
+               src/gallium/targets/xvmc-nouveau/Makefile
+               src/gallium/winsys/Makefile
+               src/gallium/winsys/i915/drm/Makefile
+               src/gallium/winsys/i915/sw/Makefile
+               src/gallium/winsys/nouveau/drm/Makefile
+               src/gallium/winsys/radeon/drm/Makefile
+               src/gallium/winsys/svga/drm/Makefile
+               src/gallium/winsys/sw/Makefile
+               src/gallium/winsys/sw/dri/Makefile
+               src/gallium/winsys/sw/fbdev/Makefile
+               src/gallium/winsys/sw/null/Makefile
+               src/gallium/winsys/sw/wayland/Makefile
+               src/gallium/winsys/sw/wrapper/Makefile
+               src/gallium/winsys/sw/xlib/Makefile
                src/gbm/Makefile
                src/gbm/main/gbm.pc
                src/glsl/Makefile
+               src/glsl/builtin_compiler/Makefile
                src/glsl/glcpp/Makefile
                src/glsl/tests/Makefile
                src/glx/Makefile
                src/glx/tests/Makefile
                src/gtest/Makefile
-               src/Makefile
                src/mapi/es1api/Makefile
                src/mapi/es1api/glesv1_cm.pc
                src/mapi/es2api/Makefile
@@ -2017,6 +2130,8 @@ AC_CONFIG_FILES([configs/current
                src/mesa/drivers/x11/Makefile
                src/mesa/libdricore/Makefile
                src/mesa/main/tests/Makefile
+               src/mesa/main/tests/hash_table/Makefile
+               src/mesa/program/Makefile
                src/mesa/x86-64/Makefile
                src/mesa/x86/Makefile])
 
@@ -2136,6 +2251,12 @@ echo "        CFLAGS:          $cflags"
 echo "        CXXFLAGS:        $cxxflags"
 echo "        Macros:          $defines"
 echo ""
+if test "x$MESA_LLVM" = x1; then
+    echo "        LLVM_CFLAGS:     $LLVM_CFLAGS"
+    echo "        LLVM_CXXFLAGS:   $LLVM_CXXFLAGS"
+    echo "        LLVM_CPPFLAGS:   $LLVM_CPPFLAGS"
+    echo ""
+fi
 echo "        PYTHON2:         $PYTHON2"
 
 echo ""