Hello, compiling SANE under linux with Intel icc fails because inb/outb are not defined, due to an ifdef __GNUC__ in sys/io.h . So testing HAVE_SYS_IO_H isn't enough, We should also test for __GNUC__ . Since icc accepts gcc inline assembly, we can use the code written to define inb and outbi when there is no io.h.
Here are the patches I needed to compile SANE with icc. The biggest change is in qcam.c, where a fallback is provided when direct io is missing. --- /home/stefdev/cvs/sane/sane-backends/sanei/sanei_pio.c 2000-08-12 17:11:34.000000000 +0200 +++ /home/stefdev/icc/umax_pp/sanei/sanei_pio.c 2003-02-18 13:10:00.000000000 +0100 @@ -58,13 +58,13 @@ # include <unistd.h> #endif -#ifdef HAVE_SYS_IO_H +#if HAVE_SYS_IO_H && defined (__GNUC__) # include <sys/io.h> /* use where available (glibc 2.x, for example) */ -#elif HAVE_ASM_IO_H +#elif HAVE_ASM_IO_H && defined (__GNUC__) # include <asm/io.h> /* ugly, but backwards compatible */ #elif HAVE_SYS_HW_H # include <sys/hw.h> -#elif defined(__i386__) && defined (__GNUC__) +#elif defined(__i386__) && ( defined (__GNUC__) || defined (__ICC) ) static __inline__ void outb (u_char value, u_long port) --- /home/stefdev/cvs/sane/sane-backends/sanei/sanei_ab306.c 2001-12-01 20:37:23.000000000 +0100 +++ /home/stefdev/icc/umax_pp/sanei/sanei_ab306.c 2003-02-18 13:10:08.000000000 +0100 @@ -49,11 +49,11 @@ #include <sys/types.h> -#ifdef HAVE_SYS_IO_H +#if HAVE_SYS_IO_H && defined (__GNUC__) # include <sys/io.h> /* use where available (glibc 2.x, for example) */ -#elif HAVE_ASM_IO_H +#elif HAVE_ASM_IO_H && defined (__GNUC__) # include <asm/io.h> /* ugly, but backwards compatible */ -#elif defined (__i386__) && defined (__GNUC__) +#elif defined (__i386__) && ( defined (__GNUC__) || defined (__ICC) ) static __inline__ void outb (u_char value, u_long port) --- /home/stefdev/cvs/sane/sane-backends/backend/qcam.c 2002-01-11 18:49:09.000000000 +0100 +++ /home/stefdev/icc/umax_pp/backend/qcam.c 2003-02-18 13:17:33.000000000 +0100 @@ -202,19 +202,29 @@ #if defined(__linux__) || defined (HAVE_SYS_HW_H) -#ifdef HAVE_SYS_IO_H +#if HAVE_SYS_IO_H && defined (__GNUC__) # include <sys/io.h> /* GNU libc based Linux */ -#elif HAVE_ASM_IO_H +#elif HAVE_ASM_IO_H && defined (__GNUC__) # include <asm/io.h> /* older Linux */ #elif HAVE_SYS_HW_H # include <sys/hw.h> /* OS/2 */ +#else +# define IO_SUPPORT_MISSING #endif -#define read_lpdata(d) inb ((d)->port) -#define read_lpstatus(d) inb ((d)->port + 1) -#define read_lpcontrol(d) inb ((d)->port + 2) -#define write_lpdata(d,v) outb ((v), (d)->port) -#define write_lpcontrol(d,v) outb ((v), (d)->port + 2) +#ifdef IO_SUPPORT_MISSING +# define read_lpdata(d) 0xFF +# define read_lpstatus(d) 0xFF +# define read_lpcontrol(d) 0xFF +# define write_lpdata(d,v) +# define write_lpcontrol(d,v) +#else +# define read_lpdata(d) inb ((d)->port) +# define read_lpstatus(d) inb ((d)->port + 1) +# define read_lpcontrol(d) inb ((d)->port + 2) +# define write_lpdata(d,v) outb ((v), (d)->port) +# define write_lpcontrol(d,v) outb ((v), (d)->port + 2) +#endif #endif /* __linux__ */ The umax_pp backend has allready been modified (in CVS )and I could test direct hardware access with scanimage built with icc. Regards, Stef