Build out-of-the-box on DragonFly BSD, instead of requiring the
builder to specify CFLAGS by hand.
The following changes take effect only if __DragonFly__ is defined.
* NEWS: Mention the fixes.
* localtime.c (HAVE___ISTHREADED):
* private.h (HAVE_ISSETUGID, HAVE_DECL_TIMEGM, HAVE_MEMPCPY):
Default to 1, not to 0.
(TM_GMTOFF) [!NO_TM_GMTOFF]: Default to tm_gmtoff.
(TM_ZONE) [!NO_TM_ZONE]: Default to tm_zone.
---
 NEWS        | 3 +--
 localtime.c | 2 +-
 private.h   | 6 +++++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index ef9689f3..a60f119f 100644
--- a/NEWS
+++ b/NEWS
@@ -65,8 +65,7 @@ Unreleased, experimental changes
     functions have not used since 2026c’s removal of the old
     posixrules feature.
 
-    localtime.c now works on AIX 7.3 by default again, working
-    around AIX’s POSIX-conformance glitch with st_ctim.
+    localtime.c now works again by default on AIX and DragonFly BSD.
 
   Changes to documentation
 
diff --git a/localtime.c b/localtime.c
index 276f8890..7bc9387f 100644
--- a/localtime.c
+++ b/localtime.c
@@ -64,7 +64,7 @@ struct stat { char st_ctime, st_dev, st_ino; };
 # endif
 # if THREAD_PREFER_SINGLE
 #  ifndef HAVE___ISTHREADED
-#   if defined __FreeBSD__ || defined __OpenBSD__
+#   if defined __FreeBSD__ || defined __OpenBSD__ || defined __DragonFly__
 #    define HAVE___ISTHREADED 1
 #   else
 #    define HAVE___ISTHREADED 0
diff --git a/private.h b/private.h
index 2e782435..f130bc49 100644
--- a/private.h
+++ b/private.h
@@ -311,6 +311,7 @@ extern int optind;
 
 #ifndef HAVE_ISSETUGID
 # if (defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
+      || defined __DragonFly__ \
       || (defined __linux__ && !defined __GLIBC__) /* Android, musl, etc. */ \
       || (defined __APPLE__ && defined __MACH__) || defined __sun)
 #  define HAVE_ISSETUGID 1
@@ -819,6 +820,7 @@ void tzset(void);
 # if (202311 <= __STDC_VERSION__ \
       || defined __GLIBC__ || defined __tm_zone /* musl */ \
       || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
+      || defined __DragonFly__ \
       || (defined __APPLE__ && defined __MACH__))
 #  define HAVE_DECL_TIMEGM 1
 # else
@@ -847,7 +849,8 @@ extern char **environ;
 
 #ifndef HAVE_MEMPCPY
 # if (defined mempcpy \
-      || defined __FreeBSD__ || defined __NetBSD__ || defined __linux__)
+      || defined __FreeBSD__ || defined __NetBSD__ || defined __DragonFly__ \
+      || defined __linux__)
 #  define HAVE_MEMPCPY 1
 # else
 #  define HAVE_MEMPCPY 0
@@ -912,6 +915,7 @@ time_t posix2time(time_t);
      || defined __GLIBC__ \
      || defined __tm_zone /* musl */ \
      || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ \
+     || defined __DragonFly__ \
      || (defined __APPLE__ && defined __MACH__))
 # if !defined TM_GMTOFF && !defined NO_TM_GMTOFF
 #  define TM_GMTOFF tm_gmtoff
-- 
2.53.0

Reply via email to