gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] compatibility patch


From: Paul Pogonyshev
Subject: Re: [gnugo-devel] compatibility patch
Date: Tue, 15 Jun 2004 18:24:21 +0300
User-agent: KMail/1.6.52

I wrote:
> Gunnar wrote:
> > Paul wrote:
> > > Maybe there's a way to make it depend on GCC version too?
> > 
> > I would guess that the proper solution is to make a configure test to
> > see whether the construction works, if someone's up to it.
> 
> I am.  I think I'll be able to post a patch later today.

Dan, can you check if this works?  I don't have Autoconf 2.52, but
I checked a similar construction with 2.57.

Paul


Index: configure.in
===================================================================
RCS file: /cvsroot/gnugo/gnugo/configure.in,v
retrieving revision 1.107
diff -u -p -r1.107 configure.in
--- configure.in        8 Jun 2004 13:27:10 -0000       1.107
+++ configure.in        15 Jun 2004 15:12:54 -0000
@@ -222,6 +222,30 @@ if test "$gnugo_cv_cpp_variadic_define" 
       AC_DEFINE(HAVE_VARIADIC_DEFINE)
 fi
 
+dnl ------ transparent unions ---------------------
+
+AH_TEMPLATE([HAVE_TRANSPARENT_UNIONS],
+[Define if your compiler supports transparent unions])
+
+AC_CACHE_CHECK(
+       [whether $CC supports transparent unions],
+       gnugo_cv_transparent_unions,
+       AC_TRY_COMPILE([],
+[[  struct {
+    union {
+      int x;
+      float y;
+    }
+  } A = { { .y = 0.0 } };
+  A.y = 1.0;]],
+               gnugo_cv_transparent_unions="yes",
+               gnugo_cv_transparent_unions="no")
+)
+
+if test "$gnugo_cv_transparent_unions" = "yes"; then
+       AC_DEFINE(HAVE_TRANSPARENT_UNIONS)
+fi
+
 dnl check for a working curses library for use in debugboard
 
 AH_TEMPLATE([CURSES],
Index: patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.135
diff -u -p -r1.135 mkpat.c
--- patterns/mkpat.c    8 Jun 2004 05:52:26 -0000       1.135
+++ patterns/mkpat.c    15 Jun 2004 15:13:02 -0000
@@ -2715,7 +2715,7 @@ write_attributes(FILE *outfile)
   int k;
 
   fprintf(outfile, "static struct pattern_attribute attributes[] = {\n");
-  fprintf(outfile, "#ifdef __GNUC__\n");
+  fprintf(outfile, "#ifdef HAVE_TRANSPARENT_UNIONS\n");
 
   for (k = 0; k < num_attributes; k++) {
     fprintf(outfile, "  {%s,", attribute_name[attributes[k].type]);
Index: patterns/patterns.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.h,v
retrieving revision 1.64
diff -u -p -r1.64 patterns.h
--- patterns/patterns.h 25 May 2004 03:14:06 -0000      1.64
+++ patterns/patterns.h 15 Jun 2004 15:13:02 -0000
@@ -203,7 +203,7 @@ enum attribute_type {
 };
 
 
-#ifdef __GNUC__
+#ifdef HAVE_TRANSPARENT_UNIONS
 
 struct pattern_attribute {
   enum attribute_type type;




reply via email to

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