From 691b56e7df4cec656cf340cd905ed649ae464c85 Mon Sep 17 00:00:00 2001 From: Eero Tamminen Date: Thu, 14 Mar 2024 16:39:52 +0200 Subject: [PATCH] gpu_sysman: use glob.h/libgen.h only if they are present Signed-off-by: Eero Tamminen --- configure.ac | 1 + src/gpu_sysman.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 6d42a798b..65eafd5eb 100644 --- a/configure.ac +++ b/configure.ac @@ -163,6 +163,7 @@ AC_CHECK_HEADERS_ONCE([ \ fs_info.h \ fshelp.h \ grp.h \ + glob.h \ kstat.h \ kvm.h \ libgen.h \ diff --git a/src/gpu_sysman.c b/src/gpu_sysman.c index 3dff3bd6a..eaacb5685 100644 --- a/src/gpu_sysman.c +++ b/src/gpu_sysman.c @@ -42,21 +42,24 @@ #include #include -#include #include +/* includes config.h with HAVE_*_H defines, needed by check below */ +#include "collectd.h" + +#if HAVE_GLOB_H && HAVE_LIBGEN_H /* "dev_file" label (for k8s Intel GPU plugin) and "pci_dev" label * (for k8s Intel resource driver) need (POSIX.1-2001/-2008) * glob() + basename() functions. */ #define ADD_DEV_FILE 1 -#if ADD_DEV_FILE #include #include +#else +#pragma message \ + "glob / libgen headers missing => no 'dev_file' / 'pci_dev' labels" #endif -#include "collectd.h" -/* comment avoiding local clang-format conflict with collectd CI one */ #include "plugin.h" #include "utils/common/common.h" -- 2.47.2