[Mesa-dev] [PATCH 5/7] configure.ac: add llvm_add_optional_component helper

Tobias Droste tdroste at gmx.de
Thu Oct 5 17:14:59 UTC 2017


Am Donnerstag, 5. Oktober 2017, 12:19:07 CEST schrieb Emil Velikov:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> We want to add "optional" components, which have been added with later
> LLVM versions.
> 
> One such in-tree example is inteljitevents. Others are to follow
> shortly.
> 
> Cc: mesa-stable at lists.freedesktop.org
> Cc: Tobias Droste <tdroste at gmx.de>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> Tobias, any preference if we keep this separate helperor fold it with
> llvm_add_component?
> 
> Should we fold the llvm_add_default_components usecase here, or keep it
> separate patch.

I'm fine with the change as is. 

That said, if I had to change it, I would just add an additional parameter to 
the llvm_add_component function and make the "else" to an "elseif" so that it 
only prints an error if it's not optional. But I don't have a strong opinion 
on that one :-)

With the changes mentioned below: 
Reviewed-by: Tobias Droste <tdroste at gmx.de>

> ---
>  configure.ac | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index dbaa6569e4e..56cbf26c778 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -955,6 +955,14 @@ llvm_add_component() {
>      fi
>  }
> 
> +llvm_add_optional_component() {
> +    new_llvm_component=$1
> +    driver_name=$2
> +
> +    if $LLVM_CONFIG --components | grep -iqw $new_llvm_component ; then
> +        LLVM_COMPONENTS="${LLVM_COMPONENTS} ${new_llvm_component}"
> +    fi
> +}

Empty line between the functions missing.

>  llvm_add_default_components() {
>      driver_name=$1
> 
> @@ -965,9 +973,7 @@ llvm_add_default_components() {
>      llvm_add_component "mcjit" $driver_name
> 
>      # Optional default components
> -    if $LLVM_CONFIG --components | grep -iqw inteljitevents ; then
> -        LLVM_COMPONENTS="$LLVM_COMPONENTS inteljitevents"
> -    fi
> +    llvm_add_component "inteljitevents" $driver_name
       ^^^^^^^^^^^^^^^^^^
This should be llvm_add_optional_component.

>  }
> 
>  llvm_add_target() {


More information about the mesa-dev mailing list