3 @@ -312,6 +312,25 @@ AC_CHECK_FUNCS(atexit ioperm i386_set_io
4 AC_REPLACE_FUNCS(getenv isfdtype sigprocmask snprintf \
5 strcasestr strdup strndup strsep usleep sleep syslog vsyslog)
7 +dnl sys/io.h might provide ioperm but not inb,outb (like for
8 +dnl non i386/x32/x86_64 with musl libc)
9 +if test "${ac_cv_header_sys_io_h}" = "yes"; then
10 + AC_MSG_CHECKING([for inb,outb (provided by sys/io.h)])
12 + [AC_LANG_PROGRAM([[#include <sys/io.h>]],
13 + [[inb(0);outb(0,0);]])],
14 + [AC_MSG_RESULT([yes])
15 + sane_cv_have_sys_io_h_with_inb_outb="yes"],
16 + [AC_MSG_RESULT([no])
17 + sane_cv_have_sys_io_h_with_inb_outb="no"
18 + AC_MSG_WARN([sys/io.h does not provide inb,outb (non i386/x32/x86_64 arch?)])])
19 + if test "$sane_cv_have_sys_io_h_with_inb_outb" = "yes"; then
20 + AC_DEFINE(SANE_HAVE_SYS_IO_H_WITH_INB_OUTB, 1, [Define to 1 if you have the <sys/io.h> providing inb,outb.])
23 + sane_cv_have_sys_io_h_with_inb_outb="no"
28 if test "$ac_cv_header_os2_h" = "yes" ; then
29 --- a/include/sane/config.h.in
30 +++ b/include/sane/config.h.in
32 /* SANE DLL minor number */
33 #undef SANE_DLL_V_MINOR
35 +/* Define to 1 if you have the <sys/io.h> providing inb,outb. */
36 +#undef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
38 /* SCSI command buffer size */
43 @@ -620,9 +620,9 @@ for be in ${BACKENDS}; do
47 - if test "${ac_cv_func_ioperm}" = "no" \
48 + if ( test "${ac_cv_func_ioperm}" = "no" || test "${sane_cv_have_sys_io_h_with_inb_outb}" = "no" )\
49 && test "${ac_cv_func__portaccess}" = "no"; then
50 - echo "*** $be backend requires ioperm and portaccess functions - $DISABLE_MSG"
51 + echo "*** $be backend requires (ioperm, inb and outb) or portaccess functions - $DISABLE_MSG"
52 backend_supported="no"
55 --- a/sanei/sanei_pio.c
56 +++ b/sanei/sanei_pio.c
60 # include <sys/io.h> /* use where available (glibc 2.x, for example) */
61 +# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
62 +# define IO_SUPPORT_MISSING
65 # include <asm/io.h> /* ugly, but backwards compatible */
67 --- a/sanei/sanei_ab306.c
68 +++ b/sanei/sanei_ab306.c
72 # include <sys/io.h> /* use where available (glibc 2.x, for example) */
73 +# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
74 +# define IO_SUPPORT_MISSING
77 # include <asm/io.h> /* ugly, but backwards compatible */
78 #elif defined (__i386__) && defined (__GNUC__)
79 --- a/sanei/sanei_pa4s2.c
80 +++ b/sanei/sanei_pa4s2.c
82 # if defined (__ICC) && __ICC >= 700
87 +# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
88 +# define IO_SUPPORT_MISSING
90 # if defined (__ICC) && __ICC >= 700
92 # elif defined(__ICC) && defined(HAVE_ASM_IO_H)
93 --- a/sanei/sanei_pp.c
94 +++ b/sanei/sanei_pp.c
99 +# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
100 +# define IO_SUPPORT_MISSING
102 # if defined (__ICC) && __ICC >= 700
104 # elif defined(__ICC) && defined(HAVE_ASM_IO_H)