This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RFC src/configure* - "CFLAGS=-g -O" instead of "CFLAGS=... -Wall"


Ian Lance Taylor wrote:

> That was a policy I put in for the binutils.  It's OK with me to
> change it provided you simultaneously change the binutils
> subdirectories (binutils, bfd, libiberty, opcodes, binutils, gas, ld,
> gprof) to default to -Wall.

The attatched patch (minus Makefile.in, aclocal.m4 and configure
changes) adds:

Makefile.am:

	WARN_CFLAGS = @WARN_CFLAGS@
	AM_CFLAGS = $(WARN_CFLAGS)

configure.in:

	code to set @WARN_CFLAGS@ to ``-W -Wall'' when GCC or
	when configured with --enable-build-warnings=XXX just takes XXXX.

to the directories: bfd, binutils, gas, gprof, ld, opcodes.
I skipped libiberty as it already set things to -W -Wall -Wtraditional!

configure was re-generated using ``autoconf''.  Makefile.in was
re-generated using ``automake --cygnus Makefile''. Both were from the
auto*-000227 snapshots (I hope :-).

	ok?
		Andrew
Index: ChangeLog
Fri Apr  7 18:10:29 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* configure (warn_cflags): Delete.

Index: bfd/ChangeLog
Fri Apr  7 15:56:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
	* configure.in (WARN_CFLAGS): Set to -W -Wall by default.  Add
 	--enable-build-warnings option.
	* Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
	* Makefile.in, configure: Re-generate.

Index: bfd/doc/ChangeLog
Fri Apr  7 17:54:38 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* Makefile.in: Rebuild with current autoconf/automake.

Index: binutils/ChangeLog
Fri Apr  7 15:56:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
	* configure.in (WARN_CFLAGS): Set to -W -Wall by default.  Add
 	--enable-build-warnings option.
	* Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
	* Makefile.in, configure: Re-generate.

Index: gas/ChangeLog
Fri Apr  7 15:56:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
	* configure.in (WARN_CFLAGS): Set to -W -Wall by default.  Add
 	--enable-build-warnings option.
	* Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
	* Makefile.in, configure: Re-generate.

Index: gprof/ChangeLog
Fri Apr  7 15:56:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
	* configure.in (WARN_CFLAGS): Set to -W -Wall by default.  Add
 	--enable-build-warnings option.
	* Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
	* Makefile.in, configure, aclocal.m4: Re-generate.

Index: ld/ChangeLog
Fri Apr  7 15:56:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
	* configure.in (WARN_CFLAGS): Set to -W -Wall by default.  Add
 	--enable-build-warnings option.
	* Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
	* Makefile.in, configure: Re-generate.

Index: opcodes/ChangeLog
Fri Apr  7 15:56:57 2000  Andrew Cagney  <cagney@b1.cygnus.com>
 
	* configure.in (WARN_CFLAGS): Set to -W -Wall by default.  Add
 	--enable-build-warnings option.
	* Makefile.am (AM_CFLAGS, WARN_CFLAGS): Add definitions.
	* Makefile.in, configure: Re-generate.

Index: configure
===================================================================
RCS file: /cvs/src/src/configure,v
retrieving revision 1.5
diff -p -r1.5 configure
*** configure	2000/03/30 02:19:55	1.5
--- configure	2000/04/07 08:38:15
*************** do
*** 902,910 ****
    test -n "$DEFAULT_LEX" && break
  done
  
- # BINUTILS LOCAL: This is included in the default CFLAGS when using gcc.
- warn_cflags="-W -Wall"
- 
  if [ "${build}" != "${host}" ]; then
    # If we are doing a Canadian Cross, in which the host and build systems
    # are not the same, we set reasonable default values for the tools.
--- 902,907 ----
*************** t loop
*** 938,944 ****
    AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
    BISON=${BISON-bison}
    CC=${CC-${host_alias}-gcc}
!   CFLAGS=${CFLAGS-"-g -O2 ${warn_cflags}"}
    CXX=${CXX-${host_alias}-c++}
    CXXFLAGS=${CXXFLAGS-"-g -O2"}
    CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
--- 935,941 ----
    AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
    BISON=${BISON-bison}
    CC=${CC-${host_alias}-gcc}
!   CFLAGS=${CFLAGS-"-g -O2"}
    CXX=${CXX-${host_alias}-c++}
    CXXFLAGS=${CXXFLAGS-"-g -O2"}
    CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
