Merge pull request #1776 from aTanW/master
[feed/packages.git] / utils / sane-backends / patches / 020-inb_outb.patch
1 --- a/configure.in
2 +++ b/configure.in
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)
6
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)])
11 + AC_LINK_IFELSE(
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.])
21 + fi
22 +else
23 + sane_cv_have_sys_io_h_with_inb_outb="no"
24 +fi
25 +
26 SANE_PROTOTYPES
27
28 if test "$ac_cv_header_os2_h" = "yes" ; then
29 --- a/include/sane/config.h.in
30 +++ b/include/sane/config.h.in
31 @@ -490,6 +484,9 @@
32 /* SANE DLL minor number */
33 #undef SANE_DLL_V_MINOR
34
35 +/* Define to 1 if you have the <sys/io.h> providing inb,outb. */
36 +#undef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
37 +
38 /* SCSI command buffer size */
39 #undef SCSIBUFFERSIZE
40
41 --- a/acinclude.m4
42 +++ b/acinclude.m4
43 @@ -620,9 +620,9 @@ for be in ${BACKENDS}; do
44 ;;
45
46 qcam)
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"
53 fi
54 ;;
55 --- a/sanei/sanei_pio.c
56 +++ b/sanei/sanei_pio.c
57 @@ -61,6 +61,9 @@
58
59 #ifdef HAVE_SYS_IO_H
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
63 +# endif
64 #elif HAVE_ASM_IO_H
65 # include <asm/io.h> /* ugly, but backwards compatible */
66 #elif HAVE_SYS_HW_H
67 --- a/sanei/sanei_ab306.c
68 +++ b/sanei/sanei_ab306.c
69 @@ -51,6 +51,9 @@
70
71 #ifdef HAVE_SYS_IO_H
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
75 +# endif
76 #elif HAVE_ASM_IO_H
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
81 @@ -72,7 +72,10 @@
82 # if defined (__ICC) && __ICC >= 700
83 # define __GNUC__ 2
84 # endif
85 -# include <sys/io.h>
86 +# include <sys/io.h>
87 +# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
88 +# define IO_SUPPORT_MISSING
89 +# endif
90 # if defined (__ICC) && __ICC >= 700
91 # undef __GNUC__
92 # elif defined(__ICC) && defined(HAVE_ASM_IO_H)
93 --- a/sanei/sanei_pp.c
94 +++ b/sanei/sanei_pp.c
95 @@ -94,6 +94,9 @@
96 # define __GNUC__ 2
97 # endif
98 # include <sys/io.h>
99 +# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
100 +# define IO_SUPPORT_MISSING
101 +# endif
102 # if defined (__ICC) && __ICC >= 700
103 # undef __GNUC__
104 # elif defined(__ICC) && defined(HAVE_ASM_IO_H)