[sane-devel] [PATCH v2] Do not use STRINGIFY for LIBDIR but pass "LIBDIR" from build system

Niels Ole Salscheider niels_ole at salscheider-online.de
Thu Jun 11 05:59:30 UTC 2015


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.

v2: also adjust backend/Makefile.in
---
 backend/Makefile.am | 2 +-
 backend/Makefile.in | 2 +-
 backend/dll.c       | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/backend/Makefile.am b/backend/Makefile.am
index 40ec6c6..c5791e6 100644
--- a/backend/Makefile.am
+++ b/backend/Makefile.am
@@ -24,7 +24,7 @@ USB_LIBS = @USB_LIBS@
 SCSI_LIBS = @SCSI_LIBS@
 PTHREAD_LIBS = @PTHREAD_LIBS@
 
-AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -DLIBDIR="$(libdir)/sane"
+AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -DLIBDIR="\"$(libdir)/sane\""
 
 V_MAJOR = @V_MAJOR@
 V_MINOR = @V_MINOR@
diff --git a/backend/Makefile.in b/backend/Makefile.in
index b688e93..be214c6 100644
--- a/backend/Makefile.in
+++ b/backend/Makefile.in
@@ -1887,7 +1887,7 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -DLIBDIR="$(libdir)/sane"
+AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -DLIBDIR="\"$(libdir)/sane\""
 AM_LDFLAGS = @STRICT_LDFLAGS@
 # The -rpath option is added because we are creating _LTLIBRARIES based
 # on configure substitution.  This causes automake to not know the
diff --git a/backend/dll.c b/backend/dll.c
index 619ee55..5264f11 100644
--- a/backend/dll.c
+++ b/backend/dll.c
@@ -430,7 +430,7 @@ load (struct backend *be)
 
   if (path)
     {
-      src_len = strlen (path) + strlen (STRINGIFY (LIBDIR)) + 1 + 1;
+      src_len = strlen (path) + strlen (LIBDIR) + 1 + 1;
       src = malloc (src_len);
       if (!src)
 	{
@@ -438,11 +438,11 @@ load (struct backend *be)
 	  return SANE_STATUS_NO_MEM;
 	}
       orig_src = src;
-      snprintf (src, src_len, "%s:%s", path, STRINGIFY (LIBDIR));
+      snprintf (src, src_len, "%s:%s", path, LIBDIR);
     }
   else
     {
-      src = STRINGIFY (LIBDIR);
+      src = LIBDIR;
       src = strdup (src);
       if (!src)
 	{
-- 
2.4.3




More information about the sane-devel mailing list