[PATCH v3 26/33] libctf: installable libctf
Nick Alcock
nick.alcock@oracle.com
Fri Sep 6 22:56:00 GMT 2019
This lets other programs read and write CTF-format data.
Only an .a is installed for now (but I hope to transition to a versioned
.so shortly: unlike libbfd and libiberty, we intend for this library to
conform to the usual long-term stable soname rules.)
New in v3.
* Makefile.def (host_modules): libctf is no longer no_install.
* Makefile.in: Regenerated.
libctf/
* configure.ac (INSTALL_LIBCTF): New, controlled by
--enable-install-libctf.
(INSTALL_LIBCTF): New, controlled by --enable-install-libctf.
* Makefile.am (INCDIR): New.
(AM_CPPFLAGS): Use $(srcdir), not $(top_srcdir).
[INSTALL_LIBCTF] (lib_LIBRARIES): Add libctf.a.
[INSTALL_LIBCTF] (include_HEADERS): Add the CTF headers.
[!INSTALL_LIBCTF] (include_HEADERS): New, empty.
* Makefile.in: Regenerated.
* configure: Regenerated.
---
ChangeLog | 5 ++
Makefile.def | 2 +-
Makefile.in | 16 +++++-
libctf/Makefile.am | 9 ++-
libctf/Makefile.in | 132 +++++++++++++++++++++++++++++++++++++-------
libctf/configure | 29 ++++++++++
libctf/configure.ac | 9 +++
7 files changed, 179 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b6e0a76fb16..9ef93916057 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-30 Nick Alcock <nick.alcock@oracle.com>
+
+ * Makefile.def (host_modules): libctf is no longer no_install.
+ * Makefile.in: Regenerated.
+
2019-07-13 Nick Alcock <nick.alcock@oracle.com>
* Makefile.def (dependencies): all-ld depends on all-libctf.
diff --git a/Makefile.def b/Makefile.def
index e887f498f4b..6f5e881d56e 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -129,7 +129,7 @@ host_modules= { module= lto-plugin; bootstrap=true;
extra_make_flags='@extra_linker_plugin_flags@'; };
host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
host_modules= { module= gotools; };
-host_modules= { module= libctf; no_install=true; no_check=true;
+host_modules= { module= libctf; no_check=true;
bootstrap=true; };
target_modules = { module= libstdc++-v3;
diff --git a/Makefile.in b/Makefile.in
index eeba51e8297..196abf01ff9 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -33849,7 +33849,13 @@ maybe-install-libctf:
@if libctf
maybe-install-libctf: install-libctf
-install-libctf:
+install-libctf: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(HOST_EXPORTS) \
+ (cd $(HOST_SUBDIR)/libctf && \
+ $(MAKE) $(FLAGS_TO_PASS) install)
@endif libctf
@@ -33858,7 +33864,13 @@ maybe-install-strip-libctf:
@if libctf
maybe-install-strip-libctf: install-strip-libctf
-install-strip-libctf:
+install-strip-libctf: installdirs
+ @: $(MAKE); $(unstage)
+ @r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ $(HOST_EXPORTS) \
+ (cd $(HOST_SUBDIR)/libctf && \
+ $(MAKE) $(FLAGS_TO_PASS) install-strip)
@endif libctf
diff --git a/libctf/Makefile.am b/libctf/Makefile.am
index a0a27b46c37..fe3050247e7 100644
--- a/libctf/Makefile.am
+++ b/libctf/Makefile.am
@@ -27,10 +27,17 @@ AUTOMAKE_OPTIONS = foreign no-texinfo.tex
ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
-AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir) -I$(top_srcdir)/../include -I$(top_srcdir)/../bfd -I../bfd
+INCDIR = $(srcdir)/../include
+AM_CPPFLAGS = -D_GNU_SOURCE -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../bfd -I../bfd
AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @WERROR@ $(ZLIBINC)
+if INSTALL_LIBCTF
+lib_LIBRARIES = libctf.a
+include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
+else
+include_HEADERS =
noinst_LIBRARIES = libctf.a
+endif
libctf_a_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
ctf-hash.c ctf-labels.c ctf-link.c ctf-lookup.c ctf-open.c \
diff --git a/libctf/Makefile.in b/libctf/Makefile.in
index 1d2efb9e756..eec706a12a4 100644
--- a/libctf/Makefile.in
+++ b/libctf/Makefile.in
@@ -32,6 +32,7 @@
# <http://www.gnu.org/licenses/>.
#
+
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@@ -115,14 +116,43 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
- $(am__configure_deps) $(am__DIST_COMMON)
+ $(am__configure_deps) $(am__include_HEADERS_DIST) \
+ $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES)
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
@@ -177,6 +207,8 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
+am__include_HEADERS_DIST = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
+HEADERS = $(include_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.h.in
# Read a list of newline-separated strings from the standard input,
@@ -327,9 +359,13 @@ AUTOMAKE_OPTIONS = foreign no-texinfo.tex
# case both are empty.
ZLIB = @zlibdir@ -lz
ZLIBINC = @zlibinc@
-AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir) -I$(top_srcdir)/../include -I$(top_srcdir)/../bfd -I../bfd
+INCDIR = $(srcdir)/../include
+AM_CPPFLAGS = -D_GNU_SOURCE -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../bfd -I../bfd
AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @WERROR@ $(ZLIBINC)
-noinst_LIBRARIES = libctf.a
+@INSTALL_LIBCTF_TRUE@lib_LIBRARIES = libctf.a
+@INSTALL_LIBCTF_FALSE@include_HEADERS =
+@INSTALL_LIBCTF_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
+@INSTALL_LIBCTF_FALSE@noinst_LIBRARIES = libctf.a
libctf_a_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c \
ctf-error.c ctf-hash.c ctf-labels.c ctf-link.c ctf-lookup.c \
ctf-open.c ctf-open-bfd.c ctf-string.c ctf-subr.c ctf-types.c \
@@ -387,6 +423,37 @@ $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
distclean-hdr:
-rm -f config.h stamp-h1
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ if test -f $$p; then \
+ $(am__strip_dir) \
+ echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \
+ ( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(libdir)'; $(am__uninstall_files_from_dir)
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
@@ -432,6 +499,27 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -657,8 +745,11 @@ distcleancheck: distclean
exit 1; } >&2
check-am: all-am
check: check-am
-all-am: Makefile $(LIBRARIES) config.h
+all-am: Makefile $(LIBRARIES) $(HEADERS) config.h
installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@@ -691,7 +782,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+clean-am: clean-generic clean-libLIBRARIES clean-noinstLIBRARIES \
+ mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
@@ -712,13 +804,13 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-includeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am:
+install-exec-am: install-libLIBRARIES
install-html: install-html-am
@@ -759,25 +851,27 @@ ps: ps-am
ps-am:
-uninstall-am:
+uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES
.MAKE: all install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
- clean-cscope clean-generic clean-noinstLIBRARIES cscope \
- cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
- dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
- distcheck distclean distclean-compile distclean-generic \
- distclean-hdr distclean-tags distcleancheck distdir \
- distuninstallcheck dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
+ clean-cscope clean-generic clean-libLIBRARIES \
+ clean-noinstLIBRARIES cscope cscopelist-am ctags ctags-am dist \
+ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
+ dist-xz dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-tags distcleancheck \
+ distdir distuninstallcheck dvi dvi-am html html-am info \
+ info-am install install-am install-data install-data-am \
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-includeHEADERS \
+ install-info install-info-am install-libLIBRARIES install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
- tags tags-am uninstall uninstall-am
+ tags tags-am uninstall uninstall-am uninstall-includeHEADERS \
+ uninstall-libLIBRARIES
.PRECIOUS: Makefile
diff --git a/libctf/configure b/libctf/configure
index 19087fed47e..4ae00664287 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -625,6 +625,8 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+INSTALL_LIBCTF_FALSE
+INSTALL_LIBCTF_TRUE
NEED_CTF_QSORT_R_FALSE
NEED_CTF_QSORT_R_TRUE
zlibinc
@@ -734,6 +736,7 @@ enable_largefile
enable_werror_always
enable_maintainer_mode
with_system_zlib
+enable_install_libctf
'
ac_precious_vars='build_alias
host_alias
@@ -1369,6 +1372,7 @@ Optional Features:
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
+ --enable-install-libctf Install libctf headers and library for end users
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -6499,6 +6503,27 @@ $as_echo "#define HAVE_O_CLOEXEC 1" >>confdefs.h
fi
+# Installation.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install libctf" >&5
+$as_echo_n "checking whether to install libctf... " >&6; }
+# Check whether --enable-install-libctf was given.
+if test "${enable_install_libctf+set}" = set; then :
+ enableval=$enable_install_libctf; install_libctf_p=$enableval
+else
+ install_libctf_p=yes
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $install_libctf_p" >&5
+$as_echo "$install_libctf_p" >&6; }
+ if test $install_libctf_p = yes; then
+ INSTALL_LIBCTF_TRUE=
+ INSTALL_LIBCTF_FALSE='#'
+else
+ INSTALL_LIBCTF_TRUE='#'
+ INSTALL_LIBCTF_FALSE=
+fi
+
+
ac_config_files="$ac_config_files Makefile"
ac_config_headers="$ac_config_headers config.h"
@@ -6645,6 +6670,10 @@ if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; th
as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${INSTALL_LIBCTF_TRUE}" && test -z "${INSTALL_LIBCTF_FALSE}"; then
+ as_fn_error $? "conditional \"INSTALL_LIBCTF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
diff --git a/libctf/configure.ac b/libctf/configure.ac
index 2a1a80b7ecb..ff8adc22a7d 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -149,6 +149,15 @@ if test $ac_cv_libctf_macro_O_CLOEXEC = yes; then
[Whether the platform has a definition of O_CLOEXEC.])
fi
+# Installation.
+AC_MSG_CHECKING([whether to install libctf])
+AC_ARG_ENABLE(install-libctf,
+[ --enable-install-libctf Install libctf headers and library for end users],
+ install_libctf_p=$enableval,
+ install_libctf_p=yes)
+AC_MSG_RESULT($install_libctf_p)
+AM_CONDITIONAL(INSTALL_LIBCTF, test $install_libctf_p = yes)
+
AC_CONFIG_FILES(Makefile)
AC_CONFIG_HEADERS(config.h)
AC_OUTPUT
--
2.23.0.239.g28aa4420fd
More information about the Binutils
mailing list