Merge remote-tracking branch 'origin/master' into pipe-video
[mesa.git] / configure.ac
index e1702ba2007ad4475bfb09bba9843aedc5b1326c..70c84b76cac10fe02ffd15b0b23e9d05e359e39f 100644 (file)
@@ -18,12 +18,12 @@ AC_CONFIG_AUX_DIR([bin])
 AC_CANONICAL_HOST
 
 dnl Versions for external dependencies
-LIBDRM_REQUIRED=2.4.23
-LIBDRM_RADEON_REQUIRED=2.4.23
-LIBDRM_INTEL_REQUIRED=2.4.23
+LIBDRM_REQUIRED=2.4.24
+LIBDRM_RADEON_REQUIRED=2.4.24
+LIBDRM_INTEL_REQUIRED=2.4.24
 DRI2PROTO_REQUIRED=2.1
 GLPROTO_REQUIRED=1.4.11
-LIBDRM_XORG_REQUIRED=2.4.23
+LIBDRM_XORG_REQUIRED=2.4.24
 LIBKMS_XORG_REQUIRED=1.0.0
 
 dnl Check for progs
@@ -319,6 +319,21 @@ else
     esac
 fi
 
+dnl
+dnl potentially-infringing-but-nobody-knows-for-sure stuff
+dnl
+AC_ARG_ENABLE([texture-float],
+    [AS_HELP_STRING([--enable-texture-float],
+        [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
+    [enable_texture_float="$enableval"],
+    [enable_texture_float=no]
+)
+if test "x$enable_texture_float" = xyes; then
+    AC_MSG_WARN([Floating-point textures enabled.])
+    AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
+    DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
+fi
+
 GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
 GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
 GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
@@ -729,6 +744,27 @@ else
     enable_xcb=no
 fi
 
+dnl Direct rendering or just indirect rendering
+case "$host_os" in
+gnu*)
+    dnl Disable by default on GNU/Hurd
+    driglx_direct_default="no"
+    ;;
+cygwin*)
+    dnl Disable by default on cygwin
+    driglx_direct_default="no"
+    ;;
+*)
+    driglx_direct_default="yes"
+    ;;
+esac
+AC_ARG_ENABLE([driglx-direct],
+    [AS_HELP_STRING([--disable-driglx-direct],
+        [enable direct rendering in GLX and EGL for DRI \
+            @<:@default=auto@:>@])],
+    [driglx_direct="$enableval"],
+    [driglx_direct="$driglx_direct_default"])
+
 dnl
 dnl libGL configuration per driver
 dnl
