History log of /netbsd-current/tools/compat/configure.ac
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.107 20-Jul-2023 lukem

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.


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.97 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.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.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.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.


Revision tags: netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 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.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.97 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.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.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.99 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.98 24-Jun-2020 uwe

Add AC_MSG_RESULT yes/no to the uio checks.


Revision tags: netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.97 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.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.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.98 24-Jun-2020 uwe

Add AC_MSG_RESULT yes/no to the uio checks.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.97 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.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.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.97 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.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.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.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.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.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.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.91 13-Jun-2018 maya

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.


Revision tags: pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.89 09-Dec-2017 sevan

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>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

branches: 1.87.6;
strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.88 02-Oct-2017 christos

handle __fpurge being declared in <stdio_ext.h>


Revision tags: perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base
# 1.87 07-Jan-2017 christos

strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.87 07-Jan-2017 christos

strmode on MacOS/X is in string.h


Revision tags: pgoyette-localcount-20170107
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: pgoyette-localcount-20161104
# 1.85 19-Oct-2016 christos

try to fix missing decls


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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}


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.82 06-Jun-2014 christos

branches: 1.82.2;
Deal with errc/warnc


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 1.77 19-Jul-2013 pooka

Fix some tests for musl libc -based systems.

from Justin Cormack and Jens Staal


Revision tags: riastradh-drm2-base agc-symver-base
# 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.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2
# 1.74 03-Nov-2011 joerg

branches: 1.74.6;
Add getline(3) compat glue.


Revision tags: yamt-pagecache-base
# 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.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 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>.


Revision tags: matt-premerge-20091211
# 1.70 16-Jun-2009 christos

add fpurge; needed by awk.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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.


Revision tags: netbsd-5-base matt-mips64-base2
# 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.


Revision tags: mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase cube-autoconf-base matt-armv6-base hpcarm-cleanup-base
# 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.


Revision tags: matt-mips64-base
# 1.61 03-Jul-2007 nakayama

Add strndup(3) to libnbcompat, since estrndup(3) added into efun.c calls it.


Revision tags: netbsd-4-base
# 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".


Revision tags: abandoned-netbsd-4-base
# 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


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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().


Revision tags: netbsd-2-0-base
# 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.


Revision tags: fvdl_fs64_base
# 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()


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.