gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] deprecated use of $CFLAGS in `configure.in'


From: Paul Pogonyshev
Subject: Re: [gnugo-devel] deprecated use of $CFLAGS in `configure.in'
Date: Tue, 11 Jan 2005 21:57:02 +0200
User-agent: KMail/1.4.3

I wrote:
> GNU Go `configure.in' adds GCC warning options directly to
> $CFLAGS.  This usage is bad, because it means a command like
>
>       make CFLAGS='...'
>
> (for instance, to compile without optimizations for easier
> debugging) will throw out all the `-W...' options.  If no one
> objects, I'll fix this.

Here it is, together with GCC warning flag requested by Arend.
I also removed `--enable-profile' option as I wrote.  I
successfully used Automake 1.6 and Autoconf 2.59 here, but I
think it's still better if Dan updates the files.

Paul


Index: configure.in
===================================================================
RCS file: /cvsroot/gnugo/gnugo/configure.in,v
retrieving revision 1.116
diff -u -p -r1.116 configure.in
--- configure.in        16 Dec 2004 19:17:00 -0000      1.116
+++ configure.in        11 Jan 2005 19:45:33 -0000
@@ -127,9 +127,6 @@ AC_ARG_ENABLE(socket-support,
  [  --disable-socket-support           don't compile GTP over TCP/IP support
   --enable-socket-support            compile TCP/IP support (default)])
 
-AC_ARG_ENABLE(profile,
- [  --enable-profile                   compile gnugo with gprof option ])
-
 AC_PROG_CC
 
 dnl for automake 1.4.x
@@ -553,30 +550,34 @@ dnl  ----------- special-case use of gcc
 
 dnl Not sure if we are supposed to be accessing this variable, but...
 
-AC_SUBST(GCC_ONLY)
-AC_SUBST(GNUGO_SOME_WARNINGS)
-AC_SUBST(GNUGO_ALL_WARNINGS)
-AC_SUBST(NO_WARNINGS)
-
-NO_WARNINGS="CFLAGS=$CFLAGS"
-if test $ac_cv_c_compiler_gnu = yes; then
-  GCC_ONLY=''
-  GGO_SOME_WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual 
-Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations -Wundef'
-  GNUGO_SOME_WARNINGS="CFLAGS=$CFLAGS $GGO_SOME_WARNINGS"
-  CFLAGS="$CFLAGS $GGO_SOME_WARNINGS"
-  if test "$enable_profile" = "yes" ; then
-     CFLAGS="-pg $CFLAGS"
+AM_CONDITIONAL(GCC_ONLY, test "$ac_compiler_gnu" = "yes")
+
+dnl Now lines in Makefile.am can be prefixed @address@hidden
+
+AC_SUBST(GCC_MAJOR_VERSION)
+AC_SUBST(GCC_MINOR_VERSION)
+AC_SUBST(GNU_GO_WARNINGS)
+
+if test "$ac_compiler_gnu" = "yes"; then
+
+  dnl M4 escaping of brackets
+  [GCC_VERSION=`$CC --version | sed 
'1!D;s/^[^0-9]*\([0-9]\+\.[0-9]\+\).*$/\1/'`
+   GCC_MAJOR_VERSION=`echo $GCC_VERSION | sed 's/^\([0-9]\+\).*$/\1/'`
+   GCC_MINOR_VERSION=`echo $GCC_VERSION | sed 's/^[0-9]\+\.\(.*\)$/\1/'`]
+
+  GNU_GO_WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual 
-Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations -Wundef'
+
+  if test $GCC_MAJOR_VERSION -ge 3 && test $GCC_MINOR_VERSION -ge 4; then
+    GNU_GO_WARNINGS="$GNU_GO_WARNINGS -Wdeclaration-after-statement"
   fi
+
 else
-  GCC_ONLY='#'
-  GNUGO_SOME_WARNINGS=''
+  GCC_MAJOR_VERSION=0
+  GCC_MINOR_VERSION=0
+  GNU_GO_WARNINGS=''
 fi
 
-
-dnl Now lines in Makefile.am can be prefixed @GCC_ONLY@, and
-dnl we can specify either @GNUGO_SOME_WARNINGS@
-
-dnl FIXME: please add warnings for other compilers !
+dnl FIXME: please add warnings for other compilers!
 
 
 AH_TEMPLATE([ENABLE_SOCKET_SUPPORT],
Index: utils/Makefile.am
===================================================================
RCS file: /cvsroot/gnugo/gnugo/utils/Makefile.am,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.am
--- utils/Makefile.am   6 Jan 2005 13:09:40 -0000       1.4
+++ utils/Makefile.am   11 Jan 2005 19:45:33 -0000
@@ -8,5 +8,3 @@ noinst_HEADERS = gg-getopt.h random.h gg
 
 # Remove these files here... they are created locally
 DISTCLEANFILES = *~
-
address@hidden@
Index: sgf/Makefile.am
===================================================================
RCS file: /cvsroot/gnugo/gnugo/sgf/Makefile.am,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile.am
--- sgf/Makefile.am     31 Mar 2002 20:46:47 -0000      1.6
+++ sgf/Makefile.am     11 Jan 2005 19:45:33 -0000
@@ -11,8 +11,7 @@ noinst_HEADERS = \
 # Remove these files here... they are created locally
 DISTCLEANFILES = *~
 
-INCLUDES =\
-       -I$(top_srcdir)/utils
+AM_CPPFLAGS = $(GNU_GO_WARNINGS) -I$(top_srcdir)/utils
 
 noinst_LIBRARIES = libsgf.a
 
Index: patterns/Makefile.am
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/Makefile.am,v
retrieving revision 1.29
diff -u -p -r1.29 Makefile.am
--- patterns/Makefile.am        6 Jan 2005 13:09:40 -0000       1.29
+++ patterns/Makefile.am        11 Jan 2005 19:45:33 -0000
@@ -51,7 +51,7 @@ transpat_SOURCES = transpat.c patlib.c t
 transpat_LDADD = 
 joseki_SOURCES = joseki.c 
 joseki_LDADD = ../engine/libboard.a ../sgf/libsgf.a ../utils/libutils.a 
-joseki_INCLUDES = -I$(top_srcdir)/sgf
+joseki_AM_CPPFLAGS = $(GNU_GO_WARNINGS) -I$(top_srcdir)/sgf
 mkeyes_SOURCES = mkeyes.c
 mkeyes_LDADD = ../utils/libutils.a
 extract_fuseki_SOURCES  = extract_fuseki.c
@@ -59,7 +59,7 @@ extract_fuseki_SOURCES  = extract_fuseki
 extract_fuseki_LDADD = ../engine/libengine.a libpatterns.a\
                       ../engine/libengine.a libpatterns.a\
                        ../sgf/libsgf.a ../utils/libutils.a
-extract_fuseki_INCLUDES = -I$(top_srcdir)/sgf
+extract_fuseki_AM_CPPFLAGS = $(GNU_GO_WARNINGS) -I$(top_srcdir)/sgf
 
 
 noinst_HEADERS = patterns.h eyes.h patlib.h dfa.h dfa-mkpat.h
@@ -90,7 +90,11 @@ dist-hook:
        cd $(distdir) && rm $(GGBUILTSOURCES)
 
 # source files in this directory get access to private prototypes
-INCLUDES = -I$(top_srcdir)/engine -I$(top_srcdir)/utils -I$(top_srcdir)/sgf
+AM_CPPFLAGS = \
+       $(GNU_GO_WARNINGS) \
+       -I$(top_srcdir)/engine \
+       -I$(top_srcdir)/utils \
+       -I$(top_srcdir)/sgf
 
 noinst_LIBRARIES = libpatterns.a
 
Index: interface/Makefile.am
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/Makefile.am,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile.am
--- interface/Makefile.am       4 Dec 2004 17:26:44 -0000       1.10
+++ interface/Makefile.am       11 Jan 2005 19:45:33 -0000
@@ -10,7 +10,8 @@ noinst_HEADERS = interface.h gmp.h gtp.h
 # Remove these files here... they are created locally
 DISTCLEANFILES = *~
 
-INCLUDES = \
+AM_CPPFLAGS = \
+       $(GNU_GO_WARNINGS) \
        -I$(top_srcdir)/sgf \
        -I$(top_srcdir)/engine \
        -I$(top_srcdir)/utils
Index: engine/Makefile.am
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/Makefile.am,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile.am
--- engine/Makefile.am  15 May 2004 18:13:41 -0000      1.22
+++ engine/Makefile.am  11 Jan 2005 19:45:33 -0000
@@ -3,7 +3,8 @@ EXTRA_DIST = engine.dsp board.dsp
 # Remove these files here... they are created locally
 DISTCLEANFILES = *~
 
-INCLUDES = \
+AM_CPPFLAGS = \
+       $(GNU_GO_WARNINGS) \
        -I../patterns \
        -I$(top_srcdir)/patterns \
        -I$(top_srcdir)/sgf \





reply via email to

[Prev in Thread] Current Thread [Next in Thread]