[sane-devel] [hpoj-devel] detecting sane-backends lib and etc directories

Henning Meier-Geinitz henning@meier-geinitz.de
Wed, 10 Jul 2002 13:39:48 +0200


On Wed, Jul 10, 2002 at 04:09:52AM -0700, David Paschal wrote:
> Hi.  Could somebody please review the following algorithm for detecting
> where sane-backends lib and etc directories are installed and let me know
> if there are any problems with it?

I haven't looked at the actual code but the summary looks fine for me.
A bit paranoic, maybe :-)

> This is for installing the external
> "hpoj" backend (http://hpoj.sourceforge.net), by setting a symlink from
> .../lib/sane/libsane-hpoj.so.1 to where libsane-hpoj.so* is really
> installed, and appending the line "hpoj" to dll.conf if necessary.

Be careful with the naming scheme. I don't know, if libsane-hpoj.so.1
(especially the .1) works on every non-Linux platform.

> The actual configure.in code I wrote is included at the end of this
> message, but I'll summarize it here:
> - Look for the file libsane-dll.so in the following places:
>   - the directory specified by "./configure --with-sane-backend=<DIR>"
>   - parsed "-L' switch from `sane-config --ldflags' with "/sane" appended
>   - `sane-config --exec-prefix`/lib/sane
>   - `sane-config --prefix`/lib/sane
>   - /usr/local/lib/sane
>   - /usr/lib/sane
>   - /usr/X11*/lib/sane

You could also parse LD_LIBRARY_PATH.

> - Look for the file dll.conf in the following places:
>   - the directory specified by "./configure --with-sane-etc=<DIR>"
>   - the environment variable $SANE_CONFIG_DIR
>   - `sane-config --prefix`/etc/sane.d
>   - `sane-config --exec-prefix`/etc/sane.d

As far as I know, if --sysconfdir isn't set explicitely, it's
${prefix}/etc/sane.d/ . I guess it's quite unlikely that anyone uses
exec-prefix for configuration files. But you never know...

>   - /etc/sane.d
>   - /usr/local/etc/sane.d
>   - /usr/etc/sane.d

I haven't seen the last one.

> For example, is anybody aware of any other paths where distributions
> might install the .so and .conf files?

I have seen SANE installed in /opt/sane/lib, /opt/sane/etc/ ..., but
that was by a local administrator.