Skip to content

Commit

Permalink
more on enabling use of internal tzcode
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@64529 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Dec 25, 2013
1 parent e826f10 commit 4a60053
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 9 deletions.
2 changes: 1 addition & 1 deletion configure
Expand Up @@ -34539,7 +34539,7 @@ _ACEOF

if test ${use_internal_tzcode} = yes; then

$as_echo "#define USE_INTERNAL_MKTME 1" >>confdefs.h
$as_echo "#define USE_INTERNAL_MKTIME 1" >>confdefs.h

fi
if test "x${use_internal_tzcode}" = xyes; then
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -2274,7 +2274,7 @@ fi
AC_DEFINE_UNQUOTED(VALGRIND_LEVEL, ${valgrind_level}, [Define as 1 or 2 to specify levels of Valgrind instrumentation])

if test ${use_internal_tzcode} = yes; then
AC_DEFINE(USE_INTERNAL_MKTME, 1, [Define to use internal time-zone code])
AC_DEFINE(USE_INTERNAL_MKITME, 1, [Define to use internal time-zone code])
fi
AM_CONDITIONAL(BUILD_TZONE, [test "x${use_internal_tzcode}" = xyes])

Expand Down
11 changes: 9 additions & 2 deletions doc/NEWS.Rd
Expand Up @@ -169,8 +169,15 @@
are not installed: but recommended packages remain needed for
thorough checking of an \R build.

\item (Windows only.) The version of \samp{tzcode} included in
\file{src/extra/tzone} has been updated.
\item The version of \samp{tzcode} included in
\file{src/extra/tzone} has been updated. (Formerly used only on
Windows.)

\item There is experimental support to use the shipped Olson
time-zone database and (64-bit) time-zone conversion code: use
\command{configure} option \option{--with-internal-tzcode}. (It
might be necessary to set environment variable \env{TZ} on OSes
where this is not already set.)
}
}

Expand Down
5 changes: 4 additions & 1 deletion share/Makefile.in
Expand Up @@ -45,7 +45,7 @@ installdirs:
@$(MKINSTALLDIRS) "$(DESTDIR)$(rsharedir)/texmf/tex/latex"
install-message:
@$(ECHO) "installing share ..."
install-sources: installdirs
install-sources: installdirs @BUILD_TZONE_TRUE@ install-zoneinfo
@for f in $(srcdir)/R/*.R; do \
$(INSTALL_DATA) $${f} "$(DESTDIR)$(rsharedir)/R"; \
done
Expand Down Expand Up @@ -78,6 +78,9 @@ install-sources: installdirs
done
install-strip: install

install-zoneinfo:
@@R_UNZIPCMD@ -qo $(top_srcdir)/src/extra/tzone/zoneinfo.zip -d "$(DESTDIR)$(rsharedir)"

uninstall:
@$(ECHO) "uninstalling share ..."
@rm -rf "$(DESTDIR)$(rsharedir)"
Expand Down
7 changes: 6 additions & 1 deletion src/extra/Makefile.in
Expand Up @@ -23,8 +23,10 @@ LIBZ =@BUILD_ZLIB_TRUE@ make.zlib
LIBXDR =@BUILD_XDR_TRUE@ make.xdr
LIBINTL =@BUILD_LIBINTL_TRUE@ make.intl
LIBTRE = make.tre
LIBTZONE = @BUILD_TZONE_TRUE@make.tzone
LIBXZ =@BUILD_XZ_TRUE@ make.xz
EXTRAS = $(RBLAS) $(LIBBZ2) $(LIBPCRE) $(LIBZ) $(LIBXDR) $(LIBINTL) $(LIBTRE) $(LIBXZ)
EXTRAS = $(RBLAS) $(LIBBZ2) $(LIBPCRE) $(LIBZ) $(LIBXDR) $(LIBINTL) \
$(LIBTRE) $(LIBTZONE) $(LIBXZ)

all: Makefile R

Expand Down Expand Up @@ -58,6 +60,9 @@ make.xz: Makefile
make.intl: Makefile
@(cd intl; $(MAKE))

make.tzone: Makefile
@(cd tzone; $(MAKE))


mostlyclean: clean
clean:
Expand Down
1 change: 1 addition & 0 deletions src/extra/tzone/localtime.c
Expand Up @@ -53,6 +53,7 @@ use of 64-bit time_t irrespective of platform.
#define localtime R_localtime
#define mktime R_mktime
#define tzset R_tzset
#define tzsetwall R_tzsetwall
#include <stdint.h>
typedef int64_t R_time_t;
#define time_t R_time_t
Expand Down
6 changes: 6 additions & 0 deletions src/gnuwin32/fixed/h/config.h
Expand Up @@ -835,6 +835,9 @@
/* Define if you have the 'wint_t' type. (For intl) */
#define HAVE_WINT_T 1

