Home | History | Annotate | only in /src/tools/compat
History log of /src/tools/compat
RevisionDateAuthorComments
 1.96 22-Oct-2025  roy rbtree: Rename rb.c to rbtree.c to match it's header rbtree.h

While here rename RBTEST to RBLOCAL to give a better meaning as we
want to include the local rbtest.h rather than the system one.

Also allow to compile outside of NetBSD source tree by guarding some
things we would otherwise expect to be defined.
 1.95 18-Sep-2025  christos Add more functions needed by mandoc
 1.94 14-May-2025  riastradh branches: 1.94.2;
tools/compat: Don't leave unfinished config.cache around on error.
 1.93 31-Oct-2024  jakllsch Add shquote to libnbcompat
 1.92 30-May-2023  lukem branches: 1.92.2;
tools/compat: use autoreconf, support MAKEVERBOSE

Use autoreconf instead of autoconf + autoheader;
we'll need aclocal in the near future.

If MAKEVERBOSE >= 2, add -v to autoreconf.
 1.91 23-May-2023  lukem tools/compat: MAKEVERBOSE support in regen
 1.90 18-Sep-2021  christos branches: 1.90.2;
Patch the build script and toolchain to allow passing through
HOST_CPPFLAGS, HOST_CXXFLAGS, but not LIBRARY_PATH because it breaks
the build. These variables are necessary to support building NetBSD
from a GNU Guix or NixOS host, where /usr/include, /lib, and all
but /bin/sh do not exist. In many cases, support for HOST_CPPFLAGS
was incomplete. From Ryan Sundberg
 1.89 25-Feb-2021  christos Add reallocarray; this is used by the new regex code and we don't want to
convert it to reallocarr so the code is kept similar with the original from
FreeBSD.
 1.88 13-Jun-2020  lukem tools: configure --silent if MAKEVERBOSE == 0
 1.87 08-May-2019  thorpej branches: 1.87.2;
Fix building libprop as a host tool library on platforms that don't have
the Matt Thomas rbtree:

- Include rb.c in libnbcompat, and provide a nbcompat sys/rbtree.h
header.
- Make sure libprop's source file include prop_object_impl.h before
anything else, and pull in nbtool_config.h from there.

Tested by simulating such a host system by renaming the host's
<sys/rbtree.h> out of the way (which reproduced the build failure)
and verifying that the host-tool installboot contained the rb_*
functions in its own .text segment.
 1.86 30-Aug-2018  christos deal with getsubopt and strncasecmp (needed by mdocml)
 1.85 16-Aug-2018  christos add strncasecmp
 1.84 11-Aug-2018  christos Add strcasecmp
 1.83 01-May-2018  christos branches: 1.83.2;
Create a new bsd.hostinit.mk file and put the build definitions for all host
programs there; make all Makefiles that use bsd.hostprog.mk include it.
Namely turn off MKREPRO and don't make lint, man pages, info files etc.
Remove the Makefile.inc files that contained these same settings, and
remove the settings from Makefile.host
 1.82 01-May-2018  christos PR/53238: Robert Elz: Disable MKREPRO in tools; the host compiler might
not support the necessary options. This is done thusly:

1. Set MKREPRO=no in Makefile.host. This handles all the Makefiles that
use it and don't include bsd.own.mk.
2. Create Makefile.inc and set MKREPRO=no in it. Change the Makefiles that
include bsd.own.mk, to include bsd.init.mk which includes Makefile.inc
first. This will also allow us to control other tools options from a
single location if we need to.

XXX: pullup-8
 1.81 06-Mar-2016  aymeric branches: 1.81.8; 1.81.14;
add our libc's regex implementation to libnbcompat.

This way, nbsed picks it up and it unbreaks the build of xf86-video-intel-old's
man page under Linux and probably other future changes which rightfully expect
the (net)bsd behaviour.

Full release tested on ArchLinux and NetBSD 7.0_STABLE
 1.80 01-Mar-2016  martin Revert to rev 1.77 for now on Aymeric's request
 1.79 01-Mar-2016  aymeric remove regsub.c from the list of files to build because it unbreaks the build
and this API is not yet endorsed. OK christos@
 1.78 29-Feb-2016  aymeric add our libc's regex implementation to libnbcompat.

This way, nbsed picks it up and it unbreaks the build of xf86-video-intel-old's
man page under Linux and probably other future changes which rightfully expect
the (net)bsd behaviour.
 1.77 09-Jan-2016  christos lex source moved.
 1.76 17-Sep-2015  christos undo previous; include is in ${.OBJDIR}
 1.75 17-Sep-2015  christos make this more robust by using .CURDIR to cd.
 1.74 26-Jul-2015  kamil Add reallocarr(3) to tools/compat

This should unbreak libutil(3) creation on systems withot reallocarr(3).
 1.73 18-Jan-2015  christos add strtoi strtou (Kamil Rytarowski)
 1.72 16-Jan-2014  christos branches: 1.72.4;
Add the {v,}{err,warn}c functions
 1.71 09-Jan-2014  apb Declare and define strnlen if necessary.
 1.70 11-Dec-2013  joerg Allow kernel code to access constant databases by moving cdbr(3) and the
required mi_vector_hash(3) into src/common.
 1.69 06-Aug-2013  apb Compile snprintb.c into libnbcompat. The source file is found in the
common/lib/libutil directory.
 1.68 05-Mar-2013  christos add dprintf
 1.67 10-Dec-2012  christos first define HOSTLIB and then include bsd.own.mk!
 1.66 09-Dec-2012  christos restore the find loop to include files generated by configure
 1.65 09-Dec-2012  christos handle the list of files and directories generated dynamically by configure
 1.64 09-Dec-2012  christos make this work
 1.63 09-Dec-2012  christos Include <bsd.own.mk> to give a chance to ${TOOLDIR} to be defined before
using it in rules. Before there was another .mk file included before ${TOOLDIR}
was used.
 1.62 09-Dec-2012  apb Use a "find | while read" loop to install all *.h files anywhere
under ${.OBJDIR}/include, and remove the previous hack of touching a
"dummy" file in each subdirectory. This should fix a problem on some
platforms where include files directly under ${.OBJDIR}/include (not in
a subdirectory) were not installed.
 1.61 02-Dec-2012  apb Make tools/compat/Makefile install the library in
