i965: Clean up error handling for context creation.
[mesa.git] / configure.ac
index 382f26fc4004177c366b5037e1e190b60a7135cf..0d082d213b6923eb4b626514b3904f273573cf87 100644 (file)
@@ -45,9 +45,7 @@ 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])
@@ -142,21 +140,6 @@ 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])
@@ -179,7 +162,6 @@ if test "x$GCC" = xyes; then
         CFLAGS="$CFLAGS -Wall -std=gnu99"
         ;;
     *)
-        CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -Wall -std=c99"
         CFLAGS="$CFLAGS -Wall -std=c99"
         ;;
     esac
@@ -209,16 +191,13 @@ 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
@@ -235,12 +214,10 @@ 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
 
@@ -315,14 +292,6 @@ 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 -O0"
@@ -1063,10 +1032,13 @@ 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 $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
+
+    DRI_DRIVER_LDFLAGS="-module -avoid-version -shared -Wl,-Bsymbolic"
 fi
 AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS")
 AC_SUBST([EXPAT_INCLUDES])
 AC_SUBST([DRI_LIB_DEPS])
+AC_SUBST([DRI_DRIVER_LDFLAGS])
 AC_SUBST([GALLIUM_DRI_LIB_DEPS])
 
 case $DRI_DIRS in
@@ -1372,10 +1344,7 @@ AC_ARG_WITH([clang-libdir],
    [CLANG_LIBDIR="$withval"],
    [CLANG_LIBDIR=""])
 
-LIBCLC_INCLUDEDIR=`pkg-config --variable=includedir libclc`
-LIBCLC_LIBEXECDIR=`pkg-config --variable=libexecdir libclc`
-AC_SUBST([LIBCLC_INCLUDEDIR])
-AC_SUBST([LIBCLC_LIBEXECDIR])
+PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
 
 if test "x$enable_opencl" = xyes; then
     if test "x$with_gallium_drivers" = x; then
@@ -1386,8 +1355,16 @@ 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])
+    if test "x$have_libclc" = xno; then
+        AC_MSG_ERROR([pkg-config cannot find libclc.pc which is required to build clover.
+                    Make sure the directory containing libclc.pc is specified in your
+                    PKG_CONFIG_PATH environment variable.
+                    By default libclc.pc is installed to /usr/local/share/pkgconfig/])
+    else
+        LIBCLC_INCLUDEDIR=`pkg-config --variable=includedir libclc`
+        LIBCLC_LIBEXECDIR=`pkg-config --variable=libexecdir libclc`
+        AC_SUBST([LIBCLC_INCLUDEDIR])
+        AC_SUBST([LIBCLC_LIBEXECDIR])
     fi
 
     GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS clover"
@@ -1555,8 +1532,9 @@ AC_ARG_WITH([llvm-shared-libs],
     [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
+        if test "x$with_llvm_shared_libs" != xyes; then
+            AC_MSG_ERROR([OpenCL requires LLVM shared libraries])
+        fi
     ])
 
 AC_ARG_WITH([llvm-prefix],
@@ -1795,7 +1773,7 @@ if test "x$with_gallium_drivers" != x; then
             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" "" "" "xvmc-r300" "vdpau-r300"
+            gallium_check_st "radeon/drm" "r300/dri" "" "" "r300/xvmc" "r300/vdpau"
             ;;
         xr600)
             HAVE_GALLIUM_R600=yes
@@ -1804,7 +1782,6 @@ 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
-                R600_NEED_RADEON_GALLIUM=yes;
                 LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
             fi
             if test "x$enable_r600_llvm" = xyes; then
@@ -1813,7 +1790,7 @@ if test "x$with_gallium_drivers" != x; then
             if test "x$enable_opencl" = xyes; then
                 LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
             fi
-            gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600"
+            gallium_check_st "radeon/drm" "r600/dri" "r600/xorg" "" "r600/xvmc" "r600/vdpau"
             ;;
         xradeonsi)
             HAVE_GALLIUM_RADEONSI=yes
@@ -1821,13 +1798,13 @@ if test "x$with_gallium_drivers" != x; then
             gallium_require_drm_loader
             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
             radeon_llvm_check
