[Mesa-dev] [PATCH 2/2] configure: Add machinery for --enable-shader-cache (and --disable-shader-cache)

Matt Turner mattst88 at gmail.com
Thu Jan 15 15:29:33 PST 2015


On Fri, Dec 19, 2014 at 6:43 PM, Carl Worth <cworth at cworth.org> wrote:
> 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.
> ---
>  configure.ac              | 23 ++++++++++++++++++++++-
>  src/util/Makefile.sources |  6 +++---
>  2 files changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 9697e9f..0361893 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1026,11 +1026,26 @@ if test "x$with_sha1" = xlibcrypto; then
>         fi
>  fi
>  AC_MSG_CHECKING([for SHA1 implementation])
> -AM_CONDITIONAL([HAVE_SHA1], [ test x$with_sha1 != x ])
>  AC_MSG_RESULT([$with_sha1])
>  AC_SUBST(SHA1_LIBS)
>  AC_SUBST(SHA1_CFLAGS)
>
> +# Allow user to configure out the shader-cache feature
> +AC_ARG_ENABLE([shader-cache],
> +    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
> +fi
> +AM_CONDITIONAL([ENABLE_SHADER_CACHE], [ test x$enable_shader_cache = xyes ])

I wouldn't put the spaces after and before the [ ] (there's an
occurrence of this in the previous patch as well, that gets removed in
this one).

Both are:

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list