2014-07-04 07:36:40 +02:00
|
|
|
dnl Common configure.ac fragment
|
2012-12-17 17:56:12 +01:00
|
|
|
dnl
|
2015-01-01 15:15:26 +01:00
|
|
|
dnl Copyright (C) 2012-2015 Free Software Foundation, Inc.
|
2012-12-17 17:56:12 +01:00
|
|
|
dnl
|
|
|
|
dnl This file is free software; you can redistribute it and/or modify
|
|
|
|
dnl it under the terms of the GNU General Public License as published by
|
|
|
|
dnl the Free Software Foundation; either version 3 of the License, or
|
|
|
|
dnl (at your option) any later version.
|
|
|
|
dnl
|
|
|
|
dnl This program is distributed in the hope that it will be useful,
|
|
|
|
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
dnl GNU General Public License for more details.
|
|
|
|
dnl
|
|
|
|
dnl You should have received a copy of the GNU General Public License
|
|
|
|
dnl along with this program; see the file COPYING3. If not see
|
|
|
|
dnl <http://www.gnu.org/licenses/>.
|
|
|
|
dnl
|
2005-04-14 07:26:44 +02:00
|
|
|
|
|
|
|
AC_DEFUN([AM_BINUTILS_WARNINGS],[
|
Make it easy to make --disable-werror the default for both binutils and gdb
The goal of this patch is to provide an easy way to make
--disable-werror the default when building binutils, or the parts
of binutils that need to get built when building GDB. In development
mode, we want to continue making -Werror the default with GCC.
But, when making releases, I think we want to make it as easy as
possible for regular users to successfully build from sources.
GDB already has this kind of feature to turn -Werror as well as
the use of the libmcheck library. As GDB Release Manager, I take
advantage of it to turn those off after having cut the branch.
I'd like to be able to do the same for the binutils bits. And
perhaps Tristan will want to do the same for his releases too
(not sure, binutils builders might be a little savvier than GDB
builders).
This patch introduces a new file, called development.sh, which
just sets a variable called $development. In our development branches
(Eg. "master"), it's set to true. But setting it to false would allow
us to change the default behavior of various development-related
features to be turned off; in this case, it turns off the use of
-Werror by default (use --enable-werror to turn it back on).
bfd/ChangeLog:
* development.sh: New file.
* warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh.
Make -Werror the default with GCC only if DEVELOPMENT is true.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add
$(srcdir)/development.sh.
* Makefile.in, configure: Regenerate.
binutils/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gas/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gold/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
* Makefile.in, configure: Regenerate.
gprof/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
ld/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
opcodes/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gdb/ChangeLog:
* development.sh: Delete.
* Makefile.in (config.status): Adjust dependency on development.sh.
* configure.ac: Adjust development.sh source call.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
* configure.ac: Adjust development.sh source call.
* Makefile.in (config.status): Adjust dependency on development.sh.
* configure: Regenerate.
Tested on x86_64-linux by building two ways: One with DEVELOPMENT
set to true, and one with DEVELOPMENT set to false. In the first
case, I could see the use of -Werror, while it disappeared in
the second case.
2014-05-19 23:46:01 +02:00
|
|
|
# Set the 'development' global.
|
|
|
|
. $srcdir/../bfd/development.sh
|
|
|
|
|
2010-04-07 09:19:02 +02:00
|
|
|
GCC_WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes"
|
|
|
|
AC_EGREP_CPP([^[0-3]$],[__GNUC__],,GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wshadow")
|
2005-04-14 07:26:44 +02:00
|
|
|
|
|
|
|
AC_ARG_ENABLE(werror,
|
2006-04-19 04:06:15 +02:00
|
|
|
[ --enable-werror treat compile warnings as errors],
|
2005-04-14 07:26:44 +02:00
|
|
|
[case "${enableval}" in
|
|
|
|
yes | y) ERROR_ON_WARNING="yes" ;;
|
|
|
|
no | n) ERROR_ON_WARNING="no" ;;
|
|
|
|
*) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
|
|
|
|
esac])
|
|
|
|
|
2010-04-07 09:19:02 +02:00
|
|
|
# Disable -Wformat by default when using gcc on mingw
|
2008-02-04 20:43:51 +01:00
|
|
|
case "${host}" in
|
|
|
|
*-*-mingw32*)
|
|
|
|
if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
|
|
|
|
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Wno-format"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
Make it easy to make --disable-werror the default for both binutils and gdb
The goal of this patch is to provide an easy way to make
--disable-werror the default when building binutils, or the parts
of binutils that need to get built when building GDB. In development
mode, we want to continue making -Werror the default with GCC.
But, when making releases, I think we want to make it as easy as
possible for regular users to successfully build from sources.
GDB already has this kind of feature to turn -Werror as well as
the use of the libmcheck library. As GDB Release Manager, I take
advantage of it to turn those off after having cut the branch.
I'd like to be able to do the same for the binutils bits. And
perhaps Tristan will want to do the same for his releases too
(not sure, binutils builders might be a little savvier than GDB
builders).
This patch introduces a new file, called development.sh, which
just sets a variable called $development. In our development branches
(Eg. "master"), it's set to true. But setting it to false would allow
us to change the default behavior of various development-related
features to be turned off; in this case, it turns off the use of
-Werror by default (use --enable-werror to turn it back on).
bfd/ChangeLog:
* development.sh: New file.
* warning.m4 (AM_BINUTILS_WARNINGS): Source bfd/development.sh.
Make -Werror the default with GCC only if DEVELOPMENT is true.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add
$(srcdir)/development.sh.
* Makefile.in, configure: Regenerate.
binutils/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gas/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gold/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
* Makefile.in, configure: Regenerate.
gprof/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
ld/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
opcodes/ChangeLog:
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
gdb/ChangeLog:
* development.sh: Delete.
* Makefile.in (config.status): Adjust dependency on development.sh.
* configure.ac: Adjust development.sh source call.
* configure: Regenerate.
gdb/gdbserver/ChangeLog:
* configure.ac: Adjust development.sh source call.
* Makefile.in (config.status): Adjust dependency on development.sh.
* configure: Regenerate.
Tested on x86_64-linux by building two ways: One with DEVELOPMENT
set to true, and one with DEVELOPMENT set to false. In the first
case, I could see the use of -Werror, while it disappeared in
the second case.
2014-05-19 23:46:01 +02:00
|
|
|
# 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
|
2005-04-14 07:26:44 +02:00
|
|
|
ERROR_ON_WARNING=yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
NO_WERROR=
|
|
|
|
if test "${ERROR_ON_WARNING}" = yes ; then
|
2005-11-07 23:14:12 +01:00
|
|
|
GCC_WARN_CFLAGS="$GCC_WARN_CFLAGS -Werror"
|
2005-04-14 07:26:44 +02:00
|
|
|
NO_WERROR="-Wno-error"
|
|
|
|
fi
|
|
|
|
|
2005-11-07 23:14:12 +01:00
|
|
|
if test "${GCC}" = yes ; then
|
|
|
|
WARN_CFLAGS="${GCC_WARN_CFLAGS}"
|
|
|
|
fi
|
|
|
|
|
2005-04-14 07:26:44 +02:00
|
|
|
AC_ARG_ENABLE(build-warnings,
|
2006-04-19 04:06:15 +02:00
|
|
|
[ --enable-build-warnings enable build-time compiler warnings],
|
2005-04-14 07:26:44 +02:00
|
|
|
[case "${enableval}" in
|
2005-11-07 23:14:12 +01:00
|
|
|
yes) WARN_CFLAGS="${GCC_WARN_CFLAGS}";;
|
|
|
|
no) if test "${GCC}" = yes ; then
|
|
|
|
WARN_CFLAGS="-w"
|
|
|
|
fi;;
|
2005-04-14 07:26:44 +02:00
|
|
|
,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
2005-11-07 23:14:12 +01:00
|
|
|
WARN_CFLAGS="${GCC_WARN_CFLAGS} ${t}";;
|
2005-04-14 07:26:44 +02:00
|
|
|
*,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
|
2005-11-07 23:14:12 +01:00
|
|
|
WARN_CFLAGS="${t} ${GCC_WARN_CFLAGS}";;
|
2005-04-14 07:26:44 +02:00
|
|
|
*) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;;
|
|
|
|
esac])
|
|
|
|
|
|
|
|
if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then
|
|
|
|
echo "Setting warning flags = $WARN_CFLAGS" 6>&1
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(WARN_CFLAGS)
|
|
|
|
AC_SUBST(NO_WERROR)
|
|
|
|
])
|