This reuse the same logic gallium uses to determine if LLVM is needed or
not:
--enable-vulkan-llvm is set to yes if at least one vulkan driver is
active and the host is i3*6 or x86_64.
To build vulkan drivers without LLVM (e.g. intel) one has to add
--disable-vulkan-llvm.

In order to make this all work the vulkan driver check has to move
either diretcly below or directly above the gallium driver checks.
Move them below the gallium driver stuff.

Signed-off-by: Tobias Droste <tdro...@gmx.de>
---
 configure.ac | 148 +++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 84 insertions(+), 64 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1e80a49..ea07cc3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1625,67 +1625,6 @@ if test -n "$with_dri_drivers"; then
 fi
 
 
-#
-# Vulkan driver configuration
-#
-
-AC_ARG_WITH([vulkan-drivers],
-    [AS_HELP_STRING([--with-vulkan-drivers@<:@=DIRS...@:>@],
-        [comma delimited Vulkan drivers list, e.g.
-        "intel"
-        @<:@default=no@:>@])],
-    [with_vulkan_drivers="$withval"],
-    [with_vulkan_drivers="no"])
-
-# Doing '--without-vulkan-drivers' will set this variable to 'no'.  Clear it
-# here so that the script doesn't choke on an unknown driver name later.
-case "x$with_vulkan_drivers" in
-    xyes) with_vulkan_drivers="$VULKAN_DRIVERS_DEFAULT" ;;
-    xno) with_vulkan_drivers='' ;;
-esac
-
-AC_ARG_WITH([vulkan-icddir],
-    [AS_HELP_STRING([--with-vulkan-icddir=DIR],
-        [directory for the Vulkan driver icd files 
@<:@${datarootdir}/vulkan/icd.d@:>@])],
-    [VULKAN_ICD_INSTALL_DIR="$withval"],
-    [VULKAN_ICD_INSTALL_DIR='${datarootdir}/vulkan/icd.d'])
-AC_SUBST([VULKAN_ICD_INSTALL_DIR])
-
-AC_ARG_ENABLE([vulkan-icd-full-driver-path],
-   [AS_HELP_STRING([--disable-vulkan-icd-full-driver-path],
-                   [create Vulkan ICD files with just a .so name and no 
path])],
-   [vulkan_icd_driver_path="$enableval"],
-   [vulkan_icd_driver_path="yes"])
-AM_CONDITIONAL(VULKAN_ICD_DRIVER_PATH, test "x$vulkan_icd_driver_path" = xyes)
-
-if test -n "$with_vulkan_drivers"; then
-    VULKAN_DRIVERS=`IFS=', '; echo $with_vulkan_drivers`
-    for driver in $VULKAN_DRIVERS; do
-        case "x$driver" in
-        xintel)
-            if test "x$HAVE_I965_DRI" != xyes; then
-                AC_MSG_ERROR([Intel Vulkan driver requires the i965 dri 
driver])
-            fi
-            if test "x$with_sha1" == "x"; then
-                AC_MSG_ERROR([Intel Vulkan driver requires SHA1])
-            fi
-            HAVE_INTEL_VULKAN=yes;
-
-            ;;
-        xradeon)
-            PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= 
$LIBDRM_AMDGPU_REQUIRED])
-            radeon_llvm_check "radv" "3" "9" "0"
-            HAVE_RADEON_VULKAN=yes;
-           ;;
-        *)
-            AC_MSG_ERROR([Vulkan driver '$driver' does not exist])
-            ;;
-        esac
-    done
-    VULKAN_DRIVERS=`echo $VULKAN_DRIVERS|tr " " "\n"|sort -u|tr "\n" " "`
-fi
-
-
 AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
 AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_glx" = xxlib -o \
                                   "x$enable_osmesa" = xyes -o \
@@ -2104,6 +2043,12 @@ AC_ARG_ENABLE([gallium-llvm],
     [enable_gallium_llvm="$enableval"],
     [enable_gallium_llvm=auto])
 
+AC_ARG_ENABLE([vulkan-llvm],
+    [AS_HELP_STRING([--enable-vulkan-llvm],
+        [build Vulkan LLVM support @<:@default=enabled on x86/x86_64@:>@])],
+    [enable_vulkan_llvm="$enableval"],
+    [enable_vulkan_llvm=auto])
+
 AC_ARG_ENABLE([llvm-shared-libs],
     [AS_HELP_STRING([--enable-llvm-shared-libs],
         [link with LLVM shared libraries @<:@default=enabled@:>@])],
@@ -2155,12 +2100,20 @@ llvm_check_version_for() {
 if test -z "$with_gallium_drivers"; then
     enable_gallium_llvm=no
 fi
+if test -z "$with_vulkan_drivers"; then
+    enable_vulkan_llvm=no
+fi
 if test "x$enable_gallium_llvm" = xauto; then
     case "$host_cpu" in
     i*86|x86_64|amd64) enable_gallium_llvm=yes;;
     esac
 fi
-if test "x$enable_gallium_llvm" = xyes || test "x$HAVE_RADEON_VULKAN" = xyes; 
then
+if test "x$enable_vulkan_llvm" = xauto; then
+    case "$host_cpu" in
+    i*86|x86_64|amd64) enable_vulkan_llvm=yes;;
+    esac
+fi
+if test "x$enable_gallium_llvm" = xyes || test "x$enable_vulkan_llvm" = xyes; 
then
     if test -n "$llvm_prefix"; then
         AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
     else