-            gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi" "" "" "vdpau-radeonsi" ""
+            gallium_check_st "radeon/drm" "radeonsi/dri" "radeonsi/xorg" "" "" "radeonsi/vdpau" ""
             ;;
         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_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau"
             gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau"
             ;;
         xfreedreno)
@@ -1961,7 +1938,6 @@ AM_CONDITIONAL(NEED_WINSYS_WRAPPER, test "x$HAVE_GALLIUM_I915" = xyes -o \
                                          "x$HAVE_GALLIUM_SVGA" = xyes)
 AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
 AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
-AM_CONDITIONAL(R600_NEED_RADEON_GALLIUM, test x$R600_NEED_RADEON_GALLIUM = xyes)
 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)
@@ -2000,6 +1976,12 @@ dnl Restore LDFLAGS and CPPFLAGS
 LDFLAGS="$_SAVE_LDFLAGS"
 CPPFLAGS="$_SAVE_CPPFLAGS"
 
+dnl Suppress clang's warnings about unused CFLAGS and CXXFLAGS
+if test "x$acv_mesa_CLANG" = xyes; then
+    CFLAGS="$CFLAGS -Qunused-arguments"
+    CXXFLAGS="$CXXFLAGS -Qunused-arguments"
+fi
+
 dnl Add user CFLAGS and CXXFLAGS
 CFLAGS="$CFLAGS $USER_CFLAGS"
 CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
@@ -2023,13 +2005,13 @@ AC_CONFIG_FILES([Makefile
                src/gallium/drivers/freedreno/Makefile
                src/gallium/drivers/freedreno/a2xx/Makefile
                src/gallium/drivers/freedreno/a3xx/Makefile
+               src/gallium/drivers/galahad/Makefile
                src/gallium/drivers/i915/Makefile
+               src/gallium/drivers/identity/Makefile
                src/gallium/drivers/ilo/Makefile
                src/gallium/drivers/llvmpipe/Makefile
+               src/gallium/drivers/noop/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
@@ -2045,7 +2027,7 @@ AC_CONFIG_FILES([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/glx/xlib/Makefile
                src/gallium/state_trackers/osmesa/Makefile
                src/gallium/state_trackers/vdpau/Makefile
                src/gallium/state_trackers/vega/Makefile
@@ -2057,9 +2039,6 @@ AC_CONFIG_FILES([Makefile
                src/gallium/targets/dri-i915/Makefile
                src/gallium/targets/dri-ilo/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/egl-static/Makefile
@@ -2068,21 +2047,24 @@ AC_CONFIG_FILES([Makefile
                src/gallium/targets/osmesa/Makefile
                src/gallium/targets/osmesa/osmesa.pc
                src/gallium/targets/pipe-loader/Makefile
+               src/gallium/targets/radeonsi/dri/Makefile
+               src/gallium/targets/radeonsi/vdpau/Makefile
+               src/gallium/targets/radeonsi/xorg/Makefile
+               src/gallium/targets/r300/dri/Makefile
+               src/gallium/targets/r300/vdpau/Makefile
+               src/gallium/targets/r300/xvmc/Makefile
+               src/gallium/targets/r600/dri/Makefile
+               src/gallium/targets/r600/vdpau/Makefile
+               src/gallium/targets/r600/xorg/Makefile
+               src/gallium/targets/r600/xvmc/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/xa-vmwgfx/Makefile
                src/gallium/targets/xa-vmwgfx/xatracker.pc
                src/gallium/targets/xorg-i915/Makefile
                src/gallium/targets/xorg-nouveau/Makefile
-               src/gallium/targets/xorg-r600/Makefile
-               src/gallium/targets/xorg-radeonsi/Makefile
                src/gallium/targets/xvmc-nouveau/Makefile
-               src/gallium/targets/xvmc-r300/Makefile
-               src/gallium/targets/xvmc-r600/Makefile
                src/gallium/targets/xvmc-softpipe/Makefile
                src/gallium/tests/trivial/Makefile
                src/gallium/tests/unit/Makefile