/* Define if your mktime works correctly outside 1902-2037. */
#define HAVE_WORKING_64BIT_MKTIME 1

/* Define to 1 if you have cairo. */
/* #undef HAVE_WORKING_CAIRO */

Expand Down Expand Up @@ -1031,6 +1034,9 @@
/* Define to use Apple's ICU. */
/* #undef USE_ICU_APPLE */

/* Define to use internal time-zone code */
#define USE_INTERNAL_MKTME 1

/* Define if the POSIX multithreading library can be used. (For intl) */
/* #undef USE_POSIX_THREADS */

Expand Down
4 changes: 3 additions & 1 deletion src/main/Makefile.in
Expand Up @@ -88,11 +88,13 @@ R_TRE = ../extra/tre/libtre.a
R_XDR = @BUILD_XDR_TRUE@ ../extra/xdr/libxdr.a
R_XZ = @BUILD_XZ_TRUE@ ../extra/xz/liblzma.a
R_LIBINTL = @BUILD_LIBINTL_TRUE@ ../extra/intl/libintl.a
R_TZONE = @BUILD_TZONE_TRUE@ ../extra/tzone/localtime.o

MAIN_LIBS = ../unix/libunix.a ../appl/libappl.a ../nmath/libnmath.a
MAIN_OBJS = `ls ../unix/*.o ../appl/*.o ../nmath/*.o`
EXTRA_STATIC_LIBS = \
$(R_ZLIBS) $(R_BZLIBS) $(R_PCRE) $(R_TRE) $(R_XDR) $(R_XZ) $(R_LIBINTL)
$(R_ZLIBS) $(R_BZLIBS) $(R_PCRE) $(R_TRE) $(R_XDR) $(R_XZ) $(R_LIBINTL) \
$(R_TZONE)
STATIC_LIBS = $(MAIN_LIBS) $(EXTRA_STATIC_LIBS)

EXTRA_LIBS = $(BLAS_LIBS) $(FLIBS) $(R_XTRA_LIBS) @LIBINTL@ $(READLINE_LIBS) $(LIBS)
Expand Down
4 changes: 2 additions & 2 deletions src/main/datetime.c
Expand Up @@ -97,12 +97,12 @@
#include <errno.h>

#ifdef Win32
# define USE_INTERNAL_MKTME 1
# define USE_INTERNAL_MKTIME 1
#endif

# include <time.h>

#ifdef USE_INTERNAL_MKTME
#ifdef USE_INTERNAL_MKTIME

# include <stdint.h>
typedef int64_t R_time_t;
Expand Down
16 changes: 16 additions & 0 deletions src/main/util.c
Expand Up @@ -942,7 +942,23 @@ SEXP attribute_hidden do_normalizepath(SEXP call, SEXP op, SEXP args, SEXP rho)
UNPROTECT(1);
return ans;
}

#ifdef USE_INTERNAL_MKTIME
const char *getTZinfo(void)
{
const char *p = getenv("TZ");
if(p) return p;
#ifdef HAVE_REALPATH
static char abspath[PATH_MAX+1] = "";
if(!abspath[0] && realpath("/etc/localtime", abspath))
return abspath + 20; // strip /usr/share/zoneinfo/
#endif
warning("system timezone name is unknown: set environment variable TZ");
return "unknown";
}
#endif

#endif // not Win32


/* encodeString(x, w, quote, justify) */
Expand Down

0 comments on commit 4a60053

Please sign in to comment.