public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] gprofng: use the --libdir path to find libraries
@ 2022-10-10 23:04 vladimir.mezentsev
  0 siblings, 0 replies; only message in thread
From: vladimir.mezentsev @ 2022-10-10 23:04 UTC (permalink / raw)
  To: binutils; +Cc: Vladimir Mezentsev

From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

gprofng/ChangeLog
2022-10-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/29663
	* src/Makefile.am: Add -DLIBDIR to CPPFLAGS.
	* src/Makefile.in: Rebuild.
	* src/envsets.cc (putenv_libcollector_ld_misc): Use LIBDIR to find
	the gprofng libraries.
---
 gprofng/src/Makefile.am | 2 +-
 gprofng/src/Makefile.in | 2 +-
 gprofng/src/envsets.cc  | 8 +++++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
index 6e0931524e4..27ef7974afe 100644
--- a/gprofng/src/Makefile.am
+++ b/gprofng/src/Makefile.am
@@ -108,7 +108,7 @@ LOCALEDIR = @localedir@
 SYSCONFDIR = @sysconfdir@
 
 AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -DLOCALEDIR=\"$(LOCALEDIR)\" \
-	-DSYSCONFDIR=\"$(SYSCONFDIR)\" \
+	-DSYSCONFDIR=\"$(SYSCONFDIR)\" -DLIBDIR=\"$(libdir)\" \
 	-I.. -I$(srcdir) \
 	-I$(srcdir)/../common \
 	-I$(srcdir)/../../include -I$(srcdir)/../../opcodes \
diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
index ba7fdd6e8ad..7efdb9885f6 100644
--- a/gprofng/src/Makefile.in
+++ b/gprofng/src/Makefile.in
@@ -536,7 +536,7 @@ ZLIBINC = @zlibinc@
 LOCALEDIR = @localedir@
 SYSCONFDIR = @sysconfdir@
 AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -DLOCALEDIR=\"$(LOCALEDIR)\" \
-	-DSYSCONFDIR=\"$(SYSCONFDIR)\" \
+	-DSYSCONFDIR=\"$(SYSCONFDIR)\" -DLIBDIR=\"$(libdir)\" \
 	-I.. -I$(srcdir) \
 	-I$(srcdir)/../common \
 	-I$(srcdir)/../../include -I$(srcdir)/../../opcodes \
diff --git a/gprofng/src/envsets.cc b/gprofng/src/envsets.cc
index 484cbf83995..c9838416638 100644
--- a/gprofng/src/envsets.cc
+++ b/gprofng/src/envsets.cc
@@ -159,12 +159,18 @@ collect::putenv_libcollector_ld_misc ()
   sb.appendf ("%s=", "SP_COLLECTOR_LIBRARY_PATH");
   int len = sb.length ();
   int cnt = 0;
+  char *fname = dbe_sprintf ("%s/%s/%s", LIBDIR, PACKAGE, LIBGP_COLLECTOR);
+  if (access (fname, R_OK | F_OK) == 0)
+    {
+      ++cnt;
+      sb.appendf ("%s/%s", LIBDIR, PACKAGE);
+    }
+  free (fname);
   for (char *s = ev; s;)
     {
       char *s1 = strchr (s, ':');
       if (s1)
 	*(s1++) = 0;
-      char *fname;
       if (*s == '/')
 	{
 	  fname = dbe_sprintf ("%s/%s/%s", s, PACKAGE, LIBGP_COLLECTOR);
-- 
2.31.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-10 23:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 23:04 [PATCH 2/2] gprofng: use the --libdir path to find libraries vladimir.mezentsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).