packages/utils/sane-backends/patches/020-inb_outb.patch
Luiz Angelo Daros de Luca e11fbf71f7 sane-backends: import from oldpackages
Changes since oldpackages:
- cups dependency was completely removed
  * This also happened in sane trunk version
- small musl patch
- added detection of inb,outb (link error with musl)
  * this also removes hack 020-non-i386-qcam.patch
- fix for segfault when using sane-test backend
- removed link to extra libraries in libsane (used only
  for preload backends)
- added format-security fix
- sane-libs and sane-backends merged and exploded into
  individual packages for each backend:
  * libsane for sane library (which backends should dep on)
  * sane-daemon for saned daemon
  * sane-xxx for sane backend for xxx
  ** each backend has its own custom dep libraries
  * sane-backends-all (with no files) that deps on all backends
  * sane-qcam is only available for x86/x86_64
  ** other archs does not implement inb/outb (at least in musl)

Now it is possible to use SANE with much less FS space (KB
instead of MB).

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2015-09-10 18:39:40 -03:00

104 lines
3.3 KiB
Diff

--- a/configure.in
+++ b/configure.in
@@ -312,6 +312,25 @@ AC_CHECK_FUNCS(atexit ioperm i386_set_io
AC_REPLACE_FUNCS(getenv isfdtype sigprocmask snprintf \
strcasestr strdup strndup strsep usleep sleep syslog vsyslog)
+dnl sys/io.h might provide ioperm but not inb,outb (like for
+dnl non i386/x32/x86_64 with musl libc)
+if test "${ac_cv_header_sys_io_h}" = "yes"; then
+ AC_MSG_CHECKING([for inb,outb (provided by sys/io.h)])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <sys/io.h>]],
+ [[inb(0);outb(0,0);]])],
+ [AC_MSG_RESULT([yes])
+ sane_cv_have_sys_io_h_with_inb_outb="yes"],
+ [AC_MSG_RESULT([no])
+ sane_cv_have_sys_io_h_with_inb_outb="no"
+ AC_MSG_WARN([sys/io.h does not provide inb,outb (non i386/x32/x86_64 arch?)])])
+ if test "$sane_cv_have_sys_io_h_with_inb_outb" = "yes"; then
+ AC_DEFINE(SANE_HAVE_SYS_IO_H_WITH_INB_OUTB, 1, [Define to 1 if you have the <sys/io.h> providing inb,outb.])
+ fi
+else
+ sane_cv_have_sys_io_h_with_inb_outb="no"
+fi
+
SANE_PROTOTYPES
if test "$ac_cv_header_os2_h" = "yes" ; then
--- a/include/sane/config.h.in
+++ b/include/sane/config.h.in
@@ -490,6 +484,9 @@
/* SANE DLL minor number */
#undef SANE_DLL_V_MINOR
+/* Define to 1 if you have the <sys/io.h> providing inb,outb. */
+#undef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+
/* SCSI command buffer size */
#undef SCSIBUFFERSIZE
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -620,9 +620,9 @@ for be in ${BACKENDS}; do
;;
qcam)
- if test "${ac_cv_func_ioperm}" = "no" \
+ if ( test "${ac_cv_func_ioperm}" = "no" || test "${sane_cv_have_sys_io_h_with_inb_outb}" = "no" )\
&& test "${ac_cv_func__portaccess}" = "no"; then
- echo "*** $be backend requires ioperm and portaccess functions - $DISABLE_MSG"
+ echo "*** $be backend requires (ioperm, inb and outb) or portaccess functions - $DISABLE_MSG"
backend_supported="no"
fi
;;
--- a/sanei/sanei_pio.c
+++ b/sanei/sanei_pio.c
@@ -61,6 +61,9 @@
#ifdef HAVE_SYS_IO_H
# include <sys/io.h> /* use where available (glibc 2.x, for example) */
+# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+# define IO_SUPPORT_MISSING
+# endif
#elif HAVE_ASM_IO_H
# include <asm/io.h> /* ugly, but backwards compatible */
#elif HAVE_SYS_HW_H
--- a/sanei/sanei_ab306.c
+++ b/sanei/sanei_ab306.c
@@ -51,6 +51,9 @@
#ifdef HAVE_SYS_IO_H
# include <sys/io.h> /* use where available (glibc 2.x, for example) */
+# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+# define IO_SUPPORT_MISSING
+# endif
#elif HAVE_ASM_IO_H
# include <asm/io.h> /* ugly, but backwards compatible */
#elif defined (__i386__) && defined (__GNUC__)
--- a/sanei/sanei_pa4s2.c
+++ b/sanei/sanei_pa4s2.c
@@ -72,7 +72,10 @@
# if defined (__ICC) && __ICC >= 700
# define __GNUC__ 2
# endif
-# include <sys/io.h>
+# include <sys/io.h>
+# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+# define IO_SUPPORT_MISSING
+# endif
# if defined (__ICC) && __ICC >= 700
# undef __GNUC__
# elif defined(__ICC) && defined(HAVE_ASM_IO_H)
--- a/sanei/sanei_pp.c
+++ b/sanei/sanei_pp.c
@@ -94,6 +94,9 @@
# define __GNUC__ 2
# endif
# include <sys/io.h>
+# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
+# define IO_SUPPORT_MISSING
+# endif
# if defined (__ICC) && __ICC >= 700
# undef __GNUC__
# elif defined(__ICC) && defined(HAVE_ASM_IO_H)