gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] autoconf stuff


From: Arend Bayer
Subject: [gnugo-devel] autoconf stuff
Date: Fri, 1 Aug 2003 18:54:36 +0200 (CEST)

I still claim that I know close to nothing about auto*, but even myself
was able to figure out that a bunch of the stuff produced by
configure was not getting used. I removed everything from configure.in
where I
a) understood what output it produces, and
b) was able to verify beyond reasonable doubt that this was not getting used.
There is probably more.

As a bonus, I added -Wundef to the gcc flags and fixed a bug found by
that. Also, I replaced setlinebuf with setvbuf according to the man
pages as had been suggested a while ago by Dave (setvbuf is ANSI,
whereas setlinebuf is no).

There is some stuff only used by debugboard, and a couple of places
trying to search for curses libraries that look redundant.

Now every macro defined in config.h gets used. The top offender in the
other direction is "#define ORACLE", which gets used 70 times in the
code.

Arend

- remove unneeded configure stuff, add -Wundef to SOME_WARNINGS
- replace setlinebuf by setvbuf

Index: configure.in
===================================================================
RCS file: /cvsroot/gnugo/gnugo/configure.in,v
retrieving revision 1.91
diff -u -p -r1.91 configure.in
--- configure.in        30 Jul 2003 17:00:05 -0000      1.91
+++ configure.in        1 Aug 2003 16:51:23 -0000
@@ -121,9 +121,6 @@ AC_ARG_ENABLE(experimental-hashing,
 AC_ARG_ENABLE(profile,
  [  --enable-profile                   compile gnugo with gprof option ])

-dnl expand any instances of @matcher@ in Makefile
-AC_SUBST(dfa_c)
-
 AC_PROG_CC

 dnl for automake 1.4.x
@@ -149,7 +146,6 @@ if test $ac_cv_mingw32 = yes;then
 fi

 AC_PROG_CPP
-AC_PROG_GCC_TRADITIONAL
 AC_PROG_RANLIB

 dnl required since we use SUBDIRS in Makefile.am
@@ -179,15 +175,11 @@ else
    term_header="no"
 fi

-AC_PATH_PROG(perl, perl)
-
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long,,[#include <stdio.h>])

-dnl results of setlinebuf test used in interface/play_ascii.c
 dnl vsnprintf not universally available
 dnl usleep not available in Unicos and mingw32
-AC_CHECK_FUNCS(setlinebuf vsnprintf gettimeofday usleep times)
+AC_CHECK_FUNCS(vsnprintf gettimeofday usleep times)

 dnl if snprintf not available try to use g_snprintf from glib
 if test $ac_cv_func_vsnprintf = no; then
@@ -210,22 +202,6 @@ if test $ac_cv_func_vsnprintf = no; then
     fi
 fi

-dnl AM_FUNC_ERROR_AT_LINE
-
-AH_TEMPLATE([HAVE___FUNCTION__],
-[Define if the preprocessor recognizes __FUNCTION__])
-
-AC_CACHE_CHECK(
-       [for __FUNCTION__],
-       gnugo_cv_c___function__,
-       AC_TRY_COMPILE(,
-               [char *s=__FUNCTION__],
-               gnugo_cv_c___function__="yes",
-               gnugo_cv_c___function__="no")
-)
-if test "$gnugo_cv_c___function__" = "yes";then
-      AC_DEFINE(HAVE___FUNCTION__)
-fi
 dnl ------ variadic #define -----------------------

 AH_TEMPLATE([HAVE_VARIADIC_DEFINE],
@@ -537,15 +513,11 @@ AC_SUBST(GNUGO_SOME_WARNINGS)
 AC_SUBST(GNUGO_ALL_WARNINGS)
 AC_SUBST(NO_WARNINGS)

-dnl Please add -Wp,-lang-c89 to SOME_WARNINGS soon
-
 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'
-  GGO_ALL_WARNINGS='-Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast 
-Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -Wmissing-declarations -Wp,-lang-c89'
+  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"
-  GNUGO_ALL_WARNINGS="CFLAGS=$CFLAGS $GGO_ALL_WARNINGS"
   CFLAGS="$CFLAGS $GGO_SOME_WARNINGS"
   if test "$enable_profile" = "yes" ; then
      CFLAGS="-pg $CFLAGS"
@@ -553,11 +525,10 @@ if test $ac_cv_c_compiler_gnu = yes; the
 else
   GCC_ONLY='#'
   GNUGO_SOME_WARNINGS=''
-  GNUGO_ALL_WARNINGS=''
 fi

 dnl Now lines in Makefile.am can be prefixed @GCC_ONLY@, and
-dnl we can specify either @GNUGO_SOME_WARNINGS@ or @GNUGO_ALL_WARNINGS@
+dnl we can specify either @GNUGO_SOME_WARNINGS@

 dnl FIXME: please add warnings for other compilers !

Index: engine/cache.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/cache.h,v
retrieving revision 1.30
diff -u -p -r1.30 cache.h
--- engine/cache.h      18 Jul 2003 18:59:21 -0000      1.30
+++ engine/cache.h      1 Aug 2003 16:51:24 -0000
@@ -32,9 +32,6 @@
 #ifndef _CACHE_H_
 #define _CACHE_H_

-/* Dump (almost) all read results. */
-#define TRACE_READ_RESULTS 0
-
 /*
  * This struct contains the attack / defense point and the result.
  * It is kept in a linked list, and each position has a list of
Index: engine/hash.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/hash.h,v
retrieving revision 1.12
diff -u -p -r1.12 hash.h
--- engine/hash.h       18 Jul 2003 18:59:21 -0000      1.12
+++ engine/hash.h       1 Aug 2003 16:51:24 -0000
@@ -29,6 +29,8 @@
  * (Reading/Hashing) for more information.
  */

+/* Dump (almost) all read results. */
+#define TRACE_READ_RESULTS 0

 #ifndef _HASH_H_
 #define _HASH_H_
@@ -149,7 +151,6 @@ void hashdata_invert_stone(Hash_data *hd
 void hashdata_set_tomove(Hash_data *hd, int to_move);

 int hashdata_diff_dump(Hash_data *key1, Hash_data *key2);
-

 #endif

Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.188
diff -u -p -r1.188 liberty.h
--- engine/liberty.h    18 Jul 2003 18:59:21 -0000      1.188
+++ engine/liberty.h    1 Aug 2003 16:51:26 -0000
@@ -1126,7 +1126,7 @@ int is_false_eye(struct half_eye_data he
  */
 void abortgo(const char *file, int line, const char *msg, int pos);

-#if GG_TURN_OFF_ASSERTS
+#ifdef GG_TURN_OFF_ASSERTS
 #define ASSERT2(x, i, j)
 #define ASSERT1(x, pos)
 #else
Index: interface/play_ascii.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_ascii.c,v
retrieving revision 1.41
diff -u -p -r1.41 play_ascii.c
--- interface/play_ascii.c      18 Jul 2003 18:59:21 -0000      1.41
+++ interface/play_ascii.c      1 Aug 2003 16:51:28 -0000
@@ -579,11 +579,7 @@ play_ascii(SGFTree *tree, Gameinfo *game
   char *tmpstring;
   int state = 1;

-#ifdef HAVE_SETLINEBUF
-  setlinebuf(stdout); /* Need at least line buffer gnugo-gnugo */
-#else
-  setbuf(stdout, NULL); /* else set it to completely UNBUFFERED */
-#endif
+  setvbuf(stdout, (char *)NULL, _IOLBF, 0); /* Set line buffering. */

   sgftree = *tree;

Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.125
diff -u -p -r1.125 play_gtp.c
--- interface/play_gtp.c        21 Jul 2003 17:12:58 -0000      1.125
+++ interface/play_gtp.c        1 Aug 2003 16:51:30 -0000
@@ -317,12 +317,8 @@ static struct gtp_command commands[] = {
 void
 play_gtp(FILE *gtp_input, int gtp_initial_orientation)
 {
-  /* Try to make sure that we have a useful level of buffering of stdout. */
-#ifdef HAVE_SETLINEBUF
-  setlinebuf(stdout);
-#else
-  setbuf(stdout, NULL);
-#endif
+  /* Set line buffering of stdout. */
+  setvbuf(stdout, (char *)NULL, _IOLBF, 0);

   /* Inform the GTP utility functions about the board size. */
   gtp_internal_set_boardsize(board_size);





reply via email to

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