[sane-devel] [PATCH] undef linux before defining STRINGIFY
Niels Ole Salscheider
niels_ole at salscheider-online.de
Tue Jun 9 14:07:00 UTC 2015
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.
Ole
> On Sun, Jun 7, 2015 at 4:14 PM, Niels Ole Salscheider
> <niels_ole at salscheider-online.de> wrote:
>> Otherwise, "linux" will be expanded to "1" when it is stringified.
>>
>> This is a problem for e. g. LIBDIR, which might contain a target
>> triplet.
>> On my system, /usr/x86_64-pc-linux-gnu-gcc would expand to
>> x86_64-pc-1-gnu-gcc.
>> ---
>> include/sane/sanei.h | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/include/sane/sanei.h b/include/sane/sanei.h
>> index ece1beb..90ec028 100644
>> --- a/include/sane/sanei.h
>> +++ b/include/sane/sanei.h
>> @@ -140,6 +140,9 @@
>> /** @hideinitializer */
>> #define NELEMS(a) ((int)(sizeof (a) / sizeof (a[0])))
>>
>> +/* undef linux so that it can be stringified. It would expand to 1
>> otherwise. */
>> +#undef linux
>> +
>> /** @hideinitializer */
>> #define STRINGIFY1(x) #x
>> /** @hideinitializer */
>> --
>> 2.4.2
>>
>>
>> --
>> sane-devel mailing list: sane-devel at lists.alioth.debian.org
>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
>> Unsubscribe: Send mail with subject "unsubscribe your_password"
>> to sane-devel-request at lists.alioth.debian.org
More information about the sane-devel
mailing list