*************** else
*** 1018,1027 ****
  	CC="gcc"
  	echo 'void f(){}' > conftest.c
  	if test -z "`${CC} -g -c conftest.c 2>&1`"; then
! 	  CFLAGS=${CFLAGS-"-g -O2 ${warn_cflags}"}
  	  CXXFLAGS=${CXXFLAGS-"-g -O2"}
  	else
! 	  CFLAGS=${CFLAGS-"-O2 ${warn_cflags}"}
  	  CXXFLAGS=${CXXFLAGS-"-O2"}
  	fi
  	rm -f conftest*
--- 1015,1024 ----
  	CC="gcc"
  	echo 'void f(){}' > conftest.c
  	if test -z "`${CC} -g -c conftest.c 2>&1`"; then
! 	  CFLAGS=${CFLAGS-"-g -O2"}
  	  CXXFLAGS=${CXXFLAGS-"-g -O2"}
  	else
! 	  CFLAGS=${CFLAGS-"-O2"}
  	  CXXFLAGS=${CXXFLAGS-"-O2"}
  	fi
  	rm -f conftest*
*************** else
*** 1038,1047 ****
        *gcc)
  	echo 'void f(){}' > conftest.c
  	if test -z "`${CC} -g -c conftest.c 2>&1`"; then
! 	  CFLAGS=${CFLAGS-"-g -O2 ${warn_cflags}"}
  	  CXXFLAGS=${CXXFLAGS-"-g -O2"}
  	else
! 	  CFLAGS=${CFLAGS-"-O2 ${warn_cflags}"}
  	  CXXFLAGS=${CXXFLAGS-"-O2"}
  	fi
  	rm -f conftest*
--- 1035,1044 ----
        *gcc)
  	echo 'void f(){}' > conftest.c
  	if test -z "`${CC} -g -c conftest.c 2>&1`"; then
! 	  CFLAGS=${CFLAGS-"-g -O2"}
  	  CXXFLAGS=${CXXFLAGS-"-g -O2"}
  	else
! 	  CFLAGS=${CFLAGS-"-O2"}
  	  CXXFLAGS=${CXXFLAGS-"-O2"}
  	fi
  	rm -f conftest*
Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.16
diff -p -r1.16 Makefile.am
*** Makefile.am	2000/04/04 10:53:53	1.16
--- Makefile.am	2000/04/07 08:38:35
*************** docdir = doc
*** 12,17 ****
--- 12,20 ----
  
  lib_LTLIBRARIES = libbfd.la
  
+ WARN_CFLAGS = @WARN_CFLAGS@
+ AM_CFLAGS = $(WARN_CFLAGS)
+ 
  # bfd.h goes here, for now
  BFD_H = bfd.h
  
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.16
diff -p -r1.16 configure.in
*** configure.in	2000/04/03 21:48:31	1.16
--- configure.in	2000/04/07 08:38:48
*************** AC_ARG_WITH(mmap,
*** 50,55 ****
--- 50,76 ----
    *)    AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;;
  esac],[want_mmap=false])dnl
  
+ build_warnings="-W -Wall"
+ AC_ARG_ENABLE(build-warnings,
+ [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
+ [case "${enableval}" in
+   yes)	;;
+   no)	build_warnings="-w";;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${build_warnings} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${t} ${build_warnings}";;
+   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+   echo "Setting warning flags = $build_warnings" 6>&1
+ fi])dnl
+ WARN_CFLAGS=""
+ if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
+     WARN_CFLAGS="${build_warnings}"
+ fi
+ AC_SUBST(WARN_CFLAGS)
+ 
  AM_CONFIG_HEADER(config.h:config.in)
  
  if test -z "$target" ; then
