[sane-devel] [PATCH] undef linux before defining STRINGIFY

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Tue Jun 9 23:38:53 UTC 2015

Olaf Meeuwissen writes:

> Niels Ole Salscheider writes:
>> Am 2015-06-09 14:21, schrieb m. allan noah:
>>> We need more info here. Where do you see this expansion problem?
>>> allan
>> The problem is that LIBDIR is passed as a define from the build system.
>> Then, STRINGIFY(LIBDIR) is used in backend/dll.c to get a string of the 
>> search path for the backends.
>> This seems to be fine but it can become a problem since "linux" is 
>> definded to "1" by default.
>> This causes an issue on e. g. Exherbo, my linux distribution. Exherbo 
>> installs all packages to /usr/target-triplet/{bin,lib,include,...} so 
>> that you can have packages for different architectures on the same root. 
>> On my system, sane would be installed to /usr/x86_64-pc-linux-gnu/..., 
>> so that LIBDIR would be defined to be /usr/x86_64-pc-linux-gnu/lib.
>> But now, STRINGIFY(LIBDIR) turns this into /usr/x86_64-pc-1-gnu/lib 
>> (since it also expands linux) - and as a result, sane cannot find any 
>> backends.
> Rather than willy-nilly undefine `linux` (unconditionally at that) in
> include/sane/sanei.h without really knowing what else might break ;-),
> I would remove the `STRINGIFY()` calls from backend/dll.c.  The build
> system passes LIBDIR as a properly quoted string already with a
>  -DLIBDIR="$(libdir)/sane"
> in AM_CPPFLAGS in backend/Makefile.am.

Scrap that.  I shouldn't reply before the second cup of coffee.  :-(

The double quotes in Makefile.am are eaten by the shell.  You would also
need to change the above to


in backend/Makefile.am and run autoreconf to update the rest of the
build system to make my suggestion work.

Hope this helps,
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom

More information about the sane-devel mailing list