From 96ae9a2e92309221fe02febb5964596df7a56525 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Thu, 10 Jul 2014 19:23:04 +0200 Subject: [PATCH] detect presense of tm_gmtoff in tm structure and add conditional build logic in yahttp --- configure.ac | 2 ++ m4/tm-gmtoff.m4 | 13 +++++++++++++ pdns/ext/yahttp/yahttp/utility.hpp | 6 ++++++ pdns/ext/yahttp/yahttp/yahttp-config.h | 3 +-- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 m4/tm-gmtoff.m4 diff --git a/configure.ac b/configure.ac index ad8da5e136..64db4a28c4 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,8 @@ AC_PROG_LIBTOOL([disable-static]) LT_INIT([disable-static]) ]) +MC_TM_GMTOFF + AM_CONDITIONAL([RELEASE_BUILD], [test "$PACKAGE_VERSION" != "git"]) # Define full_libdir to be the fully expanded (${exec_prefix}, etc.) diff --git a/m4/tm-gmtoff.m4 b/m4/tm-gmtoff.m4 new file mode 100644 index 0000000000..71742aff9a --- /dev/null +++ b/m4/tm-gmtoff.m4 @@ -0,0 +1,13 @@ +dnl Check for the tm_gmtoff field in struct tm +dnl (Borrowed from the Gaim project) + +AC_DEFUN([MC_TM_GMTOFF], +[AC_REQUIRE([AC_STRUCT_TM])dnl +AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, +[AC_TRY_COMPILE([#include +#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;], + ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)]) +if test "$ac_cv_struct_tm_gmtoff" = yes; then + AC_DEFINE(HAVE_TM_GMTOFF, 1, [tm_gmtoff is available.]) +fi +]) diff --git a/pdns/ext/yahttp/yahttp/utility.hpp b/pdns/ext/yahttp/yahttp/utility.hpp index 08b2c6f453..e2d8c62e5a 100644 --- a/pdns/ext/yahttp/yahttp/utility.hpp +++ b/pdns/ext/yahttp/yahttp/utility.hpp @@ -72,7 +72,11 @@ namespace YaHTTP { minutes = tm->tm_min; seconds = tm->tm_sec; wday = tm->tm_wday; +#ifdef HAVE_TM_GMTOFF utc_offset = tm->tm_gmtoff; +#else + utc_offset = 0; +#endif isSet = true; }; //