config BR2_PACKAGE_BPFTOOL_ARCH_SUPPORTS
	bool
	# see libbpf/src/bpf.c
	default y if BR2_arc
	default y if BR2_arm || BR2_armeb
	default y if BR2_aarch64 || BR2_aarch64_be
	default y if BR2_i386 || BR2_x86_64
	default y if BR2_sparc || BR2_sparc64
	default y if BR2_s390x

config BR2_PACKAGE_BPFTOOL
	bool "bpftool"
	depends on BR2_PACKAGE_BPFTOOL_ARCH_SUPPORTS
	depends on BR2_TOOLCHAIN_HAS_SYNC_4
	depends on !BR2_nios2 # binutils
	depends on BR2_USE_WCHAR # binutils, elfutils
	depends on !BR2_STATIC_LIBS # elfutils
	depends on BR2_TOOLCHAIN_HAS_THREADS # elfutils
	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils
	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12
	select BR2_PACKAGE_BINUTILS
	select BR2_PACKAGE_ELFUTILS
	help
	  bpftool is a tool for for inspection and simple manipulation
	  of eBPF programs and maps.

comment "bpftool needs a uClibc or glibc toolchain w/ wchar, dynamic library, threads, headers >= 4.12"
	depends on BR2_PACKAGE_BPFTOOL_ARCH_SUPPORTS
	depends on BR2_TOOLCHAIN_HAS_SYNC_4
	depends on !BR2_nios2
	depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \
		|| !BR2_TOOLCHAIN_HAS_THREADS \
		|| !(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC) \
		|| !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12
