]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
tools/build: Add libcpupower dependency detection
authorTomas Glozar <tglozar@redhat.com>
Thu, 17 Oct 2024 14:09:09 +0000 (16:09 +0200)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 17 Oct 2024 21:13:15 +0000 (17:13 -0400)
Add the ability to detect the presence of libcpupower on a system to
the Makefiles in tools/build.

Link: https://lore.kernel.org/20241017140914.3200454-2-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
tools/build/Makefile.feature
tools/build/feature/Makefile
tools/build/feature/test-libcpupower.c [new file with mode: 0644]

index ffd117135094cc68d64dbb0bbf79ee440c075ac1..2ebfb826dcea5738b37e3b8d7caf263397c9170c 100644 (file)
@@ -53,6 +53,7 @@ FEATURE_TESTS_BASIC :=                  \
         libslang-include-subdir         \
         libtraceevent                   \
         libtracefs                      \
+        libcpupower                     \
         libcrypto                       \
         libunwind                       \
         pthread-attr-setaffinity-np     \
index 5938cf799dc6770a3d83a750e05018457eecfc62..6ef3e1ca583e89c3dda32b60b5e343066bf6e51d 100644 (file)
@@ -38,6 +38,7 @@ FILES=                                          \
          test-libslang.bin                      \
          test-libslang-include-subdir.bin       \
          test-libtraceevent.bin                 \
+         test-libcpupower.bin                   \
          test-libtracefs.bin                    \
          test-libcrypto.bin                     \
          test-libunwind.bin                     \
@@ -245,6 +246,9 @@ $(OUTPUT)test-libslang-include-subdir.bin:
 $(OUTPUT)test-libtraceevent.bin:
        $(BUILD) -ltraceevent
 
+$(OUTPUT)test-libcpupower.bin:
+       $(BUILD) -lcpupower
+
 $(OUTPUT)test-libtracefs.bin:
         $(BUILD) $(shell $(PKG_CONFIG) --cflags libtracefs 2>/dev/null) -ltracefs
 
diff --git a/tools/build/feature/test-libcpupower.c b/tools/build/feature/test-libcpupower.c
new file mode 100644 (file)
index 0000000..a346aa3
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <cpuidle.h>
+
+int main(void)
+{
+       int rv = cpuidle_state_count(0);
+       return rv;
+}