Index: binutils/Makefile.am
===================================================================
RCS file: /cvs/src/src/binutils/Makefile.am,v
retrieving revision 1.10
diff -p -r1.10 Makefile.am
*** Makefile.am	2000/04/07 04:34:50	1.10
--- Makefile.am	2000/04/07 08:39:16
*************** YACC = `if [ -f ../bison/bison ]; then e
*** 19,24 ****
--- 19,27 ----
  YFLAGS = -d
  LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
  
+ WARN_CFLAGS = @WARN_CFLAGS@
+ AM_CFLAGS = $(WARN_CFLAGS)
+ 
  # these two are almost the same program
  AR_PROG=ar
  RANLIB_PROG=ranlib
Index: binutils/configure.in
===================================================================
RCS file: /cvs/src/src/binutils/configure.in,v
retrieving revision 1.12
diff -p -r1.12 configure.in
*** configure.in	2000/02/26 00:59:51	1.12
--- configure.in	2000/04/07 08:39:27
*************** AC_ARG_ENABLE(commonbfdlib,
*** 25,30 ****
--- 25,51 ----
    *)   AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
  esac])dnl
  
+ build_warnings="-W -Wall"
+ AC_ARG_ENABLE(build-warnings,
+ [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
+ [case "${enableval}" in
+   yes)	;;
+   no)	build_warnings="-w";;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${build_warnings} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${t} ${build_warnings}";;
+   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+   echo "Setting warning flags = $build_warnings" 6>&1
+ fi])dnl
+ WARN_CFLAGS=""
+ if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
+     WARN_CFLAGS="${build_warnings}"
+ fi
+ AC_SUBST(WARN_CFLAGS)
+ 
  AM_CONFIG_HEADER(config.h:config.in)
  
  if test -z "$target" ; then
Index: gas/Makefile.am
===================================================================
RCS file: /cvs/src/src/gas/Makefile.am,v
retrieving revision 1.14
diff -p -r1.14 Makefile.am
*** Makefile.am	2000/04/04 10:53:54	1.14
--- Makefile.am	2000/04/07 08:39:48
*************** tooldir = $(exec_prefix)/$(target_alias)
*** 12,17 ****
--- 12,20 ----
  YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
  LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ;  else echo flex ; fi`
  
+ WARN_CFLAGS = @WARN_CFLAGS@
+ AM_CFLAGS = $(WARN_CFLAGS)
+ 
  MKDEP = gcc -MM
  
  TARG_CPU = @target_cpu_type@
Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.19
diff -p -r1.19 configure.in
*** configure.in	2000/03/27 08:39:13	1.19
--- configure.in	2000/04/07 08:40:03
*************** esac])dnl
*** 40,45 ****
--- 40,66 ----
  
  using_cgen=no
  
+ build_warnings="-W -Wall"
+ AC_ARG_ENABLE(build-warnings,
+ [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
+ [case "${enableval}" in
+   yes)	;;
+   no)	build_warnings="-w";;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${build_warnings} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${t} ${build_warnings}";;
+   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+   echo "Setting warning flags = $build_warnings" 6>&1
+ fi])dnl
+ WARN_CFLAGS=""
+ if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
+     WARN_CFLAGS="${build_warnings}"
+ fi
+ AC_SUBST(WARN_CFLAGS)
+ 
  # Generate a header file
  AM_CONFIG_HEADER(config.h:config.in)
  
Index: gprof/Makefile.am
===================================================================
RCS file: /cvs/src/src/gprof/Makefile.am,v
retrieving revision 1.3
diff -p -r1.3 Makefile.am
*** Makefile.am	2000/04/04 10:53:55	1.3
--- Makefile.am	2000/04/07 08:40:31
*************** BASEDIR = $(srcdir)/..
*** 10,15 ****
--- 10,18 ----
  BFDDIR = $(BASEDIR)/bfd
  INCDIR	= $(BASEDIR)/include
  
+ WARN_CFLAGS = @WARN_CFLAGS@
+ AM_CFLAGS = $(WARN_CFLAGS)
+ 
  MKDEP = gcc -MM
  
  INCLUDES = -D_GNU_SOURCE -DDEBUG -I../bfd -I$(srcdir)/../include -I$(srcdir)/../bfd -I$(srcdir)/../intl -I../intl -I. -DLOCALEDIR="\"$(prefix)/share/locale\""
Index: gprof/configure.in
===================================================================
RCS file: /cvs/src/src/gprof/configure.in,v
retrieving revision 1.2
diff -p -r1.2 configure.in
*** configure.in	1999/07/15 12:15:17	1.2
--- configure.in	2000/04/07 08:40:42
*************** CY_GNU_GETTEXT
*** 25,29 ****
--- 25,50 ----
  AM_MAINTAINER_MODE
  AC_EXEEXT
  
