* Makefile (UTF8_LOCALE_MISSING): Also test [[:alpha:]],
which does not work on Haiku in UTF-8 locales.
(now.ck): Work even if the platform, like Haiku, supports
symlinks but not hard links.
* NEWS: Mention the port.
* localtime.c (issetugid) [!HAVE_ISSETUGID]:
Define to localtime_issetugid, to avoid a clash on Haiku
which declares this function but by default does not define it.
* private.h (HAVE_DECL_TIMEGM, TM_GMTOFF, TM_ZONE) [__HAIKU__]:
Default to BSD behavior.
---
 Makefile    | 6 +++---
 NEWS        | 2 ++
 localtime.c | 4 ++++
 private.h   | 4 ++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 5d463b74..96a7462e 100644
--- a/Makefile
+++ b/Makefile
@@ -922,7 +922,7 @@ check_mild: check_web check_zishrink \
 UTF8_LOCALE_MISSING = \
   { test ! '$(UTF8_LOCALE)' \
     || ! printf 'A\304\200B\n' \
-         | LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \
+         | LC_ALL='$(UTF8_LOCALE)' grep -q '^A[[:alpha:]]B$$' >/dev/null 2>&1 \
     || { export LC_ALL='$(UTF8_LOCALE)'; false; }; }
 
 character-set.ck: $(ENCHILADA)
@@ -1006,11 +1006,11 @@ now.ck: checknow.awk date tzdata.zi zdump zic 
zone1970.tab zonenow.tab
                now=$(CHECK_NOW_TIMESTAMP) && \
                  future=$$(($(CHECK_NOW_FUTURE_SECS) + $$now)) && \
                  ./zdump -i -t $$now,$$future \
-                    $$(find "$$PWD/$@d"/????*/ -type f) \
+                    $$(find "$$PWD/$@d"/????*/ -type f -o -type l) \
                     >$@d/zdump-now.tab && \
                  ./zdump -i -t 0,$$future \
                     $$(find "$$PWD/$@d" -name Etc -prune \
-                         -o -type f ! -name '*.tab' -print) \
+                         -o \( -type f -o -type l \) ! -name '*.tab' -print) \
                     >$@d/zdump-1970.tab && \
                $(AWK) \
                  -v now=$$now \
diff --git a/NEWS b/NEWS
index a60f119f..71595a8f 100644
--- a/NEWS
+++ b/NEWS
@@ -65,6 +65,8 @@ Unreleased, experimental changes
     functions have not used since 2026c’s removal of the old
     posixrules feature.
 
+    tzcode has been ported to Haiku.
+
     localtime.c now works again by default on AIX and DragonFly BSD.
 
   Changes to documentation
diff --git a/localtime.c b/localtime.c
index 7bc9387f..608ddaa6 100644
--- a/localtime.c
+++ b/localtime.c
@@ -348,6 +348,10 @@ static int fstatat(int dd, char const *path, struct stat 
*st, int flags)
 #  include <sys/auxv.h>
 # endif
 
+/* Avoid clash if headers declare but libraries do not define issetugid.  */
+# undef issetugid
+# define issetugid localtime_issetugid
+
 /* Return 1 if the process is privileged, 0 otherwise.  */
 static int
 issetugid(void)
diff --git a/private.h b/private.h
index f130bc49..f2861c94 100644
--- a/private.h
+++ b/private.h
@@ -820,7 +820,7 @@ void tzset(void);
 # if (202311 <= __STDC_VERSION__ \
       || defined __GLIBC__ || defined __tm_zone /* musl */ \
       || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
-      || defined __DragonFly__ \
+      || defined __DragonFly__ || defined __HAIKU__ \
       || (defined __APPLE__ && defined __MACH__))
 #  define HAVE_DECL_TIMEGM 1
 # else
@@ -915,7 +915,7 @@ time_t posix2time(time_t);
      || defined __GLIBC__ \
      || defined __tm_zone /* musl */ \
      || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
-     || defined __DragonFly__ \
+     || defined __DragonFly__ || defined __HAIKU__ \
      || (defined __APPLE__ && defined __MACH__))
 # if !defined TM_GMTOFF && !defined NO_TM_GMTOFF
 #  define TM_GMTOFF tm_gmtoff
-- 
2.55.0

Reply via email to