diff options
authorCarl Worth <>2015-01-14 15:53:00 -0800
committerCarl Worth <>2015-01-16 13:47:40 -0800
commit59216f53ecb3076b64a0e55856382029919ba738 (patch)
parenta24bdce46f95cbe9efd3b26f157d1eb36584861f (diff)
configure: Add machinery for --enable-shader-cache (and --disable-shader-cache)
We don't actually have the code for the shader cache just yet, but this configure machinery puts everything in place so that the shader cache can be optionally compiled in. Specifically, if the user passes no option (neither --disable-shader-cache, nor --enable-shader-cache), then this feature will be automatically detected based on the presence of a usable SHA-1 library. If no suitable library can be found, then the shader cache will be automatically disabled, (and reported in the final output from configure). The user can force the shader-cache feature to not be compiled, (even if a SHA-1 library is detected), by passing --disable-shader-cache. This will prevent the compiled Mesa libraries from depending on any library for SHA-1 implementation. Finally, the user can also force the shader cache on with --enable-shader-cache. This will cause configure to trigger a fatal error if no sutiable SHA-1 implementation can be found for the shader-cache feature. Bug fix by José Fonseca <>: Fix to put conditional assignment in, not Makefile.sources to avoid breaking scons build. Note: As recommended by José, with this commit the scons build will not compile any of the SHA-1-using code. This is waiting for someone to write SConstruct detection of the available SHA-1 libraries, (and set the appropriate HAVE_SHA1_* variables). Reviewed-by: Matt Turner <>
4 files changed, 30 insertions, 4 deletions
diff --git a/ b/
index 5b867de4814..a4c5c74c299 100644
--- a/
+++ b/
@@ -1043,11 +1043,26 @@ if test "x$with_sha1" = xlibcrypto; then
AC_MSG_CHECKING([for SHA1 implementation])
-AM_CONDITIONAL([HAVE_SHA1], [test x$with_sha1 != x])
+# Allow user to configure out the shader-cache feature
+ AS_HELP_STRING([--disable-shader-cache], [Disable binary shader cache]),
+ [enable_shader_cache="$enableval"],
+ [if test "x$with_sha1" != "x"; then
+ enable_shader_cache=yes
+ else
+ enable_shader_cache=no
+ fi])
+if test "x$with_sha1" = "x"; then
+ if test "x$enable_shader_cache" = "xyes"; then
+ AC_MSG_ERROR([Cannot enable shader cache (no SHA-1 implementation found)])
+ fi
+AM_CONDITIONAL([ENABLE_SHADER_CACHE], [test x$enable_shader_cache = xyes])
# Check for libdrm
[have_libdrm=yes], [have_libdrm=no])
@@ -2490,6 +2505,12 @@ else
echo " Gallium: no"
+dnl Shader cache
+echo ""
+echo " Shader cache: $enable_shader_cache"
+if test "x$enable_shader_cache" = "xyes"; then
+ echo " With SHA1 from: $with_sha1"
dnl Libraries
echo ""
diff --git a/src/util/ b/src/util/
index 03b619efeb7..7512138a892 100644
--- a/src/util/
+++ b/src/util/
@@ -38,8 +38,8 @@ libmesautil_la_SOURCES = \
-libmesautil_la_SOURCES += $(MESA_UTIL_SHA1_FILES)
libmesautil_la_LIBADD = $(SHA1_LIBS)
diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
index 4e54c74600c..52ae5cc7a91 100644
--- a/src/util/Makefile.sources
+++ b/src/util/Makefile.sources
@@ -1,4 +1,4 @@
sha1.c \
diff --git a/src/util/SConscript b/src/util/SConscript
index 34b9a2deaab..28fedd80cdd 100644
--- a/src/util/SConscript
+++ b/src/util/SConscript
@@ -29,6 +29,11 @@ mesautil_sources = (
+# XXX We don't yet have scons support for detecting any of the various
+# HAVE_SHA1_* definitions, so for now simply disable the shader cache.
+if False:
+ mesautil_sources += source_lists['MESA_UTIL_SHADER_CACHE_FILES']
mesautil = env.ConvenienceLibrary(
target = 'mesautil',
source = mesautil_sources,