From: Kees Monshouwer Date: Thu, 10 Jul 2014 17:23:04 +0000 (+0200) Subject: detect presense of tm_gmtoff in tm structure and add conditional build logic in yahttp X-Git-Tag: auth-3.4.0-rc1~87^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1528%2Fhead;p=thirdparty%2Fpdns.git detect presense of tm_gmtoff in tm structure and add conditional build logic in yahttp --- 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; }; //