From b73a1c06386f43b0b0d7ce99448b8c55f4c5156c Mon Sep 17 00:00:00 2001 From: Alexander Sosedkin Date: Sun, 28 Nov 2021 00:47:25 +0100 Subject: [PATCH 1/2] Document libcpuid dependency --- doc/manual/src/installation/prerequisites-source.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/manual/src/installation/prerequisites-source.md b/doc/manual/src/installation/prerequisites-source.md index 0323a4f55..37e0b5a10 100644 --- a/doc/manual/src/installation/prerequisites-source.md +++ b/doc/manual/src/installation/prerequisites-source.md @@ -58,3 +58,9 @@ `--disable-seccomp-sandboxing` option to the `configure` script (Not recommended unless your system doesn't support `libseccomp`). To get the library, visit . + + - On 64-bit x86 machines only, `libcpuid` library + is used to determine which microarchitecture levels are supported + (e.g., as whether to have `x86_64-v2-linux` among additional system types). + The library is available from its homepage + . From a9bd06d0ea2c7af9fa33763bdca174db76400ee0 Mon Sep 17 00:00:00 2001 From: Alexander Sosedkin Date: Sun, 28 Nov 2021 00:48:04 +0100 Subject: [PATCH 2/2] Make libcpuid dependency optional with --disable-cpuid --- configure.ac | 13 ++++++++++--- doc/manual/src/installation/prerequisites-source.md | 2 ++ tests/local.mk | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 65478ecc5..4108eb0a8 100644 --- a/configure.ac +++ b/configure.ac @@ -195,10 +195,17 @@ PKG_CHECK_MODULES([SODIUM], [libsodium], [CXXFLAGS="$SODIUM_CFLAGS $CXXFLAGS"]) PKG_CHECK_MODULES([LIBBROTLI], [libbrotlienc libbrotlidec], [CXXFLAGS="$LIBBROTLI_CFLAGS $CXXFLAGS"]) # Look for libcpuid. +have_libcpuid= if test "$machine_name" = "x86_64"; then - PKG_CHECK_MODULES([LIBCPUID], [libcpuid], [CXXFLAGS="$LIBCPUID_CFLAGS $CXXFLAGS"]) - have_libcpuid=1 - AC_DEFINE([HAVE_LIBCPUID], [1], [Use libcpuid]) + AC_ARG_ENABLE([cpuid], + AS_HELP_STRING([--disable-cpuid], [Do not determine microarchitecture levels with libcpuid (relevant to x86_64 only)])) + if test "x$enable_cpuid" != "xno"; then + PKG_CHECK_MODULES([LIBCPUID], [libcpuid], + [CXXFLAGS="$LIBCPUID_CFLAGS $CXXFLAGS" + have_libcpuid=1 + AC_DEFINE([HAVE_LIBCPUID], [1], [Use libcpuid])] + ) + fi fi AC_SUBST(HAVE_LIBCPUID, [$have_libcpuid]) diff --git a/doc/manual/src/installation/prerequisites-source.md b/doc/manual/src/installation/prerequisites-source.md index 37e0b5a10..1b03bacd3 100644 --- a/doc/manual/src/installation/prerequisites-source.md +++ b/doc/manual/src/installation/prerequisites-source.md @@ -64,3 +64,5 @@ (e.g., as whether to have `x86_64-v2-linux` among additional system types). The library is available from its homepage . + This is an optional dependency and can be disabled + by providing a `--disable-cpuid` to the `configure` script. diff --git a/tests/local.mk b/tests/local.mk index 6f38853bc..936b72c2a 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -48,7 +48,6 @@ nix_tests = \ flakes.sh \ flake-local-settings.sh \ build.sh \ - compute-levels.sh \ repl.sh ca/repl.sh \ ca/build.sh \ ca/build-with-garbage-path.sh \ @@ -63,6 +62,10 @@ nix_tests = \ eval-store.sh # parallel.sh +ifeq ($(HAVE_LIBCPUID), 1) + nix_tests += compute-levels.sh +endif + install-tests += $(foreach x, $(nix_tests), tests/$(x)) tests-environment = NIX_REMOTE= $(bash) -e