@@ -2326,8 +2279,14 @@ radeon_llvm_check() {
     else
         amdgpu_llvm_target_name='amdgpu'
     fi
-    if test "x$enable_gallium_llvm" != "xyes"; then
-        AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+    if test "x$5" == "xvulkan"; then
+        if test "x$enable_vulkan_llvm" != "xyes"; then
+            AC_MSG_ERROR([--enable-vulkan-llvm is required when building $1])
+        fi
+    else
+        if test "x$enable_gallium_llvm" != "xyes"; then
+            AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+        fi
     fi
     llvm_check_version_for $2 $3 $4 $1
     if test true && $LLVM_CONFIG --targets-built | grep -iqvw 
$amdgpu_llvm_target_name ; then
@@ -2499,6 +2458,67 @@ if test -n "$with_gallium_drivers"; then
     done
 fi
 
+
+#
+# Vulkan driver configuration
+#
+
+AC_ARG_WITH([vulkan-drivers],
+    [AS_HELP_STRING([--with-vulkan-drivers@<:@=DIRS...@:>@],
+        [comma delimited Vulkan drivers list, e.g.
+        "intel"
+        @<:@default=no@:>@])],
+    [with_vulkan_drivers="$withval"],
+    [with_vulkan_drivers="no"])
+
+# Doing '--without-vulkan-drivers' will set this variable to 'no'.  Clear it
+# here so that the script doesn't choke on an unknown driver name later.
+case "x$with_vulkan_drivers" in
+    xyes) with_vulkan_drivers="$VULKAN_DRIVERS_DEFAULT" ;;
+    xno) with_vulkan_drivers='' ;;
+esac
+
+AC_ARG_WITH([vulkan-icddir],
+    [AS_HELP_STRING([--with-vulkan-icddir=DIR],
+        [directory for the Vulkan driver icd files 
@<:@${datarootdir}/vulkan/icd.d@:>@])],
+    [VULKAN_ICD_INSTALL_DIR="$withval"],
+    [VULKAN_ICD_INSTALL_DIR='${datarootdir}/vulkan/icd.d'])
+AC_SUBST([VULKAN_ICD_INSTALL_DIR])
+
+AC_ARG_ENABLE([vulkan-icd-full-driver-path],
+   [AS_HELP_STRING([--disable-vulkan-icd-full-driver-path],
+                   [create Vulkan ICD files with just a .so name and no 
path])],
+   [vulkan_icd_driver_path="$enableval"],
+   [vulkan_icd_driver_path="yes"])
+AM_CONDITIONAL(VULKAN_ICD_DRIVER_PATH, test "x$vulkan_icd_driver_path" = xyes)
+
+if test -n "$with_vulkan_drivers"; then
+    VULKAN_DRIVERS=`IFS=', '; echo $with_vulkan_drivers`
+    for driver in $VULKAN_DRIVERS; do
+        case "x$driver" in
+        xintel)
+            if test "x$HAVE_I965_DRI" != xyes; then
+                AC_MSG_ERROR([Intel Vulkan driver requires the i965 dri 
driver])
+            fi
+            if test "x$with_sha1" == "x"; then
+                AC_MSG_ERROR([Intel Vulkan driver requires SHA1])
+            fi
+            HAVE_INTEL_VULKAN=yes;
+
+            ;;
+        xradeon)
+            PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= 
$LIBDRM_AMDGPU_REQUIRED])
+            radeon_llvm_check "radv" "3" "9" "0" "vulkan"
+            HAVE_RADEON_VULKAN=yes;
+           ;;
+        *)
+            AC_MSG_ERROR([Vulkan driver '$driver' does not exist])
+            ;;
+        esac
+    done
+    VULKAN_DRIVERS=`echo $VULKAN_DRIVERS|tr " " "\n"|sort -u|tr "\n" " "`
+fi
+
 dnl Set LLVM_LIBS - This is done after the driver configuration so
 dnl that drivers can add additional components to LLVM_COMPONENTS.
 dnl Previously, gallium drivers were updating LLVM_LIBS directly
-- 
2.10.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to