From 0ed4f34440b0da7957b4f301da35ba2c8354405a Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Sun, 26 Sep 2010 21:05:50 +0400 Subject: [PATCH 10/12] Use HAVE_*_H macro for detecting includes Signed-off-by: Peter Lemenkov --- hwaccess.h | 62 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 44 insertions(+), 18 deletions(-) diff --git a/hwaccess.h b/hwaccess.h index 111f7d9..3326383 100644 --- a/hwaccess.h +++ b/hwaccess.h @@ -26,13 +26,11 @@ #include "config.h" -#if defined (__i386__) || defined (__x86_64__) -#if defined(__GLIBC__) +#if defined (HAVE_SYS_IO_H) #include -#endif -#endif +#endif /* defined (HAVE_SYS_IO_H) */ -#if HAVE_LIBPCI == 1 +#if defined (HAVE_LIBPCI) /* * libpci headers use the variable name "index" which triggers shadowing * warnings on systems which have the index() function in a default #include @@ -41,7 +39,47 @@ #define index shadow_workaround_index #include #undef index -#endif + +#if defined (HAVE_STRINGS_H) +#include +#endif /* defined (HAVE_STRINGS_H) */ + +#if defined (HAVE_STDINT_H) +#include +#endif /* defined (HAVE_STDINT_H) */ + +#if defined (HAVE_SYS_TYPES_H) +#include +#endif /* defined (HAVE_SYS_TYPES_H) */ + +#if defined (HAVE_MACHINE_SYSARCH_H) +#include +#endif /* defined (HAVE_MACHINE_SYSARCH_H) */ + +#if defined (HAVE_MACHINE_CPUFUNC_H) +#include +#endif /* defined (HAVE_MACHINE_CPUFUNC_H) */ + +/* for iopl and outb under Solaris */ +#if defined HAVE_ASM_SUNDDI_H +#include +#endif /* defined HAVE_ASM_SUNDDI_H */ +#if defined HAVE_SYS_SYSI86_H +#include +#endif /* defined HAVE_SYS_SYSI86_H */ +#if defined HAVE_SYS_PSW_H +#include +#endif /* defined HAVE_SYS_PSW_H */ + +#ifdef __DJGPP__ +#include +#endif /* __DJGPP__ */ + +#if defined HAVE_DIRECTIO_DARWINIO_H +#include +#endif /* defined HAVE_DIRECTIO_DARWINIO_H */ + +#endif /* defined (HAVE_LIBPCI) */ #define ___constant_swab8(x) ((uint8_t) ( \ (((uint8_t)(x) & (uint8_t)0xffU)))) @@ -116,13 +154,6 @@ cpu_to_be(64) #if HAVE_LIBPCI == 1 #if defined (__i386__) || defined (__x86_64__) -/* for iopl and outb under Solaris */ -#if defined (__sun) && (defined(__i386) || defined(__amd64)) -#include -#include -#include -#include -#endif #if (defined(__MACH__) && defined(__APPLE__)) #define __DARWIN__ @@ -133,7 +164,6 @@ cpu_to_be(64) */ #if defined(__FreeBSD__) || defined(__DragonFly__) - #include #define off64_t off_t #define lseek64 lseek #define OUTB(x, y) do { u_int outb_tmp = (y); outb(outb_tmp, (x)); } while (0) @@ -161,8 +191,6 @@ cpu_to_be(64) #ifdef __DJGPP__ -#include - #define OUTB(x,y) outportb(y, x) #define OUTW(x,y) outportw(y, x) #define OUTL(x,y) outportl(y, x) @@ -189,8 +217,6 @@ cpu_to_be(64) #define off64_t off_t #define lseek64 lseek #if defined(__i386__) || defined(__x86_64__) - #include - #include #if defined(__NetBSD__) #if defined(__i386__) #define iopl i386_iopl -- 1.7.3.1