Commit a640845c authored by Bruce Momjian's avatar Bruce Momjian

Allow timezone to compile under Unix by blocking 'timezone' conflict with

system headers.

Allow system to find timezone database by pasing pkglibdir into the
binary via a define.
parent e9a028f8
...@@ -4,14 +4,16 @@ ...@@ -4,14 +4,16 @@
# Makefile for the timezone library # Makefile for the timezone library
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.2 2004/04/30 04:31:52 momjian Exp $ # $PostgreSQL: pgsql/src/timezone/Makefile,v 1.3 2004/04/30 14:24:14 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
subdir = src/tz subdir = src/timezone
top_builddir = ../.. top_builddir = ../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
override CPPFLAGS += -DPKGLIBDIR=\"$(pkglibdir)\"
OBJS= asctime.o difftime.o localtime.o pgtz.o OBJS= asctime.o difftime.o localtime.o pgtz.o
ZICOBJS= zic.o ialloc.o scheck.o localtime.o asctime.o pgtz.o ZICOBJS= zic.o ialloc.o scheck.o localtime.o asctime.o pgtz.o
...@@ -25,6 +27,7 @@ SUBSYS.o: $(OBJS) ...@@ -25,6 +27,7 @@ SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
zic: $(ZICOBJS) zic: $(ZICOBJS)
$(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
install: zic install: zic
zic -d $(datadir)/timezone $(TZDATAFILES) zic -d $(datadir)/timezone $(TZDATAFILES)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.1 2004/04/30 04:09:23 momjian Exp $ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.2 2004/04/30 14:24:14 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "tzfile.h" #include "tzfile.h"
#ifdef WIN32
static char tzdir[MAXPGPATH]; static char tzdir[MAXPGPATH];
static int done_tzdir = 0; static int done_tzdir = 0;
char *pgwin32_TZDIR(void) { char *pgwin32_TZDIR(void) {
...@@ -23,8 +22,12 @@ char *pgwin32_TZDIR(void) { ...@@ -23,8 +22,12 @@ char *pgwin32_TZDIR(void) {
if (done_tzdir) if (done_tzdir)
return tzdir; return tzdir;
#ifndef WIN32
StrNCpy(tzdir,PKGLIBDIR, MAXPGPATH);
#else
if (GetModuleFileName(NULL,tzdir,MAXPGPATH) == 0) if (GetModuleFileName(NULL,tzdir,MAXPGPATH) == 0)
return NULL; return NULL;
#endif
canonicalize_path(tzdir); canonicalize_path(tzdir);
if ((p = last_path_separator(tzdir)) == NULL) if ((p = last_path_separator(tzdir)) == NULL)
...@@ -32,11 +35,8 @@ char *pgwin32_TZDIR(void) { ...@@ -32,11 +35,8 @@ char *pgwin32_TZDIR(void) {
else else
*p = '\0'; *p = '\0';
strcat(tzdir,"/../share/timezone"); strcat(tzdir,"/../timezone");
done_tzdir=1; done_tzdir=1;
return tzdir; return tzdir;
} }
#else
#error pgwin32_TZDIR not implemented on non win32 yet!
#endif
...@@ -88,7 +88,11 @@ static char privatehid[] = "@(#)private.h 7.53"; ...@@ -88,7 +88,11 @@ static char privatehid[] = "@(#)private.h 7.53";
#include "errno.h" #include "errno.h"
#include "string.h" #include "string.h"
#include "limits.h" /* for CHAR_BIT */ #include "limits.h" /* for CHAR_BIT */
#define _timezone timezone
#undef timezone
#include "time.h" #include "time.h"
#define timezone _timezone
#undef _timezone
#include "stdlib.h" #include "stdlib.h"
#if HAVE_GETTEXT - 0 #if HAVE_GETTEXT - 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment