configure.ac: add llvm_add_optional_component helper
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 5 Oct 2017 10:19:07 +0000 (11:19 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 13 Oct 2017 11:56:13 +0000 (12:56 +0100)
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.

v2: Use the correct function, add blank line between functions (Tobias)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tobias Droste <tdroste@gmx.de>
configure.ac

index 751f70a02ab1677b84fd7fdd627882afafec5572..d22b522278c92f59428ecae117d43a20e900b02f 100644 (file)
@@ -955,6 +955,15 @@ 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
+}
+
 llvm_add_default_components() {
     driver_name=$1
 
@@ -965,9 +974,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_optional_component "inteljitevents" $driver_name
 }
 
 llvm_add_target() {