@@ -762,12 +798,17 @@ dri|no) # these checks are still desired when there is no mesa_driver
         AC_MSG_ERROR([Can't use static libraries for DRI drivers])
     fi
 
-    # Check for libdrm
-    PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
-    PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
     PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
-    GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
-    DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
+    GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
+    DRI_PC_REQ_PRIV=""
+
+    if test x"$driglx_direct" = xyes; then
+        # Check for libdrm
+        PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
+        PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
+        GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
+        DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
+    fi
 
     # find the DRI deps for libGL
     if test "$x11_pkgconfig" = yes; then
@@ -890,6 +931,9 @@ AC_ARG_ENABLE([glx-tls],
     [GLX_USE_TLS=no])
 AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
 
+AS_IF([test "x$GLX_USE_TLS" = xyes],
+      [DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"])
+
 dnl
 dnl More DRI setup
 dnl
@@ -907,12 +951,6 @@ AC_ARG_WITH([dri-searchpath],
     [DRI_DRIVER_SEARCH_DIR="$withval"],
     [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
 AC_SUBST([DRI_DRIVER_SEARCH_DIR])
-dnl Direct rendering or just indirect rendering
-AC_ARG_ENABLE([driglx-direct],
-    [AS_HELP_STRING([--disable-driglx-direct],
-        [enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
-    [driglx_direct="$enableval"],
-    [driglx_direct="yes"])
 dnl Which drivers to build - default is chosen by platform
 AC_ARG_WITH([dri-drivers],
     [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
@@ -945,11 +983,6 @@ esac
 
 dnl Set DRI_DIRS, DEFINES and LIB_DEPS
 if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
-    # Use TLS in GLX?
-    if test "x$GLX_USE_TLS" = xyes; then
-        DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
-    fi
-
     # Platform specific settings and drivers to build
     case "$host_os" in
     linux*)
@@ -1008,6 +1041,16 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
             DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
         fi
         ;;
+    cygwin*)
+        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
+        DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
+        if test "x$driglx_direct" = xyes; then
+            DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
+        fi
+        if test "x$DRI_DIRS" = "xyes"; then
+            DRI_DIRS="swrast"
+        fi
+        ;;
     esac
 
     # default drivers
@@ -1164,6 +1207,9 @@ if test "x$enable_egl" = xyes; then
                 if test "$have_libudev" = yes; then
                     DEFINES="$DEFINES -DHAVE_LIBUDEV"
                 fi
+                # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
+                AC_CHECK_LIB(xcb-dri2, xcb_dri2_connect_alignment_pad, [],
+                          [DEFINES="$DEFINES -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN"])
             fi
        fi
 
@@ -1399,8 +1445,6 @@ if test "x$enable_gallium" = xno -a "x$enable_openvg" = xyes; then
 fi
 if test "x$enable_gallium" = xyes; then
     SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
-    AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
-                [HAS_UDIS86="no"])
     AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
 fi
 
@@ -1502,6 +1546,27 @@ yes)
             fi
             have_st_vega="yes"
             ;;
+       xorg/xvmc)
+            # Check for xvmc?
+            if test "x$enable_gallium_g3dvl" != xyes; then
+                AC_MSG_ERROR([cannot build XvMC state tracker without --enable-gallium-g3dvl])
+            fi
+            HAVE_ST_XVMC="yes"
+            ;;
+        vdpau)
+            # Check for libvdpau?
+            if test "x$enable_gallium_g3dvl" != xyes; then
+                AC_MSG_ERROR([cannot build vdpau state tracker without --enable-gallium-g3dvl])
+            fi
+            HAVE_ST_VDPAU="yes"
+            ;;
+       va)
+            # Check for libva?
+            if test "x$enable_gallium_g3dvl" != xyes; then
+                AC_MSG_ERROR([cannot build va state tracker without --enable-gallium-g3dvl])
+            fi
+            HAVE_ST_VA="yes"
+            ;;
         esac
 
        if test -n "$tracker"; then
@@ -1589,9 +1654,10 @@ yes)
                 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/fbdev"
         fi
        if test "$plat" = "wayland"; then
-               PKG_CHECK_MODULES([WAYLAND], [wayland-client],, \
+               PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
                                  [AC_MSG_ERROR([cannot find libwayland-client])])
                WAYLAND_EGL_LIB_DEPS="$WAYLAND_LIBS $LIBDRM_LIBS"
+                GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
        fi
     done
     EGL_PLATFORMS="$egl_platforms"
@@ -1643,19 +1709,20 @@ dnl Gallium LLVM
 dnl
 AC_ARG_ENABLE([gallium-llvm],
     [AS_HELP_STRING([--enable-gallium-llvm],
-        [build gallium LLVM support @<:@default=disabled@:>@])],
+        [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
     [enable_gallium_llvm="$enableval"],
     [enable_gallium_llvm=auto])
+if test "x$enable_gallium_llvm" = xauto; then
+    case "$host_cpu" in
+    i*86|x86_64) enable_gallium_llvm=yes;;
+    esac
+fi
 if test "x$enable_gallium_llvm" = xyes; then
     if test "x$LLVM_CONFIG" != xno; then
        LLVM_VERSION=`$LLVM_CONFIG --version`
        LLVM_CFLAGS=`$LLVM_CONFIG --cppflags`
-       LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
+       LLVM_LIBS="`$LLVM_CONFIG --libs` -lstdc++"
 
-       if test "x$HAS_UDIS86" != xno; then
-           LLVM_LIBS="$LLVM_LIBS -ludis86"
-           DEFINES="$DEFINES -DHAVE_UDIS86"
-       fi
        LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
        GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
        DEFINES="$DEFINES -DGALLIUM_LLVMPIPE -D__STDC_CONSTANT_MACROS"
@@ -1671,7 +1738,7 @@ dnl
 dnl Gallium helper functions
 dnl
 gallium_check_st() {
-    if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes; then
+    if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_XORG" = xyes || test "x$HAVE_ST_XVMC" = xyes || test "x$HAVE_ST_VDPAU" = xyes || test "x$HAVE_ST_VA" = xyes; then
          GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
     fi
     if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
@@ -1680,6 +1747,15 @@ gallium_check_st() {
     if test "x$HAVE_ST_XORG" = xyes && test "x$3" != x; then
          GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
     fi
+    if test "x$HAVE_ST_XVMC" = xyes && test "x$4" != x; then
+         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
+    fi
+    if test "x$HAVE_ST_VDPAU" = xyes && test "x$5" != x; then
+         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
+    fi
+    if test "x$HAVE_ST_VA" = xyes && test "x$6" != x; then
+         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
+    fi
 }
 
 
@@ -1733,16 +1809,29 @@ fi
 dnl
 dnl Gallium Radeon r300g configuration
 dnl
-AC_ARG_ENABLE([gallium-radeon],
-    [AS_HELP_STRING([--enable-gallium-radeon],
-        [build gallium radeon @<:@default=disabled@:>@])],
-    [enable_gallium_radeon="$enableval"],
-    [enable_gallium_radeon=auto])
-if test "x$enable_gallium_radeon" = xauto; then
+AC_ARG_ENABLE([gallium-r300],
+    [AS_HELP_STRING([--enable-gallium-r300],
+        [build gallium r300 @<:@default=build DRI driver only@:>@])],
+    [enable_gallium_r300="$enableval"],
+    [enable_gallium_r300=auto])
+
+if test "$mesa_driver" != dri ; then
+    if test "x$enable_gallium_r300" = xauto; then
+      enable_gallium_r300=no
+    fi
+fi
+
+if test "x$enable_gallium_r300" != xno; then
+    if test "x$MESA_LLVM" = x0; then
+        case "$host_cpu" in
+        i*86|x86_64) AC_MSG_ERROR([LLVM is required to build Gallium R300 on x86 and x86_64]);;
+        esac
+    fi
+fi
+if test "x$enable_gallium_r300" = xauto; then
     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
     gallium_check_st "radeon/drm" "dri-r300"
-fi
-if test "x$enable_gallium_radeon" = xyes; then
+elif test "x$enable_gallium_r300" = xyes; then
     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
     gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
 fi
@@ -1752,12 +1841,12 @@ dnl Gallium Radeon r600g configuration
 dnl
 AC_ARG_ENABLE([gallium-r600],
     [AS_HELP_STRING([--enable-gallium-r600],
-        [build gallium radeon @<:@default=disabled@:>@])],
+        [build gallium r600 @<:@default=disabled@:>@])],
     [enable_gallium_r600="$enableval"],
     [enable_gallium_r600=auto])
 if test "x$enable_gallium_r600" = xyes; then
     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
-    gallium_check_st "r600/drm" "dri-r600"
+    gallium_check_st "r600/drm" "dri-r600" "" "xvmc-r600" "vdpau-r600" "va-r600"
 fi
 
 dnl
@@ -1770,8 +1859,50 @@ AC_ARG_ENABLE([gallium-nouveau],
     [enable_gallium_nouveau=no])
 if test "x$enable_gallium_nouveau" = xyes; then
     GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50 nvc0"
-    gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau"
+    gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "xvmc-nouveau"
+fi
+
+dnl
+dnl Gallium G3DVL configuration
+dnl
+AC_ARG_ENABLE([gallium-g3dvl],
+    [AS_HELP_STRING([--enable-gallium-g3dvl],
+        [build gallium g3dvl @<:@default=disabled@:>@])],
+    [enable_gallium_g3dvl="$enableval"],
+    [enable_gallium_g3dvl=no])
+if test "x$enable_gallium_g3dvl" = xyes; then
+    case "$mesa_driver" in
+    xlib)
+       if test "x$HAVE_ST_VDPAU" = xyes; then
+        GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS vdpau-softpipe"
+       fi
+       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
+       ;;
+    dri)
+        GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS g3dvl/dri"
+        ;;
+    esac
 fi
+dnl Directory for VDPAU libs
+AC_ARG_WITH([vdpau-libdir],
+    [AS_HELP_STRING([--with-vdpau-libdir=DIR],
+        [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
+    [VDPAU_LIB_INSTALL_DIR="$withval"],
+    [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
 dnl Gallium swrast configuration