diff mbox

[RFA,v2] Make it easy to make --disable-werror the default for both binutils and gdb

Message ID 1401811030-22706-1-git-send-email-brobecker@adacore.com
State New
Headers show

Commit Message

Joel Brobecker June 3, 2014, 3:57 p.m. UTC
Hello,

This is V2 of the patch series. Hopefully, I incorporated all comments
made so far. The changes compared to the previous version are:

  . Use "-a" instead of "&&" in the test expression; (H-P)
  . Fix the little thinko in one of bfd's ChangeLog (H-P)
  . Replace comment for "developement = " in development.sh
    to be completely neutral, just explaining the general
    intent of that variable (H-P and Alan)
  . Transition the gdb and gdbserver to using bfd's development.sh
    instead of keeping a separate one (Tom)
  . Adjusted various Makefiles to register the dependency on
    this file, so that a change there triggers a rebuild
    with the expected options (Joel).

Note that gold/Makefile.am had no CONFIG_STATUS_DEPENDENCIES,
so I added it, but only added developement.sh. It would be
surprised if there weren't any other dependencies to be added
there, but that should be done independently of this patch,
so not done here.

The patch was again tested various different ways, with
developement both true and false, using both fresh builds
as well as rebuilds after modifying development.sh.

OK to push?

Thanks!

Comments

Alan Modra June 4, 2014, 12:43 a.m. UTC | #1
On Tue, Jun 03, 2014 at 08:57:10AM -0700, Joel Brobecker wrote:
> OK to push?

Looks OK to me.
Maciej W. Rozycki June 4, 2014, 12:43 p.m. UTC | #2
On Tue, 3 Jun 2014, Joel Brobecker wrote:

> This is V2 of the patch series. Hopefully, I incorporated all comments
> made so far. The changes compared to the previous version are:
> 
>   . Use "-a" instead of "&&" in the test expression; (H-P)

 I think Hans-Peter's suggestion was the other way round, its "&&" that is 
