Commit Graph

183 Commits

Author SHA1 Message Date
wiz 1dc296553a Remove commas in AC_CHECK_FUNCS that shouldn't be there.
Closes PR 29577 by Valeriy E. Ushakov.
2005-03-02 18:08:43 +00:00
jmc 0a58d4b08d Define LOGIN_NAME_MAX explicitly here and override any system provided one
since the compat tools need to use the NetBSD limits, not the local system
ones (and some systems don't provide this yet anyways). Fixes PR#29170
2005-02-01 05:26:03 +00:00
jmc f7b3f12b97 Turns out some platforms (freebsd5) expose st_birthtime but not
st_birthtimensec. Make sure and check for both so programs can deal w. it
2005-01-13 00:52:40 +00:00
jmc 427a8339c4 Provide a definition for __UNCONST since there's no guarentee our sys/cdefs.h
gets pulled in
2004-12-11 09:34:08 +00:00
jmc 9da9dc64b7 Add heapsort to libnbcompat 2004-11-28 06:57:14 +00:00
jmc 7a47cf149b Check for fstatvfs and provide/use it only if the host system has it.
Fixes PR#27221
2004-10-12 03:28:30 +00:00
dbj 46ea8fc0f8 check for HAVE_STRUCT_STATVFS_F_IOSIZE
addresses PR toolchain/26415
2004-07-24 16:32:01 +00:00
dbj a7a2f3a478 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
2004-07-24 12:24:59 +00:00
tron ecde30ce9a Define "_ISOC99_SOURCE" when building under NetBSD to get the prototypes
for strtoll() and strtoull(). This fixes PR toolchain/26021.
2004-06-23 11:08:01 +00:00
jmc 3cc9c970a3 Redo the last commit. _NETBSD_SOURCE should never be used/referenced anymore.
So, don't wrap definitions in it, and instead check for it and #error out
if it somehow leaks into scope.

Tested a complete build to sets on x86 from a clean source tree.
2004-06-22 04:36:23 +00:00
jmc fe74c8aaed Note on NetBSD that _NETBSD_SOURCE should never be defined and it's an error
if it is
2004-06-22 01:51:22 +00:00
christos e71f17c257 - Wrap around #if !_NETBSD_SOURCE the definitions of u_{long,int,short,char}
- Protect dirfd() macro so that we don't re-define it.

These changes make my build proceed further.

The problem is that automatically generated files, might include system
files before they include anything else (for example our yacc skeleton
includes <stdlib.h> before it does anything else). This foils the scheme
of defining _POSIX_SOURCE and friends so that _NETBSD_SOURCE does not
get defined; in fact, we include many files with _NETBSD_SOURCE defined,
enough to cause confusion in compat_defs.h which tries to re-define things.
2004-06-21 23:14:42 +00:00
jmc 0a6d68b570 On NetBSD boxes make sure and provide prototypes for strtouq since quad_t gets
exposed all the time, but routines which use it do not. Otherwise callers
of strtouq will lose.
XXX: Need to come back through here and clean up the configure tests better
for this
2004-06-21 22:13:32 +00:00
jmc b2f782612f 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
2004-06-20 22:20:14 +00:00
thorpej b45be21f86 Use ${_TOOL_PREFIX} as appropriate. 2004-06-18 20:26:51 +00:00
thorpej a72980c494 Oops, missed a spot where we need to handle group_from_gid() separately. 2004-06-18 20:24:03 +00:00
thorpej 08248e74c7 Regen. 2004-06-18 20:17:12 +00:00
thorpej 594733dd5a Handle group_from_gid() on its own. 2004-06-18 20:17:01 +00:00
thorpej e1df38d43a Check for group_from_gid(). 2004-06-18 20:07:31 +00:00
jmc 09709f97dd Before sucking in stdlib.h check if this is NetBSD. If so, explicitly make
sure to use _POSIX_C_SOURCE and undef _NETBSD_SOURCE so the myriad of NetBSD
extentions don't get pulled into scope (and likely conflict at some point
with branched code trying to build on -current due to drift). Fixes PR#25533

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

