Hello,

uname -a:
Darwin fulcrum.local 8.3.0 Darwin Kernel Version 8.3.0: Mon Oct 3 20:04:04 PDT 2005; root:xnu-792.6.22.obj~2/RELEASE_PPC Power Macintosh powerpc

gcc --version:
powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. build 5026)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configuration options:
  --prefix=/Library/PostgreSQL \
  --localstatedir=/var/db/pgsql \
  --build=powerpc-apple-darwin8 \
  --host=powerpc-apple-darwin8 \
  --target=powerpc-apple-darwin8 \
  --disable-debug \
  --with-openssl \
  --with-bonjour \
  --with-java \
  --enable-thread-safety

Trying to build 8.1RC1 on the above configuration fails because it seems to have defined bool, but still doesn't seem to know what bool is. This causes it to fail the thread safety test during configuration and then bomb out during build with errors like these:

/Users/idart/src/postgresql-8.1RC1/build/src/../../src/interfaces/ecpg/include/ecpglib.h:84: warning: data definition has no type or storage class /Users/idart/src/postgresql-8.1RC1/build/src/../../src/interfaces/ecpg/include/ecpglib.h:85: error: parse error before 'ECPGdescribe' /Users/idart/src/postgresql-8.1RC1/build/src/../../src/interfaces/ecpg/include/ecpglib.h:85: error: parse error before 'bool' /Users/idart/src/postgresql-8.1RC1/build/src/../../src/interfaces/ecpg/include/ecpglib.h:85: warning: type defaults to 'int' in declaration of 'ECPGdescribe' /Users/idart/src/postgresql-8.1RC1/build/src/../../src/interfaces/ecpg/include/ecpglib.h:85: warning: data definition has no type or storage class
make[4]: *** [informix.o] Error 1
make[3]: *** [all] Error 2
make[2]: *** [all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

The attached patches simply makes sure bool, true and false always gets defined on OS X. This fixes the problems, but I'm afraid it might be a bit naive as the patches don't consider OS X version, GCC version, or any other factors that migth impact the build. Not to mention that it might break things if the patched headers were included in a C++ program.

I see that the build farm contains "tuna" with 10.4.2 and GCC 4.0, and apparently it builds just fine on that configuration (albeit without thread safety). If there are other solutions to this, I would appreciate it if someone could point me in the right direction.


- IT
--- src/include/c.h.orig        2005-10-15 04:49:41.000000000 +0200
+++ src/include/c.h     2005-11-02 10:44:07.000000000 +0100
@@ -178,15 +178,19 @@
 
 #ifndef __cplusplus
 
-#ifndef bool
+#if defined(__APPLE__) && defined(__MACH__)
+#define MACOSX
+#endif
+
+#if !defined(bool) || defined(MACOSX)
 typedef char bool;
 #endif
 
-#ifndef true
+#if !defined(true) || defined(MACOSX)
 #define true   ((bool) 1)
 #endif
 
-#ifndef false
+#if !defined(false) || defined(MACOSX)
 #define false  ((bool) 0)
 #endif
 #endif   /* not C++ */
--- src/interfaces/ecpg/include/ecpglib.h.orig  2005-11-02 11:01:05.000000000 
+0100
+++ src/interfaces/ecpg/include/ecpglib.h       2005-11-02 12:01:50.000000000 
+0100
@@ -9,19 +9,27 @@
 #include "libpq-fe.h"
 #include "ecpgtype.h"
 #include <string.h>
-
 #ifndef __BEOS__
+#ifndef C_H
 #ifndef __cplusplus
-#ifndef bool
-#define bool char
+
+#if defined(__APPLE__) && defined(__MACH__)
+#define MACOSX
+#endif
+
+#if !defined(bool) || defined(MACOSX)
+typedef char bool;
 #endif   /* ndef bool */
 
-#ifndef true
+#if !defined(true) || defined(MACOSX)
 #define true   ((bool) 1)
 #endif   /* ndef true */
-#ifndef false
+
+#if !defined(false) || defined(MACOSX)
 #define false  ((bool) 0)
 #endif   /* ndef false */
+
+#endif   /* C_H */
 #endif   /* not C++ */
 #else                                                  /* __BEOS__ */
 #include <SupportDefs.h>
--- src/interfaces/ecpg/pgtypeslib/extern.h.orig        2005-11-02 
11:01:37.000000000 +0100
+++ src/interfaces/ecpg/pgtypeslib/extern.h     2005-11-02 12:03:14.000000000 
+0100
@@ -37,10 +37,18 @@
 char      *pgtypes_alloc(long);
 char      *pgtypes_strdup(char *);
 
-#ifndef bool
+#ifndef C_H
+
+#if defined(__APPLE__) && defined(__MACH__)
+#define MACOSX
+#endif
+
+#if !defined(bool) || defined(MACOSX)
 #define bool char
 #endif   /* ndef bool */
 
+#endif   /* ndef C_H */
+
 #ifndef FALSE
 #define FALSE  0
 #endif   /* FALSE */
--- src/tools/thread/thread_test.c.orig 2005-11-02 10:44:30.000000000 +0100
+++ src/tools/thread/thread_test.c      2005-11-02 10:40:44.000000000 +0100
@@ -24,15 +24,19 @@
 #include "postgres.h"
 #else
 /* From src/include/c.h" */
-#ifndef bool
+#if defined(__APPLE__) && defined(__MACH__)
+#define MACOSX
+#endif
+
+#if !defined(bool) || defined(MACOSX)
 typedef char bool;
 #endif
 
-#ifndef true
+#if !defined(true) || defined(MACOSX)
 #define true   ((bool) 1)
 #endif
 
-#ifndef false
+#if !defined(false) || defined(MACOSX)
 #define false  ((bool) 0)
 #endif
 #endif
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to