portable while "-a" is likely not to work with non-GNU `test' or with 
plain Bourne shells (where it is a builtin).  This is what the autoconf 
manual has to say about it in its portability section:

`test'
     The `test' program is the way to perform many file and string
     tests.  It is often invoked by the alternate name `[', but using
     that name in Autoconf code is asking for trouble since it is an M4
     quote character.

     The `-a', `-o', `(', and `)' operands are not portable and should
     be avoided.  Thus, portable uses of `test' should never have more
     than four arguments, and scripts should use shell constructs like
     `&&' and `||' instead.  If you combine `&&' and `||' in the same
     statement, keep in mind that they have equal precedence, so it is
     often better to parenthesize even when this is redundant.  For
     example:

          # Not portable:
          test "X$a" = "X$b" -a \
            '(' "X$c" != "X$d" -o "X$e" = "X$f" ')'

          # Portable:
          test "X$a" = "X$b" &&
            { test "X$c" != "X$d" || test "X$e" = "X$f"; }

  Maciej
Joel Brobecker June 4, 2014, 12:55 p.m. UTC | #3
> >   . Use "-a" instead of "&&" in the test expression; (H-P)
> 
>  I think Hans-Peter's suggestion was the other way round, its "&&" that is 
> portable while "-a" is likely not to work with non-GNU `test' or with 
> plain Bourne shells (where it is a builtin).  This is what the autoconf 
> manual has to say about it in its portability section:

Hmmm, I see. Thanks for theh clarification.

I propose the following: Keep the patch I propose as is for now, as it
does not make things worse, and also keep things consistent. And then
follow that up with a patch which switches the operators, all of them,
to using &&.
Maciej W. Rozycki June 4, 2014, 5:42 p.m. UTC | #4
On Wed, 4 Jun 2014, Joel Brobecker wrote:

> >  I think Hans-Peter's suggestion was the other way round, its "&&" that is 
> > portable while "-a" is likely not to work with non-GNU `test' or with 
> > plain Bourne shells (where it is a builtin).  This is what the autoconf 
> > manual has to say about it in its portability section:
> 
> Hmmm, I see. Thanks for theh clarification.
> 
> I propose the following: Keep the patch I propose as is for now, as it
> does not make things worse, and also keep things consistent. And then
> follow that up with a patch which switches the operators, all of them,
> to using &&.

 Well, if that's a preexisting problem (I wasn't aware of that), then 
sure, I have no objections.

  Maciej
Tom Tromey June 4, 2014, 9 p.m. UTC | #5
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> This is V2 of the patch series. Hopefully, I incorporated all comments
Joel> made so far. The changes compared to the previous version are:

Thanks Joel.
FWIW the gdb changes looked fine to me.

Tom
Joel Brobecker June 5, 2014, 12:55 p.m. UTC | #6
Thanks, Alan and Tom.

I just pushed the patch to master.

Regarding the "-a" vs "&&", I am happy making the change, if you would
like me to. It seems from the text quoted by Maciej that "&&" might
be more portable, but since we've been using "-a" without issue (to
my knowledge) I am tempted to wait until a portability issue actually
shows up. The workaround in case of problem is fairly easy - use
another shell like bash, for instance.
diff mbox

Patch

diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 2ba2180..595c489 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -741,7 +741,8 @@  OPTIONAL_BACKENDS_CFILES = \
 CONFIG_STATUS_DEPENDENCIES = \
 	$(srcdir)/configure.in \
 	$(srcdir)/config.bfd \
-	$(srcdir)/configure.host
+	$(srcdir)/configure.host \
+	$(srcdir)/development.sh
 
 # These are defined by configure.in:
 WORDSIZE = @wordsize@
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 8a2764d..2ea8516 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1045,7 +1045,8 @@  OPTIONAL_BACKENDS_CFILES = \
 CONFIG_STATUS_DEPENDENCIES = \
 	$(srcdir)/configure.in \
 	$(srcdir)/config.bfd \
-	$(srcdir)/configure.host
+	$(srcdir)/configure.host \
+	$(srcdir)/development.sh
 
 
 # These are defined by configure.in:
diff --git a/bfd/configure b/bfd/configure
index b4f8653..f3df01c 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -12158,6 +12158,9 @@  fi
 
 
 
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -12192,8 +12195,8 @@  case "${host}" in
   *) ;;
 esac
 
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/bfd/development.sh b/bfd/development.sh
new file mode 100644
index 0000000..4c0f5b9
--- /dev/null
+++ b/bfd/development.sh
@@ -0,0 +1,19 @@ 
+# Copyright (C) 2012-2014 Free Software Foundation, Inc.
+#
+# This file is part of GDB.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Controls whether to enable development-mode features by default.
+development=true
diff --git a/bfd/warning.m4 b/bfd/warning.m4
index 28e9f8a..b1a8c7b 100644
--- a/bfd/warning.m4
+++ b/bfd/warning.m4
@@ -18,6 +18,9 @@  dnl <http://www.gnu.org/licenses/>.
 dnl
 
 AC_DEFUN([AM_BINUTILS_WARNINGS],[
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
 AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
 
@@ -39,8 +42,8 @@  case "${host}" in
   *) ;;
 esac
 
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 77c99d7..aca2610 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -514,7 +514,8 @@  all: info
 
 # We extract version from bfd/configure.in, make sure to rerun configure
 # when BFD's version changes.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+	$(BFDDIR)/development.sh
 
 DISTCLEANFILES = sysroff.c sysroff.h site.exp site.bak embedspu
 
diff --git a/binutils/Makefile.in b/binutils/Makefile.in
index 52489f2..c9e9e38 100644
--- a/binutils/Makefile.in
+++ b/binutils/Makefile.in
@@ -616,7 +616,9 @@  EXTRA_DIST = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
 
 # We extract version from bfd/configure.in, make sure to rerun configure
 # when BFD's version changes.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+	$(BFDDIR)/development.sh
+
 DISTCLEANFILES = sysroff.c sysroff.h site.exp site.bak embedspu
 MOSTLYCLEANFILES = sysinfo$(EXEEXT_FOR_BUILD) bin2c$(EXEEXT_FOR_BUILD) \
   binutils.log binutils.sum abcdefgh*
diff --git a/binutils/configure b/binutils/configure
index fcf9784..1272e53 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -11592,6 +11592,9 @@  _ACEOF
 
 
 
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -11626,8 +11629,8 @@  case "${host}" in
   *) ;;
 esac
 
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/gas/Makefile.am b/gas/Makefile.am
index 01731b9..669ab19 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -693,4 +693,6 @@  de-stage3:
 	- (cd stage3 ; rm -f as$(EXEEXT) ; mv -f * ..)
 	- rmdir stage3
 
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in $(srcdir)/configure.tgt
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+	$(srcdir)/configure.tgt \
+	$(BFDDIR)/development.sh
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 184a926..2ca56df 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -677,7 +677,10 @@  MOSTLYCLEANFILES = $(STAGESTUFF) core \
 	testsuite/site.exp site.bak site.exp stage stage1 stage2
 
 against = stage2
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in $(srcdir)/configure.tgt
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+	$(srcdir)/configure.tgt \
+	$(BFDDIR)/development.sh
+
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
diff --git a/gas/configure b/gas/configure
index 2530377..1e1086f 100755
--- a/gas/configure
+++ b/gas/configure
@@ -11575,6 +11575,9 @@  fi
 using_cgen=no
 
 
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -11609,8 +11612,8 @@  case "${host}" in
   *) ;;
 esac
 
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index c189ea3..f4c7a7f 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1474,7 +1474,7 @@  stamp-h: $(srcdir)/config.in config.status
 	  CONFIG_LINKS= \
 	  $(SHELL) config.status
 
-config.status: $(srcdir)/configure configure.tgt configure.host development.sh
+config.status: $(srcdir)/configure configure.tgt configure.host ../bfd/development.sh
 	$(SHELL) config.status --recheck
 
 ACLOCAL = aclocal
diff --git a/gdb/configure b/gdb/configure
index 56c92d3..05ebace 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -2714,7 +2714,7 @@  fi
 
 
 # Set the 'development' global.
-. $srcdir/development.sh
+. $srcdir/../bfd/development.sh
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 903f378..138fc85 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -24,7 +24,7 @@  AC_CONFIG_HEADER(config.h:config.in)
 AM_MAINTAINER_MODE
 
 # Set the 'development' global.
-. $srcdir/development.sh
+. $srcdir/../bfd/development.sh
 
 AC_PROG_CC
 AC_USE_SYSTEM_EXTENSIONS
diff --git a/gdb/development.sh b/gdb/development.sh
deleted file mode 100644
index 1c21efa..0000000
--- a/gdb/development.sh
+++ /dev/null
@@ -1,21 +0,0 @@ 
-# Copyright (C) 2012-2014 Free Software Foundation, Inc.
-#
-# This file is part of GDB.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Set to 'true' for development snapshots, 'false' for releases and
-# pre-releases.  When true, provide more thorough testing with
-# -lmcheck.
-development=true
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index f773fa2..b795b38 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -390,7 +390,7 @@  $(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../gnulib/Makefile.in config.status
 	  CONFIG_LINKS= \
 	  $(SHELL) config.status
 
-config.status: configure configure.srv $(srcdir)/../development.sh
+config.status: configure configure.srv $(srcdir)/../../bfd/development.sh
 	$(SHELL) ./config.status --recheck
 
 # automatic rebuilding in automake-generated Makefiles requires
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 101062f..62adc71 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -4324,7 +4324,7 @@  fi
 
 
 # Set the 'development' global.
-. $srcdir/../development.sh
+. $srcdir/../../bfd/development.sh
 
 # Enable -lmcheck by default (it provides cheap-enough memory
 # mangling), but turn it off for releases.
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 89a8eea..5a10ee7 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -41,7 +41,7 @@  AC_HEADER_STDC
 AC_FUNC_ALLOCA
 
 # Set the 'development' global.
-. $srcdir/../development.sh
+. $srcdir/../../bfd/development.sh
 
 # Enable -lmcheck by default (it provides cheap-enough memory
 # mangling), but turn it off for releases.
diff --git a/gold/Makefile.am b/gold/Makefile.am
index 78f0271..54393f9 100644
--- a/gold/Makefile.am
+++ b/gold/Makefile.am
@@ -197,6 +197,8 @@  dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADSLIB) \
 	$(LIBDL)
 dwp_LDFLAGS = $(GOLD_LDFLAGS)
 
+CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
+
 # Use an explicit dependency for the bison generated header file.
 expression.$(OBJEXT): yyscript.h
 script-sections.$(OBJEXT): yyscript.h
diff --git a/gold/Makefile.in b/gold/Makefile.in
index 1ef3cce..579505a 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -564,6 +564,7 @@  dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADSLIB) \
 	$(LIBDL)
 
 dwp_LDFLAGS = $(GOLD_LDFLAGS)
+CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
 POTFILES = $(CCFILES) $(HFILES) $(TARGETSOURCES)
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ld1_SOURCES = $(sources_var)
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
diff --git a/gold/configure b/gold/configure
index f61307b..6f53b22 100755
--- a/gold/configure
+++ b/gold/configure
@@ -6630,6 +6630,9 @@  fi
 
 
 
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -6664,8 +6667,8 @@  case "${host}" in
   *) ;;
 esac
 
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/gprof/Makefile.am b/gprof/Makefile.am
index 1db6951..2daefac 100644
--- a/gprof/Makefile.am
+++ b/gprof/Makefile.am
@@ -60,7 +60,8 @@  diststuff: $(BUILT_SOURCES) info $(man_MANS)
 
 # We extract version from bfd/configure.in, make sure to rerun configure
 # when BFD's version changes.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+	$(BFDDIR)/development.sh
 
 # This empty rule is a hack against gmake patched by Apple.
 %.o:%.m
diff --git a/gprof/Makefile.in b/gprof/Makefile.in
index 3af41e8..1706ba7 100644
--- a/gprof/Makefile.in
+++ b/gprof/Makefile.in
@@ -325,7 +325,9 @@  EXTRA_DIST = $(BUILT_SOURCES) bbconv.pl $(man_MANS)
 
 # We extract version from bfd/configure.in, make sure to rerun configure
 # when BFD's version changes.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+	$(BFDDIR)/development.sh
+
 POTFILES = $(sources) $(noinst_HEADERS)
 MANCONF = -Dman
 TEXI2POD = perl $(srcdir)/../etc/texi2pod.pl $(AM_MAKEINFOFLAGS)
diff --git a/gprof/configure b/gprof/configure
index 5a9c81e..3d6b415 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -12004,6 +12004,9 @@  fi
 
 
 
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -12038,8 +12041,8 @@  case "${host}" in
   *) ;;
 esac
 
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
     ERROR_ON_WARNING=yes
 fi
 
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 24ba3e1..44e7ca6 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -2057,7 +2057,8 @@  MAINTAINERCLEANFILES = configdoc.texi ld.1
 # We want to reconfigure if configure.host or configure.tgt changes.  We
 # extract version from bfd/configure.in, so we must depend on that also.
 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
-	$(srcdir)/../bfd/configure.in
+	$(srcdir)/../bfd/configure.in \
+	$(srcdir)/../bfd/development.sh
 
 MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
 	ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 9dd4399..2582cea 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -888,7 +888,8 @@  MAINTAINERCLEANFILES = configdoc.texi ld.1 ld.info
 # We want to reconfigure if configure.host or configure.tgt changes.  We
 # extract version from bfd/configure.in, so we must depend on that also.
 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
-	$(srcdir)/../bfd/configure.in
+	$(srcdir)/../bfd/configure.in \
+	$(srcdir)/../bfd/development.sh
 
 MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
 	ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
diff --git a/ld/configure b/ld/configure
index b6c3246..6dd7bc6 100755
--- a/ld/configure
+++ b/ld/configure
@@ -4642,6 +4642,9 @@  $as_echo "$ac_cv_path_EGREP" >&6; }
 
 
 
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -4676,8 +4679,8 @@  case "${host}" in
   *) ;;
 esac
 
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
     ERROR_ON_WARNING=yes
 fi
 
@@ -12193,7 +12196,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12196 "configure"
+#line 12199 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12299,7 +12302,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12302 "configure"
+#line 12305 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index de98c28..9ff6a38 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -296,7 +296,8 @@  OFILES = @BFD_MACHINES@
 
 # We should reconfigure whenever bfd/configure.in changes, because
 # that's where the version number in Makefile comes from.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+	$(BFDDIR)/development.sh
 
 AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
 
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index 5995f1c..f83f1d9 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -569,7 +569,9 @@  OFILES = @BFD_MACHINES@
 
 # We should reconfigure whenever bfd/configure.in changes, because
 # that's where the version number in Makefile comes from.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
+CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in \
+	$(BFDDIR)/development.sh
+
 AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
 libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c
 # It's desirable to list ../bfd/libbfd.la in DEPENDENCIES and LIBADD.
diff --git a/opcodes/configure b/opcodes/configure
index 9379bbf..40a2b85 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -11504,6 +11504,9 @@  esac
 fi
 
 
+# Set the 'development' global.
+. $srcdir/../bfd/development.sh
+
 GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -11538,8 +11541,8 @@  case "${host}" in
   *) ;;
 esac
 
-# Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+# Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" -a "$development" = true ; then
     ERROR_ON_WARNING=yes
 fi