Fix installation to honor PREFIX and LIBDIR

This patch changes the behavior of 'make install' so
that a user can pass PREFIX to have the libpfm4 files
installed somewhere other than the standard /usr/local
directory.

This patch also allows for a user to pass LIBDIR to
specify a non-standard install directory for the
libpfm library files. The standard library install
directory is <install-dir>/lib, but on some architectures
(including x86_64 and ppc64), 64-bit libraries are
typically installed into a "lib64" subdirectory.

This patch also removes the invocation of ldconfig from
the lib/Makefile install target, since that results in
and error when a non-root user is trying to install.

The README was updated to document the three changes
made in this patch.

Signed-off-by: Maynard Johnson <mayna...@us.ibm.com>
---
 README       |   14 ++++++++++++++
 config.mk    |    8 ++++++--
 lib/Makefile |    1 -
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 70bb052..cf2fcc3 100644
--- a/README
+++ b/README
@@ -104,6 +104,20 @@ INSTALLATION
        - type make
        - type make install
 
+       - The default installation location is /usr/local. You can specify
+         a diffierent install location as follows:
+               $ make PREFIX=<install-dir> install
+         Depending on your install location, you may need to run the 'ldconfig'
+         command or use LD_LIBRARY_PATH when you build and run tools that
+         link to the libpfm4 library.
+
+       - By default, libpfm library files are installed in <install-dir>/lib.
+         If 'make' builds 64-bit libraries on your system, and your target
+         architecture expects 64-bit libraries to be located in a library
+         named "lib64", then you should use the LIBDIR variable when 
installing,
+         as follows:
+               $ make LIBDIR=<install-dir>/lib64 install
+
        - To compile and install the Python bindings, you need to go to the
          python sub-directory and type make. Python may not be systematically
          built.
diff --git a/config.mk b/config.mk
index 9e5504c..1a38d87 100644
--- a/config.mk
+++ b/config.mk
@@ -101,8 +101,12 @@ AGE=0
 #
 # Where should things (lib, headers, man) go in the end.
 #
-PREFIX=/usr/local
-LIBDIR=$(PREFIX)/lib
+ifeq (${PREFIX},)
+       PREFIX=/usr/local
+endif
+ifeq (${LIBDIR},)
+       LIBDIR=$(PREFIX)/lib
+endif
 INCDIR=$(PREFIX)/include
 MANDIR=$(PREFIX)/share/man
 DOCDIR=$(PREFIX)/share/doc/libpfm-$(VERSION).$(REVISION).$(AGE)
diff --git a/lib/Makefile b/lib/Makefile
index d2f00a9..1df6894 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -281,7 +281,6 @@ ifeq ($(CONFIG_PFMLIB_SHARED),y)
        $(INSTALL) $(SLIBPFM) $(DESTDIR)$(LIBDIR)
        cd $(DESTDIR)$(LIBDIR); $(LN) $(SLIBPFM) $(VLIBPFM)
        cd $(DESTDIR)$(LIBDIR); $(LN) $(SLIBPFM) libpfm.$(SOLIBEXT)
-       $(LDCONFIG)
 endif
 
 tags:
-- 
1.7.1



------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to