summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2004-04-30 14:24:14 +0000
committerBruce Momjian2004-04-30 14:24:14 +0000
commita640845c881fe2ee0798187825a24cbb90c44f19 (patch)
treeb88d105ec2b7ea00a9f4259ec657909f278bd520
parente9a028f81f10a63b340696fc34c4dac9849a8f43 (diff)
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.
-rw-r--r--src/timezone/Makefile7
-rw-r--r--src/timezone/pgtz.c12
-rw-r--r--src/timezone/private.h4
3 files changed, 15 insertions, 8 deletions
diff --git a/src/timezone/Makefile b/src/timezone/Makefile
index b94bb663f24..ac5926c79c7 100644
--- a/src/timezone/Makefile
+++ b/src/timezone/Makefile
@@ -4,14 +4,16 @@
# Makefile for the timezone library
# 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 = ../..
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,6 +27,7 @@ SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
zic: $(ZICOBJS)
+ $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
install: zic
zic -d $(datadir)/timezone $(TZDATAFILES)
diff --git a/src/timezone/pgtz.c b/src/timezone/pgtz.c
index 7bb789340b9..8e94fc8c6c5 100644
--- a/src/timezone/pgtz.c
+++ b/src/timezone/pgtz.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
* 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 @@
#include "tzfile.h"
-#ifdef WIN32
static char tzdir[MAXPGPATH];
static int done_tzdir = 0;
char *pgwin32_TZDIR(void) {
@@ -23,8 +22,12 @@ char *pgwin32_TZDIR(void) {
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,11 +35,8 @@ char *pgwin32_TZDIR(void) {
else
*p = '\0';
- strcat(tzdir,"/../share/timezone");
+ strcat(tzdir,"/../timezone");
done_tzdir=1;
return tzdir;
}
-#else
-#error pgwin32_TZDIR not implemented on non win32 yet!
-#endif
diff --git a/src/timezone/private.h b/src/timezone/private.h
index c8f45486837..4c94b2d21e5 100644
--- a/src/timezone/private.h
+++ b/src/timezone/private.h
@@ -88,7 +88,11 @@ static char privatehid[] = "@(#)private.h 7.53";
#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