${TOOLDIR}/lib/libnbcompat.a, install the include files in
${TOOLDIR}/include/compat/**, and install defs.mk in
${TOOLDIR}/share/compat/defs.mk. Previously, nothing from
tools/compat was installed under TOOLDIR.

Adjust tools/compat/Makefile to use an uninstalled copy of
host-mkdep from the .OBJDIR of tools/host-mkdep, and an uninstalled
copy of the install program from the .OBJDIR of tools/binstall.
This allows it to be built after tools/host-mkdep is built but
before tools/host-mkdep is installed; and to be installed after
tools/binstall is built but before tools/binstall is installed.
 1.60 02-Dec-2012  apb Teach tools/compat/Makefile to use an uninstalled copy of host-mkdep
from the.OBJDIR of tools/host-mkdep. This is in preparation for
building all three of tools/host-mkdep, tools/compat, and tools/binstall,
before installing any of them.

While here, also move the regen target to the end.
 1.59 04-Jun-2012  joerg branches: 1.59.2;
Add cdbr(3) support to tools/compat.
 1.58 04-Jun-2012  joerg Build getcap.c only once.
 1.57 03-Jun-2012  joerg Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
 1.56 18-Feb-2012  njoly Adjust libyywrap.c location.
 1.55 03-Nov-2011  joerg branches: 1.55.2;
Add getline.c here too.
 1.54 03-Feb-2010  roy branches: 1.54.6;
Userland now builds and uses terminfo instead of termcap.

OK: core@, jdc@
 1.53 17-Jun-2009  christos add fpurge
 1.52 18-Oct-2008  tsutsui Prepare dummy <resolv.h> and <arpa/nameser.h> to make asn1_compile and
compile_et compile on systems which don't have these BIND headers like Cygwin.

Tested by "build.sh -m i386 -U release" on CYGWIN_NT-5.1-1.5.25,
and should close PR toolchain/29032.
 1.51 28-Sep-2007  lukem add raise_default_signal
 1.50 07-Aug-2007  apb branches: 1.50.2;
More detailed instructions for what to do when editing configure.ac.
In particular, discourage the use of non-tools versions of
autoconf and autoheader.
 1.49 03-Jul-2007  nakayama Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.
 1.48 14-Dec-2006  he Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
o Bump libutil minor version number
o Fix uses to include <util.h> to pick up the function definitions
o Fix most uses of flags_to_string() to release the now-malloc()ed result
 1.47 29-Oct-2006  dogcow branches: 1.47.2; 1.47.4;
...and one more for xcompilation (due to lib/libc/hash/sha1/sha1hl.c, sigh.)
 1.46 27-Oct-2006  mrg add ${.CURDIR}/../../common/lib/libc/hash/{rmd160,sha2} to the .PATH
so that these sources are found after this code moved.

(hi christos!)
 1.45 08-Oct-2006  thorpej Put common/lib/libc/stdlib into .PATH. From Hisashi T Fujinaka.
 1.44 26-Aug-2006  christos Some tools need efuns.
 1.43 20-May-2006  christos Don't remove files that are needed for a build after make clean. Before
'make clean; make' failed in tools because necessary configure generated
files were removed. The failure manifested itself with string_to_flags
being undefined in binstall.
 1.42 11-Feb-2006  wiz Redo previous differently: use AH_TOP and AH_BOTTOM macros to insert
header and footer into nbtool_config.h.in directly.
 1.41 11-Feb-2006  wiz Make using autoheader easier:
split off the autogenerated file into nbtool_config_internal.h,
and let nbtool_config.h be a file with the proper wrappers.

This way you can just change configure.ac, run autoconf and autoheader,
verify the result, and commit, but don't have to edit nbtool_config*in
manually every time.
 1.40 20-Dec-2005  christos Search the new common framework.
 1.39 24-Sep-2005  elad Sync with recent MD2 changes.
 1.38 24-Sep-2005  elad Sync with recent changes.
 1.37 13-Sep-2005  christos We don't need any ndbm sources.
 1.36 13-Sep-2005  christos don't use the _foo.c files; all the code is in foo.c now.
 1.35 13-Sep-2005  christos compat reorg.
 1.34 26-Aug-2005  elad Pull in SHA2 routines from libc to nbcompat.
 1.33 19-Aug-2005  christos 64 bit inode changes
 1.32 28-Nov-2004  jmc branches: 1.32.2;
Add heapsort to libnbcompat
 1.31 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.30 18-Jun-2004  thorpej Use ${_TOOL_PREFIX} as appropriate.
 1.29 03-May-2004  jmc Make this build on non-NetBSD again (specifically linux). Exclude __ndbm13.c
from the imported db sources as well
 1.28 27-Oct-2003  lukem branches: 1.28.2;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.27 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.26 01-Aug-2003  lukem Rework how dependency generation is performed:

* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
This is a change of behaviour. If a Makefile wants the clean semantics
it must specifically append to CLEANFILES.
Resolves PR toolchain/5204.

* To recap: .d (depend) files are generated for all files in SRCS and DPSRCS
that have a suffix of: .c .m .s .S .C .cc .cpp .cxx

* If YHEADER is set, automatically add the .y->.h to DPSRCS & CLEANFILES

* Ensure that ${OBJS} ${POBJS} ${LOBJS} ${SOBJS} *.d depend upon ${DPSRCS}

* Deprecate the (short lived) DEPENDSRCS


Update the various Makefiles to these new semantics; generally either
adding to CLEANFILES (because DPSRCS doesn't do that anymore), or replacing
specific .o dependencies with DPSRCS entries.

Tested with "make -j 8 distribution" and "make distribution".
 1.25 29-Jul-2003  fredb Must add "configure.lineno" to CLEANFILES after updating to autoconf 2.57.
 1.24 03-Jun-2003  uwe Add atoll(3) to libnbcompat. We need it when building target's gcc
for a 64-bit target on a 32-bit host.

NB: There seems to be a bug in either gcc itself or the way we import
it, b/c the incorrect #define HAVE_ATOLL is picked from (e.g. for
sparc64) gnu/usr.bin/gcc/arch/sparc64/auto-host.h - so when gen*
auxilary (host) programs are built in gnu/usr.bin/gcc/backend, they
incorrectly pick-up target's HAVE_ATOLL.

For now providing atoll(3) in libnbcompat is a simple and sufficient
workaround.
 1.23 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.22 14-Mar-2003  thorpej Add a putc_unlocked().
 1.21 13-Mar-2003  thorpej Disable pre-compiled headers on Darwin.
 1.20 04-Dec-2002  lukem Tweak dependencies so that defs.mk depends upon config.cache, and
config.cache depends upon 'include/.stamp configure config.h.in defs.mk.in'
and runs configure. Forcebly remove config.cache before running configure.

This change means that config.cache is (still) retained between "make clean"
(but not "make cleandir") runs, but is flushed if configure or config.h.in
is changed, as the cache may contain incorrect information in that case.
 1.19 30-Nov-2002  lukem - Migrate fparseln(3) from libutil to libc, where it should have been in
the first place...
- Bump libutil major (to 7.0) and libc minor (to 12.91).
 1.18 29-Nov-2002  lukem replace missing strsuftoll(3)
 1.17 08-Oct-2002  lukem Implement replacements for lchflags(), lchmod(), and lchown(),
which first lstat(2) the target and return EINVAL if it's a symlink,
and then call ch{flags,mod,own} as appropriate.
Removes the need for hokey code inside the tools themselves...
 1.16 06-Oct-2002  lukem Provide strtoll() in libnbcompat.
Should fix relevant build issue on HP-UX and MacOS X hosts.
 1.15 14-Sep-2002  thorpej * Check for mkstemp() and mkdtemp(), and build them into libnbcompat
if necessary.
* mktemp is now a host-tool, so nuke the lame script (which isn't even
properly installed during the tools bootstrap).
 1.14 13-Sep-2002  thorpej * Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.13 18-Apr-2002  tv branches: 1.13.2;
Actually put the include directory timestamp under the "include" directory,
such that nuking the dir by hand also nukes the timestamp.
 1.12 18-Apr-2002  bjh21 Add a stub issetugid() for platforms that don't have it. For now, we assume
that no host program will be installed set-id, so the stub function always
returns 0.
 1.11 01-Apr-2002  bjh21 Revert addition of mkdtemp() to libnbcompat. I don't think we need mktemp(1)
after all.
 1.10 31-Mar-2002  bjh21 Add mkdtemp to libnbcompat, since glibc doesn't have it an mktemp(1) will
need it.
 1.9 31-Mar-2002  bjh21 Add the md[245], sha1 and rmd160 functions to libnbcompat, conditional on their
not being in the host libc.
This will be necessary to make cksum into a host tool.
 1.8 26-Feb-2002  tv Add some more bits of host compatibility.
 1.7 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.6 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.5 24-Jan-2002  lukem - Replace pwcache(3) if necessary (pwcache_userdb(3) is checked for).
Tested on -current and 1.5.3.
- Wrap some long lines.
 1.4 21-Jan-2002  lukem reachover to ../../lib/libutil for fparseln.c
 1.3 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.2 04-Jan-2002  lukem Add replacement fgetln(3) (from lukemftp/libukem), as fparseln(3) uses it
 1.1 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.13.2.3 12-Jul-2004  he Pull up revision 1.17 (requested by cgd in ticket #1719):
Implement replacements for lchflags(), lchmod(), and
lchown(), to enable cross-building on more host systems.
 1.13.2.2 30-Nov-2002  he Pull up revision 1.15 (requested by thorpej in ticket #807):
o Check for mkstemp() and mkdtemp(), and build them into
libcompat if necessary.
o mktemp is now a host-tool, so remove the now obsoleted
script.
 1.13.2.1 03-Nov-2002  he Pull up revision 1.14 (requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.28.2.1 22-Jun-2004  tron branches: 1.28.2.1.2;
Pull up revision 1.31 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.28.2.1.2.1 06-Apr-2005  he Pull up revision 1.32 (requested by jmc in ticket #1026):
Convert remaining host tools for amiga to correct cross tools.
Now allows complete amiga builds on non-NetBSD and non-BSD hosts.
 1.32.2.1 08-Sep-2005  tron Apply patch (requested by elad in ticket #743):
Introduce SHA2 hashing routines in userland, including the common
helper routines.
 1.47.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.47.2.2 18-Nov-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #1224):
tools/compat/Makefile: revision 1.52
tools/compat/configure.ac: revision 1.67
Prepare dummy <resolv.h> and <arpa/nameser.h> to make asn1_compile and
compile_et compile on systems which don't have these BIND headers like
Cygwin.
Tested by "build.sh -m i386 -U release" on CYGWIN_NT-5.1-1.5.25,
and should close PR toolchain/29032.
 1.47.2.1 30-Aug-2007  pavel Pull up following revision(s) (requested by apb in ticket #827):
tools/compat/Makefile: revision 1.50
tools/compat/compat_defs.h: revision 1.60
tools/compat/configure.ac: revision 1.62-1.64
More detailed instructions for what to do when editing configure.ac.
In particular, discourage the use of non-tools versions of
autoconf and autoheader.
Provide definitions for {be,le}{16,32,64}{enc,dec} if necessary.
This is adapted from the very detailed fix provided by
Giles Lean in PR bin/36678.
Only one simplified implementation is provided, instead of the
two implementations conditional on __GNUC_PREREQ__(2,95) that are
provided in NetBSD's <sys/endian.h>. The use of memcpy instead of
__builtin__memcpy, and the absence of __inline or __unused, should make
it independent of GCC.
Update the instructions to say that regen should be done again
to pick up changed RCS IDs.
 1.50.2.1 06-Nov-2007  matt sync with HEAD
 1.54.6.5 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.54.6.4 16-Jan-2013  yamt sync with (a bit old) head
 1.54.6.3 30-Oct-2012  yamt sync with head
 1.54.6.2 17-Apr-2012  yamt sync with head
 1.54.6.1 10-Nov-2011  yamt sync with head
 1.55.2.2 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.55.2.1 23-Feb-2012  riz Pull up following revision(s) (requested by tron in ticket #19):
usr.bin/lex/version.h: file removal
usr.bin/lex/main.c: file removal
usr.bin/lex/libmain.c: file removal
usr.bin/lex/COPYING: file removal
usr.bin/lex/misc.c: file removal
usr.bin/lex/Makefile: file removal
usr.bin/lex/dfa.c: file removal
tools/compat/Makefile: revision 1.56
external/bsd/flex/dist/libmain.c: revision 1.2
usr.bin/lex/flexdef.h: file removal
usr.bin/lex/flex.1: file removal
usr.bin/lex/ecs.c: file removal
usr.bin/lex/FlexLexer.h: file removal
usr.bin/lex/libyywrap.c: file removal
usr.bin/lex/config.h: file removal
usr.bin/lex/ccl.c: file removal
usr.bin/lex/NEWS: file removal
usr.bin/lex/flex.skl: file removal
usr.bin/lex/scan.l: file removal
usr.bin/lex/gen.c: file removal
usr.bin/lex/yylex.c: file removal
usr.bin/lex/VERSION: file removal
usr.bin/lex/initscan.c: file removal
usr.bin/lex/sym.c: file removal
usr.bin/lex/tblcmp.c: file removal
usr.bin/lex/nfa.c: file removal
usr.bin/lex/mkskel.sh: file removal
external/bsd/flex/dist/libyywrap.c: revision 1.2
usr.bin/lex/parse.y: file removal
this has not been used for ages.
Adjust libyywrap.c location.
fix prototypes
 1.59.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.59.2.2 23-Jun-2013  tls resync from head
 1.59.2.1 25-Feb-2013  tls resync with head
 1.72.4.1 22-Apr-2015  snj Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
 1.81.14.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.81.14.1 02-May-2018  pgoyette Synch with HEAD
 1.81.8.1 05-May-2018  martin Pull up following revision(s) (requested by christos in ticket #796):

tools/mdsetimage/Makefile: revision 1.15
tools/compat/Makefile: revision 1.82
tools/gdb/Makefile: revision 1.35
tools/lorder/Makefile: revision 1.13
tools/gcc/Makefile: revision 1.85
tools/dtc/Makefile: revision 1.3
tools/cvslatest/Makefile: revision 1.2
tools/ctfmerge/Makefile: revision 1.8
tools/libelf/Makefile: revision 1.9
tools/libdwarf/Makefile: revision 1.8
tools/ctfconvert/Makefile: revision 1.7
tools/makekeys/Makefile: revision 1.2
tools/gettext/Makefile: revision 1.7
tools/binstall/Makefile: revision 1.12
tools/libfdt/Makefile: revision 1.3
tools/libctf/Makefile: revision 1.7
tools/binutils/Makefile: revision 1.27
tools/mandoc/Makefile: revision 1.11
tools/Makefile.host: revision 1.32
tools/dbsym/Makefile: revision 1.13
tools/genassym/Makefile: revision 1.7
tools/Makefile.inc: revision 1.14

PR/53238: Robert Elz: Disable MKREPRO in tools; the host compiler might
not support the necessary options. This is done thusly:

1. Set MKREPRO=no in Makefile.host. This handles all the Makefiles that
use it and don't include bsd.own.mk.
2. Create Makefile.inc and set MKREPRO=no in it. Change the Makefiles that
include bsd.own.mk, to include bsd.init.mk which includes Makefile.inc
first. This will also allow us to control other tools options from a
single location if we need to.

XXX: pullup-8
 1.83.2.1 10-Jun-2019  christos Sync with HEAD
 1.87.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1973):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
usr.bin/nbperf/nbperf.c: revision 1.7
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)
tools/compat/configure (patch for regen from above)

Don't use arc4random for the tools build on NetBSD either.
compat_defs.h explicitly forces _POSIX_SOURCE and this hides the
prototype in stdlib.h.
pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.90.2.2 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1174):

tools/compat/configure.ac: revision 1.111 (patch)
tools/compat/compat_defs.h: revision 1.126 (patch)
tools/compat/compat_defs.h: revision 1.127 (patch)
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)

pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.90.2.1 17-Nov-2024  martin Pull up following revision(s) (requested by kre in ticket #1004):

tools/compat/configure: revision 1.106
lib/libc/string/__strsignal.c: revision 1.26
tools/compat/configure.ac: revision 1.108
tools/compat/nbtool_config.h.in: revision 1.57
usr.bin/elf2aout/elf2aout.c: revision 1.24
tools/compat/Makefile: revision 1.93
sys/arch/macppc/stand/fixcoff/fixcoff.c: revision 1.13
tools/compat/compat_defs.h: revision 1.123

Include <arpa/inet.h> for htonl() (From Jan-Benedict Glaw)
Probably this should be using htobe32() instead of htonl()
(and so <endian.h> rather than <arpa/inet.h>) as there is
no sign of any network anywhere near here. But that's for
another day, and to be done by someone who can test it.

Portability fixes from Jan-Benedict Glaw
The args to help() and usage() need to be const char *
and main() should be declared as returning int.

Add shquote to libnbcompat
Include shquote() in configure tests
Regen for added shquote()

Stop attempting to return a (char*) in place of (const char *)
This removes a cast that was added in 1994, when __strsignal()
returned a char * to convert the const char * element of sys_siglist
into a type that matched.

It should have been removed when __strsignal() was changed to
return const char * in 1998. But wasn't.

This should fix an inane warning (treated as an error) from a
compile stupid enough to allow a natural char * (as in char buf[N])
to be returned as a result (which is, of course, fine), but complains
about returning (char *) applied to a (const char *).
 1.92.2.1 02-Aug-2025  perseant Sync with HEAD
 1.94.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #56):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
tools/compat/nbtool_config.h.in: revision 1.60
tools/compat/nbtool_config.h.in: revision 1.61
lib/libc/stdio/mkstemps.c: revision 1.2
tools/compat/configure: revision 1.108
tools/compat/configure: revision 1.109
tools/compat/nbtool_config.h.in: revision 1.59
tools/compat/Makefile: revision 1.95
tools/compat/configure.ac: revision 1.110

Add more functions needed by mandoc

regen

add vsyslog decl check

regen

Do the nbtool dance.
 1.29 02-Sep-2023  palle Update build instructions for Solaris 10 hosts
 1.28 24-Aug-2023  palle Update build instructions for Solaris 11.3 hosts
 1.27 23-Aug-2023  palle Update build instructions for Solaris 11.3 hosts
 1.26 15-Aug-2023  palle Update build instructions for Solaris 10 and Solaris 11.3 hosts
 1.25 14-Aug-2023  palle Update build instructions for Solaris 11.4 (CBE) hosts
 1.24 30-Jul-2023  palle Update build instruction for Solaris 11.4 (CBE) hosts
 1.23 16-Jul-2023  palle Update build instructions for Solaris 11.4 hosts: specify HOST_SH and note standards
 1.22 05-Jul-2023  palle Update build instruction for Solaris 11.4 hosts
 1.21 11-Jul-2021  cjep Final note on OpenBSD cross-buildling. Remaining issues were due to
default limits on the build host.
 1.20 04-Jul-2021  cjep LLVM RT library will actually cross-build from OpenBSD provided sufficient
limits are in place for the build user.
 1.19 29-Jun-2021  cjep Note OpenBSD cross-build progress
 1.18 28-Jun-2021  cjep avoid triggering conflict indicator warnings
 1.17 28-Jun-2021  cjep note on Darwin/Mac
 1.16 12-May-2021  cjep Add macOS High Sierra to the list of verified build platforms
 1.15 07-May-2021  cjep branches: 1.15.2;
More test notes from using build.sh against non NetBSD platforms.
 1.14 06-May-2021  cjep Update with information from recent testing of different Linux variants
on AWS. Also FreeBSD 13.
 1.13 09-Sep-2018  palle Add instructions for building NetBSD on modern Solaris 11 hosts
 1.12 05-Apr-2005  jmc branches: 1.12.82; 1.12.84;
Update notes for testing on linux, OS/X
 1.11 22-Jun-2004  jmc Note on NetBSD that _NETBSD_SOURCE should never be defined and it's an error
if it is
 1.10 29-Dec-2003  jmc List that all hosts require a posix sh and override with HOST_SH if needed.
Start a list of any other general tools assumed (gzip being the only one
right now).
Note that redhat8 works with no special settings.
 1.9 17-Nov-2003  dbj note successful build on Mac OS 10.3 with xcode 1.0 developer tools
 1.8 29-Sep-2002  lukem It's "HP-UX" not "HP/UX". (Thanks Giles).
 1.7 22-Sep-2002  lukem preliminary HP/UX notes from Giles; it needs zlib.
(as Solaris, Linux and HP/UX all mention they need zlib and it should
be part of libnbcompat, maybe this is a hint for us to get a move on
and do that :)
 1.6 16-Sep-2002  briggs Note that RedHat 7.3 hosts successfully as of today with the caveat that
LANG=C must be in the environment.
 1.5 13-Sep-2002  thorpej Update Solaris section (again).
 1.4 13-Sep-2002  thorpej * Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.3 28-Apr-2002  bjh21 branches: 1.3.2;
I believe I've fixed nbmake's dependency on /bin/sh.
 1.2 24-Apr-2002  bjh21 src/tools/dbsym has been buildable on non-NetBSD systems for some time.
 1.1 01-Feb-2002  tv Cross-hosting notes for foreign OS's. (Currently Linux, Solaris, and older
releases of NetBSD.)
 1.3.2.2 03-Nov-2002  he Pull up revision 1.5 (requested by thorpej in ticket #801):
Update Solaris section.
 1.3.2.1 03-Nov-2002  he Pull up revision 1.4 (requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.12.84.1 10-Jun-2019  christos Sync with HEAD
 1.12.82.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.15.2.1 31-May-2021  cjep sync with head
 1.2 20-Jul-2023  lukem tools/compat: regen
 1.1 30-May-2023  lukem tools/compat: regen
 1.2 11-Dec-2013  joerg Allow kernel code to access constant databases by moving cdbr(3) and the
required mi_vector_hash(3) into src/common.
 1.1 04-Jun-2012  joerg branches: 1.1.2; 1.1.4; 1.1.6;
Add cdbr(3) support to tools/compat.
 1.1.6.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.2 30-Oct-2012  yamt sync with head
 1.1.6.1 04-Jun-2012  yamt file cdbr.h was added on branch yamt-pagecache on 2012-10-30 19:00:11 +0000
 1.1.4.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.2.2 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.1.2.1 04-Jun-2012  riz file cdbr.h was added on branch netbsd-6 on 2012-06-23 22:54:56 +0000
 1.1 03-Jun-2012  joerg branches: 1.1.2; 1.1.6;
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
 1.1.6.2 30-Oct-2012  yamt sync with head
 1.1.6.1 03-Jun-2012  yamt file cdbw.h was added on branch yamt-pagecache on 2012-10-30 19:00:11 +0000
 1.1.2.2 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.1.2.1 03-Jun-2012  riz file cdbw.h was added on branch netbsd-6 on 2012-06-23 22:54:56 +0000
 1.127 18-Sep-2025  christos add vsyslog decl check
 1.126 18-Sep-2025  christos Add more functions needed by mandoc
 1.125 05-May-2025  christos branches: 1.125.2;
Add roundup2() used by ctf
 1.124 02-Mar-2025  riastradh libc: New _r variants of heapsort, mergesort, qsort.

Also kheapsort_r for kernel/standalone use.

These variants allow the caller to pass a cookie through to the
comparison function, e.g. if you want to sort an array of indices
into a buffer.

qsort_r is new in POSIX.1-2024; the others are obvious analogues of
our nonstandard extensions for heapsort and mergesort.

PR lib/58931: qsort_r() missing
 1.123 31-Oct-2024  kre Include shquote() in configure tests
 1.122 21-Jul-2023  lukem branches: 1.122.2;
tools/compat/compat_defs.h: improve NAME_MAX compat

Move the NAME_MAX workaround to the <limits.h> section,
and don't assume that _XOPEN_NAME_MAX is available.
 1.121 08-Jul-2023  palle Add support for missing NAME_MAX when building on Solaris hosts
 1.120 30-May-2021  cjep branches: 1.120.4;
PR port-amiga/56188

Include a prototype for __nbcompat_heapsort. The tools for amiga now
build on Darwin where one Amiga specific tool uses heapsort.

Despite being a one-liner, ./build.sh -m amiga tools was tested on
NetBSD, Darwin, FreeBSD & Linux with the change.

Discussed various options with jdc & thorpej. Perhaps in the future
we could look at using qsort instead of heapsort as qsort is
standardised and more likely to be available. We could then remove
heapsort from the compatibility library.
 1.119 24-May-2021  uwe Fix typo in pathname in a comment.
 1.118 25-Feb-2021  christos branches: 1.118.2;
Add reallocarray; this is used by the new regex code and we don't want to
convert it to reallocarr so the code is kept similar with the original from
FreeBSD.
 1.117 23-Feb-2021  rin Fix copy-paste error for heapsort(3), so that it is declared appropriately.
 1.116 19-Jun-2019  kamil branches: 1.116.2;
Add more SunOS types to tools/compat

Add fallback defintions of: uchar_t, ushort_t, uint_t, ulong_t.

Needed by the libctf code on Ubuntu 16.x.
 1.115 19-Jun-2019  kamil Add sys/uio.h & enum uio_seg, enum uio_rw to tools/compat

This is needed for bootstrapping the tools on Ubuntu 16.x.
 1.114 30-Aug-2018  christos deal with getsubopt and strncasecmp (needed by mdocml)
 1.113 11-Aug-2018  christos Add strcasecmp
 1.112 13-Jun-2018  maya branches: 1.112.2;
Revert my previous config test inclusion for u_longlong_t.

Fixing this differently by avoiding the need for the definition.
It also caused a problem in OS X, as I neglected to include a correct header
 1.111 12-Jun-2018  christos Move the typedefs before the header inclusions (except <features.h>) and
explain why.
 1.110 11-Jun-2018  maya Add configure check and fallback definition for u_longlong_t

Should help linux tools compilation of dtrace tools, and not
affect NetBSD.

From Chuck Zmudzinski in current-users, with light modification
by myself.
 1.109 03-Oct-2017  christos branches: 1.109.2;
fix fpurge declaration
 1.108 02-Oct-2017  christos handle __fpurge being declared in <stdio_ext.h>
 1.107 07-Jan-2017  christos branches: 1.107.6;
adjust for SSP (MacOS/X)
 1.106 07-Jan-2017  christos need ctype.h
 1.105 07-Jan-2017  christos Check for declarations, not the existance of functions since some are
visible only when _NETBSD_SOURCE is defined. This avoids || defined(__NetBSD__)
hacks.
 1.104 19-Oct-2016  christos try to fix missing decls
 1.103 21-Sep-2015  pooka branches: 1.103.2;
Add more compat defs for code compiled for !NetBSD targets.

At least GNU Hurd lacks MAXHOSTNAMELEN/MAXPATHLEN/PATH_MAX, so make sure
those have some arbitrary semi-sane values.

from Robert Millan in PR misc/50166, with some modifications from myself
 1.102 26-Jul-2015  kamil Add reallocarr(3) to tools/compat

This should unbreak libutil(3) creation on systems withot reallocarr(3).
 1.101 16-Jan-2015  christos strto{i,u}
 1.100 24-Dec-2014  christos add __UNVOLATILE
 1.99 24-Sep-2014  christos put O_CLOEXEC definition here.
 1.98 01-Sep-2014  apb Copy definitions of __type_min(t), __type_max(t), and some related macros,
from <sys/cdefs.h>, for use when building tools.
 1.97 06-Jun-2014  christos branches: 1.97.2;
Deal with errc/warnc
 1.96 19-Apr-2014  apb Clarify the NetBSD-specific and Linux-specific code at the top of
compat_defs.h:

* Explain why _NETBSD_SOURCE should not be defined on NetBSD.
* Move NetBSD-specific block to the top of the file.
* Improve comment about Linux <feature.h>.
* Move #undef _POSIX_SOURCE and #undef _POSIX_C_SOURCE to the
Linux-specific block instead of a place that would affect all
non-NetBSD platforms. This makes the code match the comment.

This will need to be re-visited if other platforms also need
#undef _POSIX_SOURCE or #undef _POSIX_C_SOURCE. At present, I suspect
that they are needed only for Linux.
 1.95 09-Jan-2014  apb branches: 1.95.2;
fix prototype for strnlen.
 1.94 09-Jan-2014  apb Declare and define strnlen if necessary.
 1.93 24-Oct-2013  apb Define __USE for use during a tools build.
 1.92 18-Aug-2013  joerg Support __format_arg.
 1.91 06-Aug-2013  apb declare snptintb_m() and snprintb() if HAVE_SNPRINTB is not defined.
 1.90 20-Jul-2013  christos revert socklen_t to int (from dh)
 1.89 19-Jul-2013  christos PR/48063: Justin Cormack: incorrect definition of socklen_t
 1.88 05-Mar-2013  christos branches: 1.88.4;
add dprintf
 1.87 17-Feb-2013  christos cygwin defines u_quad_t in <rpc/types.h>, so include this to the headers
we include and test by default.
 1.86 04-Jun-2012  joerg branches: 1.86.2;
Make Alan Barrett happy and add ().
 1.85 03-Jun-2012  joerg Add __predict_true / __predict_false definitions.
 1.84 02-Jun-2012  joerg Don't depend on __P.
 1.83 21-Jan-2012  tsutsui branches: 1.83.2;
Always redefine DEV_BSIZE=512.
All references of DEV_BSIZE in tools are to manipulate target
(i.e. NetBSD's) file images (in installboot(8) and makefs(8) etc.) and
no host's DEV_BSIZE is required for the moment. Closes PR toolchain/42574.
 1.82 03-Nov-2011  joerg Add getline(3) compat glue.
 1.81 05-Sep-2011  jdc branches: 1.81.2;
Add PDP_ENDIAN definition, required for makefs (v7fs).
 1.80 27-Aug-2011  joerg Ensure __printflike exists.
 1.79 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.78 10-Jan-2011  apb Define PRI[diouxX]8. We previously did this only for
16- and 32-bit type, but now PRIu8 is needed for tools/disklabel.

Also define SCN[diouxX]{8,16,32}, the scanf counterparts
to the PRI[diouxX]{8,16,32} macros.

Tested via "build.sh tools" on a system whose native definitions
or the PRI* and SCN* mcros was disabled.
 1.77 14-Jan-2010  christos undef and redefine instead of checking if it is define, from joerg
 1.76 14-Jan-2010  christos provide __arraycount for those that don't have it.
 1.75 11-Nov-2009  tron Revert most of revision 1.73:
We cannot user_from_uid(3) or group_from_gid(3) unless the system
also supports pwcache_userdb(3) and pwcache_groupdb(3). The build will
use the hosts password and user database otherwise. Switch back to the
old behaviour to only the native functions if they are all present.
This fixes cross builds under Mac OS X and FreeBSD.

Fix based on problem analysis provided by Akihiko Hayashi.
 1.74 06-Nov-2009  joerg Define __RCSID and __COPYRIGHT as structure, so that the following
semicolon is consumed.
 1.73 02-Oct-2009  christos split all the password and group translation functions into individual
ifdefs instead of having a large one.
 1.72 24-Feb-2009  sketch Make 'build.sh tools' work with the Sun Studio compiler, although bugs in
some of the generated tools still prevent building a full release using them.
 1.71 03-Feb-2009  dbj branches: 1.71.2;
avoid including grp.h
 1.70 18-Jan-2009  apb Use hex instead of decimal in #if FOO_MAX == 0xffff.... tests, and
append "U" to make the constants unsigned.
 1.69 18-Jan-2009  apb Provide definitions for PRI{d,i,o,u,x,X}{16,32,64}. Many tools
already use [u]int{16,32,64}_t types, and a few already had their own
#ifndef/#define/#endif code for a few of these macros. A future commit
will remove that now-redundant code in the affected tools.
 1.68 06-Jan-2009  agc Apply part of the patch from Julio M. Merino Vidal in

http://mail-index.netbsd.org/source-changes/2009/01/05/msg214884.html

to make the toolchain cross-build on Mac OS X. Nozaki-san has addressed
the other issues.
 1.67 20-Oct-2008  apb branches: 1.67.2;
The tools/compat versions of mkstemp() and mkdtemp() need to call the
internal function that's usually named "__gettemp". However in a cross
build, "__gettemp" is in a namespace reserved for the host system, so we
can't use that. Use "__nbcompat_gettemp" instead, following the example
of several other functions or macros in tools/compat. Previously, this
was handled by using the name "gettemp", but that conflicts with the
local gettemp() function in dist/nawk.
 1.66 20-Oct-2008  dogcow Define __USE_ISOC99 for linux, making the isblank() proto appear.
This is probably not the Right Thing, but it seems to not break anything.
 1.65 30-Oct-2007  tls Try to address mess with user_from_uid and friends by ensuring we always
get our versions if any of the functions aren't present on the host system.

Still assumes if the functions are all there, they work like ours, which
may be a problem too.
 1.64 19-Oct-2007  christos I am now convinced of the error of my ways, and I am checking for all the
decls mtree is using.
 1.63 18-Oct-2007  christos Move linux block up higher as it was before. noted by apb
 1.62 18-Oct-2007  christos - define the NetBSD options before including any files
- add the _NETBSD_TOOLS define to make more symbols visible
- user_from_uid and group_from_gid are renamed only if we don't have them
 1.61 28-Sep-2007  lukem Add raise_default_signal().
 1.60 07-Aug-2007  apb branches: 1.60.2;
Provide definitions for {be,le}{16,32,64}{enc,dec} if necessary.
This is adapted from the very detailed fix provided by
Giles Lean in PR bin/36678.

Only one simplified implementation is provided, instead of the
two implementations conditional on __GNUC_PREREQ__(2,95) that are
provided in NetBSD's <sys/endian.h>. The use of memcpy instead of
__builtin__memcpy, and the absence of __inline or __unused, should make
it independent of GCC.
 1.59 03-Jul-2007  nakayama Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.
 1.58 09-Jan-2007  ginsbach Fix tools build, binstall/xinstall, for systems without id_t, e.g.
MacOS X 10.3.9. This should better match the NetBSD definition of id_t
in sys/sys/types.h.
 1.57 12-Oct-2006  christos branches: 1.57.2; 1.57.4;
kill __unused
 1.56 09-Oct-2006  christos sideways check for error functions.
 1.55 07-Oct-2006  apb Add definitions for strmode. This was missing from the
patch in PR 31232.
 1.54 29-Sep-2006  apb Use ${HOST_SH} instead of the host system's /bin/sh wherever possible:

* _PATH_BSHELL from the host's <paths.h> might be broken, so override it
with our PATH_BSHELL, which is derived from HOST_SH.
 1.53 20-Aug-2006  thorpej Also check for DIR.__dd_fd. tools/compat now builds on the WWDC developer
preview version of Mac OS X "Leopard".
 1.52 14-Feb-2006  dyoung Two changes to facilitate building tools on Darwin:

1. #undef d_fileno, which is set by Darwin's <dirent.h>,
and which clashes with d_fileno in NetBSD headers.

2. Install the sys/ufs/ header files in nbinclude/ in order
to override Darwin's own, incompatible header files.
 1.51 11-Feb-2006  wiz Define prototypes for strsuftoll and strsuftollx if the one for
strsuftoll was not found by configure. Second part of nbmakefs build
on 3.0.
 1.50 10-Feb-2006  wiz Adapt for bswap* changes in configure.ac.
 1.49 09-Feb-2006  dogcow change #include <sys/endian.h> => #include <machine/endian.h> so that
it's (more) consistent in the tree; this, along with changing tools/compat's
autoconf detection from AC_CHECK_FUNCS to AC_CHECK_DECLS makes the vast
majority of htobe16 and friends' redefinition errors bite the dust.
Tested with -current and FreeBSD.
 1.48 14-Sep-2005  tron Make cross compiling NetBSD under Linux work again. Problem noted by
R. Huvendiek on "current-users" mailing list.
 1.47 27-Aug-2005  uwe UINT8_MAX and UINT16_MAX are needed for disklabel.
 1.46 22-Aug-2005  tron Define "_PATH_VI" if necessary to make cross-building work again under
Solaris (and potentially other platforms) after "disklabel" has been
added to the hosts tools.
 1.45 11-Dec-2004  jmc Provide a definition for __UNCONST since there's no guarentee our sys/cdefs.h
gets pulled in
 1.44 28-Nov-2004  jmc Add heapsort to libnbcompat
 1.43 23-Jun-2004  tron Define "_ISOC99_SOURCE" when building under NetBSD to get the prototypes
for strtoll() and strtoull(). This fixes PR toolchain/26021.
 1.42 22-Jun-2004  jmc Redo the last commit. _NETBSD_SOURCE should never be used/referenced anymore.
So, don't wrap definitions in it, and instead check for it and #error out
if it somehow leaks into scope.

Tested a complete build to sets on x86 from a clean source tree.
 1.41 21-Jun-2004  christos - Wrap around #if !_NETBSD_SOURCE the definitions of u_{long,int,short,char}
- Protect dirfd() macro so that we don't re-define it.

These changes make my build proceed further.

The problem is that automatically generated files, might include system
files before they include anything else (for example our yacc skeleton
includes <stdlib.h> before it does anything else). This foils the scheme
of defining _POSIX_SOURCE and friends so that _NETBSD_SOURCE does not
get defined; in fact, we include many files with _NETBSD_SOURCE defined,
enough to cause confusion in compat_defs.h which tries to re-define things.
 1.40 21-Jun-2004  jmc On NetBSD boxes make sure and provide prototypes for strtouq since quad_t gets
exposed all the time, but routines which use it do not. Otherwise callers
of strtouq will lose.
XXX: Need to come back through here and clean up the configure tests better
for this
 1.39 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.38 18-Jun-2004  thorpej Oops, missed a spot where we need to handle group_from_gid() separately.
 1.37 18-Jun-2004  thorpej Handle group_from_gid() on its own.
 1.36 14-Jun-2004  jmc Before sucking in stdlib.h check if this is NetBSD. If so, explicitly make
sure to use _POSIX_C_SOURCE and undef _NETBSD_SOURCE so the myriad of NetBSD
extentions don't get pulled into scope (and likely conflict at some point
with branched code trying to build on -current due to drift). Fixes PR#25533

XXX: The entire process here is just wacky and the entire cross tools process
needed to be reviewed to build clean w. just _POSIX_C_SOURCE or the equiv
set on NetBSD hosts or this will lose again somewhere..
 1.35 18-May-2004  sjg Apply patch from OGAWA Takaya to fix FreeBSD hosted builds.
The trick is to force use of the NetBSD versions of user_from_{uid,gid}().

PR: 24843
 1.34 24-Apr-2004  matt Add a compat definition of __packed.
 1.33 23-Apr-2004  christos more constification suggested by kleink.
 1.32 23-Apr-2004  christos adjust to constification of cget*()
 1.31 27-Oct-2003  lukem branches: 1.31.2;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.30 27-Aug-2003  uwe If SIZE_MAX is not defined, but SIZE_T_MAX is defined (e.g. FreeBSD),
define SIZE_MAX as SIZE_T_MAX.
 1.29 27-Jul-2003  lukem If HAVE_SYS_ENDIAN_H, pull in <sys/endian.h>. Fixes build.sh on FreeBSD 5.1.
Fix from Grant Beattie <grant@>
 1.28 18-Jul-2003  fredb As discussed briefly on tech-toolchain, AIX doesn't have "u_long",
so add a check for that. Partial fix for PR toolchain/22177.
 1.27 03-Jun-2003  uwe Add atoll(3) to libnbcompat. We need it when building target's gcc
for a 64-bit target on a 32-bit host.

NB: There seems to be a bug in either gcc itself or the way we import
it, b/c the incorrect #define HAVE_ATOLL is picked from (e.g. for
sparc64) gnu/usr.bin/gcc/arch/sparc64/auto-host.h - so when gen*
auxilary (host) programs are built in gnu/usr.bin/gcc/backend, they
incorrectly pick-up target's HAVE_ATOLL.

For now providing atoll(3) in libnbcompat is a simple and sufficient
workaround.
 1.26 13-Mar-2003  thorpej Check for sys/socket.h and socklen_t.
 1.25 31-Jan-2003  uwe Avoid cgetcap &co prototypes conflicting with those provided by the host.
With this change we can cross-compile on FreeBSD 4.x.
 1.24 27-Jan-2003  uwe Provide __SCCSID() needed by pwd_mkdb.
 1.23 29-Nov-2002  lukem replace missing strsuftoll(3)
 1.22 20-Oct-2002  christos PR/18733: Jed Davis: define _PATH_DEFTAPE; pax needs it.
 1.21 08-Oct-2002  lukem Implement replacements for lchflags(), lchmod(), and lchown(),
which first lstat(2) the target and return EINVAL if it's a symlink,
and then call ch{flags,mod,own} as appropriate.
Removes the need for hokey code inside the tools themselves...
 1.20 06-Oct-2002  lukem Provide strtoll() in libnbcompat.
Should fix relevant build issue on HP-UX and MacOS X hosts.
 1.19 30-Sep-2002  lukem Fix from Giles Lean:
HP-UX has MAP_ANONYMOUS but not MAP_ANON
 1.18 14-Sep-2002  thorpej * Check for mkstemp() and mkdtemp(), and build them into libnbcompat
if necessary.
* mktemp is now a host-tool, so nuke the lame script (which isn't even
properly installed during the tools bootstrap).
 1.17 13-Sep-2002  bjh21 Add __restrict to the set of tokens we #define away: our glob.h uses it.
 1.16 03-Jul-2002  pooka Fine-grain checking somewhat:
* check for user_from_uid() in addition to pwcache_userdb()
* check for svis() in addition to vis()
 1.15 24-Apr-2002  bjh21 branches: 1.15.2;
Rather than hardcoding two possible locations of the POSIX shell (for
Solaris and everything else), set _PATH_BSHELL to the first occurrence of
"sh" on the path. This should be rather more portable.
 1.14 23-Apr-2002  bjh21 Add test for alloca() and <alloca.h>, since Sun Workshop C 5.0 needs this.
 1.13 22-Apr-2002  bjh21 <stdint.h> belongs before <sys/endian.h>.
 1.12 22-Apr-2002  bjh21 Define __CONCAT if the host doesn't.
 1.11 22-Apr-2002  lukem add UINT32_MAX if it's not defined
 1.10 18-Apr-2002  bjh21 Add a stub issetugid() for platforms that don't have it. For now, we assume
that no host program will be installed set-id, so the stub function always
returns 0.
 1.9 04-Apr-2002  bjh21 Add htobe16() and friends, #ifndef HAVE_SYS_ENDIAN_H.
 1.8 04-Apr-2002  bjh21 Replace a spurious hard space (\xa0) with a normal one.
 1.7 07-Mar-2002  tv Need DEV_BSIZE and roundup() for makefs on non-NetBSD hosts.
 1.6 26-Feb-2002  tv Add some more bits of host compatibility.
 1.5 06-Feb-2002  lukem remove btodb() hack now that makefs doesn't need it anymore.
the #define was wrong anyway; it was x<<9 instead of x>>9
 1.4 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.3 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.2 24-Jan-2002  lukem - Replace pwcache(3) if necessary (pwcache_userdb(3) is checked for).
Tested on -current and 1.5.3.
- Wrap some long lines.
 1.1 22-Jan-2002  thorpej Split compat definitions into a separate file so that autoconf
doesn't comment out #undef's that we want to keep.
 1.15.2.6 23-Jul-2004  tron Apply patch (request by dbj in ticket 1723):
Fix building the netbsd-1-6 branch under Darwin/MacOS.
 1.15.2.5 22-Jun-2004  tron Pull up revision 1.40 (requested by jmc in ticket #1717):
On NetBSD boxes make sure and provide prototypes for strtouq since quad_t gets
exposed all the time, but routines which use it do not. Otherwise callers
of strtouq will lose.
XXX: Need to come back through here and clean up the configure tests better
for this
 1.15.2.4 16-Jun-2004  jmc Add some define's to null out RCSID/COPYRIGHT/etc. Also add _PATH_DEFTAPE.
Fixes issues from PR#24481
 1.15.2.3 14-Jun-2004  tron Pull up revision 1.36 (requested by jmc in ticket #1711):
Before sucking in stdlib.h check if this is NetBSD. If so, explicitly make
sure to use _POSIX_C_SOURCE and undef _NETBSD_SOURCE so the myriad of NetBSD
extentions don't get pulled into scope (and likely conflict at some point
with branched code trying to build on -current due to drift). Fixes PR#25533
XXX: The entire process here is just wacky and the entire cross tools process
needed to be reviewed to build clean w. just _POSIX_C_SOURCE or the equiv
set on NetBSD hosts or this will lose again somewhere..
 1.15.2.2 30-Nov-2002  he Pull up revision 1.18 (requested by thorpej in ticket #807):
o Check for mkstemp() and mkdtemp(), and build them into
libcompat if necessary.
o mktemp is now a host-tool, so remove the now obsoleted
script.
 1.15.2.1 03-Nov-2002  he Pull up revision 1.17 (requested by thorpej in ticket #802):
Add __restrict to the set of tokens we #define away: our
glob.h uses it.
 1.31.2.5 23-Jun-2004  jmc branches: 1.31.2.5.2;
Pullup rev 1.43 (requested by tron in ticket #539)

Define "_ISOC99_SOURCE" when building under NetBSD to get the prototypes
for strtoll() and strtoull()
 1.31.2.4 22-Jun-2004  tron Apply patch (requested by jmc in ticket #538):
Fix build problems caused by changes for ticket #527.
 1.31.2.3 22-Jun-2004  tron Pull up revision 1.40 (requested by jmc in ticket #527):
On NetBSD boxes make sure and provide prototypes for strtouq since quad_t gets
exposed all the time, but routines which use it do not. Otherwise callers
of strtouq will lose.
XXX: Need to come back through here and clean up the configure tests better
for this
 1.31.2.2 22-Jun-2004  tron Pull up revision 1.39 via patch (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.31.2.1 14-Jun-2004  tron Pull up revision 1.36 (requested by jmc in ticket #495):
Before sucking in stdlib.h check if this is NetBSD. If so, explicitly make
sure to use _POSIX_C_SOURCE and undef _NETBSD_SOURCE so the myriad of NetBSD
extentions don't get pulled into scope (and likely conflict at some point
with branched code trying to build on -current due to drift). Fixes PR#25533
XXX: The entire process here is just wacky and the entire cross tools process
needed to be reviewed to build clean w. just _POSIX_C_SOURCE or the equiv
set on NetBSD hosts or this will lose again somewhere..
 1.31.2.5.2.1 06-Apr-2005  he Pull up revision 1.44 (requested by jmc in ticket #1026):
Convert remaining host tools for amiga to correct cross tools.
Now allows complete amiga builds on non-NetBSD and non-BSD hosts.
 1.57.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.57.2.2 14-Feb-2009  snj Apply patch (requested by adrianp in ticket #1278):
Fix build on netbsd-5 amd64 hosts.
 1.57.2.1 30-Aug-2007  pavel branches: 1.57.2.1.2;
Pull up following revision(s) (requested by apb in ticket #827):
tools/compat/Makefile: revision 1.50
tools/compat/compat_defs.h: revision 1.60
tools/compat/configure.ac: revision 1.62-1.64
More detailed instructions for what to do when editing configure.ac.
In particular, discourage the use of non-tools versions of
autoconf and autoheader.
Provide definitions for {be,le}{16,32,64}{enc,dec} if necessary.
This is adapted from the very detailed fix provided by
Giles Lean in PR bin/36678.
Only one simplified implementation is provided, instead of the
two implementations conditional on __GNUC_PREREQ__(2,95) that are
provided in NetBSD's <sys/endian.h>. The use of memcpy instead of
__builtin__memcpy, and the absence of __inline or __unused, should make
it independent of GCC.
Update the instructions to say that regen should be done again
to pick up changed RCS IDs.
 1.57.2.1.2.1 14-Feb-2009  snj Apply patch (requested by adrianp in ticket #1278):
Fix build on netbsd-5 amd64 hosts.
 1.60.2.1 06-Nov-2007  matt sync with HEAD
 1.67.2.2 07-Jan-2010  snj Apply patch (requested by tron in ticket #1202):
Don't include grp.h Fixes cross-build under Mac OS X 10.6.
 1.67.2.1 15-Jan-2009  snj branches: 1.67.2.1.2; 1.67.2.1.4;
Pull up following revision(s) (requested by jmcneill in ticket #270):
tools/compat/compat_defs.h: revision 1.68
Apply part of the patch from Julio M. Merino Vidal in
http://mail-index.netbsd.org/source-changes/2009/01/05/msg214884.html
to make the toolchain cross-build on Mac OS X. Nozaki-san has addressed
the other issues.
 1.67.2.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.67.2.1.2.1 07-Jan-2010  snj Apply patch (requested by tron in ticket #1202):
Don't include grp.h Fixes cross-build under Mac OS X 10.6.
 1.71.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.81.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.81.2.3 30-Oct-2012  yamt sync with head
 1.81.2.2 17-Apr-2012  yamt sync with head
 1.81.2.1 10-Nov-2011  yamt sync with head
 1.83.2.1 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.86.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.86.2.2 23-Jun-2013  tls resync from head
 1.86.2.1 25-Feb-2013  tls resync with head
 1.88.4.1 23-Jul-2013  riastradh sync with HEAD
 1.95.2.1 10-Aug-2014  tls Rebase.
 1.97.2.2 22-Apr-2015  snj Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
 1.97.2.1 12-Nov-2014  snj Pull up following revision(s) (requested by martin in ticket #216):
share/man/man9/todr.9: revision 1.17
sys/arch/sh3/dev/rtc.c: revision 1.9
sys/dev/clock_subr.c: revision 1.17-1.22
sys/dev/clock_subr.h: revision 1.22
sys/fs/msdosfs/msdosfs_conv.c: revision 1.10
tools/compat/compat_defs.h: revision 1.98
tools/compat/dev/clock_subr.h: revision 1.1-1.2
usr.sbin/makefs/msdos/Makefile.inc: revision 1.6
clock_secs_to_ymdhms(9) takes seconds as a time_t, not int.
--
Make this compile- and usable from userland as well.
--
Add a slightly stripped down version of sys/dev/clock/clock_subr.h to make
this code available for tools.
--
Reformulate an overflow test so it can be used in tool builds (i.e. does
not depend on netbsd specific macros).
--
Make msdosfs time conversion use the y/m/d/h/m/s conversion functions
from clock_subr.c and compile that into the userland (and tools)
makefs as well.
--
Copy definitions of __type_min(t), __type_max(t), and some related macros,
from <sys/cdefs.h>, for use when building tools.
--
Revert previous; test secs > __type_max(time_t) again, now
that __type_max is available in tools/compat/compat_defs.h.
--
If HAVE_NBTOOL_CONFIG_H is set, then include "nbtool_config.h",
because this file is compiled as part of tools/makefs.
--
Counting leap years was fine while we had 32bit time_t - but now it
is not a good idea for dates far away in the future.
For dates in the year 2000 or later, use arithmetic instead (since the
repeating periods are well aligned). Should fix PR 49144.
--
Avoid overflowing the "year" value by making the field uint64_t. Adapt
arguments and local variables accordingly.
This now fixes PR 49144 for real.
--
Adapt formats for debug printfs to clock_subr type changes.
 1.103.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.103.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.103.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.107.6.2 21-Dec-2017  snj revert ticket 435
 1.107.6.1 21-Dec-2017  snj Pull up following revision(s) (requested by sevan in ticket #435):
tools/compat/compat_defs.h: 1.108
tools/compat/configure: 1.87-1.88
tools/compat/configure.ac: 1.88-1.89
tools/compat/fpurge.c: 1.2
tools/compat/nbtool_config.h.in: 1.41-1.42
handle __fpurge being declared in <stdio_ext.h>
--
regen
--
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.
Closes PR toolchain/52797
--
regen
 1.109.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.109.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.112.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.112.2.1 10-Jun-2019  christos Sync with HEAD
 1.116.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1973):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
usr.bin/nbperf/nbperf.c: revision 1.7
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)
tools/compat/configure (patch for regen from above)

Don't use arc4random for the tools build on NetBSD either.
compat_defs.h explicitly forces _POSIX_SOURCE and this hides the
prototype in stdlib.h.
pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.118.2.1 31-May-2021  cjep sync with head
 1.120.4.2 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1174):

tools/compat/configure.ac: revision 1.111 (patch)
tools/compat/compat_defs.h: revision 1.126 (patch)
tools/compat/compat_defs.h: revision 1.127 (patch)
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)

pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.120.4.1 17-Nov-2024  martin Pull up following revision(s) (requested by kre in ticket #1004):

tools/compat/configure: revision 1.106
lib/libc/string/__strsignal.c: revision 1.26
tools/compat/configure.ac: revision 1.108
tools/compat/nbtool_config.h.in: revision 1.57
usr.bin/elf2aout/elf2aout.c: revision 1.24
tools/compat/Makefile: revision 1.93
sys/arch/macppc/stand/fixcoff/fixcoff.c: revision 1.13
tools/compat/compat_defs.h: revision 1.123

Include <arpa/inet.h> for htonl() (From Jan-Benedict Glaw)
Probably this should be using htobe32() instead of htonl()
(and so <endian.h> rather than <arpa/inet.h>) as there is
no sign of any network anywhere near here. But that's for
another day, and to be done by someone who can test it.

Portability fixes from Jan-Benedict Glaw
The args to help() and usage() need to be const char *
and main() should be declared as returning int.

Add shquote to libnbcompat
Include shquote() in configure tests
Regen for added shquote()

Stop attempting to return a (char*) in place of (const char *)
This removes a cast that was added in 1994, when __strsignal()
returned a char * to convert the const char * element of sys_siglist
into a type that matched.

It should have been removed when __strsignal() was changed to
return const char * in 1998. But wasn't.

This should fix an inane warning (treated as an error) from a
compile stupid enough to allow a natural char * (as in char buf[N])
to be returned as a result (which is, of course, fine), but complains
about returning (char *) applied to a (const char *).
 1.122.2.1 02-Aug-2025  perseant Sync with HEAD
 1.125.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #56):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
tools/compat/nbtool_config.h.in: revision 1.60
tools/compat/nbtool_config.h.in: revision 1.61
lib/libc/stdio/mkstemps.c: revision 1.2
tools/compat/configure: revision 1.108
tools/compat/configure: revision 1.109
tools/compat/nbtool_config.h.in: revision 1.59
tools/compat/Makefile: revision 1.95
tools/compat/configure.ac: revision 1.110

Add more functions needed by mandoc

regen

add vsyslog decl check

regen

Do the nbtool dance.
 1.2 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.1 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.2 08-Nov-2007  christos make it so that we always use our own version of getopt_long as the comment
says.
 1.1 20-Jun-2004  jmc branches: 1.1.2; 1.1.18;
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.1.18.1 09-Jan-2008  matt sync with HEAD
 1.1.2.2 22-Jun-2004  tron Pull up revision 1.1 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.1.2.1 20-Jun-2004  tron file compat_getopt.h was added on branch netbsd-2-0 on 2004-06-22 07:31:16 +0000
 1.4 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.3 11-Nov-2001  jmc Pull the rmd160 stuff out as mtree now has options to selectively compile
pieces out we won't need during a build.
 1.2 08-Nov-2001  jmc XXX...Complete hack for now.

Add a stub for RMD160File which prints out a warning and returns NULL.

This allows mtree to be built when hosting from a 1.5.x box.
The real solution is to convert the src/tools bits into clean portable tools
and not have them so NetBSD-current centric.
 1.1 14-Aug-2001  tv Bootstrap toolchain framework, first pass.
 1.6 18-Jan-2009  christos Fix struct passwd time fields. From Shin'ichiro TAYA
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 01-Feb-2005  jmc branches: 1.4.24;
Define LOGIN_NAME_MAX explicitly here and override any system provided one
since the compat tools need to use the NetBSD limits, not the local system
ones (and some systems don't provide this yet anyways). Fixes PR#29170
 1.3 18-May-2004  sjg Apply patch from OGAWA Takaya to fix FreeBSD hosted builds.
The trick is to force use of the NetBSD versions of user_from_{uid,gid}().

PR: 24843
 1.2 03-Jul-2002  pooka work around FreeBSD defining user_from_uid() in stdlib.h
 1.1 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.4.24.1 18-May-2008  yamt sync with head.
 1.3 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.2 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.31 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.30 25-Jul-2003  atatat More properly host-tool-ify stat
 1.29 18-Jul-2003  fredb As discussed briefly on tech-toolchain, AIX doesn't have "u_long",
so add a check for that. Partial fix for PR toolchain/22177.
 1.28 14-Mar-2003  thorpej Add a putc_unlocked().
 1.27 13-Mar-2003  thorpej Check for sys/socket.h and socklen_t.
 1.26 29-Nov-2002  lukem replace missing strsuftoll(3)
 1.25 06-Oct-2002  lukem Provide strtoll() in libnbcompat.
Should fix relevant build issue on HP-UX and MacOS X hosts.
 1.24 06-Oct-2002  lukem complete check for lchflags
 1.23 04-Oct-2002  thorpej Check for <poll.h> and poll(2).
 1.22 16-Sep-2002  briggs Always use NetBSD's fts(3) in compat builds. Some systems (notably
Red Hat 7.3, at least) do not have fts(3) implementations that work
correctly with -D_FILE_OFFSET_BITS=64.
 1.21 14-Sep-2002  thorpej * Check for mkstemp() and mkdtemp(), and build them into libnbcompat
if necessary.
* mktemp is now a host-tool, so nuke the lame script (which isn't even
properly installed during the tools bootstrap).
 1.20 13-Sep-2002  thorpej * Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.19 03-Jul-2002  pooka Fine-grain checking somewhat:
* check for user_from_uid() in addition to pwcache_userdb()
* check for svis() in addition to vis()
 1.18 24-Apr-2002  bjh21 branches: 1.18.2;
Rather than hardcoding two possible locations of the POSIX shell (for
Solaris and everything else), set _PATH_BSHELL to the first occurrence of
"sh" on the path. This should be rather more portable.
 1.17 23-Apr-2002  bjh21 Add test for alloca() and <alloca.h>, since Sun Workshop C 5.0 needs this.
 1.16 18-Apr-2002  bjh21 Add a stub issetugid() for platforms that don't have it. For now, we assume
that no host program will be installed set-id, so the stub function always
returns 0.
 1.15 04-Apr-2002  bjh21 Add HAVE_SYS_ENDIAN_H.
 1.14 01-Apr-2002  bjh21 Revert addition of mkdtemp() to libnbcompat. I don't think we need mktemp(1)
after all.
 1.13 31-Mar-2002  bjh21 Add mkdtemp to libnbcompat, since glibc doesn't have it an mktemp(1) will
need it.
 1.12 31-Mar-2002  bjh21 Add the md[245], sha1 and rmd160 functions to libnbcompat, conditional on their
not being in the host libc.
This will be necessary to make cksum into a host tool.
 1.11 07-Mar-2002  tv Add compat defns for uint*_t (the non-underscored ones).
[The logic in all of this is ugly, and should instead be fixed up to use
AC_CHECK_SIZEOF to use primitives if the counterpart type is unavailable.]
 1.10 26-Feb-2002  tv Add some more bits of host compatibility.
 1.9 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.8 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.7 24-Jan-2002  lukem - Replace pwcache(3) if necessary (pwcache_userdb(3) is checked for).
Tested on -current and 1.5.3.
- Wrap some long lines.
 1.6 22-Jan-2002  thorpej Split compat definitions into a separate file so that autoconf
doesn't comment out #undef's that we want to keep.
 1.5 21-Jan-2002  tv Somewhere along the line, the _DIAGASSERT was lost. Re-add it (as a macro
that expands to nothing); only NetBSD hosts really have this.
 1.4 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.3 10-Jan-2002  lukem look for <inttypes.h> and #include if found (for uint*_t)
 1.2 04-Jan-2002  lukem Add replacement fgetln(3) (from lukemftp/libukem), as fparseln(3) uses it
 1.1 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.18.2.4 23-Jul-2004  tron Apply patch (request by dbj in ticket 1723):
Fix building the netbsd-1-6 branch under Darwin/MacOS.
 1.18.2.3 01-Dec-2002  he Pull up revision 1.22 (requested by thorpej in ticket #834):
Always NetBSD's own fts(3) in compat builds. Some systems
(among them RedHat 7.3) do not have fts(3) implementations
which work correctly with -D_FILE_OFFSET_BITS=64.
 1.18.2.2 30-Nov-2002  he Pull up revision 1.21 (requested by thorpej in ticket #807):
o Check for mkstemp() and mkdtemp(), and build them into
libcompat if necessary.
o mktemp is now a host-tool, so remove the now obsoleted
script.
 1.18.2.1 03-Nov-2002  he Pull up revision 1.20 (via patch, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.109 18-Sep-2025  christos regen
 1.108 18-Sep-2025  christos regen
 1.107 24-Jul-2025  hans branches: 1.107.2;
tools/compat: add definitions of __[u]intXX_t types on systems that lack them

Fixes another cross-build issue on illumos.
 1.106 31-Oct-2024  kre Regen for added shquote()
 1.105 20-Jul-2023  lukem branches: 1.105.2;
tools/compat: regen
 1.104 20-Jul-2023  lukem tools/compat: regen
 1.103 03-Jun-2023  lukem regen
 1.102 30-May-2023  lukem tools/compat: regen
 1.101 29-May-2023  lukem tools/compat: regen
 1.100 23-May-2023  lukem tools/compat: regen for dispatch_semaphore_create
 1.99 25-Feb-2021  christos branches: 1.99.6;
Add reallocarray; this is used by the new regex code and we don't want to
convert it to reallocarr so the code is kept similar with the original from
FreeBSD.
 1.98 24-Jun-2020  uwe Regen: Add AC_MSG_RESULT yes/no to the uio checks.
 1.97 22-Jun-2019  hannken branches: 1.97.2;
Bring back two lines deleted by accident. From Kamil Rytarowski.
 1.96 22-Jun-2019  hannken Update tools/compat/configure for new path of "rpc/types.h".

Remove intermediate patch from rpcgen/Makefile.

Patch from Nick Hudson, errors from me.
 1.95 19-Jun-2019  kamil regen tools/compat
 1.94 19-Jun-2019  kamil Add sys/uio.h & enum uio_seg, enum uio_rw to tools/compat

This is needed for bootstrapping the tools on Ubuntu 16.x.
 1.93 30-Aug-2018  christos deal with getsubopt and strncasecmp (needed by mdocml)
 1.92 16-Aug-2018  christos add strncasecmp
 1.91 11-Aug-2018  christos Add strcasecmp
 1.90 13-Jun-2018  maya branches: 1.90.2;
Revert my previous config test inclusion for u_longlong_t.

Fixing this differently by avoiding the need for the definition.
It also caused a problem in OS X, as I neglected to include a correct header
 1.89 11-Jun-2018  maya Add configure check and fallback definition for u_longlong_t

Should help linux tools compilation of dtrace tools, and not
affect NetBSD.

From Chuck Zmudzinski in current-users, with light modification
by myself.
 1.88 09-Dec-2017  sevan branches: 1.88.2;
regen
 1.87 02-Oct-2017  christos regen
 1.86 07-Jan-2017  christos branches: 1.86.6;
regen
 1.85 19-Oct-2016  christos regen
 1.84 20-Jan-2016  christos branches: 1.84.2;
Regen with autoconf 2.69.
 1.83 26-Jul-2015  kamil Add reallocarr(3) to tools/compat

This should unbreak libutil(3) creation on systems withot reallocarr(3).
 1.82 16-Jan-2015  christos regen
 1.81 06-Jun-2014  christos branches: 1.81.2;
Deal with errc/warnc
 1.80 09-Jan-2014  apb branches: 1.80.2;
regen
 1.79 14-Aug-2013  jmcneill regen
 1.78 09-Aug-2013  jmcneill regen
 1.77 06-Aug-2013  apb regen, to pick up the test for snprintb_m.
 1.76 19-Jul-2013  pooka regen

(XXX: I don't think these files were previously regen'd with the
method documented in configure.ac, and therefore the diffs are now huge)
 1.75 05-Mar-2013  christos branches: 1.75.4;
regen
 1.74 17-Feb-2013  christos regen
 1.73 03-Nov-2011  joerg branches: 1.73.6;
Add getline(3) compat glue.
 1.72 14-Aug-2011  apb branches: 1.72.2;
regen
 1.71 15-Jan-2010  asau Regenerate.
 1.70 16-Jun-2009  christos add fpurge; needed by awk.
 1.69 03-Feb-2009  dbj do not require sys/mtio.h for a tools build of pax
 1.68 05-Jan-2009  tnozaki 1. reworking PR lib/40317:
libnbcompat already contains empty fparseln.lo
so previous fix doesn't work correctly.
i've just added broken fparseln check to configure script.

2. reworking cross build breakage under FreeBSD/MacOS X.
FreeBSD/MacOS X still have public /usr/include/runetype.h
derived from 4.4BSD-Lite. so i renamed out private header from
src/lib/libc/locale/runetype.h to src/lib/libc/locale/runetype_local.h
to solve this problems.

3. fix build breakage when CITRUS=no was set.
 1.67 18-Oct-2008  tsutsui branches: 1.67.2;
Regen from configure.ac rev 1.67:
> Prepare dummy <resolv.h> and <arpa/nameser.h> to make asn1_compile and
> compile_et compile on systems which don't have these BIND headers like Cygwin.
 1.66 14-Oct-2008  tsutsui Regen autoconf stuff using tools version of autoconf (in src/tools/autoconf),
as per suggestion from apb@ on tech-toolchain.
Tested 'build.sh -U release iso-image' on NetBSD/i386 4.99.73.
 1.65 19-Oct-2007  christos I am now convinced of the error of my ways, and I am checking for all the
decls mtree is using.
 1.64 28-Sep-2007  lukem regen for raise_default_signal
 1.63 07-Aug-2007  apb branches: 1.63.2;
Regen after recent changes to configure.ac and compat_defs.h.
(Most of the changes seem to result from somebody having used
non-tools versions of autoconf and autoheader in the past.)
 1.62 03-Jul-2007  nakayama Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.
 1.61 09-Oct-2006  christos branches: 1.61.2; 1.61.4;
regen.
 1.60 07-Oct-2006  apb regen
 1.59 20-Aug-2006  thorpej Also check for DIR.__dd_fd. tools/compat now builds on the WWDC developer
preview version of Mac OS X "Leopard".
 1.58 22-Feb-2006  dogcow Twiddle configure/configure.ac to check/define/create machine/endian.h; this
should fix PR/32878. Tested on NetBSD-current, FreeBSD4, Solaris8.
 1.57 11-Feb-2006  wiz regen
 1.56 11-Feb-2006  wiz regen
 1.55 11-Feb-2006  wiz regen.
 1.54 09-Feb-2006  wiz regen.
 1.53 09-Feb-2006  dogcow change #include <sys/endian.h> => #include <machine/endian.h> so that
it's (more) consistent in the tree; this, along with changing tools/compat's
autoconf detection from AC_CHECK_FUNCS to AC_CHECK_DECLS makes the vast
majority of htobe16 and friends' redefinition errors bite the dust.
Tested with -current and FreeBSD.
 1.52 02-Feb-2006  dbj regen
 1.51 02-Mar-2005  wiz Remove commas in AC_CHECK_FUNCS that shouldn't be there.
Closes PR 29577 by Valeriy E. Ushakov.
 1.50 13-Jan-2005  jmc Turns out some platforms (freebsd5) expose st_birthtime but not
st_birthtimensec. Make sure and check for both so programs can deal w. it
 1.49 28-Nov-2004  jmc Add heapsort to libnbcompat
 1.48 12-Oct-2004  jmc Check for fstatvfs and provide/use it only if the host system has it.
Fixes PR#27221
 1.47 24-Jul-2004  dbj check for HAVE_STRUCT_STATVFS_F_IOSIZE
addresses PR toolchain/26415
 1.46 24-Jul-2004  dbj remove HAVE_STRUCT_STATFS_F_IOSIZE
this is not currently being used and should be replaced with
HAVE_STRUCT_STATVFS_F_IOSIZE, but that will be done separately.
This commit should be able to be safely pulled up to
the netbsd-2-0 branch to address PR toolchain/26415
 1.45 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.44 18-Jun-2004  thorpej Regen.
 1.43 12-Nov-2003  dbj branches: 1.43.2;
regen after HAVE_SYS_POLL_H change
 1.42 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.41 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.40 25-Jul-2003  atatat Regen for host-tool-ified stat
 1.39 18-Jul-2003  fredb Regenerate with autoconf 2.57.
 1.38 18-Jul-2003  fredb As discussed briefly on tech-toolchain, AIX doesn't have "u_long",
so add a check for that. Partial fix for PR toolchain/22177.
 1.37 03-Jun-2003  uwe Add atoll(3) to libnbcompat. We need it when building target's gcc
for a 64-bit target on a 32-bit host.

NB: There seems to be a bug in either gcc itself or the way we import
it, b/c the incorrect #define HAVE_ATOLL is picked from (e.g. for
sparc64) gnu/usr.bin/gcc/arch/sparc64/auto-host.h - so when gen*
auxilary (host) programs are built in gnu/usr.bin/gcc/backend, they
incorrectly pick-up target's HAVE_ATOLL.

For now providing atoll(3) in libnbcompat is a simple and sufficient
workaround.
 1.36 14-Mar-2003  thorpej Add a putc_unlocked().
 1.35 13-Mar-2003  thorpej Fix the socklen_t test; we need to explcitly list the headers we want
included for that test.
 1.34 13-Mar-2003  thorpej Check for sys/socket.h and socklen_t.
 1.33 16-Dec-2002  thorpej Include <sys/types.h> before <grp.h>; Mac OS 10.2.2 needs this.
 1.32 16-Dec-2002  thorpej Include <sys/types.h> before including <dirent.h>; Mac OS 10.2.2
needs this.
 1.31 30-Nov-2002  lukem add check back for util.h; needed on some foreign systems
 1.30 30-Nov-2002  lukem - Migrate fparseln(3) from libutil to libc, where it should have been in
the first place...
- Bump libutil major (to 7.0) and libc minor (to 12.91).
 1.29 29-Nov-2002  lukem replace missing strsuftoll(3)
 1.28 07-Oct-2002  briggs Just check for poll.h, don't fail if it's not present.
 1.27 06-Oct-2002  lukem Provide strtoll() in libnbcompat.
Should fix relevant build issue on HP-UX and MacOS X hosts.
 1.26 05-Oct-2002  lukem check for lchflags
 1.25 04-Oct-2002  thorpej Check for <poll.h> and poll(2).
 1.24 16-Sep-2002  briggs Always use NetBSD's fts(3) in compat builds. Some systems (notably
Red Hat 7.3, at least) do not have fts(3) implementations that work
correctly with -D_FILE_OFFSET_BITS=64.
 1.23 14-Sep-2002  thorpej * Check for mkstemp() and mkdtemp(), and build them into libnbcompat
if necessary.
* mktemp is now a host-tool, so nuke the lame script (which isn't even
properly installed during the tools bootstrap).
 1.22 13-Sep-2002  thorpej * Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.21 03-Jul-2002  pooka Fine-grain checking somewhat:
* check for user_from_uid() in addition to pwcache_userdb()
* check for svis() in addition to vis()
 1.20 24-Apr-2002  bjh21 branches: 1.20.2;
Rather than hardcoding two possible locations of the POSIX shell (for
Solaris and everything else), set _PATH_BSHELL to the first occurrence of
"sh" on the path. This should be rather more portable.
 1.19 23-Apr-2002  bjh21 Add test for alloca() and <alloca.h>, since Sun Workshop C 5.0 needs this.
 1.18 22-Apr-2002  bjh21 Create sys/endian.h if it doesn't exist, since rmd160.c includes it directly.
 1.17 19-Apr-2002  tv Emit an empty <stdint.h> if the host doesn't have one. Should fix PR 16416.
 1.16 18-Apr-2002  tv Re-add test for <sys/endian.h>; it disappeared somewhere along the way.
 1.15 18-Apr-2002  bjh21 Add a stub issetugid() for platforms that don't have it. For now, we assume
that no host program will be installed set-id, so the stub function always
returns 0.
 1.14 01-Apr-2002  bjh21 Revert addition of mkdtemp() to libnbcompat. I don't think we need mktemp(1)
after all.
 1.13 31-Mar-2002  bjh21 Add mkdtemp to libnbcompat, since glibc doesn't have it an mktemp(1) will
need it.
 1.12 31-Mar-2002  bjh21 Add the md[245], sha1 and rmd160 functions to libnbcompat, conditional on their
not being in the host libc.
This will be necessary to make cksum into a host tool.
 1.11 07-Mar-2002  tv Don't gratuitously touch the replacement headers in ${.OBJDIR}/include;
instead, touch them only if they're changed.
 1.10 07-Mar-2002  tv Move inttypes.h to list of auto-generated-empty headers.
 1.9 07-Mar-2002  tv Add compat defns for uint*_t (the non-underscored ones).
[The logic in all of this is ugly, and should instead be fixed up to use
AC_CHECK_SIZEOF to use primitives if the counterpart type is unavailable.]
 1.8 26-Feb-2002  tv Add some more bits of host compatibility.
 1.7 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.6 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.5 24-Jan-2002  lukem - Replace pwcache(3) if necessary (pwcache_userdb(3) is checked for).
Tested on -current and 1.5.3.
- Wrap some long lines.
 1.4 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.3 10-Jan-2002  lukem regen from configure.ac 1.3 for <inttypes.h> change
 1.2 04-Jan-2002  lukem Add replacement fgetln(3) (from lukemftp/libukem), as fparseln(3) uses it
 1.1 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.20.2.4 23-Jul-2004  tron Apply patch (request by dbj in ticket 1723):
Fix building the netbsd-1-6 branch under Darwin/MacOS.
 1.20.2.3 01-Dec-2002  he Pull up revision 1.24 (requested by thorpej in ticket #834):
Always NetBSD's own fts(3) in compat builds. Some systems
(among them RedHat 7.3) do not have fts(3) implementations
which work correctly with -D_FILE_OFFSET_BITS=64.
 1.20.2.2 30-Nov-2002  he Pull up regenerated file (requested by thorpej in ticket #807):
o Check for mkstemp() and mkdtemp(), and build them into
libcompat if necessary.
o mktemp is now a host-tool, so remove the now obsoleted
script.
 1.20.2.1 03-Nov-2002  he Pull up regenerated file (requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.43.2.2 25-Jul-2004  tron branches: 1.43.2.2.2;
Pull up revision 1.46 (requested by dbj in ticket #712):
remove HAVE_STRUCT_STATFS_F_IOSIZE
this is not currently being used and should be replaced with
HAVE_STRUCT_STATVFS_F_IOSIZE, but that will be done separately.
This commit should be able to be safely pulled up to
the netbsd-2-0 branch to address PR toolchain/26415
 1.43.2.1 22-Jun-2004  tron Pull up revision 1.45 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.43.2.2.2.1 06-Apr-2005  he Pull up revision 1.49 (via patch, requested by jmc in ticket #1026):
Convert remaining host tools for amiga to correct cross tools.
Now allows complete amiga builds on non-NetBSD and non-BSD hosts.
 1.61.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.61.2.3 14-Feb-2009  snj Apply patch (requested by adrianp in ticket #1278):
Fix build on netbsd-5 amd64 hosts.
 1.61.2.2 18-Nov-2008  snj Regen for ticket 1224.
 1.61.2.1 31-Aug-2007  pavel branches: 1.61.2.1.2;
regen for ticket #827. Files provided by apb@.
 1.61.2.1.2.1 14-Feb-2009  snj Apply patch (requested by adrianp in ticket #1278):
Fix build on netbsd-5 amd64 hosts.
 1.63.2.1 06-Nov-2007  matt sync with HEAD
 1.67.2.3 02-Nov-2011  riz Pull up following revision(s) (requested by tsutsui in ticket #1676):
tools/compat/configure.ac: revision 1.71
tools/compat/configure: revision 1.71
tools/compat/nbtool_config.h.in: revision 1.24
Test for <sys/endian.h> and provide HAVE_SYS_ENDIAN_H.
Fixes FreeBSD hosted builds (PR 42440 and PR 42470).
Approved by <dholland>.
Regenerate.
 1.67.2.2 03-Oct-2009  snj Pull up following revision(s) (requested by apb in ticket #1020):
bin/pax/Makefile: revision 1.38
bin/pax/ar_io.c: revision 1.49
tools/compat/configure: revision 1.69
tools/compat/configure.ac: revision 1.69
do not require sys/mtio.h for a tools build of pax
 1.67.2.1 15-Jan-2009  snj branches: 1.67.2.1.2; 1.67.2.1.4;
Regen for ticket 270.
 1.67.2.1.4.1 15-Dec-2009  matt Allow tools to build on OSX 10.6 (Snow Leopard).
 1.67.2.1.2.1 03-Oct-2009  snj Pull up following revision(s) (requested by apb in ticket #1020):
bin/pax/Makefile: revision 1.38
bin/pax/ar_io.c: revision 1.49
tools/compat/configure: revision 1.69
tools/compat/configure.ac: revision 1.69
do not require sys/mtio.h for a tools build of pax
 1.72.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.72.2.1 10-Nov-2011  yamt sync with head
 1.73.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.73.6.2 23-Jun-2013  tls resync from head
 1.73.6.1 25-Feb-2013  tls resync with head
 1.75.4.1 23-Jul-2013  riastradh sync with HEAD
 1.80.2.1 10-Aug-2014  tls Rebase.
 1.81.2.1 22-Apr-2015  snj Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
 1.84.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.84.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.86.6.3 03-Feb-2018  snj Pull up following revision(s) (requested by sevan in ticket #435):
tools/compat/configure: revision 1.88 via patch
tools/compat/configure.ac: revision 1.89 via patch
tools/compat/nbtool_config.h.in: revision 1.42
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.
Closes PR toolchain/52797
--
regen
 1.86.6.2 21-Dec-2017  snj revert ticket 435
 1.86.6.1 21-Dec-2017  snj Pull up following revision(s) (requested by sevan in ticket #435):
tools/compat/compat_defs.h: 1.108
tools/compat/configure: 1.87-1.88
tools/compat/configure.ac: 1.88-1.89
tools/compat/fpurge.c: 1.2
tools/compat/nbtool_config.h.in: 1.41-1.42
handle __fpurge being declared in <stdio_ext.h>
--
regen
--
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.
Closes PR toolchain/52797
--
regen
 1.88.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.90.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.90.2.1 10-Jun-2019  christos Sync with HEAD
 1.97.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1973):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
usr.bin/nbperf/nbperf.c: revision 1.7
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)
tools/compat/configure (patch for regen from above)

Don't use arc4random for the tools build on NetBSD either.
compat_defs.h explicitly forces _POSIX_SOURCE and this hides the
prototype in stdlib.h.
pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.99.6.3 19-Oct-2025  martin Apply patch, requested by mrg in ticket #1174:

tools/compat/configure

apply tools/compat/configure.ac rev 1.110 and 1.111:
fixes for modern compilers.
 1.99.6.2 17-Nov-2024  martin Pull up following revision(s) (requested by kre in ticket #1004):

tools/compat/configure: revision 1.106
lib/libc/string/__strsignal.c: revision 1.26
tools/compat/configure.ac: revision 1.108
tools/compat/nbtool_config.h.in: revision 1.57
usr.bin/elf2aout/elf2aout.c: revision 1.24
tools/compat/Makefile: revision 1.93
sys/arch/macppc/stand/fixcoff/fixcoff.c: revision 1.13
tools/compat/compat_defs.h: revision 1.123

Include <arpa/inet.h> for htonl() (From Jan-Benedict Glaw)
Probably this should be using htobe32() instead of htonl()
(and so <endian.h> rather than <arpa/inet.h>) as there is
no sign of any network anywhere near here. But that's for
another day, and to be done by someone who can test it.

Portability fixes from Jan-Benedict Glaw
The args to help() and usage() need to be const char *
and main() should be declared as returning int.

Add shquote to libnbcompat
Include shquote() in configure tests
Regen for added shquote()

Stop attempting to return a (char*) in place of (const char *)
This removes a cast that was added in 1994, when __strsignal()
returned a char * to convert the const char * element of sys_siglist
into a type that matched.

It should have been removed when __strsignal() was changed to
return const char * in 1998. But wasn't.

This should fix an inane warning (treated as an error) from a
compile stupid enough to allow a natural char * (as in char buf[N])
to be returned as a result (which is, of course, fine), but complains
about returning (char *) applied to a (const char *).
 1.99.6.1 30-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #221):

external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c: revision 1.18
external/cddl/osnet/sys/sys/opentypes.h: revision 1.7
tools/compat/configure: revision 1.100
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.6
external/cddl/osnet/dist/tools/ctf/cvt/barrier.h: revision 1.4
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.7
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.8
tools/compat/configure.ac: revision 1.100
external/cddl/osnet/dist/tools/ctf/cvt/tdata.c: revision 1.10
tools/compat/nbtool_config.h.in: revision 1.54

ctfmerge: error check sem_*() and pthread_*() APIs

terminate() if sem_*() returns -1 or pthread_*() returns != 0.
(Set errno from pthread_*() so terminate() prints the strerror message).

Note: Failing on errors instead of ignoring them helps identify
reasons for intermittent failures, such as those on macOS host builds:

ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented

ctfmerge: fix macOS semaphore implementation

Use dispatch_semaphore_create() if present instead of sem_init().
macOS doesn't actually implement sem_init() (et al)
(even though it provides the prototypes as deprecated).

This was detected by the previous commit to ctfmerge
that added error handling.

Implement ctfmerge's barrier operations in terms of
dispatch(3) APIs such as dispatch_semaphore_create() (et al).

Update tools/compat/configure.ac to find dispatch_semaphore_create().
Fixes ctfmerge on macOS hosts.

Inspired by https://stackoverflow.com/a/27847103

tools/compat: regen for dispatch_semaphore_create

ctfmerge: fix macOS semaphore implementation, part 2
dispatch_semaphore_signal() doesn't return an error, just an
indicator of whether a thread was woken or not, so there's
no need to fail on non-zero return.

osnet: on macOS, use <mach/boolean.h> for boolean_t
macOS/x86_64 defines boolean_t as 'unsigned int' not 'int',
which causes a build issue with tools/ctfmerge on that host
after my recent fixes for macOS semaphores.

So use the <mach/boolean.h> instead of a local typedef ifdef __APPLE__.
May fix a macOS/x86_64 build issue reported by cjep@.
Builds fine on NetBSD/amd64 or macOS/arm.

Note: this compat stuff is clunky, and based on the commit log,
annoyingly error prone. A newer sync of osnet from upstream /may/
improve a lot of these compat typedef workarounds for solaris types...
 1.105.2.1 02-Aug-2025  perseant Sync with HEAD
 1.107.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #56):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
tools/compat/nbtool_config.h.in: revision 1.60
tools/compat/nbtool_config.h.in: revision 1.61
lib/libc/stdio/mkstemps.c: revision 1.2
tools/compat/configure: revision 1.108
tools/compat/configure: revision 1.109
tools/compat/nbtool_config.h.in: revision 1.59
tools/compat/Makefile: revision 1.95
tools/compat/configure.ac: revision 1.110

Add more functions needed by mandoc

regen

add vsyslog decl check

regen

Do the nbtool dance.
 1.111 18-Sep-2025  christos add vsyslog decl check
 1.110 18-Sep-2025  christos Add more functions needed by mandoc
 1.109 24-Jul-2025  hans branches: 1.109.2;
tools/compat: add definitions of __[u]intXX_t types on systems that lack them

Fixes another cross-build issue on illumos.
 1.108 31-Oct-2024  kre Include shquote() in configure tests
 1.107 20-Jul-2023  lukem branches: 1.107.2;
tools: binstall can use posix_spawn() instead of vfork()
 1.106 20-Jul-2023  lukem tools/compat: provide nb_check_cc_flag.m4

Implement m4 macro NB_CHECK_CC_FLAG(FLAG, [VAR=FLAG_DERIVED])
Determine if the C compiler supports FLAG,
and sets output variable VAR to FLAG if FLAG is supported.

If VAR is not provided, default to FLAG_DERIVED, which is
FLAG converted to upper-case and all special characters
replaced with "_", and the result prepended with "CC_".
FLAG_DERIVED is appended to the m4 macro NB_CHECK_CC_FLAG_VARS.
E.g., if FLAG is "-Wexample=yes", FLAG_DERIVED is "CC_WEXAMPLE_YES".

This is implemented in separate buildaux/nb_check_cc_flag.m4,
based on configure's NB_CC_FLAG(), but supports VAR override.

Adapt configure from internal NB_CC_FLAG() to NB_CHECK_CC_FLAG().

(Note: AX_CHECK_COMPILE_FLAG() from autoconf-archive could be enhanced
to support the clang and gcc workarounds I've implemented here.)
 1.105 03-Jun-2023  lukem tools/compat: support all bsd.own.mk disabled warnings

Check the host CC support for all the warnings now in <bsd.own.mk>
and override appropriately in defs.mk.

In general there's a 1:1 mapping, with the special case
CC_WNO_ADDRESS_OF_PACKED_MEMBER which is set from both
@CC_WNO_ADDRESS_OF_PACKED_MEMBER@ (gcc) and
@CC_WNO_ERROR_ADDRESS_OF_PACKED_MEMBER@ (clang).
 1.104 30-May-2023  lukem tools/compat: disable host CC warnings

Determine if the host CC supports flags to disable various
warnings similar to <bsd.own.mk> GCC_*, CLANG_*, and CC_*,
and override the <bsd.own.mk> equivalents in defs.mk.

Silences "warning: unknown warning option '...'" from our source.
External source (e.g., binutils and gcc) need their own fixes
to enhance their detection of supported clang compiler flags.
 1.103 30-May-2023  lukem tools/compat: detect supported host compiler flags

Define NB_CC_FLAG(FLAG) to use AX_CHECK_COMPILE_FLAG
to determine if the host compiler supports FLAG
and define and AC_SUBST CC_FLAG if so.

Use workarounds to force clang to hard-fail on unknown -Wwarning,
and gcc to use -WWARN to check unknown -Wno-WARN because the
latter doesn't cause an error in gcc.

In the future we could use NB_CC_FLAG([-fcommon]) for
older NetBSD release branches compiled with host gcc 10+.

Rework Darwin -no-cpp-precomp check to use NB_CC_FLAG().
Note: this flag probably hasn't been required on macOS (Darwin)
for a long time, but serves as a good example on how to use this.

Display varaibles at the end of configure to show what was detected.
 1.102 30-May-2023  lukem tools/compat: don't expose HAVE_PTHREAD_H to make

Non of the tools Makefiles needs HAVE_PTHREAD_H, so don't
AC_SUBST it or provide in defs.mk.
 1.101 29-May-2023  lukem tools/compat/configure.ac: style tweaks

Use "NB_" prefix not "AC_" for our macros ("AC_" is for autoconf).
Fail is NB_ macro isn't defined.
Use AC_DEFUN() instead of define().
Consistently use () in zero argument macro calls.
 1.100 23-May-2023  lukem ctfmerge: fix macOS semaphore implementation

Use dispatch_semaphore_create() if present instead of sem_init().

macOS doesn't actually implement sem_init() (et al)
(even though it provides the prototypes as deprecated).
This was detected by the previous commit to ctfmerge
that added error handling.

Implement ctfmerge's barrier operations in terms of
dispatch(3) APIs such as dispatch_semaphore_create() (et al).

Update tools/compat/configure.ac to find dispatch_semaphore_create().

Fixes ctfmerge on macOS hosts.

Inspired by https://stackoverflow.com/a/27847103.
 1.99 25-Feb-2021  christos branches: 1.99.6;
Add reallocarray; this is used by the new regex code and we don't want to
convert it to reallocarr so the code is kept similar with the original from
FreeBSD.
 1.98 24-Jun-2020  uwe Add AC_MSG_RESULT yes/no to the uio checks.
 1.97 22-Jun-2019  hannken branches: 1.97.2;
Update tools/compat/configure for new path of "rpc/types.h".

Remove intermediate patch from rpcgen/Makefile.

Patch from Nick Hudson, errors from me.
 1.96 19-Jun-2019  kamil Add more SunOS types to tools/compat

Add fallback defintions of: uchar_t, ushort_t, uint_t, ulong_t.

Needed by the libctf code on Ubuntu 16.x.
 1.95 19-Jun-2019  kamil Add sys/uio.h & enum uio_seg, enum uio_rw to tools/compat

This is needed for bootstrapping the tools on Ubuntu 16.x.
 1.94 30-Aug-2018  christos deal with getsubopt and strncasecmp (needed by mdocml)
 1.93 16-Aug-2018  christos add strncasecmp
 1.92 11-Aug-2018  christos Add strcasecmp
 1.91 13-Jun-2018  maya branches: 1.91.2;
Revert my previous config test inclusion for u_longlong_t.

Fixing this differently by avoiding the need for the definition.
It also caused a problem in OS X, as I neglected to include a correct header
 1.90 11-Jun-2018  maya Add configure check and fallback definition for u_longlong_t

Should help linux tools compilation of dtrace tools, and not
affect NetBSD.

From Chuck Zmudzinski in current-users, with light modification
by myself.
 1.89 09-Dec-2017  sevan branches: 1.89.2;
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.

Closes PR toolchain/52797
 1.88 02-Oct-2017  christos handle __fpurge being declared in <stdio_ext.h>
 1.87 07-Jan-2017  christos branches: 1.87.6;
strmode on MacOS/X is in string.h
 1.86 07-Jan-2017  christos Check for declarations, not the existance of functions since some are
visible only when _NETBSD_SOURCE is defined. This avoids || defined(__NetBSD__)
hacks.
 1.85 19-Oct-2016  christos try to fix missing decls
 1.84 26-Jul-2015  kamil branches: 1.84.2;
Add reallocarr(3) to tools/compat

This should unbreak libutil(3) creation on systems withot reallocarr(3).
 1.83 16-Jan-2015  christos strto{i,u}
 1.82 06-Jun-2014  christos branches: 1.82.2;
Deal with errc/warnc
 1.81 09-Jan-2014  apb branches: 1.81.2;
Add strnlen to configure tests in tools/compat
 1.80 14-Aug-2013  jmcneill add test for struct tm tm_gmtoff member
 1.79 09-Aug-2013  jmcneill makefs_udf uses clock_gettime, and on some versions of linux that lives in librt
 1.78 06-Aug-2013  apb Add a configure test for snprintb_m. We will assume that
the rpesence of snprintb_m implies the presence of snprintb.
 1.77 19-Jul-2013  pooka Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal
 1.76 05-Mar-2013  christos branches: 1.76.4;
add dprintf
 1.75 17-Feb-2013  christos cygwin defines u_quad_t in <rpc/types.h>, so include this to the headers
we include and test by default.
 1.74 03-Nov-2011  joerg branches: 1.74.6;
Add getline(3) compat glue.
 1.73 14-Aug-2011  apb branches: 1.73.2;
Detect the presence of <pthread.h>, and add a HAVE_PTHREAD_H
variable in defs.mk.
 1.72 14-Aug-2011  apb Prevent expansion of <dollar>NetBSD<dollar> in a string that's
indended to be copied to nbtool_config.h.

Fix most lines longer than 80 columns. I don't know how to fix the
long lines in the definition of NB_CHECK_INTTYPE.
 1.71 15-Jan-2010  asau Test for <sys/endian.h> and provide HAVE_SYS_ENDIAN_H.
Fixes FreeBSD hosted builds (PR 42440 and PR 42470).

Approved by <dholland>.
 1.70 16-Jun-2009  christos add fpurge; needed by awk.
 1.69 03-Feb-2009  dbj do not require sys/mtio.h for a tools build of pax
 1.68 05-Jan-2009  tnozaki 1. reworking PR lib/40317:
libnbcompat already contains empty fparseln.lo
so previous fix doesn't work correctly.
i've just added broken fparseln check to configure script.

2. reworking cross build breakage under FreeBSD/MacOS X.
FreeBSD/MacOS X still have public /usr/include/runetype.h
derived from 4.4BSD-Lite. so i renamed out private header from
src/lib/libc/locale/runetype.h to src/lib/libc/locale/runetype_local.h
to solve this problems.

3. fix build breakage when CITRUS=no was set.
 1.67 18-Oct-2008  tsutsui branches: 1.67.2;
Prepare dummy <resolv.h> and <arpa/nameser.h> to make asn1_compile and
compile_et compile on systems which don't have these BIND headers like Cygwin.

Tested by "build.sh -m i386 -U release" on CYGWIN_NT-5.1-1.5.25,
and should close PR toolchain/29032.
 1.66 19-Oct-2007  christos I am now convinced of the error of my ways, and I am checking for all the
decls mtree is using.
 1.65 28-Sep-2007  lukem Add raise_default_signal().
 1.64 07-Aug-2007  apb branches: 1.64.2;
Update the instructions to say that regen should be done again
to pick up changed RCS IDs.
 1.63 07-Aug-2007  apb Provide definitions for {be,le}{16,32,64}{enc,dec} if necessary.
This is adapted from the very detailed fix provided by
Giles Lean in PR bin/36678.

Only one simplified implementation is provided, instead of the
two implementations conditional on __GNUC_PREREQ__(2,95) that are
provided in NetBSD's <sys/endian.h>. The use of memcpy instead of
__builtin__memcpy, and the absence of __inline or __unused, should make
it independent of GCC.
 1.62 07-Aug-2007  apb More detailed instructions for what to do when editing configure.ac.
In particular, discourage the use of non-tools versions of
autoconf and autoheader.
 1.61 03-Jul-2007  nakayama Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.
 1.60 09-Oct-2006  christos branches: 1.60.2; 1.60.4;
sideways check for error functions.
 1.59 07-Oct-2006  elad PR/31232: Wim Lewis: tools/compat doesn't check for pre-existence of
strmode()

Commited slightly different diff, input and okay from apb@
 1.58 20-Aug-2006  thorpej Also check for DIR.__dd_fd. tools/compat now builds on the WWDC developer
preview version of Mac OS X "Leopard".
 1.57 22-Feb-2006  dogcow Twiddle configure/configure.ac to check/define/create machine/endian.h; this
should fix PR/32878. Tested on NetBSD-current, FreeBSD4, Solaris8.
 1.56 11-Feb-2006  wiz Redo previous differently: use AH_TOP and AH_BOTTOM macros to insert
header and footer into nbtool_config.h.in directly.
 1.55 11-Feb-2006  wiz Make using autoheader easier:
split off the autogenerated file into nbtool_config_internal.h,
and let nbtool_config.h be a file with the proper wrappers.

This way you can just change configure.ac, run autoconf and autoheader,
verify the result, and commit, but don't have to edit nbtool_config*in
manually every time.
 1.54 11-Feb-2006  wiz Add AC_CHECK_DECLS test for strsuftoll. hannken reports it is needed
for building nbmakefs on 3.0/i386.
 1.53 09-Feb-2006  wiz Use the AC_DEFINE version with three arguments consistently, since
then autoheader works too.
Replace the remaining abusers of AC_CHECK_FUNCS with AC_CHECK_DECLS
too.
 1.52 09-Feb-2006  dogcow change #include <sys/endian.h> => #include <machine/endian.h> so that
it's (more) consistent in the tree; this, along with changing tools/compat's
autoconf detection from AC_CHECK_FUNCS to AC_CHECK_DECLS makes the vast
majority of htobe16 and friends' redefinition errors bite the dust.
Tested with -current and FreeBSD.
 1.51 02-Feb-2006  dbj touch an empty sys/bswap.h if detected as missing by configure
this fixes cross compile problems from recent changes to
convert machine/bswap.h to sys/bswap.h
 1.50 02-Mar-2005  wiz Remove commas in AC_CHECK_FUNCS that shouldn't be there.
Closes PR 29577 by Valeriy E. Ushakov.
 1.49 13-Jan-2005  jmc Turns out some platforms (freebsd5) expose st_birthtime but not
st_birthtimensec. Make sure and check for both so programs can deal w. it
 1.48 28-Nov-2004  jmc Add heapsort to libnbcompat
 1.47 12-Oct-2004  jmc Check for fstatvfs and provide/use it only if the host system has it.
Fixes PR#27221
 1.46 24-Jul-2004  dbj check for HAVE_STRUCT_STATVFS_F_IOSIZE
addresses PR toolchain/26415
 1.45 24-Jul-2004  dbj remove HAVE_STRUCT_STATFS_F_IOSIZE
this is not currently being used and should be replaced with
HAVE_STRUCT_STATVFS_F_IOSIZE, but that will be done separately.
This commit should be able to be safely pulled up to
the netbsd-2-0 branch to address PR toolchain/26415
 1.44 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.43 18-Jun-2004  thorpej Check for group_from_gid().
 1.42 12-Nov-2003  dbj branches: 1.42.2;
use sys/poll.h and HAVE_SYS_POLL_H instead of just HAVE_POLL_H
HAVE_SYS_POLL_H is used by src/include/roken.h needed by the host tool asn1_compile
 1.41 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.40 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.39 25-Jul-2003  atatat More properly host-tool-ify stat
 1.38 18-Jul-2003  fredb As discussed briefly on tech-toolchain, AIX doesn't have "u_long",
so add a check for that. Partial fix for PR toolchain/22177.
 1.37 03-Jun-2003  uwe Add atoll(3) to libnbcompat. We need it when building target's gcc
for a 64-bit target on a 32-bit host.

NB: There seems to be a bug in either gcc itself or the way we import
it, b/c the incorrect #define HAVE_ATOLL is picked from (e.g. for
sparc64) gnu/usr.bin/gcc/arch/sparc64/auto-host.h - so when gen*
auxilary (host) programs are built in gnu/usr.bin/gcc/backend, they
incorrectly pick-up target's HAVE_ATOLL.

For now providing atoll(3) in libnbcompat is a simple and sufficient
workaround.
 1.36 14-Mar-2003  thorpej Add a putc_unlocked().
 1.35 13-Mar-2003  thorpej Fix the socklen_t test; we need to explcitly list the headers we want
included for that test.
 1.34 13-Mar-2003  thorpej Check for sys/socket.h and socklen_t.
 1.33 16-Dec-2002  thorpej Include <sys/types.h> before <grp.h>; Mac OS 10.2.2 needs this.
 1.32 16-Dec-2002  thorpej Include <sys/types.h> before including <dirent.h>; Mac OS 10.2.2
needs this.
 1.31 30-Nov-2002  lukem add check back for util.h; needed on some foreign systems
 1.30 30-Nov-2002  lukem - Migrate fparseln(3) from libutil to libc, where it should have been in
the first place...
- Bump libutil major (to 7.0) and libc minor (to 12.91).
 1.29 29-Nov-2002  lukem replace missing strsuftoll(3)
 1.28 07-Oct-2002  briggs Just check for poll.h, don't fail if it's not present.
 1.27 06-Oct-2002  lukem Provide strtoll() in libnbcompat.
Should fix relevant build issue on HP-UX and MacOS X hosts.
 1.26 05-Oct-2002  lukem check for lchflags
 1.25 04-Oct-2002  thorpej Check for <poll.h> and poll(2).
 1.24 16-Sep-2002  briggs Always use NetBSD's fts(3) in compat builds. Some systems (notably
Red Hat 7.3, at least) do not have fts(3) implementations that work
correctly with -D_FILE_OFFSET_BITS=64.
 1.23 14-Sep-2002  thorpej * Check for mkstemp() and mkdtemp(), and build them into libnbcompat
if necessary.
* mktemp is now a host-tool, so nuke the lame script (which isn't even
properly installed during the tools bootstrap).
 1.22 13-Sep-2002  thorpej * Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.21 03-Jul-2002  pooka Fine-grain checking somewhat:
* check for user_from_uid() in addition to pwcache_userdb()
* check for svis() in addition to vis()
 1.20 24-Apr-2002  bjh21 branches: 1.20.2;
Rather than hardcoding two possible locations of the POSIX shell (for
Solaris and everything else), set _PATH_BSHELL to the first occurrence of
"sh" on the path. This should be rather more portable.
 1.19 23-Apr-2002  bjh21 Add test for alloca() and <alloca.h>, since Sun Workshop C 5.0 needs this.
 1.18 22-Apr-2002  bjh21 Create sys/endian.h if it doesn't exist, since rmd160.c includes it directly.
 1.17 19-Apr-2002  tv Emit an empty <stdint.h> if the host doesn't have one. Should fix PR 16416.
 1.16 18-Apr-2002  tv Re-add test for <sys/endian.h>; it disappeared somewhere along the way.
 1.15 18-Apr-2002  bjh21 Add a stub issetugid() for platforms that don't have it. For now, we assume
that no host program will be installed set-id, so the stub function always
returns 0.
 1.14 01-Apr-2002  bjh21 Revert addition of mkdtemp() to libnbcompat. I don't think we need mktemp(1)
after all.
 1.13 31-Mar-2002  bjh21 Add mkdtemp to libnbcompat, since glibc doesn't have it an mktemp(1) will
need it.
 1.12 31-Mar-2002  bjh21 Add the md[245], sha1 and rmd160 functions to libnbcompat, conditional on their
not being in the host libc.
This will be necessary to make cksum into a host tool.
 1.11 07-Mar-2002  tv Don't gratuitously touch the replacement headers in ${.OBJDIR}/include;
instead, touch them only if they're changed.
 1.10 07-Mar-2002  tv Move inttypes.h to list of auto-generated-empty headers.
 1.9 07-Mar-2002  tv Add compat defns for uint*_t (the non-underscored ones).
[The logic in all of this is ugly, and should instead be fixed up to use
AC_CHECK_SIZEOF to use primitives if the counterpart type is unavailable.]
 1.8 26-Feb-2002  tv Add some more bits of host compatibility.
 1.7 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.6 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.5 24-Jan-2002  lukem - Replace pwcache(3) if necessary (pwcache_userdb(3) is checked for).
Tested on -current and 1.5.3.
- Wrap some long lines.
 1.4 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.3 10-Jan-2002  lukem look for <inttypes.h> and #include if found (for uint*_t)
 1.2 04-Jan-2002  lukem Add replacement fgetln(3) (from lukemftp/libukem), as fparseln(3) uses it
 1.1 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.20.2.4 23-Jul-2004  tron Apply patch (request by dbj in ticket 1723):
Fix building the netbsd-1-6 branch under Darwin/MacOS.
 1.20.2.3 01-Dec-2002  he Pull up revision 1.24 (requested by thorpej in ticket #834):
Always NetBSD's own fts(3) in compat builds. Some systems
(among them RedHat 7.3) do not have fts(3) implementations
which work correctly with -D_FILE_OFFSET_BITS=64.
 1.20.2.2 30-Nov-2002  he Pull up revision 1.23 (via patch, requested by thorpej in ticket #807):
o Check for mkstemp() and mkdtemp(), and build them into
libcompat if necessary.
o mktemp is now a host-tool, so remove the now obsoleted
script.
 1.20.2.1 03-Nov-2002  he Pull up revision 1.22 (via patch, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.42.2.2 25-Jul-2004  tron branches: 1.42.2.2.2;
Pull up revision 1.45 (requested by dbj in ticket #712):
remove HAVE_STRUCT_STATFS_F_IOSIZE
this is not currently being used and should be replaced with
HAVE_STRUCT_STATVFS_F_IOSIZE, but that will be done separately.
This commit should be able to be safely pulled up to
the netbsd-2-0 branch to address PR toolchain/26415
 1.42.2.1 22-Jun-2004  tron Pull up revision 1.44 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.42.2.2.2.1 06-Apr-2005  he Pull up revision 1.48 (via patch, requested by jmc in ticket #1026):
Convert remaining host tools for amiga to correct cross tools.
Now allows complete amiga builds on non-NetBSD and non-BSD hosts.
 1.60.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.60.2.3 14-Feb-2009  snj Apply patch (requested by adrianp in ticket #1278):
Fix build on netbsd-5 amd64 hosts.
 1.60.2.2 18-Nov-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #1224):
tools/compat/Makefile: revision 1.52
tools/compat/configure.ac: revision 1.67
Prepare dummy <resolv.h> and <arpa/nameser.h> to make asn1_compile and
compile_et compile on systems which don't have these BIND headers like
Cygwin.
Tested by "build.sh -m i386 -U release" on CYGWIN_NT-5.1-1.5.25,
and should close PR toolchain/29032.
 1.60.2.1 30-Aug-2007  pavel branches: 1.60.2.1.2;
Pull up following revision(s) (requested by apb in ticket #827):
tools/compat/Makefile: revision 1.50
tools/compat/compat_defs.h: revision 1.60
tools/compat/configure.ac: revision 1.62-1.64
More detailed instructions for what to do when editing configure.ac.
In particular, discourage the use of non-tools versions of
autoconf and autoheader.
Provide definitions for {be,le}{16,32,64}{enc,dec} if necessary.
This is adapted from the very detailed fix provided by
Giles Lean in PR bin/36678.
Only one simplified implementation is provided, instead of the
two implementations conditional on __GNUC_PREREQ__(2,95) that are
provided in NetBSD's <sys/endian.h>. The use of memcpy instead of
__builtin__memcpy, and the absence of __inline or __unused, should make
it independent of GCC.
Update the instructions to say that regen should be done again
to pick up changed RCS IDs.
 1.60.2.1.2.1 14-Feb-2009  snj Apply patch (requested by adrianp in ticket #1278):
Fix build on netbsd-5 amd64 hosts.
 1.64.2.1 06-Nov-2007  matt sync with HEAD
 1.67.2.3 02-Nov-2011  riz Pull up following revision(s) (requested by tsutsui in ticket #1676):
tools/compat/configure.ac: revision 1.71
tools/compat/configure: revision 1.71
tools/compat/nbtool_config.h.in: revision 1.24
Test for <sys/endian.h> and provide HAVE_SYS_ENDIAN_H.
Fixes FreeBSD hosted builds (PR 42440 and PR 42470).
Approved by <dholland>.
Regenerate.
 1.67.2.2 03-Oct-2009  snj Pull up following revision(s) (requested by apb in ticket #1020):
bin/pax/Makefile: revision 1.38
bin/pax/ar_io.c: revision 1.49
tools/compat/configure: revision 1.69
tools/compat/configure.ac: revision 1.69
do not require sys/mtio.h for a tools build of pax
 1.67.2.1 15-Jan-2009  snj branches: 1.67.2.1.2; 1.67.2.1.4;
Pull up following revision(s) (requested by jmcneill in ticket #270):
lib/libc/locale/fix_grouping.c: revision 1.3
lib/libc/locale/iswctype_sb.c: revision 1.7
lib/libc/locale/rune.h: revision 1.14
lib/libc/locale/runetype.h: file removal
lib/libc/locale/runetype_local.h: revision 1.1
lib/libc/stdio/fparseln.c: revision 1.8
lib/libc/string/wcscmp.c: revision 1.7
lib/libc/string/wcsncmp.c: revision 1.7
lib/libc/string/wmemcmp.c: revision 1.5
tools/compat/configure: regen
tools/compat/configure.ac: revision 1.68
tools/compat/nbtool_config.h.in: regen
usr.bin/mklocale/Makefile: revision 1.15
usr.bin/mklocale/lex.l: revision 1.16
usr.bin/mklocale/yacc.y: revision 1.27
1. reworking PR lib/40317:
libnbcompat already contains empty fparseln.lo
so previous fix doesn't work correctly.
i've just added broken fparseln check to configure script.
2. reworking cross build breakage under FreeBSD/MacOS X.
FreeBSD/MacOS X still have public /usr/include/runetype.h
derived from 4.4BSD-Lite. so i renamed out private header from
src/lib/libc/locale/runetype.h to src/lib/libc/locale/runetype_local.h
to solve this problems.
3. fix build breakage when CITRUS=no was set.
 1.67.2.1.4.1 15-Dec-2009  matt Allow tools to build on OSX 10.6 (Snow Leopard).
 1.67.2.1.2.1 03-Oct-2009  snj Pull up following revision(s) (requested by apb in ticket #1020):
bin/pax/Makefile: revision 1.38
bin/pax/ar_io.c: revision 1.49
tools/compat/configure: revision 1.69
tools/compat/configure.ac: revision 1.69
do not require sys/mtio.h for a tools build of pax
 1.73.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.73.2.1 10-Nov-2011  yamt sync with head
 1.74.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.74.6.2 23-Jun-2013  tls resync from head
 1.74.6.1 25-Feb-2013  tls resync with head
 1.76.4.1 23-Jul-2013  riastradh sync with HEAD
 1.81.2.1 10-Aug-2014  tls Rebase.
 1.82.2.1 22-Apr-2015  snj Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
 1.84.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.84.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.84.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.87.6.3 03-Feb-2018  snj Pull up following revision(s) (requested by sevan in ticket #435):
tools/compat/configure: revision 1.88 via patch
tools/compat/configure.ac: revision 1.89 via patch
tools/compat/nbtool_config.h.in: revision 1.42
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.
Closes PR toolchain/52797
--
regen
 1.87.6.2 21-Dec-2017  snj revert ticket 435
 1.87.6.1 21-Dec-2017  snj Pull up following revision(s) (requested by sevan in ticket #435):
tools/compat/compat_defs.h: 1.108
tools/compat/configure: 1.87-1.88
tools/compat/configure.ac: 1.88-1.89
tools/compat/fpurge.c: 1.2
tools/compat/nbtool_config.h.in: 1.41-1.42
handle __fpurge being declared in <stdio_ext.h>
--
regen
--
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.
Closes PR toolchain/52797
--
regen
 1.89.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.89.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.91.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.91.2.1 10-Jun-2019  christos Sync with HEAD
 1.97.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1973):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
usr.bin/nbperf/nbperf.c: revision 1.7
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)
tools/compat/configure (patch for regen from above)

Don't use arc4random for the tools build on NetBSD either.
compat_defs.h explicitly forces _POSIX_SOURCE and this hides the
prototype in stdlib.h.
pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.99.6.3 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1174):

tools/compat/configure.ac: revision 1.111 (patch)
tools/compat/compat_defs.h: revision 1.126 (patch)
tools/compat/compat_defs.h: revision 1.127 (patch)
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)

pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.99.6.2 17-Nov-2024  martin Pull up following revision(s) (requested by kre in ticket #1004):

tools/compat/configure: revision 1.106
lib/libc/string/__strsignal.c: revision 1.26
tools/compat/configure.ac: revision 1.108
tools/compat/nbtool_config.h.in: revision 1.57
usr.bin/elf2aout/elf2aout.c: revision 1.24
tools/compat/Makefile: revision 1.93
sys/arch/macppc/stand/fixcoff/fixcoff.c: revision 1.13
tools/compat/compat_defs.h: revision 1.123

Include <arpa/inet.h> for htonl() (From Jan-Benedict Glaw)
Probably this should be using htobe32() instead of htonl()
(and so <endian.h> rather than <arpa/inet.h>) as there is
no sign of any network anywhere near here. But that's for
another day, and to be done by someone who can test it.

Portability fixes from Jan-Benedict Glaw
The args to help() and usage() need to be const char *
and main() should be declared as returning int.

Add shquote to libnbcompat
Include shquote() in configure tests
Regen for added shquote()

Stop attempting to return a (char*) in place of (const char *)
This removes a cast that was added in 1994, when __strsignal()
returned a char * to convert the const char * element of sys_siglist
into a type that matched.

It should have been removed when __strsignal() was changed to
return const char * in 1998. But wasn't.

This should fix an inane warning (treated as an error) from a
compile stupid enough to allow a natural char * (as in char buf[N])
to be returned as a result (which is, of course, fine), but complains
about returning (char *) applied to a (const char *).
 1.99.6.1 30-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #221):

external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c: revision 1.18
external/cddl/osnet/sys/sys/opentypes.h: revision 1.7
tools/compat/configure: revision 1.100
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.6
external/cddl/osnet/dist/tools/ctf/cvt/barrier.h: revision 1.4
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.7
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.8
tools/compat/configure.ac: revision 1.100
external/cddl/osnet/dist/tools/ctf/cvt/tdata.c: revision 1.10
tools/compat/nbtool_config.h.in: revision 1.54

ctfmerge: error check sem_*() and pthread_*() APIs

terminate() if sem_*() returns -1 or pthread_*() returns != 0.
(Set errno from pthread_*() so terminate() prints the strerror message).

Note: Failing on errors instead of ignoring them helps identify
reasons for intermittent failures, such as those on macOS host builds:

ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented

ctfmerge: fix macOS semaphore implementation

Use dispatch_semaphore_create() if present instead of sem_init().
macOS doesn't actually implement sem_init() (et al)
(even though it provides the prototypes as deprecated).

This was detected by the previous commit to ctfmerge
that added error handling.

Implement ctfmerge's barrier operations in terms of
dispatch(3) APIs such as dispatch_semaphore_create() (et al).

Update tools/compat/configure.ac to find dispatch_semaphore_create().
Fixes ctfmerge on macOS hosts.

Inspired by https://stackoverflow.com/a/27847103

tools/compat: regen for dispatch_semaphore_create

ctfmerge: fix macOS semaphore implementation, part 2
dispatch_semaphore_signal() doesn't return an error, just an
indicator of whether a thread was woken or not, so there's
no need to fail on non-zero return.

osnet: on macOS, use <mach/boolean.h> for boolean_t
macOS/x86_64 defines boolean_t as 'unsigned int' not 'int',
which causes a build issue with tools/ctfmerge on that host
after my recent fixes for macOS semaphores.

So use the <mach/boolean.h> instead of a local typedef ifdef __APPLE__.
May fix a macOS/x86_64 build issue reported by cjep@.
Builds fine on NetBSD/amd64 or macOS/arm.

Note: this compat stuff is clunky, and based on the commit log,
annoyingly error prone. A newer sync of osnet from upstream /may/
improve a lot of these compat typedef workarounds for solaris types...
 1.107.2.1 02-Aug-2025  perseant Sync with HEAD
 1.109.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #56):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
tools/compat/nbtool_config.h.in: revision 1.60
tools/compat/nbtool_config.h.in: revision 1.61
lib/libc/stdio/mkstemps.c: revision 1.2
tools/compat/configure: revision 1.108
tools/compat/configure: revision 1.109
tools/compat/nbtool_config.h.in: revision 1.59
tools/compat/Makefile: revision 1.95
tools/compat/configure.ac: revision 1.110

Add more functions needed by mandoc

regen

add vsyslog decl check

regen

Do the nbtool dance.
 1.4 16-Oct-2006  apb Wrap #ifndef __BIT_TYPES_DEFINED__ around #define __BIT_TYPES_DEFINED__.
Reported by Narayana Prasad.
 1.3 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.17 03-Jun-2023  lukem tools/compat: support all bsd.own.mk disabled warnings

Check the host CC support for all the warnings now in <bsd.own.mk>
and override appropriately in defs.mk.

In general there's a 1:1 mapping, with the special case
CC_WNO_ADDRESS_OF_PACKED_MEMBER which is set from both
@CC_WNO_ADDRESS_OF_PACKED_MEMBER@ (gcc) and
@CC_WNO_ERROR_ADDRESS_OF_PACKED_MEMBER@ (clang).
 1.16 03-Jun-2023  lukem bsd.own.mk: rename GCC_NO_* to CC_WNO_*

Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.15 30-May-2023  lukem tools/compat: disable host CC warnings

Determine if the host CC supports flags to disable various
warnings similar to <bsd.own.mk> GCC_*, CLANG_*, and CC_*,
and override the <bsd.own.mk> equivalents in defs.mk.

Silences "warning: unknown warning option '...'" from our source.
External source (e.g., binutils and gcc) need their own fixes
to enhance their detection of supported clang compiler flags.
 1.14 30-May-2023  lukem tools/compat: detect supported host compiler flags

Define NB_CC_FLAG(FLAG) to use AX_CHECK_COMPILE_FLAG
to determine if the host compiler supports FLAG
and define and AC_SUBST CC_FLAG if so.

Use workarounds to force clang to hard-fail on unknown -Wwarning,
and gcc to use -WWARN to check unknown -Wno-WARN because the
latter doesn't cause an error in gcc.

In the future we could use NB_CC_FLAG([-fcommon]) for
older NetBSD release branches compiled with host gcc 10+.

Rework Darwin -no-cpp-precomp check to use NB_CC_FLAG().
Note: this flag probably hasn't been required on macOS (Darwin)
for a long time, but serves as a good example on how to use this.

Display varaibles at the end of configure to show what was detected.
 1.13 30-May-2023  lukem tools/compat: don't expose HAVE_PTHREAD_H to make

Non of the tools Makefiles needs HAVE_PTHREAD_H, so don't
AC_SUBST it or provide in defs.mk.
 1.12 02-Dec-2012  apb Change the default value of COMPATLIB_UNINSTALLED to no, now that
all users of comapt/defs.mk have been adjusted. This is the last
commit related to fixing PR 47188.
 1.11 02-Dec-2012  apb Add two variables to tools/compat/defs.mk.in:

COMPATLIB_UNINSTALLED:
If "yes", then use the files from the .OBJDIR of
NETBSDSRCDIR/tools/compat. Otherwise, use the files
from TOOLDIR.

COMPATLIB_NO_LIB:
If "yes" then do not use the library (but still use
the include files).

COMPATLIB_UNINSTALLED defaults to "yes" for now, but this will soon be
changed to "no.
 1.10 14-Aug-2011  apb branches: 1.10.2; 1.10.8;
Detect the presence of <pthread.h>, and add a HAVE_PTHREAD_H
variable in defs.mk.
 1.9 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.8 27-Oct-2003  lukem branches: 1.8.2;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.7 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.6 13-Mar-2003  thorpej Move -no-cpp-precomp logic to defs.mk.
 1.5 15-Sep-2002  thorpej Add a HOST_BSHELL make var which contains the path to the working
shell.
 1.4 31-Jan-2002  tv branches: 1.4.2;
Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.3 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.2 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.1 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.4.2.1 01-Dec-2002  he Pull up revision 1.5 (requested by thorpej in ticket #825):
Add a HOST_BSHELL make variable which contains the path to
the working shell.
 1.8.2.1 22-Jun-2004  tron Pull up revision 1.9 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.10.8.1 25-Feb-2013  tls resync with head
 1.10.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.2 05-Mar-2013  christos branches: 1.2.4; 1.2.10;
don't leak on error.
 1.1 05-Mar-2013  christos add dprintf
 1.2.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.10.1 05-Mar-2013  yamt file dprintf.c was added on branch yamt-pagecache on 2014-05-22 11:42:30 +0000
 1.2.4.2 23-Jun-2013  tls resync from head
 1.2.4.1 05-Mar-2013  tls file dprintf.c was added on branch tls-maxphys on 2013-06-23 06:28:57 +0000
 1.5 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.4 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.3 13-Jan-2002  lukem rcsid
 1.2 04-Jan-2002  lukem need <errno.h> and <stdarg.h>
 1.1 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.12 09-Oct-2015  christos use c comments
 1.11 08-Oct-2015  christos don't lie in the comment; this is not the re-entrant version
 1.10 08-Oct-2015  christos Switch to a version that does not suffer from reporting the wrong length
if the file contains NULs. From OpenBSD.
 1.9 29-Apr-2008  martin Convert to new 2 clause license
 1.8 18-Oct-2006  christos branches: 1.8.16;
PR/34848: Roland Illig: NetBSD's sed cannot handle files that are missing
the final new line.
This is an fgetln() problem; fix and add a way to test.
 1.7 26-Aug-2006  christos Remove advertising clause.
 1.6 15-May-2005  christos Replace the original fgetln with a simpler one that:
1. Works if the last line does not end up in \n
2. Does not scan the string multiple times.
3. Does not copy the string, but writes it directly in the buffer.
4. Handles out of memory conditions gracefully.
 1.5 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.4 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.3 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.2 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.1 04-Jan-2002  lukem Add replacement fgetln(3) (from lukemftp/libukem), as fparseln(3) uses it
 1.8.16.1 18-May-2008  yamt sync with head.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 27-Oct-2003  lukem branches: 1.5.30;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.4 07-Jun-2002  mason fix minor typo -> s/lokcing/locking/
 1.3 07-Mar-2002  tv fcntl locking works much better when the `struct flock' is actually given
to fcntl....
 1.2 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.5.30.1 18-May-2008  yamt sync with head.
 1.4 23-Jan-2002  lukem remove
 1.3 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.2 04-Jan-2002  lukem remove lukemftp comment; this is just as close to the libutil version
 1.1 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.3 03-Oct-2017  joerg Be consistent with our header.
 1.2 02-Oct-2017  christos handle __fpurge being declared in <stdio_ext.h>
 1.1 16-Jun-2009  christos branches: 1.1.38;
add fpurge; needed by awk.
 1.1.38.2 21-Dec-2017  snj revert ticket 435
 1.1.38.1 21-Dec-2017  snj Pull up following revision(s) (requested by sevan in ticket #435):
tools/compat/compat_defs.h: 1.108
tools/compat/configure: 1.87-1.88
tools/compat/configure.ac: 1.88-1.89
tools/compat/fpurge.c: 1.2
tools/compat/nbtool_config.h.in: 1.41-1.42
handle __fpurge being declared in <stdio_ext.h>
--
regen
--
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.
Closes PR toolchain/52797
--
regen
 1.2 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1 16-Sep-2002  briggs branches: 1.1.2;
Always use NetBSD's fts(3) in compat builds. Some systems (notably
Red Hat 7.3, at least) do not have fts(3) implementations that work
correctly with -D_FILE_OFFSET_BITS=64.
 1.1.2.2 01-Dec-2002  he Pull up revision 1.1 (new, requested by thorpej in ticket #834):
Always NetBSD's own fts(3) in compat builds. Some systems
(among them RedHat 7.3) do not have fts(3) implementations
which work correctly with -D_FILE_OFFSET_BITS=64.
 1.1.2.1 16-Sep-2002  he file fts.h was added on branch netbsd-1-6 on 2002-12-01 19:10:45 +0000
 1.2 16-Sep-2014  christos Fix problem reading the last line when it did not contain a delimiter
(Hubert Garavel)
 1.1 20-Mar-2011  christos add a stdio neutral getline/getdelim implementation.
 1.8 04-Nov-2008  dbj include unistd.h where getmode is traditionally declared
 1.7 28-Apr-2008  martin branches: 1.7.6; 1.7.8; 1.7.10;
Remove clause 3 and 4 from TNF licenses
 1.6 13-Jan-2004  simonb branches: 1.6.30;
White space nit.
 1.5 12-Jan-2004  simonb Use the first argument of getmode() to modify the second arg, instead of
just replacing the second arg. This lets the higher order file type bits
survive. Fixes problems with the tools version of mknod(8).
 1.4 08-Jan-2004  simonb KNF.
 1.3 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.6.30.1 18-May-2008  yamt sync with head.
 1.7.10.1 21-Apr-2010  matt sync to netbsd-5
 1.7.8.1 16-Feb-2010  bouyer Pull up following revision(s) (requested by snj in ticket #1308):
tools/compat/getmode.c: revision 1.8
include unistd.h where getmode is traditionally declared
 1.7.6.1 16-Feb-2010  bouyer Pull up following revision(s) (requested by snj in ticket #1308):
tools/compat/getmode.c: revision 1.8
include unistd.h where getmode is traditionally declared
 1.2 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.1 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.2 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1 13-Sep-2002  thorpej branches: 1.1.2;
* Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.2 03-Nov-2002  he Pull up revision 1.1 (new, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.1 13-Sep-2002  he file glob.h was added on branch netbsd-1-6 on 2002-11-03 16:18:39 +0000
 1.2 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1 18-Apr-2002  bjh21 Add a stub issetugid() for platforms that don't have it. For now, we assume
that no host program will be installed set-id, so the stub function always
returns 0.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 27-Oct-2003  lukem branches: 1.3.4; 1.3.32;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 19-Mar-2003  grant if target is not a symlink, silently succeed rather than failing with
EINVAL.

on systems which don't have lch{flags,own,mod}, flags, ownership and
modes of symlinks is meaningless, anyway.

ok'd by christos.
 1.1 08-Oct-2002  lukem Implement replacements for lchflags(), lchmod(), and lchown(),
which first lstat(2) the target and return EINVAL if it's a symlink,
and then call ch{flags,mod,own} as appropriate.
Removes the need for hokey code inside the tools themselves...
 1.3.32.1 18-May-2008  yamt sync with head.
 1.3.4.2 12-Jul-2004  he Pull up revisions 1.1-1.2 (new, requested by ticket #1719):
Implement replacements for lchflags(), lchmod(), and
lchown(), to enable cross-building on more host systems.
 1.3.4.1 27-Oct-2003  he file lchflags.c was added on branch netbsd-1-6 on 2004-07-12 21:09:32 +0000
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 27-Oct-2003  lukem branches: 1.3.4; 1.3.32;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 19-Mar-2003  grant if target is not a symlink, silently succeed rather than failing with
EINVAL.

on systems which don't have lch{flags,own,mod}, flags, ownership and
modes of symlinks is meaningless, anyway.

ok'd by christos.
 1.1 08-Oct-2002  lukem Implement replacements for lchflags(), lchmod(), and lchown(),
which first lstat(2) the target and return EINVAL if it's a symlink,
and then call ch{flags,mod,own} as appropriate.
Removes the need for hokey code inside the tools themselves...
 1.3.32.1 18-May-2008  yamt sync with head.
 1.3.4.2 12-Jul-2004  he Pull up revisions 1.1-1.2 (new, requested by ticket #1719):
Implement replacements for lchflags(), lchmod(), and
lchown(), to enable cross-building on more host systems.
 1.3.4.1 27-Oct-2003  he file lchmod.c was added on branch netbsd-1-6 on 2004-07-12 21:09:32 +0000
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 27-Oct-2003  lukem branches: 1.3.4; 1.3.32;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 19-Mar-2003  grant if target is not a symlink, silently succeed rather than failing with
EINVAL.

on systems which don't have lch{flags,own,mod}, flags, ownership and
modes of symlinks is meaningless, anyway.

ok'd by christos.
 1.1 08-Oct-2002  lukem Implement replacements for lchflags(), lchmod(), and lchown(),
which first lstat(2) the target and return EINVAL if it's a symlink,
and then call ch{flags,mod,own} as appropriate.
Removes the need for hokey code inside the tools themselves...
 1.3.32.1 18-May-2008  yamt sync with head.
 1.3.4.2 12-Jul-2004  he Pull up revisions 1.1-1.2 (new, requested by ticket #1719):
Implement replacements for lchflags(), lchmod(), and
lchown(), to enable cross-building on more host systems.
 1.3.4.1 27-Oct-2003  he file lchown.c was added on branch netbsd-1-6 on 2004-07-12 21:09:32 +0000
 1.2 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1 13-Sep-2002  thorpej branches: 1.1.2;
* Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.2 03-Nov-2002  he Pull up revision 1.1 (new, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.1 13-Sep-2002  he file md2.h was added on branch netbsd-1-6 on 2002-11-03 16:18:39 +0000
 1.3 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 01-Oct-2003  seb Adjust pathnames to {md{4,5},sha1}.h after their removal from
src/include.

Approved by mrg@
 1.1 13-Sep-2002  thorpej branches: 1.1.2;
* Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.2 03-Nov-2002  he Pull up revision 1.1 (new, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.1 13-Sep-2002  he file md4.h was added on branch netbsd-1-6 on 2002-11-03 16:18:39 +0000
 1.3 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 01-Oct-2003  seb Adjust pathnames to {md{4,5},sha1}.h after their removal from
src/include.

Approved by mrg@
 1.1 13-Sep-2002  thorpej branches: 1.1.2;
* Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.2 03-Nov-2002  he Pull up revision 1.1 (new, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.1 13-Sep-2002  he file md5.h was added on branch netbsd-1-6 on 2002-11-03 16:18:39 +0000
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.3 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 31-Jan-2002  tv Make sure there are no weak references in libnbcompat (avoids linker
confusion issues).
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.2 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.1 14-Aug-2001  tv Bootstrap toolchain framework, first pass.
 1.2 11-Nov-2001  jmc Pull the rmd160 stuff out as mtree now has options to selectively compile
pieces out we won't need during a build.
 1.1 08-Nov-2001  jmc XXX...Complete hack for now.

Add a stub for RMD160File which prints out a warning and returns NULL.

This allows mtree to be built when hosting from a 1.5.x box.
The real solution is to convert the src/tools bits into clean portable tools
and not have them so NetBSD-current centric.
 1.2 11-Feb-2006  wiz Redo previous differently: use AH_TOP and AH_BOTTOM macros to insert
header and footer into nbtool_config.h.in directly.
 1.1 11-Feb-2006  wiz Make using autoheader easier:
split off the autogenerated file into nbtool_config_internal.h,
and let nbtool_config.h be a file with the proper wrappers.

This way you can just change configure.ac, run autoconf and autoheader,
verify the result, and commit, but don't have to edit nbtool_config*in
manually every time.
 1.61 18-Sep-2025  christos regen
 1.60 18-Sep-2025  christos regen
 1.59 18-Sep-2025  christos Add more functions needed by mandoc
 1.58 24-Jul-2025  hans branches: 1.58.2;
tools/compat: add definitions of __[u]intXX_t types on systems that lack them

Fixes another cross-build issue on illumos.
 1.57 31-Oct-2024  kre Regen for added shquote()
 1.56 20-Jul-2023  lukem branches: 1.56.2;
tools/compat: regen
 1.55 30-May-2023  lukem tools/compat: regen
 1.54 23-May-2023  lukem tools/compat: regen for dispatch_semaphore_create
 1.53 25-Feb-2021  christos branches: 1.53.6;
Add reallocarray; this is used by the new regex code and we don't want to
convert it to reallocarr so the code is kept similar with the original from
FreeBSD.
 1.52 22-Jun-2019  hannken branches: 1.52.2;
Update tools/compat/configure for new path of "rpc/types.h".

Remove intermediate patch from rpcgen/Makefile.

Patch from Nick Hudson, errors from me.
 1.51 19-Jun-2019  kamil regen tools/compat
 1.50 19-Jun-2019  kamil Add sys/uio.h & enum uio_seg, enum uio_rw to tools/compat

This is needed for bootstrapping the tools on Ubuntu 16.x.
 1.49 27-Jan-2019  dholland Restore comment accidentally lost in merge.
 1.48 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.47 30-Aug-2018  christos deal with getsubopt and strncasecmp (needed by mdocml)
 1.46 16-Aug-2018  christos add strncasecmp
 1.45 11-Aug-2018  christos Add strcasecmp
 1.44 13-Jun-2018  maya branches: 1.44.2;
Revert my previous config test inclusion for u_longlong_t.

Fixing this differently by avoiding the need for the definition.
It also caused a problem in OS X, as I neglected to include a correct header
 1.43 11-Jun-2018  maya Add configure check and fallback definition for u_longlong_t

Should help linux tools compilation of dtrace tools, and not
affect NetBSD.

From Chuck Zmudzinski in current-users, with light modification
by myself.
 1.42 09-Dec-2017  sevan branches: 1.42.2;
regen
 1.41 02-Oct-2017  christos regen
 1.40 07-Jan-2017  christos branches: 1.40.6;
regen
 1.39 19-Oct-2016  christos regen
 1.38 20-Jan-2016  christos branches: 1.38.2;
Regen with autoconf 2.69.
 1.37 26-Jul-2015  kamil Add reallocarr(3) to tools/compat

This should unbreak libutil(3) creation on systems withot reallocarr(3).
 1.36 16-Jan-2015  christos regen
 1.35 06-Jun-2014  christos branches: 1.35.2;
Deal with errc/warnc
 1.34 09-Jan-2014  apb branches: 1.34.2;
regen
 1.33 14-Aug-2013  jmcneill regen
 1.32 09-Aug-2013  jmcneill regen
 1.31 06-Aug-2013  apb regen, to pick up the test for snprintb_m.
 1.30 19-Jul-2013  pooka regen

(XXX: I don't think these files were previously regen'd with the
method documented in configure.ac, and therefore the diffs are now huge)
 1.29 05-Mar-2013  christos branches: 1.29.4;
regen
 1.28 17-Feb-2013  christos regen
 1.27 03-Nov-2011  joerg branches: 1.27.6;
Add getline(3) compat glue.
 1.26 14-Aug-2011  apb branches: 1.26.2;
regen
 1.25 21-Jan-2010  tsutsui Regen this properly per procedure described in src/tools/compat/configure.ac.
 1.24 15-Jan-2010  asau Test for <sys/endian.h> and provide HAVE_SYS_ENDIAN_H.
Fixes FreeBSD hosted builds (PR 42440 and PR 42470).

Approved by <dholland>.
 1.23 16-Jun-2009  christos add fpurge; needed by awk.
 1.22 05-Jan-2009  tnozaki 1. reworking PR lib/40317:
libnbcompat already contains empty fparseln.lo
so previous fix doesn't work correctly.
i've just added broken fparseln check to configure script.

2. reworking cross build breakage under FreeBSD/MacOS X.
FreeBSD/MacOS X still have public /usr/include/runetype.h
derived from 4.4BSD-Lite. so i renamed out private header from
src/lib/libc/locale/runetype.h to src/lib/libc/locale/runetype_local.h
to solve this problems.

3. fix build breakage when CITRUS=no was set.
 1.21 18-Oct-2008  tsutsui branches: 1.21.2;
Regen from configure.ac rev 1.67:
> Prepare dummy <resolv.h> and <arpa/nameser.h> to make asn1_compile and
> compile_et compile on systems which don't have these BIND headers like Cygwin.
 1.20 14-Oct-2008  tsutsui Regen autoconf stuff using tools version of autoconf (in src/tools/autoconf),
as per suggestion from apb@ on tech-toolchain.
Tested 'build.sh -U release iso-image' on NetBSD/i386 4.99.73.
 1.19 19-Oct-2007  christos I am now convinced of the error of my ways, and I am checking for all the
decls mtree is using.
 1.18 28-Sep-2007  lukem regen for raise_default_signal
 1.17 07-Aug-2007  apb branches: 1.17.2;
Regen after recent changes to configure.ac and compat_defs.h.
(Most of the changes seem to result from somebody having used
non-tools versions of autoconf and autoheader in the past.)
 1.16 03-Jul-2007  nakayama Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.
 1.15 09-Oct-2006  christos branches: 1.15.2; 1.15.4;
regen.
 1.14 07-Oct-2006  apb Add definitions for strmode. This was missing from the
patch in PR 31232.
 1.13 20-Aug-2006  thorpej Also check for DIR.__dd_fd. tools/compat now builds on the WWDC developer
preview version of Mac OS X "Leopard".
 1.12 11-Feb-2006  wiz Redo previous differently: use AH_TOP and AH_BOTTOM macros to insert
header and footer into nbtool_config.h.in directly.
 1.11 11-Feb-2006  wiz Make using autoheader easier:
split off the autogenerated file into nbtool_config_internal.h,
and let nbtool_config.h be a file with the proper wrappers.

This way you can just change configure.ac, run autoconf and autoheader,
verify the result, and commit, but don't have to edit nbtool_config*in
manually every time.
 1.10 11-Feb-2006  wiz rerun autoheader (and re-add header and footer).
 1.9 09-Feb-2006  wiz regen with autoheader; header and footer need to be added manually,
add a comment saying so.
 1.8 09-Feb-2006  dogcow change #include <sys/endian.h> => #include <machine/endian.h> so that
it's (more) consistent in the tree; this, along with changing tools/compat's
autoconf detection from AC_CHECK_FUNCS to AC_CHECK_DECLS makes the vast
majority of htobe16 and friends' redefinition errors bite the dust.
Tested with -current and FreeBSD.
 1.7 12-Oct-2004  jmc Check for fstatvfs and provide/use it only if the host system has it.
Fixes PR#27221
 1.6 24-Jul-2004  dbj check for HAVE_STRUCT_STATVFS_F_IOSIZE
addresses PR toolchain/26415
 1.5 24-Jul-2004  dbj remove HAVE_STRUCT_STATFS_F_IOSIZE
this is not currently being used and should be replaced with
HAVE_STRUCT_STATVFS_F_IOSIZE, but that will be done separately.
This commit should be able to be safely pulled up to
the netbsd-2-0 branch to address PR toolchain/26415
 1.4 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.3 18-Jun-2004  thorpej Check for group_from_gid().
 1.2 12-Nov-2003  dbj branches: 1.2.2;
use sys/poll.h and HAVE_SYS_POLL_H instead of just HAVE_POLL_H
HAVE_SYS_POLL_H is used by src/include/roken.h needed by the host tool asn1_compile
 1.1 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2.2.2 25-Jul-2004  tron Pull up revision 1.5 (requested by dbj in ticket #712):
remove HAVE_STRUCT_STATFS_F_IOSIZE
this is not currently being used and should be replaced with
HAVE_STRUCT_STATVFS_F_IOSIZE, but that will be done separately.
This commit should be able to be safely pulled up to
the netbsd-2-0 branch to address PR toolchain/26415
 1.2.2.1 22-Jun-2004  tron Pull up revision 1.4 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.15.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.15.2.3 14-Feb-2009  snj Apply patch (requested by adrianp in ticket #1278):
Fix build on netbsd-5 amd64 hosts.
 1.15.2.2 18-Nov-2008  snj Regen for ticket 1224.
 1.15.2.1 31-Aug-2007  pavel branches: 1.15.2.1.2;
regen for ticket #827. Files provided by apb@.
 1.15.2.1.2.1 14-Feb-2009  snj Apply patch (requested by adrianp in ticket #1278):
Fix build on netbsd-5 amd64 hosts.
 1.17.2.1 06-Nov-2007  matt sync with HEAD
 1.21.2.2 02-Nov-2011  riz Pull up following revision(s) (requested by tsutsui in ticket #1676):
tools/compat/configure.ac: revision 1.71
tools/compat/configure: revision 1.71
tools/compat/nbtool_config.h.in: revision 1.24
Test for <sys/endian.h> and provide HAVE_SYS_ENDIAN_H.
Fixes FreeBSD hosted builds (PR 42440 and PR 42470).
Approved by <dholland>.
Regenerate.
 1.21.2.1 15-Jan-2009  snj Regen for ticket 270.
 1.26.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.26.2.1 10-Nov-2011  yamt sync with head
 1.27.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.6.2 23-Jun-2013  tls resync from head
 1.27.6.1 25-Feb-2013  tls resync with head
 1.29.4.1 23-Jul-2013  riastradh sync with HEAD
 1.34.2.1 10-Aug-2014  tls Rebase.
 1.35.2.1 22-Apr-2015  snj Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
 1.38.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.38.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.40.6.3 03-Feb-2018  snj Pull up following revision(s) (requested by sevan in ticket #435):
tools/compat/configure: revision 1.88 via patch
tools/compat/configure.ac: revision 1.89 via patch
tools/compat/nbtool_config.h.in: revision 1.42
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.
Closes PR toolchain/52797
--
regen
 1.40.6.2 21-Dec-2017  snj revert ticket 435
 1.40.6.1 21-Dec-2017  snj Pull up following revision(s) (requested by sevan in ticket #435):
tools/compat/compat_defs.h: 1.108
tools/compat/configure: 1.87-1.88
tools/compat/configure.ac: 1.88-1.89
tools/compat/fpurge.c: 1.2
tools/compat/nbtool_config.h.in: 1.41-1.42
handle __fpurge being declared in <stdio_ext.h>
--
regen
--
Add asnprintf() to the AC_CHECK_DECLS list.
Resolves conflict when cross compiling on Cygwin the provided implementation
does not get picked up.
Closes PR toolchain/52797
--
regen
 1.42.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.42.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.44.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.44.2.1 10-Jun-2019  christos Sync with HEAD
 1.52.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1973):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
usr.bin/nbperf/nbperf.c: revision 1.7
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)
tools/compat/configure (patch for regen from above)

Don't use arc4random for the tools build on NetBSD either.
compat_defs.h explicitly forces _POSIX_SOURCE and this hides the
prototype in stdlib.h.
pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.53.6.3 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #1174):

tools/compat/configure.ac: revision 1.111 (patch)
tools/compat/compat_defs.h: revision 1.126 (patch)
tools/compat/compat_defs.h: revision 1.127 (patch)
bin/pax/options.c: revision 1.120
tools/compat/nbtool_config.h.in: revision 1.59 (patch)
tools/compat/Makefile: revision 1.95 (patch)
tools/compat/configure.ac: revision 1.110 (patch)

pax: need <strings.h> for ffs()

Fixes warning as host tool on NetBSD 9.99

Add more functions needed by mandoc

add vsyslog decl check
 1.53.6.2 17-Nov-2024  martin Pull up following revision(s) (requested by kre in ticket #1004):

tools/compat/configure: revision 1.106
lib/libc/string/__strsignal.c: revision 1.26
tools/compat/configure.ac: revision 1.108
tools/compat/nbtool_config.h.in: revision 1.57
usr.bin/elf2aout/elf2aout.c: revision 1.24
tools/compat/Makefile: revision 1.93
sys/arch/macppc/stand/fixcoff/fixcoff.c: revision 1.13
tools/compat/compat_defs.h: revision 1.123

Include <arpa/inet.h> for htonl() (From Jan-Benedict Glaw)
Probably this should be using htobe32() instead of htonl()
(and so <endian.h> rather than <arpa/inet.h>) as there is
no sign of any network anywhere near here. But that's for
another day, and to be done by someone who can test it.

Portability fixes from Jan-Benedict Glaw
The args to help() and usage() need to be const char *
and main() should be declared as returning int.

Add shquote to libnbcompat
Include shquote() in configure tests
Regen for added shquote()

Stop attempting to return a (char*) in place of (const char *)
This removes a cast that was added in 1994, when __strsignal()
returned a char * to convert the const char * element of sys_siglist
into a type that matched.

It should have been removed when __strsignal() was changed to
return const char * in 1998. But wasn't.

This should fix an inane warning (treated as an error) from a
compile stupid enough to allow a natural char * (as in char buf[N])
to be returned as a result (which is, of course, fine), but complains
about returning (char *) applied to a (const char *).
 1.53.6.1 30-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #221):

external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c: revision 1.18
external/cddl/osnet/sys/sys/opentypes.h: revision 1.7
tools/compat/configure: revision 1.100
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.6
external/cddl/osnet/dist/tools/ctf/cvt/barrier.h: revision 1.4
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.7
external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.8
tools/compat/configure.ac: revision 1.100
external/cddl/osnet/dist/tools/ctf/cvt/tdata.c: revision 1.10
tools/compat/nbtool_config.h.in: revision 1.54

ctfmerge: error check sem_*() and pthread_*() APIs

terminate() if sem_*() returns -1 or pthread_*() returns != 0.
(Set errno from pthread_*() so terminate() prints the strerror message).

Note: Failing on errors instead of ignoring them helps identify
reasons for intermittent failures, such as those on macOS host builds:

ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented

ctfmerge: fix macOS semaphore implementation

Use dispatch_semaphore_create() if present instead of sem_init().
macOS doesn't actually implement sem_init() (et al)
(even though it provides the prototypes as deprecated).

This was detected by the previous commit to ctfmerge
that added error handling.

Implement ctfmerge's barrier operations in terms of
dispatch(3) APIs such as dispatch_semaphore_create() (et al).

Update tools/compat/configure.ac to find dispatch_semaphore_create().
Fixes ctfmerge on macOS hosts.

Inspired by https://stackoverflow.com/a/27847103

tools/compat: regen for dispatch_semaphore_create

ctfmerge: fix macOS semaphore implementation, part 2
dispatch_semaphore_signal() doesn't return an error, just an
indicator of whether a thread was woken or not, so there's
no need to fail on non-zero return.

osnet: on macOS, use <mach/boolean.h> for boolean_t
macOS/x86_64 defines boolean_t as 'unsigned int' not 'int',
which causes a build issue with tools/ctfmerge on that host
after my recent fixes for macOS semaphores.

So use the <mach/boolean.h> instead of a local typedef ifdef __APPLE__.
May fix a macOS/x86_64 build issue reported by cjep@.
Builds fine on NetBSD/amd64 or macOS/arm.

Note: this compat stuff is clunky, and based on the commit log,
annoyingly error prone. A newer sync of osnet from upstream /may/
improve a lot of these compat typedef workarounds for solaris types...
 1.56.2.1 02-Aug-2025  perseant Sync with HEAD
 1.58.2.1 19-Oct-2025  martin Pull up following revision(s) (requested by mrg in ticket #56):

tools/compat/configure.ac: revision 1.111
tools/compat/compat_defs.h: revision 1.126
tools/compat/compat_defs.h: revision 1.127
tools/compat/nbtool_config.h.in: revision 1.60
tools/compat/nbtool_config.h.in: revision 1.61
lib/libc/stdio/mkstemps.c: revision 1.2
tools/compat/configure: revision 1.108
tools/compat/configure: revision 1.109
tools/compat/nbtool_config.h.in: revision 1.59
tools/compat/Makefile: revision 1.95
tools/compat/configure.ac: revision 1.110

Add more functions needed by mandoc

regen

add vsyslog decl check

regen

Do the nbtool dance.
 1.2 11-Feb-2006  wiz Redo previous differently: use AH_TOP and AH_BOTTOM macros to insert
header and footer into nbtool_config.h.in directly.
 1.1 11-Feb-2006  wiz Make using autoheader easier:
split off the autogenerated file into nbtool_config_internal.h,
and let nbtool_config.h be a file with the proper wrappers.

This way you can just change configure.ac, run autoconf and autoheader,
verify the result, and commit, but don't have to edit nbtool_config*in
manually every time.
 1.1 03-Feb-2010  roy Userland now builds and uses terminfo instead of termcap.

OK: core@, jdc@
 1.3 12-Nov-2014  joerg If the internals are not explicitly requested, use #include_next to pick
up the system version. <locale> from libc++ requires this and is used by
src/tools/elftosb2.
 1.2 27-Feb-2014  matt branches: 1.2.4;
To build elftosb with clang++, it needs more than nl_types.h provides.
XXX to workaround with, if compiling on __NetBSD__ just include the real
nl_types.h
 1.1 29-Jan-2002  tv branches: 1.1.56; 1.1.62;
Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.1.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.56.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.4.1 14-Nov-2014  martin Pull up following revision(s) (requested by jmcneill in ticket #236):
tools/compat/nl_types.h: revision 1.3
If the internals are not explicitly requested, use #include_next to pick
up the system version. <locale> from libc++ requires this and is used by
src/tools/elftosb2.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 27-Oct-2003  lukem branches: 1.3.30;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.3.30.1 18-May-2008  yamt sync with head.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 27-Oct-2003  lukem branches: 1.3.30;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 21-Mar-2003  pooka FreeBSD #defines putc_unlocked in stdio.h, so guard against that also
 1.1 14-Mar-2003  thorpej Add a putc_unlocked().
 1.3.30.1 18-May-2008  yamt sync with head.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 27-Oct-2003  lukem branches: 1.3.30;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.3.30.1 18-May-2008  yamt sync with head.
 1.6 03-Jul-2023  christos PR/57500: Palle Lyckegaard: include missing tools/compat/regex.h for
__{BEGIN,END}_DECLS.
 1.5 11-Mar-2018  christos undo previous; breaks the build. handle inside flex.
 1.4 11-Mar-2018  hans Fix build of tools/lex on platforms lacking sys/cdefs.h by including
nbtool_config.h in tools/compat/regex.h. Tested on illumos.
 1.3 06-Mar-2016  aymeric branches: 1.3.14;
add our libc's regex implementation to libnbcompat.

This way, nbsed picks it up and it unbreaks the build of xf86-video-intel-old's
man page under Linux and probably other future changes which rightfully expect
the (net)bsd behaviour.

Full release tested on ArchLinux and NetBSD 7.0_STABLE
 1.2 01-Mar-2016  martin Remove regexp.h here temporarily
 1.1 29-Feb-2016  aymeric add our libc's regex implementation to libnbcompat.

This way, nbsed picks it up and it unbreaks the build of xf86-video-intel-old's
man page under Linux and probably other future changes which rightfully expect
the (net)bsd behaviour.
 1.3.14.1 15-Mar-2018  pgoyette Synch with HEAD
 1.4 07-Feb-2013  christos branches: 1.4.4;
add shaX and rmd160 headers, same as mdX
 1.3 24-Sep-2005  elad branches: 1.3.24;
Move rmd160.h to crypto/ to keep in sync with recent changes.
Noted by xtraeme@.
 1.2 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1 13-Sep-2002  thorpej branches: 1.1.2;
* Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.2 03-Nov-2002  he Pull up revision 1.1 (new, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.1 13-Sep-2002  he file rmd160.h was added on branch netbsd-1-6 on 2002-11-03 16:18:40 +0000
 1.3.24.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.4.2 25-Feb-2013  tls resync with head
 1.4.4.1 07-Feb-2013  tls file rmd160.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 27-Oct-2003  lukem branches: 1.3.30;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.1 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.3.30.1 18-May-2008  yamt sync with head.
 1.4 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.3 26-Feb-2002  tv Add some more bits of host compatibility.
 1.2 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.1 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.4 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.3 26-Feb-2002  tv Add some more bits of host compatibility.
 1.2 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.1 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 27-Oct-2003  lukem branches: 1.4.30;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.3 31-Jan-2002  tv Provide a default string so host tools that forget to call setprogname()
won't accidentally segfault just trying to print a usage message.
 1.2 10-Jan-2002  lukem - act more like lib/libc/gen/setprogname.c, and store the basename of
the argument to setprogname()
- knf
 1.1 11-Dec-2001  tv Add the framework for autoconf-based src/tools/compat structure. This will
(after it is more fleshed out) allow the host tools to work more cleanly
on non-NetBSD hosts.
 1.4.30.1 18-May-2008  yamt sync with head.
 1.5 07-Feb-2013  christos branches: 1.5.4;
add shaX and rmd160 headers, same as mdX
 1.4 29-Oct-2006  dogcow branches: 1.4.24;
cross (and native) building works again. woo.
 1.3 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 01-Oct-2003  seb Adjust pathnames to {md{4,5},sha1}.h after their removal from
src/include.

Approved by mrg@
 1.1 13-Sep-2002  thorpej branches: 1.1.2;
* Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.2 03-Nov-2002  he Pull up revision 1.1 (new, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.1 13-Sep-2002  he file sha1.h was added on branch netbsd-1-6 on 2002-11-03 16:18:40 +0000
 1.4.24.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.4.2 25-Feb-2013  tls resync with head
 1.5.4.1 07-Feb-2013  tls file sha1.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.2 07-Feb-2013  christos branches: 1.2.4; 1.2.10;
yes, but include the right file
 1.1 07-Feb-2013  christos add shaX and rmd160 headers, same as mdX
 1.2.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.10.1 07-Feb-2013  yamt file sha2.h was added on branch yamt-pagecache on 2014-05-22 11:42:30 +0000
 1.2.4.2 25-Feb-2013  tls resync with head
 1.2.4.1 07-Feb-2013  tls file sha2.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.3 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.2 31-Jan-2002  tv Include config.h unconditionally; clean up.
 1.1 29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.1 31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.2 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1 13-Sep-2002  thorpej branches: 1.1.2;
* Always include the NetBSD glob(3) in libnbcompat, as the host
tools use some features of glob(3) that are not available on
all systems.
* Always include the NetBSD vis(3) in libnbcompat, since vis(3)
is not really standardized, and the vis(3) present on some systems
is different from ours.
* Always include the NetBSD MD2, MD4, MD5, RMD160, and SHA1 implementations
in libnbcompat. The host tools use features of the NetBSD versions
which aren't present on all systems that include those functions.
* Add a check for random(3) -- the Heimdal host tools want it.
* Add a check for termios.h -- the Heimdal host tools want it.
* Update the README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.2 03-Nov-2002  he Pull up revision 1.1 (new, requested by thorpej in ticket #797):
Include various more functions in libnbcompat, mostly
becuase our tools use features not universally present in
other versions. This applies to glob(3), vis(3), and the
MD2, MD4, RMD160 and SHA1 implementations.
Also add checks for random(3) and termios.h for the Heimdal
host tools.
Update README to indicate the current state of building the
host tools on Solaris 8 (for SPARC).
 1.1.2.1 13-Sep-2002  he file vis.h was added on branch netbsd-1-6 on 2002-11-03 16:18:40 +0000
 1.1 30-May-2023  lukem tools/compat: import AX_CHECK_COMPILE_FLAG

Import AX_CHECK_COMPILE_FLAG serial 6 from autoconf-archive
https://github.com/autoconf-archive/autoconf-archive.git
as at commit 5b5ce7f on 2023-05-01.
 1.1 20-Jul-2023  lukem tools/compat: provide nb_check_cc_flag.m4

Implement m4 macro NB_CHECK_CC_FLAG(FLAG, [VAR=FLAG_DERIVED])
Determine if the C compiler supports FLAG,
and sets output variable VAR to FLAG if FLAG is supported.

If VAR is not provided, default to FLAG_DERIVED, which is
FLAG converted to upper-case and all special characters
replaced with "_", and the result prepended with "CC_".
FLAG_DERIVED is appended to the m4 macro NB_CHECK_CC_FLAG_VARS.
E.g., if FLAG is "-Wexample=yes", FLAG_DERIVED is "CC_WEXAMPLE_YES".

This is implemented in separate buildaux/nb_check_cc_flag.m4,
based on configure's NB_CC_FLAG(), but supports VAR override.

Adapt configure from internal NB_CC_FLAG() to NB_CHECK_CC_FLAG().

(Note: AX_CHECK_COMPILE_FLAG() from autoconf-archive could be enhanced
to support the clang and gcc workarounds I've implemented here.)
 1.2 27-Oct-2006  mrg make sure we can find <sys/{rmd160,sha2}.h>. make sure the crypto/foo.h
versions of these include something that exists...
 1.1 24-Sep-2005  elad Move rmd160.h to crypto/ to keep in sync with recent changes.
Noted by xtraeme@.
 1.2 27-Oct-2006  mrg make sure we can find <sys/{rmd160,sha2}.h>. make sure the crypto/foo.h
versions of these include something that exists...
 1.1 26-Aug-2005  elad branches: 1.1.2;
Add nbcompat SHA2 header.
 1.1.2.2 08-Sep-2005  tron Apply patch (requested by elad in ticket #743):
Introduce SHA2 hashing routines in userland, including the common
helper routines.
 1.1.2.1 26-Aug-2005  tron file sha2.h was added on branch netbsd-3 on 2005-09-08 19:15:44 +0000
 1.3 22-Dec-2014  christos remove unused constants (Kamil Rytarowski)
 1.2 07-Sep-2014  martin branches: 1.2.2;
Avoid overflowing the "year" value by making the field uint64_t. Adapt
arguments and local variables accordingly.
This now fixes PR 49144 for real.
 1.1 01-Sep-2014  martin Add a slightly stripped down version of sys/dev/clock/clock_subr.h to make
this code available for tools.
 1.2.2.2 12-Nov-2014  snj Pull up following revision(s) (requested by martin in ticket #216):
share/man/man9/todr.9: revision 1.17
sys/arch/sh3/dev/rtc.c: revision 1.9
sys/dev/clock_subr.c: revision 1.17-1.22
sys/dev/clock_subr.h: revision 1.22
sys/fs/msdosfs/msdosfs_conv.c: revision 1.10
tools/compat/compat_defs.h: revision 1.98
tools/compat/dev/clock_subr.h: revision 1.1-1.2
usr.sbin/makefs/msdos/Makefile.inc: revision 1.6
clock_secs_to_ymdhms(9) takes seconds as a time_t, not int.
--
Make this compile- and usable from userland as well.
--
Add a slightly stripped down version of sys/dev/clock/clock_subr.h to make
this code available for tools.
--
Reformulate an overflow test so it can be used in tool builds (i.e. does
not depend on netbsd specific macros).
--
Make msdosfs time conversion use the y/m/d/h/m/s conversion functions
from clock_subr.c and compile that into the userland (and tools)
makefs as well.
--
Copy definitions of __type_min(t), __type_max(t), and some related macros,
from <sys/cdefs.h>, for use when building tools.
--
Revert previous; test secs > __type_max(time_t) again, now
that __type_max is available in tools/compat/compat_defs.h.
--
If HAVE_NBTOOL_CONFIG_H is set, then include "nbtool_config.h",
because this file is compiled as part of tools/makefs.
--
Counting leap years was fine while we had 32bit time_t - but now it
is not a good idea for dates far away in the future.
For dates in the year 2000 or later, use arithmetic instead (since the
repeating periods are well aligned). Should fix PR 49144.
--
Avoid overflowing the "year" value by making the field uint64_t. Adapt
arguments and local variables accordingly.
This now fixes PR 49144 for real.
--
Adapt formats for debug printfs to clock_subr type changes.
 1.2.2.1 07-Sep-2014  snj file clock_subr.h was added on branch netbsd-7 on 2014-11-12 18:50:55 +0000
 1.1 26-Jan-2013  christos branches: 1.1.4; 1.1.10;
links for makefs
 1.1.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.10.1 26-Jan-2013  yamt file bootsect.h was added on branch yamt-pagecache on 2014-05-22 11:42:30 +0000
 1.1.4.2 25-Feb-2013  tls resync with head
 1.1.4.1 26-Jan-2013  tls file bootsect.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.1 26-Jan-2013  christos branches: 1.1.4; 1.1.10;
links for makefs
 1.1.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.10.1 26-Jan-2013  yamt file bpb.h was added on branch yamt-pagecache on 2014-05-22 11:42:30 +0000
 1.1.4.2 25-Feb-2013  tls resync with head
 1.1.4.1 26-Jan-2013  tls file bpb.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.1 26-Jan-2013  christos branches: 1.1.4; 1.1.10;
links for makefs
 1.1.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.10.1 26-Jan-2013  yamt file denode.h was added on branch yamt-pagecache on 2014-05-22 11:42:30 +0000
 1.1.4.2 25-Feb-2013  tls resync with head
 1.1.4.1 26-Jan-2013  tls file denode.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.1 26-Jan-2013  christos branches: 1.1.4; 1.1.10;
links for makefs
 1.1.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.10.1 26-Jan-2013  yamt file direntry.h was added on branch yamt-pagecache on 2014-05-22 11:42:30 +0000
 1.1.4.2 25-Feb-2013  tls resync with head
 1.1.4.1 26-Jan-2013  tls file direntry.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.1 26-Jan-2013  christos branches: 1.1.4; 1.1.10;
links for makefs
 1.1.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.10.1 26-Jan-2013  yamt file fat.h was added on branch yamt-pagecache on 2014-05-22 11:42:30 +0000
 1.1.4.2 25-Feb-2013  tls resync with head
 1.1.4.1 26-Jan-2013  tls file fat.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.1 26-Jan-2013  christos branches: 1.1.4; 1.1.10;
links for makefs
 1.1.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.10.1 26-Jan-2013  yamt file msdosfsmount.h was added on branch yamt-pagecache on 2014-05-22 11:42:30 +0000
 1.1.4.2 25-Feb-2013  tls resync with head
 1.1.4.1 26-Jan-2013  tls file msdosfsmount.h was added on branch tls-maxphys on 2013-02-25 00:30:29 +0000
 1.2 08-Oct-2003  lukem Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
 1.1 12-May-2002  bjh21 Use the target disklabel_mbr.h, since it just describes data structures for
use on the target. This gets prep-mkbootimage to compile under Linux.
 1.2 28-Jan-2007  dogcow Back out this addition; it's The Wrong Thing when other system headers get
included.
 1.1 28-Jan-2007  dogcow Due to recent changes in the cd9660 code, crosscompilation of tools/makefs
now fails due to the use of [be]e{16,32}dec. Add a compat header, and force
the inclusion of <sys/endian.h>.
 1.1 19-Jul-2007  jmmv branches: 1.1.2; 1.1.8; 1.1.20;
sys/queue.h now requires sys/null.h, so add a compatibility header file.
Fixes build of tools under, e.g. Mac OS X.
 1.1.20.2 19-Jul-2007  jmmv sys/queue.h now requires sys/null.h, so add a compatibility header file.
Fixes build of tools under, e.g. Mac OS X.
 1.1.20.1 19-Jul-2007  jmmv file null.h was added on branch matt-mips64 on 2007-07-19 13:49:13 +0000
 1.1.8.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.1.8.1 19-Jul-2007  wrstuden file null.h was added on branch wrstuden-fixsa on 2007-09-03 07:05:26 +0000
 1.1.2.2 21-Jul-2007  liamjfoy Pull up following revision(s) (requested by jmmv in ticket #778):
tools/compat/sys/null.h: revision 1.1
sys/queue.h now requires sys/null.h, so add a compatibility header file.
Fixes build of tools under, e.g. Mac OS X.
 1.1.2.1 19-Jul-2007  liamjfoy file null.h was added on branch netbsd-4 on 2007-07-21 12:50:51 +0000
 1.1 21-Jan-2002  tv Make many host tools compile on non-NetBSD hosts. Not complete, but
very nearly there.
 1.1 08-May-2019  thorpej branches: 1.1.2;
Fix building libprop as a host tool library on platforms that don't have
the Matt Thomas rbtree:

- Include rb.c in libnbcompat, and provide a nbcompat sys/rbtree.h
header.
- Make sure libprop's source file include prop_object_impl.h before
anything else, and pull in nbtool_config.h from there.

Tested by simulating such a host system by renaming the host's
<sys/rbtree.h> out of the way (which reproduced the build failure)
and verifying that the host-tool installboot contained the rb_*
functions in its own .text segment.
 1.1.2.2 10-Jun-2019  christos Sync with HEAD
 1.1.2.1 08-May-2019  christos file rbtree.h was added on branch phil-wifi on 2019-06-10 22:10:14 +0000
 1.1 27-Oct-2006  mrg make sure we can find <sys/{rmd160,sha2}.h>. make sure the crypto/foo.h
versions of these include something that exists...
 1.2 12-Mar-2013  christos not a good place to include "nbtool_config.h"
 1.1 29-Oct-2006  dogcow branches: 1.1.40; 1.1.46;
cross (and native) building works again. woo.
 1.1.46.1 23-Jun-2013  tls resync from head
 1.1.40.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1 27-Oct-2006  mrg make sure we can find <sys/{rmd160,sha2}.h>. make sure the crypto/foo.h
versions of these include something that exists...
 1.2 27-Mar-2010  cegger remove OSX specific fix where CLOCK_REALTIME is not defined.
It has been properly fixed in
http://mail-index.netbsd.org/source-changes/2010/03/26/msg008200.html
 1.1 26-Mar-2010  cegger toolchain buildfix on OSX with MKDTRACE=yes:

The host <sys/time.h> doesn't provide CLOCK_REALTIME but ctf uses it.
See http://mail-index.netbsd.org/current-users/2010/03/20/msg012963.html

No comments.
 1.1 20-Dec-2006  agc Fixes to allow veriexecgen to be built as a host tool.
 1.1 14-May-2003  dbj use reachover relative paths in compat include files instead of
symlinking ufs include files into installboot and makefs tool objdirs
reviewed by lukem and thorpej on tech-toolchain
 1.1 14-May-2003  dbj use reachover relative paths in compat include files instead of
symlinking ufs include files into installboot and makefs tool objdirs
reviewed by lukem and thorpej on tech-toolchain
 1.1 14-May-2003  dbj use reachover relative paths in compat include files instead of
symlinking ufs include files into installboot and makefs tool objdirs
reviewed by lukem and thorpej on tech-toolchain
 1.1 14-May-2003  dbj use reachover relative paths in compat include files instead of
symlinking ufs include files into installboot and makefs tool objdirs
reviewed by lukem and thorpej on tech-toolchain
 1.1 07-Mar-2011  joerg ufs/ufs/quota.h is now used by makefs
 1.1 14-May-2003  dbj use reachover relative paths in compat include files instead of
symlinking ufs include files into installboot and makefs tool objdirs
reviewed by lukem and thorpej on tech-toolchain

RSS XML Feed