sysinfo: Make libpci an optional dependency
This commit is contained in:
parent
47b653cc7c
commit
3e53635dfb
|
@ -19,14 +19,17 @@ if system == 'linux' or system == 'darwin'
|
|||
]
|
||||
|
||||
if system == 'linux'
|
||||
libpci = dependency('libpci')
|
||||
libpci = dependency('libpci', required: false)
|
||||
if libpci.found()
|
||||
sysinfo_deps += libpci
|
||||
sysinfo_cargs += '-DHAVE_LIBPCI'
|
||||
sysinfo_sources += 'unix/pci.c'
|
||||
endif
|
||||
sysinfo_includes += 'unix'
|
||||
sysinfo_sources += [
|
||||
'unix/backend.c',
|
||||
'unix/match.c',
|
||||
'unix/parse.c',
|
||||
'unix/pci.c',
|
||||
]
|
||||
|
||||
picidsdir = libpci.get_pkgconfig_variable('idsdir')
|
||||
|
|
|
@ -140,6 +140,9 @@ gint64 xs_parse_uptime(void)
|
|||
|
||||
int xs_parse_sound(char *snd_card)
|
||||
{
|
||||
#ifndef HAVE_LIBPCI
|
||||
return 1;
|
||||
#else
|
||||
char buffer[bsize], cards[bsize] = "\0", vendor[7] = "\0", device[7] = "\0", *pos;
|
||||
u16 class = PCI_CLASS_MULTIMEDIA_AUDIO;
|
||||
|
||||
|
@ -178,10 +181,14 @@ int xs_parse_sound(char *snd_card)
|
|||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int xs_parse_video(char *vid_card)
|
||||
{
|
||||
#ifndef HAVE_LIBPCI
|
||||
return 1;
|
||||
#else
|
||||
char vendor[7] = "\0", device[7] = "\0";
|
||||
u16 class = PCI_CLASS_DISPLAY_VGA;
|
||||
if (pci_find_by_class(&class, vendor, device))
|
||||
|
@ -189,10 +196,14 @@ int xs_parse_video(char *vid_card)
|
|||
else
|
||||
pci_find_fullname(vid_card, vendor, device);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int xs_parse_ether(char *ethernet_card)
|
||||
{
|
||||
#ifndef HAVE_LIBPCI
|
||||
return 1;
|
||||
#else
|
||||
char vendor[7] = "\0", device[7] = "\0";
|
||||
u16 class = PCI_CLASS_NETWORK_ETHERNET;
|
||||
if (pci_find_by_class(&class, vendor, device))
|
||||
|
@ -200,10 +211,14 @@ int xs_parse_ether(char *ethernet_card)
|
|||
else
|
||||
pci_find_fullname(ethernet_card, vendor, device);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int xs_parse_agpbridge(char *agp_bridge)
|
||||
{
|
||||
#ifndef HAVE_LIBPCI
|
||||
return 1;
|
||||
#else
|
||||
char vendor[7] = "\0", device[7] = "\0";
|
||||
u16 class = PCI_CLASS_BRIDGE_HOST;
|
||||
if (pci_find_by_class(&class, vendor, device))
|
||||
|
@ -211,6 +226,7 @@ int xs_parse_agpbridge(char *agp_bridge)
|
|||
else
|
||||
pci_find_fullname(agp_bridge, vendor, device);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int xs_parse_meminfo(unsigned long long *mem_tot, unsigned long long *mem_free, int swap)
|
||||
|
|
Loading…
Reference in New Issue