Skip to content

Commit fea4a9d

Browse files
Fix build with ancient libpci versions
#248
1 parent 183c8d7 commit fea4a9d

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

src/detection/gpu/gpu_linux.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ typedef struct PCIData
2020
FF_LIBRARY_SYMBOL(pci_fill_info);
2121
FF_LIBRARY_SYMBOL(pci_read_byte);
2222
FF_LIBRARY_SYMBOL(pci_lookup_name);
23-
FF_LIBRARY_SYMBOL(pci_get_string_property);
2423
FF_LIBRARY_SYMBOL(pci_get_param);
24+
25+
#if PCI_LIB_VERSION >= 0x030800
26+
FF_LIBRARY_SYMBOL(pci_get_string_property);
27+
#endif
2528
} PCIData;
2629

2730
static bool pciIDsContains(u16 searched, const u16* ids)
@@ -204,17 +207,20 @@ static const char* pciDetectGPUs(const FFinstance* instance, FFlist* gpus)
204207
{
205208
PCIData pci;
206209

207-
FF_LIBRARY_LOAD(libpci, &instance->config.libPCI, "dlopen libpci.so failed", "libpci.so", 4)
208-
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libpci, pci_alloc)
209-
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libpci, pci_init)
210-
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libpci, pci_scan_bus)
211-
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libpci, pci_cleanup)
212-
213-
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_fill_info)
214-
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_lookup_name)
215-
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_read_byte)
216-
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_get_param)
217-
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_get_string_property)
210+
FF_LIBRARY_LOAD(libpci, &instance->config.libPCI, "dlopen libpci.so failed", "libpci.so", 4);
211+
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libpci, pci_alloc);
212+
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libpci, pci_init);
213+
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libpci, pci_scan_bus);
214+
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(libpci, pci_cleanup);
215+
216+
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_fill_info);
217+
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_lookup_name);
218+
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_read_byte);
219+
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_get_param);
220+
221+
#if PCI_LIB_VERSION >= 0x030800
222+
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libpci, pci, pci_get_string_property);
223+
#endif
218224

219225
pci.access = ffpci_alloc();
220226
ffpci_init(pci.access);

0 commit comments

Comments
 (0)