+ build_warnings="-W -Wall"
+ AC_ARG_ENABLE(build-warnings,
+ [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
+ [case "${enableval}" in
+   yes)	;;
+   no)	build_warnings="-w";;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${build_warnings} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${t} ${build_warnings}";;
+   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+   echo "Setting warning flags = $build_warnings" 6>&1
+ fi])dnl
+ WARN_CFLAGS=""
+ if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
+     WARN_CFLAGS="${build_warnings}"
+ fi
+ AC_SUBST(WARN_CFLAGS)
+ 
  AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
  [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])
Index: ld/Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.26
diff -p -r1.26 Makefile.am
*** Makefile.am	2000/04/04 10:53:56	1.26
--- Makefile.am	2000/04/07 08:41:15
*************** YACC = `if [ -f ../bison/bison ]; then e
*** 13,18 ****
--- 13,21 ----
  YFLAGS = -d
  LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
  
+ WARN_CFLAGS = @WARN_CFLAGS@
+ AM_CFLAGS = $(WARN_CFLAGS)
+ 
  # We put the scripts in the directory $(scriptdir)/ldscripts.
  # We can't put the scripts in $(datadir) because the SEARCH_DIR
  # directives need to be different for native and cross linkers.
Index: ld/configure.in
===================================================================
RCS file: /cvs/src/src/ld/configure.in,v
retrieving revision 1.8
diff -p -r1.8 configure.in
*** configure.in	1999/11/26 16:19:30	1.8
--- configure.in	2000/04/07 08:41:27
*************** AC_ARG_ENABLE(64-bit-bfd,
*** 25,30 ****
--- 25,51 ----
    *)    AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
  esac],[want64=false])dnl
  
+ build_warnings="-W -Wall"
+ AC_ARG_ENABLE(build-warnings,
+ [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
+ [case "${enableval}" in
+   yes)	;;
+   no)	build_warnings="-w";;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${build_warnings} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${t} ${build_warnings}";;
+   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+   echo "Setting warning flags = $build_warnings" 6>&1
+ fi])dnl
+ WARN_CFLAGS=""
+ if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
+     WARN_CFLAGS="${build_warnings}"
+ fi
+ AC_SUBST(WARN_CFLAGS)
+ 
  AM_CONFIG_HEADER(config.h:config.in)
  
  if test -z "$target" ; then
Index: opcodes/Makefile.am
===================================================================
RCS file: /cvs/src/src/opcodes/Makefile.am,v
retrieving revision 1.9
diff -p -r1.9 Makefile.am
*** Makefile.am	2000/04/04 10:53:56	1.9
--- Makefile.am	2000/04/07 08:41:45
*************** INCDIR = $(srcdir)/../include
*** 8,13 ****
--- 8,16 ----
  BFDDIR = $(srcdir)/../bfd
  MKDEP = gcc -MM
  
+ WARN_CFLAGS = @WARN_CFLAGS@
+ AM_CFLAGS = $(WARN_CFLAGS)
+ 
  lib_LTLIBRARIES = libopcodes.la
  
  # This is where bfd.h lives.
Index: opcodes/configure.in
===================================================================
RCS file: /cvs/src/src/opcodes/configure.in,v
retrieving revision 1.5
diff -p -r1.5 configure.in
*** configure.in	2000/03/27 08:39:14	1.5
--- configure.in	2000/04/07 08:41:54
*************** AC_ARG_ENABLE(commonbfdlib,
*** 43,48 ****
--- 43,69 ----
    *)   AC_MSG_ERROR([bad value ${enableval} for opcodes commonbfdlib option]) ;;
  esac])dnl
  
+ build_warnings="-W -Wall"
+ AC_ARG_ENABLE(build-warnings,
+ [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
+ [case "${enableval}" in
+   yes)	;;
+   no)	build_warnings="-w";;
+   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${build_warnings} ${t}";;
+   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
+         build_warnings="${t} ${build_warnings}";;
+   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+ esac
+ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
+   echo "Setting warning flags = $build_warnings" 6>&1
+ fi])dnl
+ WARN_CFLAGS=""
+ if test "x${build_warnings}" != x -a "x$GCC" = xyes ; then
+     WARN_CFLAGS="${build_warnings}"
+ fi
+ AC_SUBST(WARN_CFLAGS)
+ 
  AM_CONFIG_HEADER(config.h:config.in)
  
  if test -z "$target" ; then

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]