From cebcd93fa98cf3261548f3985d8356d06ac55873 Mon Sep 17 00:00:00 2001 From: paulc Date: Thu, 26 Feb 2015 09:53:31 +0000 Subject: [PATCH] Fixed build on systems where timezone is not an integer type variable. git-svn-id: http://voip.null.ro/svn/yate@5944 acf43c95-373e-0410-b603-e72c3f656dc1 --- configure.in | 14 ++++++++++++++ engine/Makefile.in | 2 +- engine/TelEngine.cpp | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index e13877c3..4a2ebf36 100644 --- a/configure.in +++ b/configure.in @@ -191,6 +191,20 @@ HAVE_GMTOFF="-DHAVE_GMTOFF" fi AC_SUBST(HAVE_GMTOFF) +HAVE_INT_TZ="" +AC_MSG_CHECKING([for integer timezone variable]) +have_tzint="no" +AC_TRY_COMPILE([ +#include +],[ +long tz = -timezone; +],have_tzint="yes") +AC_MSG_RESULT([$have_tzint]) +if [[ "$have_tzint" = "yes" ]]; then +HAVE_INT_TZ="-DHAVE_INT_TZ" +fi +AC_SUBST(HAVE_INT_TZ) + HAVE_POLL=no AC_ARG_ENABLE(poll,AC_HELP_STRING([--enable-poll],[Use poll() on sockets (default: yes)]),want_poll=$enableval,want_poll=yes) if [[ "x$want_poll" = "xyes" ]]; then diff --git a/engine/Makefile.in b/engine/Makefile.in index a0d8c979..e480414b 100644 --- a/engine/Makefile.in +++ b/engine/Makefile.in @@ -113,7 +113,7 @@ Thread.o: @srcdir@/Thread.cpp $(MKDEPS) $(CINC) $(COMPILE) @THREAD_KILL@ @HAVE_PRCTL@ -c $< TelEngine.o: @srcdir@/TelEngine.cpp $(MKDEPS) $(CINC) - $(COMPILE) @ATOMIC_OPS@ @HAVE_GMTOFF@ -c $< + $(COMPILE) @ATOMIC_OPS@ @HAVE_GMTOFF@ @HAVE_INT_TZ@ -c $< Client.o: @srcdir@/Client.cpp $(MKDEPS) $(CLINC) $(COMPILE) -c $< diff --git a/engine/TelEngine.cpp b/engine/TelEngine.cpp index e3c74d5b..1fa76df4 100644 --- a/engine/TelEngine.cpp +++ b/engine/TelEngine.cpp @@ -847,7 +847,11 @@ int Time::timeZone() if (localtime_r(&time,&t)) return t.tm_gmtoff; #endif +#ifdef HAVE_INT_TZ return -timezone; +#else + return 0; +#endif #endif }