Allow building on platforms without `struct tm.tm_gmtoff`, `timezone`, `daylight`
I'm not happy about this because the results are non-intuitive, but that
looks like something which originates in libyang's attempts to use local
TZ everywhere instead of normalizing to UTC time.
But hey, this only matters on a platform which cannot "easily" represent
timezones in `struct tm`, or for which we cannot determine the TZ/DST
status without going the extra mile of writing non-POSIX stuff. So as
long as we mark the returned value with "I cannot really vouch for the
TZ", this *might* even be standard-compliant.
diff --git a/CMakeModules/UseCompat.cmake b/CMakeModules/UseCompat.cmake
index 7d7a338..a3be828 100644
--- a/CMakeModules/UseCompat.cmake
+++ b/CMakeModules/UseCompat.cmake
@@ -47,6 +47,10 @@
check_include_file("stdatomic.h" HAVE_STDATOMIC)
+ include(CheckStructHasMember)
+ check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
+ check_symbol_exists(timezone time.h HAVE_TIME_H_TIMEZONE)
+
unset(CMAKE_REQUIRED_DEFINITIONS)
unset(CMAKE_REQUIRED_LIBRARIES)