]> granicus.if.org Git - pdns/commitdiff
detect presense of tm_gmtoff in tm structure and add conditional build logic in yahttp
authorKees Monshouwer <mind04@monshouwer.org>
Thu, 10 Jul 2014 17:23:04 +0000 (19:23 +0200)
committermind04 <mind04@monshouwer.org>
Thu, 10 Jul 2014 17:23:04 +0000 (19:23 +0200)
configure.ac
m4/tm-gmtoff.m4 [new file with mode: 0644]
pdns/ext/yahttp/yahttp/utility.hpp
pdns/ext/yahttp/yahttp/yahttp-config.h

index ad8da5e136988ae66f2267ca95fceacf7c0a43ad..64db4a28c4fd1422fbe524dbf4e1631e0fd2c350 100644 (file)
@@ -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 (file)
index 0000000..71742af
--- /dev/null
@@ -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 <sys/types.h>
+#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
+])
index 08b2c6f45313294154998932e9d2a968902c5f81..e2d8c62e5af7cf8b74826c4f3c5ebab93c8f5c85 100644 (file)
@@ -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;
      }; //<! parses date from struct tm 
 
@@ -138,7 +142,9 @@ namespace YaHTTP {
        tm.tm_hour = hours;
        tm.tm_min = minutes;
        tm.tm_sec = seconds;
+#ifdef HAVE_TM_GMTOFF
        tm.tm_gmtoff = utc_offset;
+#endif
        return mktime(&tm);
      }; //<! returns this datetime as unixtime. will not work for dates before 1970/1/1 00:00:00 GMT
   };
index 8241f201f1bce402ab87792f4ca3a32ef4e05ef8..0e84fa0e8f121caee15bb1ba7cb6042142ae12e4 100644 (file)
@@ -1,2 +1 @@
-/* config header for embedded libyahttp */
-#define HAVE_BOOST 1
+#include "../../../../config.h"