PR: 24843
2004-05-18 22:14:35 +00:00
jmc 7a3a50551c Make this build on non-NetBSD again (specifically linux). Exclude __ndbm13.c
from the imported db sources as well
2004-05-03 03:20:20 +00:00
matt d4793b28a9 Add a compat definition of __packed. 2004-04-24 15:46:24 +00:00
christos dbe056a805 more constification suggested by kleink. 2004-04-23 14:46:31 +00:00
christos 5c424ffc08 adjust to constification of cget*() 2004-04-23 14:38:16 +00:00
simonb fa7a1046d3 White space nit. 2004-01-13 00:53:06 +00:00
simonb c7fb30805a Use the first argument of getmode() to modify the second arg, instead of
just replacing the second arg.  This lets the higher order file type bits
survive.  Fixes problems with the tools version of mknod(8).
2004-01-12 02:23:37 +00:00
simonb a5c6a6feac KNF. 2004-01-08 12:16:09 +00:00
jmc a2aecee228 List that all hosts require a posix sh and override with HOST_SH if needed.
Start a list of any other general tools assumed (gzip being the only one
right now).
Note that redhat8 works with no special settings.
2003-12-29 07:09:44 +00:00
dbj 8547b2b628 note successful build on Mac OS 10.3 with xcode 1.0 developer tools 2003-11-17 05:42:58 +00:00
dbj f26617b6f6 regen after HAVE_SYS_POLL_H change 2003-11-12 19:44:33 +00:00
dbj a473896520 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
2003-11-12 19:43:58 +00:00
lukem 444edb22a9 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).
2003-10-27 01:42:50 +00:00
lukem 171d653219 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).
2003-10-27 00:12:41 +00:00
lukem f85d2d1c14 Use ${HOST_SH} instead of `sh'.
If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
2003-10-26 07:25:33 +00:00
lukem 1c33b4e6a4 Overhaul MBR handling (part 1):
<sys/bootblock.h>:
    *	Added definitions for the Master Boot Record (MBR) used by
	a variety of systems (primarily i386), including the format
	of the BIOS Parameter Block (BPB).
	This information was cribbed from a variety of sources
	including <sys/disklabel_mbr.h> which this is a superset of.

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

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

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

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

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

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

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

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

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

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


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
2003-10-08 04:25:43 +00:00
seb e969ce2f8d Adjust pathnames to {md{4,5},sha1}.h after their removal from
src/include.

Approved by mrg@
2003-10-01 11:59:06 +00:00
uwe 3f02ec91cd If SIZE_MAX is not defined, but SIZE_T_MAX is defined (e.g. FreeBSD),
define SIZE_MAX as SIZE_T_MAX.
2003-08-27 18:33:26 +00:00
lukem a93ea220fc Rework how dependency generation is performed:
* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
  This is a change of behaviour.  If a Makefile wants the clean semantics
  it must specifically append to CLEANFILES.
  Resolves PR toolchain/5204.

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

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

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

* Deprecate the (short lived) DEPENDSRCS


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

Tested with "make -j 8 distribution" and "make distribution".
2003-08-01 17:03:41 +00:00
fredb b92132145c Must add "configure.lineno" to CLEANFILES after updating to autoconf 2.57. 2003-07-29 19:25:02 +00:00
lukem deeae012af If HAVE_SYS_ENDIAN_H, pull in <sys/endian.h>. Fixes build.sh on FreeBSD 5.1.
Fix from Grant Beattie <grant@>
2003-07-27 07:56:37 +00:00
salo 22a0ae4298 netbsd.org->NetBSD.org 2003-07-26 20:17:31 +00:00
atatat cdea39b56a Regen for host-tool-ified stat 2003-07-25 03:22:39 +00:00
atatat d5fb781871 More properly host-tool-ify stat 2003-07-25 03:21:15 +00:00
fredb 93dcb2eb39 Regenerate with autoconf 2.57. 2003-07-18 13:51:44 +00:00
fredb c0326dd8e8 As discussed briefly on tech-toolchain, AIX doesn't have "u_long",
so add a check for that. Partial fix for PR toolchain/22177.
2003-07-18 13:45:15 +00:00
uwe 0bbb587407 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.
2003-06-03 03:16:48 +00:00
dbj 41b9cfff20 use reachover relative paths in compat include files instead of
symlinking ufs include files into installboot and makefs tool objdirs
reviewed by lukem and thorpej on tech-toolchain
2003-05-14 00:30:26 +00:00
bjh21 4be7a2dcf3 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

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

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

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-28 23:16:11 +00:00
pooka cfb2c17888 FreeBSD #defines putc_unlocked in stdio.h, so guard against that also 2003-03-21 14:40:26 +00:00
grant fc135e74ba if target is not a symlink, silently succeed rather than failing with
EINVAL.

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

ok'd by christos.
2003-03-19 09:26:38 +00:00
thorpej 241ed6a4c1 Add a putc_unlocked(). 2003-03-14 03:38:42 +00:00
thorpej 1d994487b3 Fix the socklen_t test; we need to explcitly list the headers we want
included for that test.
2003-03-13 16:27:03 +00:00
thorpej 3550b00b45 Move -no-cpp-precomp logic to defs.mk. 2003-03-13 05:15:49 +00:00
thorpej 8b1707fd43 Disable pre-compiled headers on Darwin. 2003-03-13 05:00:28 +00:00
thorpej 72ec5d6a9c Check for sys/socket.h and socklen_t. 2003-03-13 04:30:39 +00:00
uwe 4eb408dcd9 Avoid cgetcap &co prototypes conflicting with those provided by the host.
With this change we can cross-compile on FreeBSD 4.x.
2003-01-31 20:50:29 +00:00
uwe af823cea6c Provide __SCCSID() needed by pwd_mkdb. 2003-01-27 01:17:47 +00:00
thorpej 7059a54da4 Include <sys/types.h> before <grp.h>; Mac OS 10.2.2 needs this. 2002-12-16 00:35:00 +00:00
thorpej bd339b41ac Include <sys/types.h> before including <dirent.h>; Mac OS 10.2.2
needs this.
2002-12-16 00:31:59 +00:00
lukem 90af8ac79d Tweak dependencies so that defs.mk depends upon config.cache, and
config.cache depends upon 'include/.stamp configure config.h.in defs.mk.in'
and runs configure.  Forcebly remove config.cache before running configure.

This change means that config.cache is (still) retained between "make clean"
(but not "make cleandir") runs, but is flushed if configure or config.h.in
is changed, as the cache may contain incorrect information in that case.
2002-12-04 23:27:54 +00:00
lukem c6f399207c add check back for util.h; needed on some foreign systems 2002-11-30 21:43:27 +00:00
lukem b1e79510cf - 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).
2002-11-30 03:04:44 +00:00
lukem 336730e201 replace missing strsuftoll(3) 2002-11-29 13:00:22 +00:00
christos 1391513680 PR/18733: Jed Davis: define _PATH_DEFTAPE; pax needs it. 2002-10-20 00:42:20 +00:00
lukem dba0caccee Implement replacements for lchflags(), lchmod(), and lchown(),
which first lstat(2) the target and return EINVAL if it's a symlink,
and then call ch{flags,mod,own} as appropriate.
Removes the need for hokey code inside the tools themselves...
2002-10-08 00:28:36 +00:00
briggs 4fb03019c2 Just check for poll.h, don't fail if it's not present. 2002-10-07 18:12:36 +00:00
lukem 8b42f7b9d9 Provide strtoll() in libnbcompat.
Should fix relevant build issue on HP-UX and MacOS X hosts.
2002-10-06 12:09:34 +00:00
lukem c61581112f complete check for lchflags 2002-10-06 01:25:58 +00:00
lukem cb48eb573f check for lchflags 2002-10-05 04:13:30 +00:00
thorpej bcb4b867fe Check for <poll.h> and poll(2). 2002-10-04 22:10:10 +00:00
lukem b9472f8280 Fix from Giles Lean:
HP-UX has MAP_ANONYMOUS but not MAP_ANON
2002-09-30 00:39:21 +00:00
lukem 6a507832d7 It's "HP-UX" not "HP/UX". (Thanks Giles). 2002-09-29 07:05:28 +00:00
lukem ab956106b3 preliminary HP/UX notes from Giles; it needs zlib.
(as Solaris, Linux and HP/UX all mention they need zlib and it should
be part of libnbcompat, maybe this is a hint for us to get a move on
and do that :)
2002-09-22 01:26:39 +00:00
briggs 482480a39e Note that RedHat 7.3 hosts successfully as of today with the caveat that
LANG=C must be in the environment.
2002-09-16 18:13:04 +00:00
briggs a94d82e6f9 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.
2002-09-16 04:10:36 +00:00
thorpej 6d82557c32 Add a HOST_BSHELL make var which contains the path to the working
shell.
2002-09-15 16:46:23 +00:00
thorpej d92d489497 * 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).
2002-09-14 04:30:27 +00:00
bjh21 82a564def5 Add __restrict to the set of tokens we #define away: our glob.h uses it. 2002-09-13 23:35:34 +00:00
thorpej 44390285d1 Update Solaris section (again). 2002-09-13 23:35:32 +00:00
thorpej f54ca60093 * 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).
2002-09-13 19:07:01 +00:00
pooka c695034447 work around FreeBSD defining user_from_uid() in stdlib.h 2002-07-03 17:17:04 +00:00
pooka d8c01a3d2a Fine-grain checking somewhat:
* check for user_from_uid() in addition to pwcache_userdb()
* check for svis() in addition to vis()
2002-07-03 17:16:26 +00:00
mason f8af64685c fix minor typo -> s/lokcing/locking/ 2002-06-07 21:13:55 +00:00
bjh21 4eb51f77ed Use the target disklabel_mbr.h, since it just describes data structures for
use on the target.  This gets prep-mkbootimage to compile under Linux.
2002-05-12 12:30:10 +00:00
bjh21 2b918abe52 I believe I've fixed nbmake's dependency on /bin/sh. 2002-04-28 22:28:38 +00:00
bjh21 a3112ce1b9 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.
2002-04-24 19:41:58 +00:00
bjh21 6d3e84cc85 src/tools/dbsym has been buildable on non-NetBSD systems for some time. 2002-04-24 16:28:55 +00:00
bjh21 a64574e0e7 Add test for alloca() and <alloca.h>, since Sun Workshop C 5.0 needs this. 2002-04-23 00:13:50 +00:00
bjh21 bfebd5429d <stdint.h> belongs before <sys/endian.h>. 2002-04-22 23:40:10 +00:00
bjh21 35d3ac9968 Define __CONCAT if the host doesn't. 2002-04-22 23:39:38 +00:00
bjh21 c5b9549c5f Create sys/endian.h if it doesn't exist, since rmd160.c includes it directly. 2002-04-22 19:23:33 +00:00
lukem 7de4309228 add UINT32_MAX if it's not defined 2002-04-22 15:09:19 +00:00
tv bcde44453d Emit an empty <stdint.h> if the host doesn't have one. Should fix PR 16416. 2002-04-19 22:47:11 +00:00
tv 42f04dab1c Actually put the include directory timestamp under the "include" directory,
such that nuking the dir by hand also nukes the timestamp.
2002-04-18 21:15:08 +00:00
tv 25252c9a84 Re-add test for <sys/endian.h>; it disappeared somewhere along the way. 2002-04-18 21:05:22 +00:00
bjh21 6619533896 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.
2002-04-18 15:31:51 +00:00
bjh21 833d114dfc Add HAVE_SYS_ENDIAN_H. 2002-04-04 17:52:04 +00:00
bjh21 55b93a6461 Add htobe16() and friends, #ifndef HAVE_SYS_ENDIAN_H. 2002-04-04 17:49:20 +00:00
bjh21 79cd9fb3ab Replace a spurious hard space (\xa0) with a normal one. 2002-04-04 17:28:33 +00:00