bfd.h installation location

Alan Modra amodra@bigpond.net.au
Wed May 15 22:48:00 GMT 2002


On Wed, May 15, 2002 at 05:50:31PM -0700, H . J . Lu wrote:
> It doesn't help when --enable-shared is used. I don't mind
> libbfd-target-version.so myself.

Yes, that would be nice.  Here's the first step towards cleaning
up libbfd installation, installing libbfd and headers only when
native or --enable-shared.  I'm not familiar enough with libtool
to tackle renaming shared libs for the non-native shared case.

Comments and improvements welcome.  I'll install this in a day or
so, assuming it's not revised by some libtool guru.

bfd/ChangeLog
	* acinclude.m4 (AM_INSTALL_LIBBFD): New.
	* configure.in: Invoke AM_INSTALL_LIBBFD.
	* Makefile.am (install-data-local): Revert 2002-05-13.  Move to..
	(install_libbfd): .. New target.
	(uninstall_libbfd): Likewise.
	(install-libLTLIBRARIES): Likewise.
	(uninstall-libLTLIBRARIES): Likewise.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* Makefile.in: Regenerate.

Index: bfd/acinclude.m4
===================================================================
RCS file: /cvs/src/src/bfd/acinclude.m4,v
retrieving revision 1.5
diff -u -p -r1.5 acinclude.m4
--- bfd/acinclude.m4	31 Aug 2000 09:35:50 -0000	1.5
+++ bfd/acinclude.m4	16 May 2002 04:40:33 -0000
@@ -123,3 +123,18 @@ ifelse(yes,no,[
 AC_DEFUN([CY_WITH_NLS],)
 AC_SUBST(INTLLIBS)
 ])
+
+AC_DEFUN([AM_INSTALL_LIBBFD],
+[AC_MSG_CHECKING([whether to install libbfd])
+  AC_ARG_ENABLE(install-libbfd,
+[  --install-libbfd controls installation of libbfd and related headers],
+      INSTALL_LIBBFD_P=$enableval,
+      if test "${host}" = "${target}" -o "$enable_shared" = "yes"; then
+        INSTALL_LIBBFD_P=yes
+      else
+        INSTALL_LIBBFD_P=no
+      fi)
+  AC_MSG_RESULT($INSTALL_LIBBFD_P)
+  AM_CONDITIONAL(INSTALL_LIBBFD, test $INSTALL_LIBBFD_P = yes)
+]
+)
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.94
diff -u -p -r1.94 configure.in
--- bfd/configure.in	13 May 2002 13:33:29 -0000	1.94
+++ bfd/configure.in	16 May 2002 04:40:39 -0000
@@ -98,6 +98,7 @@ if test -z "$target" ; then
 fi
 
 AM_MAINTAINER_MODE
+AM_INSTALL_LIBBFD
 AC_EXEEXT
 
 host64=false
Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.82
diff -u -p -r1.82 Makefile.am
--- bfd/Makefile.am	13 May 2002 00:58:40 -0000	1.82
+++ bfd/Makefile.am	16 May 2002 04:40:32 -0000
@@ -672,14 +672,35 @@ $(BFD32_LIBS) \
  $(BFD64_BACKENDS) \
  $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
 
-# Install BFD include file, and others that it needs.
-install-data-local: $(BFD_H)
+install-libLTLIBRARIES: @INSTALL_LIBBFD_TRUE@ install_libbfd
 	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(exec_prefix)/include
-	$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(exec_prefix)/include/bfd.h
-	$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(exec_prefix)/include/ansidecl.h
-	$(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(exec_prefix)/include/symcat.h
-	$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(exec_prefix)/include/bfdlink.h
+
+uninstall-libLTLIBRARIES: @INSTALL_LIBBFD_TRUE@ uninstall_libbfd
+	@$(NORMAL_UNINSTALL)
+
+.PHONY: install_libbfd uninstall_libbfd
+install_libbfd: $(lib_LTLIBRARIES) $(BFD_H)
+	$(mkinstalldirs) $(DESTDIR)$(libdir)
+	$(mkinstalldirs) $(DESTDIR)$(includedir)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    echo "$(LIBTOOL)  --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
+	    $(LIBTOOL)  --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
+	  else :; fi; \
+	done
+	$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(includedir)/bfd.h
+	$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(includedir)/ansidecl.h
+	$(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(includedir)/symcat.h
+	$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(includedir)/bfdlink.h
+
+uninstall_libbfd:
+	list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  $(LIBTOOL)  --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+	done
+	rm -f $(DESTDIR)$(includedir)/bfd.h
+	rm -f $(DESTDIR)$(includedir)/ansidecl.h
+	rm -f $(DESTDIR)$(includedir)/symcat.h
+	rm -f $(DESTDIR)$(includedir)/bfdlink.h
 
 Makefile: $(srcdir)/configure.in
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list