# 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
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
zic: $(ZICOBJS)
+ $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
install: zic
zic -d $(datadir)/timezone $(TZDATAFILES)
* 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 $
*
*-------------------------------------------------------------------------
*/
#include "tzfile.h"
-#ifdef WIN32
static char tzdir[MAXPGPATH];
static int done_tzdir = 0;
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)
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
#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