diff options
author | Rajagopal Venkat <rajagopal.venkat@linaro.org> | 2012-06-25 22:44:13 +0530 |
---|---|---|
committer | Chris E Ferron <chris.e.ferron@linux.intel.com> | 2012-07-19 11:56:58 -0700 |
commit | 51242c5ac119768094209e3bf502beac34d1e3ff (patch) | |
tree | 0698a459fd9857863824d1cdc26777737dd43e2b | |
parent | 0a8fbf9c4dc1f18a97bf17c741a5ddccfc448b34 (diff) |
conditionally disable pci if not supported
disable pci if not supported by host platform. When
libpci is not found, define a macro which will be
used for conditional compilation.
Signed-off-by: Rajagopal Venkat <rajagopal.venkat@linaro.org>
-rw-r--r-- | src/lib.cpp | 20 | ||||
-rw-r--r-- | src/lib.h | 5 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/lib.cpp b/src/lib.cpp index 0f87e48..77e49a2 100644 --- a/src/lib.cpp +++ b/src/lib.cpp @@ -35,11 +35,13 @@ #include <math.h> #include <stdlib.h> +#include "lib.h" + +#ifndef HAVE_NO_PCI extern "C" { #include <pci/pci.h> } - -#include "lib.h" +#endif #include <stdio.h> #include <stdint.h> @@ -266,6 +268,7 @@ void format_watts(double W, char *buffer, unsigned int len) } +#ifndef HAVE_NO_PCI static struct pci_access *pci_access; char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len) @@ -290,6 +293,19 @@ void end_pci_access(void) pci_free_name_list(pci_access); } +#else + +char *pci_id_to_name(uint16_t vendor, uint16_t device, char *buffer, int len) +{ + return NULL; +} + +void end_pci_access(void) +{ +} + +#endif /* HAVE_NO_PCI */ + int utf_ok = -1; @@ -30,6 +30,11 @@ #endif #include <stdint.h> +/* Include only for Automake builds */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #ifndef DISABLE_I18N #define _(STRING) gettext(STRING) #else |