[sane-devel] [PATCH] undefined symbols in the qcam backend on GNU/kFreeBSD

Aurelien Jarno aurelien at aurel32.net
Mon Jan 9 11:10:09 UTC 2006


On Sun, Jan 08, 2006 at 01:53:45PM +0100, Henning Meier-Geinitz wrote:
> Hi,
Hi,

> On 2006-01-07 05:15, Aurelien Jarno wrote:
> > -#if defined(__linux__) || defined (HAVE_SYS_HW_H)
> > +#if defined(__GLIBC__) || defined (HAVE_SYS_HW_H)
> 
> But this means that Linux without glibc won' work, which is the reason
> for this one:
> 
> >  #elif HAVE_ASM_IO_H
> >  # include <asm/io.h>		/* older Linux */
> >  #elif HAVE_SYS_HW_H
> 
> Granted, not many pre-glibc linux systems will exist and use SANE but
> I guess this should be made more intelligent nevertheless.
> 
> Or do I miss something?

Yes, you are right, and I also forget about uclibc. What about the
following patch? It may be a bit ugly, but at least it breaks nothing:

Index: qcam.c
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/qcam.c,v
retrieving revision 1.9
diff -u -d -p -r1.9 qcam.c
--- qcam.c	6 May 2005 21:06:06 -0000	1.9
+++ qcam.c	9 Jan 2006 10:50:23 -0000
@@ -193,10 +193,10 @@ static const SANE_Range odd_bw_x_range =
 static const SANE_Range bw_y_range = { 0, 241, 1 };
 static const SANE_Range odd_bw_y_range = { 1, 242, 1 };
 
-#if defined(__linux__) || defined (HAVE_SYS_HW_H)
+#if defined(__linux__) || defined(__GLIBC__) || defined (HAVE_SYS_HW_H)
 
 #ifdef HAVE_SYS_IO_H
-# include <sys/io.h>		/* GNU libc based Linux */
+# include <sys/io.h>		/* GNU libc based OS */
 #elif HAVE_ASM_IO_H
 # include <asm/io.h>		/* older Linux */
 #elif HAVE_SYS_HW_H


Please find also that one which is not based on detecting an OS, but
rather on the detected header files. 

I also moved the read_lp* and write_lpdata functions out of the test, in
case there is a linux system which has inb and outb defined in an other
header than the ones in the test. Note that if no header include the
definition of inb and outb, there is no regression, but the message that
will appear at dl_open will be changed from "undefined symbol
write_lpdata" to "undefined symbol outb".

Index: qcam.c
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/qcam.c,v
retrieving revision 1.9
diff -u -d -p -r1.9 qcam.c
--- qcam.c	6 May 2005 21:06:06 -0000	1.9
+++ qcam.c	9 Jan 2006 10:52:53 -0000
@@ -193,23 +193,24 @@ static const SANE_Range odd_bw_x_range =
 static const SANE_Range bw_y_range = { 0, 241, 1 };
 static const SANE_Range odd_bw_y_range = { 1, 242, 1 };
 
-#if defined(__linux__) || defined (HAVE_SYS_HW_H)
+#if defined(HAVE_SYS_IO_H) || defined(HAVE_ASM_IO_H) || defined (HAVE_SYS_HW_H)
 
 #ifdef HAVE_SYS_IO_H
-# include <sys/io.h>		/* GNU libc based Linux */
+# include <sys/io.h>		/* GNU libc based OS */
 #elif HAVE_ASM_IO_H
 # include <asm/io.h>		/* older Linux */
 #elif HAVE_SYS_HW_H
 # include <sys/hw.h>		/* OS/2 */
 #endif
 
+#endif /* <sys/io.h> || <asm/io.h> || <sys/hw.h> */
+
 #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 /* __linux__ */
 
 static SANE_Status
 enable_ports (QC_Device * q)


Please select the patch you prefer.

Thanks,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32 at debian.org         | aurelien at aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net



More information about the sane-devel mailing list