public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: gcc-patches@gcc.gnu.org
Cc: Joseph Myers <joseph@codesourcery.com>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Subject: [PATCH v3] add support for --disable-gcov
Date: Mon, 11 Jun 2018 07:26:00 -0000	[thread overview]
Message-ID: <20180611072553.26334-1-rasmus.villemoes@prevas.dk> (raw)
In-Reply-To: <99e19880-9cd6-8895-5e26-21825a8f6021@prevas.dk>

For some targets (in my case VxWorks 5.5), libgcov does not compile due
to missing functions and macros such as getpid() and F_OK.

Incidentally, gcc/Makefile.in already contains comments such as

# Install gcov if it was compiled.

but there is no logic in place to actually allow gcov to not be
compiled.

So add an option for disabling build and install of libgcov and the
related host tools.

2018-06-10  Rasmus Villemoes  <rasmus.villemoes@prevas.dk>

gcc/
	* configure.ac: Add --disable-gcov option.
	* configure: Regenerate.
	* Makefile.in: Honour @enable_gcov@.
	* doc/install.texi: Document --disable-gcov.

libgcc/
	* configure.ac: Add --disable-gcov option.
	* configure: Regenerate.
	* Makefile.in: Honour @enable_gcov@.
---
 gcc/Makefile.in      | 6 ++++--
 gcc/configure.ac     | 5 +++++
 gcc/doc/install.texi | 4 ++++
 libgcc/Makefile.in   | 8 +++++++-
 libgcc/configure.ac  | 5 +++++
 5 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index d8f3e886118..1f38cacde7a 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -137,8 +137,10 @@ SUBDIRS =@subdirs@ build
 
 # Selection of languages to be made.
 CONFIG_LANGUAGES = @all_selected_languages@
-LANGUAGES = c gcov$(exeext) gcov-dump$(exeext) gcov-tool$(exeext) \
-            $(CONFIG_LANGUAGES)
+LANGUAGES = c $(CONFIG_LANGUAGES)
+ifeq (@enable_gcov@,yes)
+LANGUAGES += gcov$(exeext) gcov-dump$(exeext) gcov-tool$(exeext)
+endif
 
 # Default values for variables overridden in Makefile fragments.
 # CFLAGS is for the user to override to, e.g., do a cross build with -O2.
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 010ecd2ccf6..4fc851c644e 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -921,6 +921,11 @@ AC_ARG_ENABLE(shared,
 ], [enable_shared=yes])
 AC_SUBST(enable_shared)
 
+AC_ARG_ENABLE(gcov,
+[  --disable-gcov          don't provide libgcov and related host tools],
+[], [enable_gcov=yes])
+AC_SUBST(enable_gcov)
+
 AC_ARG_WITH(specs,
   [AS_HELP_STRING([--with-specs=SPECS],
                   [add SPECS to driver command-line processing])],
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 7c5cdc762d3..03eaeed4e87 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1044,6 +1044,10 @@ virtual calls in verifiable mode at all.  However the libvtv library will
 still be built (see @option{--disable-libvtv} to turn off building libvtv).
 @option{--disable-vtable-verify} is the default.
 
+@item --disable-gcov
+Specify that the run-time library used for coverage analysis
+and associated host tools should not be built.
+
 @item --disable-multilib
 Specify that multiple target
 libraries to support different target variants, calling
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index dd8cee99fd3..b7f20557214 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -36,6 +36,7 @@ SHELL = @SHELL@
 
 cpu_type = @cpu_type@
 enable_shared = @enable_shared@
+enable_gcov = @enable_gcov@
 double_type_size = @double_type_size@
 long_double_type_size = @long_double_type_size@
 decimal_float = @decimal_float@
@@ -941,7 +942,10 @@ libgcc.a libgcov.a libunwind.a libgcc_eh.a:
 
 	$(RANLIB) $@
 
-all: libgcc.a libgcov.a
+all: libgcc.a
+ifeq ($(enable_gcov),yes)
+all: libgcov.a
+endif
 
 ifneq ($(LIBUNWIND),)
 all: libunwind.a
@@ -1164,9 +1168,11 @@ install-leaf: $(install-shared) $(install-libunwind)
 	$(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
 	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
 	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
+ifeq ($(enable_libgcov),yes)
 	$(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
 	chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
 	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
+endif
 
 	parts="$(INSTALL_PARTS)";				\
 	for file in $$parts; do					\
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index b59aa746afc..9d0bbcaba86 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -68,6 +68,11 @@ AC_ARG_ENABLE(shared,
 ], [enable_shared=yes])
 AC_SUBST(enable_shared)
 
+AC_ARG_ENABLE(gcov,
+[  --disable-gcov          don't provide libgcov and related host tools],
+[], [enable_gcov=yes])
+AC_SUBST(enable_gcov)
+
 AC_ARG_ENABLE(vtable-verify,
 [  --enable-vtable-verify    Enable vtable verification feature ],
 [case "$enableval" in
-- 
2.16.4

  reply	other threads:[~2018-06-11  7:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25 13:06 [PATCH] libgcc: Add support for --disable-libgcov Rasmus Villemoes
2018-05-25 16:40 ` Joseph Myers
2018-05-25 21:35   ` [PATCH v2] " Rasmus Villemoes
2018-06-01 12:11     ` Rasmus Villemoes
2018-06-11  7:26       ` Rasmus Villemoes [this message]
2018-06-12 21:18         ` [PATCH v3] add support for --disable-gcov Jeff Law
2018-06-27 19:23           ` Rainer Orth
2018-06-27 21:01             ` Rasmus Villemoes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180611072553.26334-1-rasmus.villemoes@prevas.dk \
    --to=rasmus.villemoes@prevas.dk \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).