Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> writes:
> >     /usr/include/time.h:104: `pg_timezone' redeclared as different kind of
> >     symbol
> 
> Your <time.h> really defines "pg_timezone"??  I'm wondering if this is
> an indirect effect of a macro naming collision.

I applied the following patch to allow it to compile on Unix.  I had to
mask the 'timezone' define before including "time.h".

I also pass pkglibdir into the timezone makefile like we do for fmgr so
it will know where to find the timezone database.  This is probably only
an interim solution.  We need a more general fix for lib/ anyway, and
this is basically the same problem (that the lib directory is compiled
into the binary and can't be moved).

With this change it compiles but I get this error:
        
        zic -d /usr/local/pgsql/share/timezone data/africa data/antarctica
        data/asia data/australasia data/europe data/northamerica
        data/southamerica data/pacificnew data/etcetera data/factory
        data/backward data/systemv data/solar87 data/solar88 data/solar89
        "data/solar87", line 385: too many local time types (rule from
        "data/solar87", line 45)

Magnus doesn't see it on Win32.  

To test, define PGTZ in pg_config.h and set PGTZ=yes in Makefile.global.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/timezone/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/timezone/Makefile,v
retrieving revision 1.2
diff -c -c -r1.2 Makefile
*** src/timezone/Makefile       30 Apr 2004 04:31:52 -0000      1.2
--- src/timezone/Makefile       30 Apr 2004 14:21:23 -0000
***************
*** 8,17 ****
  #
  #-------------------------------------------------------------------------
  
! subdir = src/tz
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  
  OBJS= asctime.o difftime.o localtime.o pgtz.o
  ZICOBJS= zic.o ialloc.o scheck.o localtime.o asctime.o pgtz.o
  
--- 8,19 ----
  #
  #-------------------------------------------------------------------------
  
! subdir = src/timezone
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  
+ override CPPFLAGS += -DPKGLIBDIR=\"$(pkglibdir)\"
+ 
  OBJS= asctime.o difftime.o localtime.o pgtz.o
  ZICOBJS= zic.o ialloc.o scheck.o localtime.o asctime.o pgtz.o
  
***************
*** 25,30 ****
--- 27,33 ----
        $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
  
  zic: $(ZICOBJS)
+       $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
  install: zic
        zic -d $(datadir)/timezone $(TZDATAFILES)
Index: src/timezone/pgtz.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/timezone/pgtz.c,v
retrieving revision 1.1
diff -c -c -r1.1 pgtz.c
*** src/timezone/pgtz.c 30 Apr 2004 04:09:23 -0000      1.1
--- src/timezone/pgtz.c 30 Apr 2004 14:21:23 -0000
***************
*** 15,21 ****
  #include "tzfile.h"
  
  
- #ifdef WIN32
  static char tzdir[MAXPGPATH];
  static int done_tzdir = 0;
  char *pgwin32_TZDIR(void) {
--- 15,20 ----
***************
*** 23,30 ****
--- 22,33 ----
        if (done_tzdir)
                return tzdir;
  
+ #ifndef WIN32
+       StrNCpy(tzdir,PKGLIBDIR, MAXPGPATH);
+ #else
        if (GetModuleFileName(NULL,tzdir,MAXPGPATH) == 0)
                return NULL;
+ #endif
        
        canonicalize_path(tzdir);
        if ((p = last_path_separator(tzdir)) == NULL)
***************
*** 32,42 ****
        else
                *p = '\0';
        
!       strcat(tzdir,"/../share/timezone");
  
        done_tzdir=1;
        return tzdir;
  }
- #else
- #error pgwin32_TZDIR not implemented on non win32 yet!
- #endif
--- 35,42 ----
        else
                *p = '\0';
        
!       strcat(tzdir,"/../timezone");
  
        done_tzdir=1;
        return tzdir;
  }
Index: src/timezone/private.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/timezone/private.h,v
retrieving revision 1.2
diff -c -c -r1.2 private.h
*** src/timezone/private.h      30 Apr 2004 04:44:06 -0000      1.2
--- src/timezone/private.h      30 Apr 2004 14:21:23 -0000
***************
*** 88,94 ****
--- 88,98 ----
  #include "errno.h"
  #include "string.h"
  #include "limits.h"   /* for CHAR_BIT */
+ #define _timezone timezone
+ #undef timezone
  #include "time.h"
+ #define timezone _timezone
+ #undef _timezone
  #include "stdlib.h"
  
  #if HAVE_GETTEXT - 0
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to