config BR2_PACKAGE_LLVM_ARCH_SUPPORTS
	bool
	default y if BR2_i386
	default y if BR2_x86_64
	default y if BR2_aarch64
	default y if BR2_arm || BR2_armeb

config BR2_PACKAGE_LLVM_TARGET_ARCH
	string
	default "AArch64" if BR2_aarch64
	default "ARM" if BR2_arm || BR2_armeb
	default "X86" if BR2_i386 || BR2_x86_64

config BR2_PACKAGE_LLVM
	bool "llvm"
	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
	depends on BR2_TOOLCHAIN_HAS_THREADS
	depends on BR2_INSTALL_LIBSTDCPP
	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
	depends on !BR2_STATIC_LIBS
	depends on BR2_USE_WCHAR # std::wstring
	help
	  The LLVM Project is a collection of modular and reusable
	  compiler and toolchain technologies.

	  http://llvm.org

if BR2_PACKAGE_LLVM

config BR2_PACKAGE_LLVM_AMDGPU
	bool "AMDGPU backend"
	help
	  Build AMDGPU target. Select this option if you are going
	  to install mesa3d with llvm and use Gallium Radeon driver.

config BR2_PACKAGE_LLVM_RTTI
	bool "enable rtti"
	help
	  Build LLVM with run-time type information. LLVM can be built
	  without rtti, but turning it off changes the ABI of C++
	  programs.

	  This features is needed to build the Gallium Nouveau driver
	  or the Clover OpenCL state tracker when llvm support is
	  enabled.

	  https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html

endif

comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
		|| BR2_STATIC_LIBS || !BR2_USE_WCHAR

comment "llvm needs a toolchain not affected by GCC bug 64735"
	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735