tzcode: Move configuration into separate header.

MFC after:	1 week
Sponsored by:	Klara, Inc.
This commit is contained in:
Dag-Erling Smørgrav 2023-01-11 10:20:46 +01:00
parent d68f154205
commit 394cf6719a
6 changed files with 33 additions and 30 deletions

View File

@ -7,21 +7,8 @@
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
**
** $FreeBSD$
*/
/* Stuff moved from Makefile.inc to reduce clutter */
#ifndef TM_GMTOFF
#define TM_GMTOFF tm_gmtoff
#define TM_ZONE tm_zone
#define PCTS 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_UNISTD_H 1
#define LOCALE_HOME _PATH_LOCALE
#define TZDIR "/usr/share/zoneinfo"
#endif /* ndef TM_GMTOFF */
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
@ -524,12 +511,6 @@ typedef unsigned long uintmax_t;
# define restrict /* empty */
#endif
#if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
# define ATTRIBUTE_PURE /* empty */
#endif
/*
** Workarounds for compilers/systems.
*/

19
contrib/tzcode/tzconfig.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef TZCONFIG_H_INCLUDED
#define TZCONFIG_H_INCLUDED
#define TM_GMTOFF tm_gmtoff
#define TM_ZONE tm_zone
#define HAVE_GETTEXT false
#define HAVE_SYS_STAT_H true
#define HAVE_UNISTD_H true
#define HAVE_STDINT_H true
#define PCTS 1
#define NETBSD_INSPIRED 0
#define STD_INSPIRED 1
#define HAVE_TZNAME 2
#define USG_COMPAT 0
#define ALTZONE 0
#endif /* !TZCONFIG_H_INCLUDED */

View File

@ -176,6 +176,8 @@ SRCS+= __getosreldate.c \
CFLAGS.arc4random.c= -I${SRCTOP}/sys -I${SRCTOP}/sys/crypto/chacha20
CFLAGS.sysconf.c= -I${SRCTOP}/contrib/tzcode
CFLAGS.dlfcn.c= ${RTLD_HDRS}
CFLAGS.tls.c= ${RTLD_HDRS}

View File

@ -3,17 +3,20 @@
.PATH: ${LIBC_SRCTOP}/stdtime ${SRCTOP}/contrib/tzcode
SRCS+= asctime.c difftime.c localtime.c strftime.c strptime.c timelocal.c \
time32.c
TZCODE_SRCS= asctime.c difftime.c localtime.c
STDTIME_SRCS= strftime.c strptime.c timelocal.c
SRCS+= ${TZCODE_SRCS} ${STDTIME_SRCS} time32.c
SYM_MAPS+= ${LIBC_SRCTOP}/stdtime/Symbol.map
SYM_MAPS+= ${LIBC_SRCTOP}/stdtime/Symbol.map
CFLAGS+= -I${SRCTOP}/contrib/tzcode -I${LIBC_SRCTOP}/stdtime
.for src in ${TZCODE_SRCS} ${STDTIME_SRCS}
CFLAGS.${src}+= -I${SRCTOP}/contrib/tzcode -include tzconfig.h
.endfor
.for src in ${STDTIME_SRCS}
CFLAGS.${src}+= -I${LIBC_SRCTOP}/stdtime
.endfor
CFLAGS.localtime.c= -fwrapv
CFLAGS.localtime.c+= -DALL_STATE -DTHREAD_SAFE
CFLAGS.localtime.c+= -DHAVE_TZNAME=2 -DUSG_COMPAT=0 -DALTZONE=0
CFLAGS.localtime.c+= -DNETBSD_INSPIRED=0 -DSTD_INSPIRED=1
.if ${MK_DETECT_TZ_CHANGES} != "no"
CFLAGS.localtime.c+= -DDETECT_TZ_CHANGES
.endif

View File

@ -6,7 +6,6 @@ PROG= zdump
MAN= zdump.8
SRCS= zdump.c
CFLAGS+= -DNETBSD_INSPIRED=0 -DSTD_INSPIRED=1
CFLAGS+= -I${SRCTOP}/contrib/tzcode
CFLAGS+= -I${SRCTOP}/contrib/tzcode -include tzconfig.h
.include <bsd.prog.mk>

View File

@ -6,7 +6,6 @@ PROG= zic
MAN= zic.8
SRCS= zic.c
CFLAGS+= -DNETBSD_INSPIRED=0 -DSTD_INSPIRED=1
CFLAGS+= -I${SRCTOP}/contrib/tzcode
CFLAGS+= -I${SRCTOP}/contrib/tzcode -include tzconfig.h
.include <bsd.prog.mk>