[Mesa-dev] [PATCH] configure.ac: Rework LLVM dependency handling
Tobias Droste
tdroste at gmx.de
Sat Oct 8 15:55:41 UTC 2016
After this change each driver can request LLVM with a specific version
and specific targets/components anywhere.
For gallium "--enable-gallium-llvm" is only needed if at least one
driver calls "gallium_require_llvm()".
If the flag is set to auto it will default to no now if no driver with
"gallium_require_llvm()" is included.
If gallium swrast driver is selected and LLVM is installed and
"--enable-gallium-llvm" is yes or auto, it defaults to llvmpipe,
otherwise to softpipe.
Signed-off-by: Tobias Droste <tdroste at gmx.de>
---
configure.ac | 451 +++++++++++++++++++++++++++++++++--------------------------
1 file changed, 249 insertions(+), 202 deletions(-)
diff --git a/configure.ac b/configure.ac
index 77eefd1..6a8eecd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,35 @@ XVMC_REQUIRED=1.0.6
PYTHON_MAKO_REQUIRED=0.8.0
LIBSENSORS_REQUIRED=4.0.0
+dnl Required LLVM versions
+LLVM_VERSION_REQUIRED_MAJOR_GALLIUM=3
+LLVM_VERSION_REQUIRED_MINOR_GALLIUM=3
+LLVM_VERSION_REQUIRED_PATCH_GALLIUM=0
+
+LLVM_VERSION_REQUIRED_MAJOR_OPENCL=3
+LLVM_VERSION_REQUIRED_MINOR_OPENCL=6
+LLVM_VERSION_REQUIRED_PATCH_OPENCL=0
+
+LLVM_VERSION_REQUIRED_MAJOR_LLVMPIPE=3
+LLVM_VERSION_REQUIRED_MINOR_LLVMPIPE=6
+LLVM_VERSION_REQUIRED_PATCH_LLVMPIPE=0
+
+LLVM_VERSION_REQUIRED_MAJOR_SWR=3
+LLVM_VERSION_REQUIRED_MINOR_SWR=6
+LLVM_VERSION_REQUIRED_PATCH_SWR=0
+
+LLVM_VERSION_REQUIRED_MAJOR_R600=3
+LLVM_VERSION_REQUIRED_MINOR_R600=6
+LLVM_VERSION_REQUIRED_PATCH_R600=0
+
+LLVM_VERSION_REQUIRED_MAJOR_RADEONSI=3
+LLVM_VERSION_REQUIRED_MINOR_RADEONSI=6
+LLVM_VERSION_REQUIRED_PATCH_RADEONSI=0
+
+LLVM_VERSION_REQUIRED_MAJOR_RADV=3
+LLVM_VERSION_REQUIRED_MINOR_RADV=9
+LLVM_VERSION_REQUIRED_PATCH_RADV=0
+
dnl Check for progs
AC_PROG_CPP
AC_PROG_CC
@@ -861,6 +890,178 @@ fi
AC_SUBST([SELINUX_CFLAGS])
AC_SUBST([SELINUX_LIBS])
+dnl
+dnl LLVM
+dnl
+AC_ARG_ENABLE([llvm-shared-libs],
+ [AS_HELP_STRING([--enable-llvm-shared-libs],
+ [link with LLVM shared libraries @<:@default=enabled@:>@])],
+ [enable_llvm_shared_libs="$enableval"],
+ [enable_llvm_shared_libs=yes])
+
+AC_ARG_WITH([llvm-prefix],
+ [AS_HELP_STRING([--with-llvm-prefix],
+ [Prefix for LLVM installations in non-standard locations])],
+ [llvm_prefix="$withval"],
+ [llvm_prefix=''])
+
+PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
+if test "x$have_libelf" = xno; then
+ LIBELF_LIBS=''
+ LIBELF_CFLAGS=''
+ AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], [have_libelf=no])
+ AC_SUBST([LIBELF_LIBS])
+ AC_SUBST([LIBELF_CFLAGS])
+fi
+
+# Call this inside ` ` to get the return value.
+# $1 is the llvm-config command with arguments.
+strip_unwanted_llvm_flags() {
+ # Use \> (marks the end of the word)
+ echo `$1` | sed \
+ -e 's/-march=\S*//g' \
+ -e 's/-mtune=\S*//g' \
+ -e 's/-mcpu=\S*//g' \
+ -e 's/-DNDEBUG\>//g' \
+ -e 's/-D_GNU_SOURCE\>//g' \
+ -e 's/-pedantic\>//g' \
+ -e 's/-Wcovered-switch-default\>//g' \
+ -e 's/-O.\>//g' \
+ -e 's/-g\>//g' \
+ -e 's/-Wall\>//g' \
+ -e 's/-Wcast-qual\>//g' \
+ -e 's/-Woverloaded-virtual\>//g' \
+ -e 's/-fcolor-diagnostics\>//g' \
+ -e 's/-fdata-sections\>//g' \
+ -e 's/-ffunction-sections\>//g' \
+ -e 's/-fno-exceptions\>//g' \
+ -e 's/-fomit-frame-pointer\>//g' \
+ -e 's/-fvisibility-inlines-hidden\>//g' \
+ -e 's/-fPIC\>//g' \
+ -e 's/-fstack-protector-strong\>//g'
+}
+
+if test -z "${LLVM_CONFIG}"; then
+ if test -n "$llvm_prefix"; then
+ AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
+ else
+ AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
+ fi
+fi
+
+if test "x$LLVM_CONFIG" != xno; then
+ LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
+ LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
+ LLVM_BINDIR=`$LLVM_CONFIG --bindir`
+ LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
+ LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
+ LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
+ LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
+ LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
+ LLVM_COMPONENTS=""
+
+ AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
+ [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+ AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
+ [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
+
+ LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
+ if test -z "$LLVM_VERSION_PATCH"; then
+ LLVM_VERSION_PATCH=0
+ fi
+
+ if test -n "${LLVM_VERSION_MAJOR}"; then
+ LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
+ else
+ LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
+ fi
+
+ DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
+ MESA_LLVM=1
+else
+ MESA_LLVM=0
+ LLVM_VERSION_INT=0
+fi
+
+AC_SUBST([MESA_LLVM])
+AC_SUBST([LLVM_BINDIR])
+AC_SUBST([LLVM_CFLAGS])
+AC_SUBST([LLVM_CPPFLAGS])
+AC_SUBST([LLVM_CXXFLAGS])
+AC_SUBST([LLVM_LIBDIR])
+AC_SUBST([LLVM_LIBS])
+AC_SUBST([LLVM_LDFLAGS])
+AC_SUBST([LLVM_INCLUDEDIR])
+AC_SUBST([LLVM_VERSION])
+
+llvm_check_version_for() {
+ if test "x$MESA_LLVM" = x0 || test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
+ AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
+ fi
+}
+
+llvm_add_component() {
+ new_llvm_component=$1
+ fail_if_not_present=$2
+ driver_name=$3
+
+ if test -z "$LLVM_COMPONENTS"; then
+ # Make the string non zero length
+ LLVM_COMPONENTS=" "
+
+ # Required default components
+ llvm_add_component "engine" "yes" $driver_name
+ llvm_add_component "bitwriter" "yes" $driver_name
+ llvm_add_component "mcjit" "yes" $driver_name
+ llvm_add_component "mcdisassembler" "yes" $driver_name
+
+ # Optional default components
+ llvm_add_component "inteljitevents" "no" $driver_name
+ fi
+
+ if $LLVM_CONFIG --components | grep -iqw $new_llvm_component ; then
+ LLVM_COMPONENTS="${LLVM_COMPONENTS} ${new_llvm_component}"
+ else
+ if test "x$fail_if_not_present" = "xyes"; then
+ AC_MSG_ERROR([LLVM component '$new_llvm_component' not enabled in your LLVM build. Required by $driver_name.])
+ fi
+ fi
+}
+
+llvm_add_target() {
+ new_llvm_target=$1
+ fail_if_not_present=$2
+ driver_name=$3
+
+ if $LLVM_CONFIG --targets-built | grep -iqw $new_llvm_target ; then
+ llvm_add_component $new_llvm_target $fail_if_not_present $driver_name
+ else
+ if test "x$fail_if_not_present" = "xyes"; then
+ AC_MSG_ERROR([LLVM target '$new_llvm_target' not enabled in your LLVM build. Required by $driver_name.])
+ fi
+ fi
+}
+
+radeon_llvm_check() {
+ if test ${LLVM_VERSION_INT} -lt 307; then
+ amdgpu_llvm_target_name='r600'
+ else
+ amdgpu_llvm_target_name='amdgpu'
+ fi
+
+ llvm_check_version_for $*
+
+ llvm_add_target $amdgpu_llvm_target_name "yes" $4
+ llvm_add_component "bitreader" "yes" $4
+ llvm_add_component "ipo" "yes" $4
+
+ NEED_RADEON_LLVM=yes
+
+ if test "x$have_libelf" != xyes; then
+ AC_MSG_ERROR([$4 requires libelf when using llvm])
+ fi
+}
+
dnl Options for APIs
AC_ARG_ENABLE([opengl],
[AS_HELP_STRING([--disable-opengl],
@@ -1202,8 +1403,6 @@ if test "x$enable_gallium_osmesa" = xyes; then
fi
fi
-AC_SUBST([MESA_LLVM])
-
# SHA1 hashing
AC_ARG_WITH([sha1],
[AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
@@ -1718,6 +1917,7 @@ if test -n "$with_vulkan_drivers"; then
;;
xradeon)
PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
+ radeon_llvm_check $LLVM_VERSION_REQUIRED_MAJOR_RADV $LLVM_VERSION_REQUIRED_MINOR_RADV $LLVM_VERSION_REQUIRED_PATCH_RADV "radv"
HAVE_RADEON_VULKAN=yes;
;;
*)
@@ -1969,15 +2169,6 @@ AC_ARG_WITH([clang-libdir],
[CLANG_LIBDIR=''])
PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
-PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
-
-if test "x$have_libelf" = xno; then
- LIBELF_LIBS=''
- LIBELF_CFLAGS=''
- AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], [have_libelf=no])
- AC_SUBST([LIBELF_LIBS])
- AC_SUBST([LIBELF_CFLAGS])
-fi
if test "x$enable_opencl" = xyes; then
if test -z "$with_gallium_drivers"; then
@@ -2011,27 +2202,35 @@ if test "x$enable_opencl" = xyes; then
if test "x$have_libelf" != xyes; then
AC_MSG_ERROR([Clover requires libelf])
fi
+
+ llvm_check_version_for $LLVM_VERSION_REQUIRED_MAJOR_OPENCL $LLVM_VERSION_REQUIRED_MINOR_OPENCL $LLVM_VERSION_REQUIRED_PATCH_OPENCL "opencl"
+ llvm_add_component "all-targets" "yes" "opencl"
+ llvm_add_component "ipos" "yes" "opencl"
+ llvm_add_component "linker" "yes" "opencl"
+ llvm_add_component "instrumentation" "yes" "opencl"
+ llvm_add_component "irreader" "yes" "opencl"
+ llvm_add_component "option" "yes" "opencl"
+ llvm_add_component "objcarcopts" "yes" "opencl"
+ llvm_add_component "profiledata" "yes" "opencl"
+
+ dnl Check for Clang internal headers
+ if test -z "$CLANG_LIBDIR"; then
+ CLANG_LIBDIR=${LLVM_LIBDIR}
+ fi
+ CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
+ AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
+ [AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])])
fi
AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
AC_SUBST([OPENCL_LIBNAME])
+AC_SUBST([CLANG_RESOURCE_DIR])
dnl
dnl Gallium configuration
dnl
AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
-AC_SUBST([LLVM_BINDIR])
-AC_SUBST([LLVM_CFLAGS])
-AC_SUBST([LLVM_CPPFLAGS])
-AC_SUBST([LLVM_CXXFLAGS])
-AC_SUBST([LLVM_LIBDIR])
-AC_SUBST([LLVM_LIBS])
-AC_SUBST([LLVM_LDFLAGS])
-AC_SUBST([LLVM_INCLUDEDIR])
-AC_SUBST([LLVM_VERSION])
-AC_SUBST([CLANG_RESOURCE_DIR])
-
case "x$enable_opengl$enable_gles1$enable_gles2" in
x*yes*)
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
@@ -2143,141 +2342,13 @@ dnl Gallium LLVM
dnl
AC_ARG_ENABLE([gallium-llvm],
[AS_HELP_STRING([--enable-gallium-llvm],
- [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
+ [build gallium LLVM support @<:@default=enabled on x86/x86_64 when needed@:>@])],
[enable_gallium_llvm="$enableval"],
[enable_gallium_llvm=auto])
-AC_ARG_ENABLE([llvm-shared-libs],
- [AS_HELP_STRING([--enable-llvm-shared-libs],
- [link with LLVM shared libraries @<:@default=enabled@:>@])],
- [enable_llvm_shared_libs="$enableval"],
- [enable_llvm_shared_libs=yes])
-
-AC_ARG_WITH([llvm-prefix],
- [AS_HELP_STRING([--with-llvm-prefix],
- [Prefix for LLVM installations in non-standard locations])],
- [llvm_prefix="$withval"],
- [llvm_prefix=''])
-
-
-# Call this inside ` ` to get the return value.
-# $1 is the llvm-config command with arguments.
-strip_unwanted_llvm_flags() {
- # Use \> (marks the end of the word)
- echo `$1` | sed \
- -e 's/-march=\S*//g' \
- -e 's/-mtune=\S*//g' \
- -e 's/-mcpu=\S*//g' \
- -e 's/-DNDEBUG\>//g' \
- -e 's/-D_GNU_SOURCE\>//g' \
- -e 's/-pedantic\>//g' \
- -e 's/-Wcovered-switch-default\>//g' \
- -e 's/-O.\>//g' \
- -e 's/-g\>//g' \
- -e 's/-Wall\>//g' \
- -e 's/-Wcast-qual\>//g' \
- -e 's/-Woverloaded-virtual\>//g' \
- -e 's/-fcolor-diagnostics\>//g' \
- -e 's/-fdata-sections\>//g' \
- -e 's/-ffunction-sections\>//g' \
- -e 's/-fno-exceptions\>//g' \
- -e 's/-fomit-frame-pointer\>//g' \
- -e 's/-fvisibility-inlines-hidden\>//g' \
- -e 's/-fPIC\>//g' \
- -e 's/-fstack-protector-strong\>//g'
-}
-
-llvm_check_version_for() {
- if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
- AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
- fi
-}
-
-
-
if test -z "$with_gallium_drivers"; then
enable_gallium_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 -n "$llvm_prefix"; then
- AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
- else
- AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
- fi
-
- if test "x$LLVM_CONFIG" != xno; then
- LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
- LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
- LLVM_BINDIR=`$LLVM_CONFIG --bindir`
- LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
- LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
- LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
- LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
- LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
-
- AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
- [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
- AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
- [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
-
- LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
- if test -z "$LLVM_VERSION_PATCH"; then
- LLVM_VERSION_PATCH=0
- fi
-
- if test -n "${LLVM_VERSION_MAJOR}"; then
- LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
- else
- LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
- fi
-
- LLVM_REQUIRED_VERSION_MAJOR="3"
- LLVM_REQUIRED_VERSION_MINOR="3"
- if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
- AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
- fi
-
- LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler"
-
- if $LLVM_CONFIG --components | grep -q inteljitevents ; then
- LLVM_COMPONENTS="${LLVM_COMPONENTS} inteljitevents"
- fi
-
- if test "x$enable_opencl" = xyes; then
- llvm_check_version_for "3" "6" "0" "opencl"
-
- LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation"
- LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata"
- fi
- DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
- MESA_LLVM=1
-
- dnl Check for Clang internal headers
- if test "x$enable_opencl" = xyes; then
- if test -z "$CLANG_LIBDIR"; then
- CLANG_LIBDIR=${LLVM_LIBDIR}
- fi
- CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
- AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
- [AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])])
- fi
- else
- MESA_LLVM=0
- LLVM_VERSION_INT=0
- fi
-else
- MESA_LLVM=0
- LLVM_VERSION_INT=0
-
- if test "x$enable_opencl" = xyes; then
- AC_MSG_ERROR([cannot enable OpenCL without LLVM])
- fi
-fi
dnl Directory for XVMC libs
AC_ARG_WITH([xvmc-libdir],
@@ -2335,12 +2406,21 @@ gallium_require_drm() {
}
gallium_require_llvm() {
- if test "x$MESA_LLVM" = x0; then
- case "$host" in *gnux32) return;; esac
- case "$host_cpu" in
- i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
- esac
- fi
+ case "$host" in *gnux32) return;; esac
+ case "$host_cpu" in
+ i*86|x86_64|amd64)
+ if test "x$enable_gallium_llvm" = xauto; then
+ enable_gallium_llvm=yes
+ fi
+
+ if test "x$enable_gallium_llvm" != "xyes"; then
+ AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
+ fi
+
+ llvm_check_version_for $LLVM_VERSION_REQUIRED_MAJOR_GALLIUM $LLVM_VERSION_REQUIRED_MINOR_GALLIUM $LLVM_VERSION_REQUIRED_PATCH_GALLIUM "gallium"
+ llvm_add_target "x86" "yes" "gallium"
+ ;;
+ esac
}
gallium_require_drm_loader() {
@@ -2367,40 +2447,6 @@ require_egl_drm() {
fi
}
-radeon_llvm_check() {
- if test ${LLVM_VERSION_INT} -lt 307; then
- amdgpu_llvm_target_name='r600'
- else
- amdgpu_llvm_target_name='amdgpu'
- fi
- llvm_check_version_for $2 $3 $4 $1
- if test true && $LLVM_CONFIG --targets-built | grep -iqvw $amdgpu_llvm_target_name ; then
- AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM build.])
- fi
- LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo"
- NEED_RADEON_LLVM=yes
- if test "x$have_libelf" != xyes; then
- AC_MSG_ERROR([$1 requires libelf when using llvm])
- fi
-}
-
-radeon_gallium_llvm_check() {
- if test "x$enable_gallium_llvm" != "xyes"; then
- AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
- fi
- radeon_llvm_check $*
-}
-
-swr_llvm_check() {
- gallium_require_llvm $1
- if test ${LLVM_VERSION_INT} -lt 306; then
- AC_MSG_ERROR([LLVM version 3.6 or later required when building $1])
- fi
- if test "x$enable_gallium_llvm" != "xyes"; then
- AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
- fi
-}
-
swr_require_cxx_feature_flags() {
feature_name="$1"
preprocessor_test="$2"
@@ -2465,9 +2511,9 @@ if test -n "$with_gallium_drivers"; then
xr300)
HAVE_GALLIUM_R300=yes
PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
- gallium_require_drm "Gallium R300"
+ gallium_require_drm "r300"
gallium_require_drm_loader
- gallium_require_llvm "Gallium R300"
+ gallium_require_llvm "r300"
;;
xr600)
HAVE_GALLIUM_R600=yes
@@ -2475,8 +2521,9 @@ if test -n "$with_gallium_drivers"; then
gallium_require_drm "Gallium R600"
gallium_require_drm_loader
if test "x$enable_opencl" = xyes; then
- radeon_gallium_llvm_check "r600g" "3" "6" "0"
- LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
+ radeon_llvm_check $LLVM_VERSION_REQUIRED_MAJOR_R600 $LLVM_VERSION_REQUIRED_MINOR_R600 $LLVM_VERSION_REQUIRED_PATCH_R600 "r600"
+ gallium_require_llvm "r600"
+ llvm_add_component "asmparser" "yes" "r600"
fi
;;
xradeonsi)
@@ -2485,7 +2532,8 @@ if test -n "$with_gallium_drivers"; then
PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
gallium_require_drm "radeonsi"
gallium_require_drm_loader
- radeon_gallium_llvm_check "radeonsi" "3" "6" "0"
+ radeon_llvm_check $LLVM_VERSION_REQUIRED_MAJOR_RADEONSI $LLVM_VERSION_REQUIRED_MINOR_RADEONSI $LLVM_VERSION_REQUIRED_PATCH_RADEONSI "radeonsi"
+ gallium_require_llvm "radeonsi"
require_egl_drm "radeonsi"
;;
xnouveau)
@@ -2502,12 +2550,15 @@ if test -n "$with_gallium_drivers"; then
;;
xswrast)
HAVE_GALLIUM_SOFTPIPE=yes
- if test "x$MESA_LLVM" = x1; then
+ if test "x$MESA_LLVM" = x1 && (test "x$enable_gallium_llvm" = xyes || test "x$enable_gallium_llvm" = xauto); then
+ gallium_require_llvm "llvmpipe"
+ llvm_check_version_for $LLVM_VERSION_REQUIRED_MAJOR_LLVMPIPE $LLVM_VERSION_REQUIRED_MINOR_LLVMPIPE $LLVM_VERSION_REQUIRED_PATCH_LLVMPIPE "llvmpipe"
HAVE_GALLIUM_LLVMPIPE=yes
fi
;;
xswr)
- swr_llvm_check "swr"
+ llvm_check_version_for $LLVM_VERSION_REQUIRED_MAJOR_SWR $LLVM_VERSION_REQUIRED_MINOR_SWR $LLVM_VERSION_REQUIRED_PATCH_SWR "swr"
+ gallium_require_llvm "swr"
swr_require_cxx_feature_flags "C++11" "__cplusplus >= 201103L" \
",-std=c++11" \
@@ -2550,10 +2601,6 @@ if test -n "$with_gallium_drivers"; then
done
fi
-if test "x$HAVE_RADEON_VULKAN" = "xyes"; then
- radeon_llvm_check "radv" "3" "9" "0"
-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
More information about the mesa-dev
mailing list