sane-project-website/old-archive/2000-03/0094.html

196 wiersze
7.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: Re: backends and external libraries</TITLE>
<META NAME="Author" CONTENT="Petter Reinholdtsen (pere@hungry.com)">
<META NAME="Subject" CONTENT="Re: backends and external libraries">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: backends and external libraries</H1>
<!-- received="Fri Mar 10 17:54:50 2000" -->
<!-- isoreceived="20000311015450" -->
<!-- sent="Sat, 11 Mar 2000 09:58:56 +0800" -->
<!-- isosent="20000311015856" -->
<!-- name="Petter Reinholdtsen" -->
<!-- email="pere@hungry.com" -->
<!-- subject="Re: backends and external libraries" -->
<!-- id="200003110158.JAA27125@minerva.ee.uwa.edu.au" -->
<!-- inreplyto="backends and external libraries" -->
<STRONG>From:</STRONG> Petter Reinholdtsen (<A HREF="mailto:pere@hungry.com?Subject=Re:%20backends%20and%20external%20libraries&In-Reply-To=&lt;200003110158.JAA27125@minerva.ee.uwa.edu.au&gt;"><EM>pere@hungry.com</EM></A>)<BR>
<STRONG>Date:</STRONG> Fri Mar 10 2000 - 17:58:56 PST
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0095.html">Anne Merritt: "HP4C + Symbios SCSI card"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0093.html">Oliver Rauch: "Re: xsane-0.57 freezes"</A>
<LI><STRONG>Maybe in reply to:</STRONG> <A HREF="0013.html">David Paschal: "backends and external libraries"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0095.html">Anne Merritt: "HP4C + Symbios SCSI card"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0095.html">Anne Merritt: "HP4C + Symbios SCSI card"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#94">[ date ]</A>
<A HREF="index.html#94">[ thread ]</A>
<A HREF="subject.html#94">[ subject ]</A>
<A HREF="author.html#94">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
<EM>&gt; - Modify the configure.in (and generate a new ./configure) to check
</EM><BR>
<EM>&gt; for the existence, version, and location of this external library
</EM><BR>
<EM>&gt; (which I'm currently calling PTAL, for &quot;Peripheral Transport
</EM><BR>
<EM>&gt; Abstraction Library&quot;). ./configure currently does something similar
</EM><BR>
<EM>&gt; to check for GTK.
</EM><BR>
<P>To check the existence, add 'AC_CHECK_LIB(&lt;lib&gt;, &lt;function_needed&gt;)'
<BR>
and 'AC_CHECK_HEADERS(&lt;libheader.h&gt;)' in 'configure.in'. Update
<BR>
'include/sane/config.h.in' with the new defines. Then run 'autoconf'
<BR>
to make a new configure file.
<BR>
<P>To check the version, you can either check for two different functions
<BR>
using 'AC_CHECK_FUNCS(&lt;function&gt;) after you checked for the library to
<BR>
see which one of them are present, write your own test program to
<BR>
compare the library version against the requred version, or write a
<BR>
test program to return a header define and do the comparing in
<BR>
configure.in. I suggest the first method.
<BR>
<P><EM>&gt; - If the library is not found, then build the HP SCL backend as usual
</EM><BR>
<EM>&gt; to support the usual connection methods (SCSI, device, PIO). Disable
</EM><BR>
<EM>&gt; the new HP DTF backend I'm working on to support the sheetfed
</EM><BR>
<EM>&gt; OfficeJets and the LaserJet 1100A (which could be connected either
</EM><BR>
<EM>&gt; to a LAN via an HP JetDirect external print server, or eventually to
</EM><BR>
<EM>&gt; the parallel port on a workstation using a Linux kernel module).
</EM><BR>
<P>Check for the define HAVE_LIB&lt;lib&gt; to include code requiring the
<BR>
library.
<BR>
<P><EM>&gt; - If the library is found, then enable the DTF backend. Use the gcc
</EM><BR>
<EM>&gt; -D switch to pass in an extra #define to the HP SCL backend that
</EM><BR>
<EM>&gt; enables my added code that interfaces with PTAL to support the
</EM><BR>
<EM>&gt; SCL-based flatbed HP OfficeJets. What should I call this #define?
</EM><BR>
<EM>&gt; &quot;PTAL&quot;? Or &quot;HAVE_PTAL&quot;?
</EM><BR>
<P>It will be called HAVE_LIBPTAL if the library is called libptal.a.
<BR>
<P><EM>&gt; - When building PTAL-enabled backends, as well as versions of Peter
</EM><BR>
<EM>&gt; Kirchgessner's hpinq and hpscan utilities that I've hacked to
</EM><BR>
<EM>&gt; support PTAL, either statically or dynamically link the PTAL
</EM><BR>
<EM>&gt; library to the corresponding backend or executable. I imagine
</EM><BR>
<EM>&gt; dynamic linking would be preferable, but isn't it unavailable on
</EM><BR>
<EM>&gt; certain platforms?
</EM><BR>
<P><EM>&gt; And what would happen if both the SCL and DTF backends were
</EM><BR>
<EM>&gt; running at the same time (i.e. under saned)?
</EM><BR>
<P>I'm not sure if I understand which problem you are describing here.
<BR>
<P><EM>&gt; (Does PTAL need to be thread-safe, even through AFAIK none of its
</EM><BR>
<EM>&gt; intended clients will be multi-threaded?)
</EM><BR>
<P>Why should it not be thread safe? All libraries should be thread
<BR>
safe. :-) It is currently not a requirement for SANE.
<BR>
<P><EM>&gt; So are the above items all I need to do, or can somebody tell me
</EM><BR>
<EM>&gt; what else I need to do?
</EM><BR>
<P>If your backend source is one set of files which conditional compile,
<BR>
the above should be work. If you have two set of backend files
<BR>
producing two different backends, you will need to add things like
<BR>
this to configure.in:
<BR>
<P>&nbsp;&nbsp;if test &quot;${ac_cv_header_sys_socket_h}&quot; = &quot;no&quot;; then
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;disabling NET backend&quot;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;NET=
<BR>
&nbsp;&nbsp;else
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;enabling NET backend&quot;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;NET=net
<BR>
&nbsp;&nbsp;fi
<BR>
&nbsp;&nbsp;AC_SUBST(NET)
<BR>
<P>The 'test'-part is checkig for a specific header file. It can also
<BR>
check for functions and libraries. The 'NET' keyword need to be in
<BR>
backend/Makefile.in, with '@' around it to be substituted when the
<BR>
backend is enabled.
<BR>
<PRE>
--
##&gt; Petter Reinholdtsen &lt;## | <A HREF="mailto:pere@td.org.uit.no?Subject=Re:%20backends%20and%20external%20libraries&In-Reply-To=&lt;200003110158.JAA27125@minerva.ee.uwa.edu.au&gt;">pere@td.org.uit.no</A>
<P>--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20backends%20and%20external%20libraries&In-Reply-To=&lt;200003110158.JAA27125@minerva.ee.uwa.edu.au&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0095.html">Anne Merritt: "HP4C + Symbios SCSI card"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0093.html">Oliver Rauch: "Re: xsane-0.57 freezes"</A>
<LI><STRONG>Maybe in reply to:</STRONG> <A HREF="0013.html">David Paschal: "backends and external libraries"</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0095.html">Anne Merritt: "HP4C + Symbios SCSI card"</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0095.html">Anne Merritt: "HP4C + Symbios SCSI card"</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#94">[ date ]</A>
<A HREF="index.html#94">[ thread ]</A>
<A HREF="subject.html#94">[ subject ]</A>
<A HREF="author.html#94">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Fri Mar 10 2000 - 17:55:57 PST</EM>
</EM>
</SMALL>
</BODY>
</HTML>