summary refs log tree commit diff stats
path: root/plugins/sysinfo
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2017-11-18 21:06:21 -0500
committerPatrick Griffis <tingping@tingping.se>2017-11-18 21:06:21 -0500
commit38f8cc8e0ccb981a06074cf9bf2ff8facb896c5d (patch)
tree9fc37512610352a48940550770b2c3da4ae4d630 /plugins/sysinfo
parent3e53635dfbd30acb7b11f07a6f00071e7643867f (diff)
sysinfo: Fix libpci detection
For some reason on my system `libpci` is found even though its not
installed...? Plus I forgot a few headers being included.
Diffstat (limited to 'plugins/sysinfo')
-rw-r--r--plugins/sysinfo/meson.build10
-rw-r--r--plugins/sysinfo/unix/parse.c6
2 files changed, 9 insertions, 7 deletions
diff --git a/plugins/sysinfo/meson.build b/plugins/sysinfo/meson.build
index 5656724e..7b4c9425 100644
--- a/plugins/sysinfo/meson.build
+++ b/plugins/sysinfo/meson.build
@@ -20,10 +20,14 @@ if system == 'linux' or system == 'darwin'
 
   if system == 'linux'
     libpci = dependency('libpci', required: false)
-    if libpci.found()
+    if libpci.found() and cc.has_header('pci/pci.h')
       sysinfo_deps += libpci
       sysinfo_cargs += '-DHAVE_LIBPCI'
       sysinfo_sources += 'unix/pci.c'
+
+      picidsdir = libpci.get_pkgconfig_variable('idsdir')
+      pciids = join_paths(picidsdir, 'pci.ids')
+      sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids)
     endif
     sysinfo_includes += 'unix'
     sysinfo_sources += [
@@ -31,10 +35,6 @@ if system == 'linux' or system == 'darwin'
       'unix/match.c',
       'unix/parse.c',
     ]
-
-    picidsdir = libpci.get_pkgconfig_variable('idsdir')
-    pciids = join_paths(picidsdir, 'pci.ids')
-    sysinfo_cargs += '-DPCIIDS_FILE="@0@"'.format(pciids)
   elif system == 'darwin'
     add_languages('objc')
     sysinfo_sources += 'osx/backend.m'
diff --git a/plugins/sysinfo/unix/parse.c b/plugins/sysinfo/unix/parse.c
index 30599068..784e2824 100644
--- a/plugins/sysinfo/unix/parse.c
+++ b/plugins/sysinfo/unix/parse.c
@@ -23,14 +23,16 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <pci/header.h>
+#ifdef HAVE_LIBPCI
+	#include <pci/header.h>
+	#include "pci.h"
+#endif
 #include <glib.h>
 
 #ifdef __sparc__
 #include <dirent.h>
 #endif
 
-#include "pci.h"
 #include "match.h"
 #include "parse.h"
 #include "sysinfo.h"