Subject: build.sh on solaris 2.7
To: None <tech-toolchain@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-toolchain
Date: 03/27/2002 23:39:27
--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,
I spent some time trying to get NetBSD building on a solaris 2.7 host.
Here is a list of problems I got, and how I solved them (see attached patch).
I'd like eventually to commit those changes; although my patch handle all
issues at once I can do separate commits.

First is the shell problem. /bin/sh isn't good enouth and remplacing it isn't
an option for me. I added a new variable to build.sh, HOST_SHELL, which
defaults to /bin/sh. I added call to $HOST_SHELL in various places in makefiles
and scripts.
make has the path to the shell hardcoded. I considered reading the path from
a environnement variable but this could have undesired side effects, so I
keept a hardcoded shell, but which can be chosen at compile time:
a HOST_SHELL macro is defined to the string on the compile command line.
It's set to /bin/sh in usr.bin/make/Makefile and $HOST_SHELL in buildmake.sh

Second I found that 'config.h' for the compat stuff was a bad name, because
there are several config.h around in the tree. Sometimes the wrong one was
used. I renamed the compat config.h to host_config.h now that I'm thinking
of it, maybe compat_config.h would be better ? Also I keept HAVE_CONFIG_H,
this should probably be renamed to HAVE_HOST_CONFIG_H or HAVE_COMPAT_CONFIG_H.
Anyway the idea is there :)

Another problem was the need I had to define custom cpp flags for tools.
I added a HOST_CPPFLAGS variable to build.sh (it already had HOST_CLFLAGS and
HOST_LDFLAGS).
I had to use a -idirafter in HOST_CPPFLAGS, but host-mkdep didn't't handle it,
I fixed this too.

I also found an issue with UPDATE in bsd.lib.mk: build.sh -u sets UPDATE
to yes, not the empty string. __archiveinstall uses a construct which
assumes that UPDATE is empty when defined.

makelintstub uses cpp, I made it use "${CPP}" instead of "cpp".

Some tools can't be compiled or used on non-NetBSD hosts yet (e.g. 
sparc-installboot), I added a test for NetBSD in tools/Makefile and
use it to exclude some hosts tools.

tools/makefs/Makefile uses a ln -f which solaris's ln doens't understant.
As there is an explicit rm just before, -f isn't needed here.

xlint wants to use MAP_ANON, I added a check for this in compat/configure,
and defaults to malloc if not available.

rpc.pcnfsd uses a local makefile hack to make genetared headers depend on the
rpcgen binary. Other rpc utilities don't do that so I removed it. If we really
want this we'll have to make it in share/mk and use it for all makefiles
calling rpc.

For some tools solaris's glob isn't good enouth. I added __glob13.c/glob.h to
libcompat.

On solaris some tools also want -lsocket, I added a check for this in
tools/compat/comfigure.


With these changes I can successfully run a 'build.sh -t'. A 'make build'
will also make good progress (all of lib gnu/lib compile for example).
Here are the unresolved issue yet:

First a few host tools can't be compiled on non-NetBSD hosts.
sparc-installboot and dbsym aren't critical for now. dbsym could use
a trick similar to mips-elf2ecoff (use cut-down NetBSD headers in tool
dir), but sparc-installboot needs fondamental rework as it wants to work
on devices.
A more annoying one is mklocale. It's brocken because it uses types and
unions defined in md header (machine/ansi.h) to dump a binary file
for the target host. For now it's not a problem for NetBSD->NetBSD compiles,
because the types and unions are the same on all NetBSD-suppored arch.
But when NetBSD will be ported to a machine with different alignement
constraints, or a non-32bit int this will become a problem.
I don't know how to solve this, exept duplicating the part we need from
ansi.h for all NetBSD archs, in the tool dir. Idea welcome.

My make build has stopped on build of host tools that are not in the
src/tools dir: mk* in bin/sh, mkmagic in usr/bin/file, etc ...
The probleme here is that these tools are build without src/tools/compat.
It should be easy to add path and library calls to HOST_* from share/mk,
but the problem here is that we need to include tools/compat/defs.mk,
and this one changes DPADD and LDADD. It should change HOST_DPADD and
HOST_LDADD instead, and get DPADD/LDADD updated in Makefile.host.
I didn't look at this yet.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--

--n8g4imXOkfNTN/H1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff-sol27

Index: build.sh
===================================================================
RCS file: /cvsroot/basesrc/build.sh,v
retrieving revision 1.52
diff -u -r1.52 build.sh
--- build.sh	2002/03/14 18:33:04	1.52
+++ build.sh	2002/03/27 19:06:59
@@ -123,6 +123,7 @@
 opt_a=no
 opts='a:B:bdhj:m:nortuw:D:O:R:T:U'
 runcmd=
+shell=${HOST_SHELL-/bin/sh}
 
 if type getopts >/dev/null 2>&1; then
 	# Use POSIX getopts.
@@ -246,9 +247,9 @@
 	trap "exit 1" 1 2 3 15
 	$runcmd cd $tmpdir
 
-	$runcmd env CC="${HOST_CC-cc}" CPPFLAGS="${HOST_CPPFLAGS}" CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \
-		$cwd/tools/make/configure || bomb "configure of nbmake failed"
-	$runcmd sh buildmake.sh || bomb "build of nbmake failed"
+	$runcmd env CC="${HOST_CC-cc}" HOST_SHELL="${shell}" CPPFLAGS="${HOST_CPPFLAGS}" CFLAGS="${HOST_CFLAGS--O}" LDFLAGS="${HOST_LDFLAGS}" \
+		${shell} $cwd/tools/make/configure || bomb "configure of nbmake failed"
+	$runcmd env HOST_SHELL="${shell}" ${shell} buildmake.sh || bomb "build of nbmake failed"
 
 	make=$tmpdir/nbmake
 	$runcmd cd $cwd
@@ -379,12 +380,12 @@
 	${runcmd-exec} $makewrapper $buildtarget
 elif $do_buildonlytools; then
 	if [ "$MKOBJDIRS" != "no" ]; then
-		$runcmd $makewrapper obj-tools || exit 1
+		$runcmd env HOST_SHELL=${shell} $makewrapper obj-tools || exit 1
 	fi
 	$runcmd cd tools
 	if [ "$UPDATE" = "" ]; then
-		${runcmd-exec} $makewrapper cleandir dependall install
+		${runcmd-exec} env HOST_SHELL=${shell} $makewrapper cleandir dependall install
 	else
-		${runcmd-exec} $makewrapper dependall install
+		${runcmd-exec} env HOST_SHELL=${shell} $makewrapper dependall install
 	fi
 fi
Index: bin/dd/strsuftoull.c
===================================================================
RCS file: /cvsroot/basesrc/bin/dd/strsuftoull.c,v
retrieving revision 1.7
diff -u -r1.7 strsuftoull.c
--- strsuftoull.c	2002/01/31 22:43:33	1.7
+++ strsuftoull.c	2002/03/27 19:06:59
@@ -79,7 +79,7 @@
 #endif /* not lint */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/types.h>
Index: bin/ls/stat_flags.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ls/stat_flags.c,v
retrieving revision 1.13
diff -u -r1.13 stat_flags.c
--- stat_flags.c	2002/01/31 22:43:34	1.13
+++ stat_flags.c	2002/03/27 19:06:59
@@ -43,7 +43,7 @@
 #endif /* not lint */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #else
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
 #endif
Index: bin/pax/pax.h
===================================================================
RCS file: /cvsroot/basesrc/bin/pax/pax.h,v
retrieving revision 1.13
diff -u -r1.13 pax.h
--- pax.h	2002/01/31 22:43:36	1.13
+++ pax.h	2002/03/27 19:07:00
@@ -40,7 +40,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #else
 #define HAVE_LCHMOD 1
 #define HAVE_LCHOWN 1
Index: gnu/usr.sbin/mdsetimage/mdsetimage.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/usr.sbin/mdsetimage/mdsetimage.c,v
retrieving revision 1.6
diff -u -r1.6 mdsetimage.c
--- mdsetimage.c	2002/03/02 12:21:14	1.6
+++ mdsetimage.c	2002/03/27 19:08:06
@@ -42,7 +42,7 @@
 #endif /* not lint */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/types.h>
Index: lib/libc/db/btree/btree.h
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/db/btree/btree.h,v
retrieving revision 1.12
diff -u -r1.12 btree.h
--- btree.h	2002/01/21 21:33:42	1.12
+++ btree.h	2002/03/27 19:08:10
@@ -39,7 +39,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 /* Macros to set/clear/test flags. */
Index: lib/libc/db/hash/hash.h
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/db/hash/hash.h,v
retrieving revision 1.10
diff -u -r1.10 hash.h
--- hash.h	2002/01/21 21:33:42	1.10
+++ hash.h	2002/03/27 19:08:10
@@ -39,7 +39,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 /* Operations */
Index: lib/libc/gen/err.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/err.c,v
retrieving revision 1.19
diff -u -r1.19 err.c
--- err.c	2002/01/31 22:43:37	1.19
+++ err.c	2002/03/27 19:08:10
@@ -46,7 +46,7 @@
 #include "namespace.h"
 #endif
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 #include <err.h>
 
Index: lib/libc/gen/errx.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/errx.c,v
retrieving revision 1.7
diff -u -r1.7 errx.c
--- errx.c	2002/01/31 22:43:37	1.7
+++ errx.c	2002/03/27 19:08:10
@@ -46,7 +46,7 @@
 #include "namespace.h"
 #endif
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 #include <err.h>
 
Index: lib/libc/gen/pw_scan.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/pw_scan.c,v
retrieving revision 1.11
diff -u -r1.11 pw_scan.c
--- pw_scan.c	2002/01/29 10:20:30	1.11
+++ pw_scan.c	2002/03/27 19:08:10
@@ -34,7 +34,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #include "compat_pwd.h"
 #else
 #include <sys/cdefs.h>
Index: lib/libc/gen/verr.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/verr.c,v
retrieving revision 1.9
diff -u -r1.9 verr.c
--- verr.c	2002/01/31 22:43:38	1.9
+++ verr.c	2002/03/27 19:08:10
@@ -46,7 +46,7 @@
 #include "namespace.h"
 #endif
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 #include <err.h>
 #include <errno.h>
Index: lib/libc/gen/verrx.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/verrx.c,v
retrieving revision 1.9
diff -u -r1.9 verrx.c
--- verrx.c	2002/01/31 22:43:38	1.9
+++ verrx.c	2002/03/27 19:08:10
@@ -46,7 +46,7 @@
 #include "namespace.h"
 #endif
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 #include <err.h>
 #include <stdio.h>
Index: lib/libc/gen/vwarn.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/vwarn.c,v
retrieving revision 1.9
diff -u -r1.9 vwarn.c
--- vwarn.c	2002/01/31 22:43:39	1.9
+++ vwarn.c	2002/03/27 19:08:10
@@ -46,7 +46,7 @@
 #include "namespace.h"
 #endif
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 #include <err.h>
 #include <errno.h>
Index: lib/libc/gen/vwarnx.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/vwarnx.c,v
retrieving revision 1.9
diff -u -r1.9 vwarnx.c
--- vwarnx.c	2002/01/31 22:43:39	1.9
+++ vwarnx.c	2002/03/27 19:08:10
@@ -46,7 +46,7 @@
 #include "namespace.h"
 #endif
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 #include <err.h>
 #include <stdio.h>
Index: lib/libc/gen/warn.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/warn.c,v
retrieving revision 1.7
diff -u -r1.7 warn.c
--- warn.c	2002/01/31 22:43:39	1.7
+++ warn.c	2002/03/27 19:08:11
@@ -46,7 +46,7 @@
 #include "namespace.h"
 #endif
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 #include <err.h>
 
Index: lib/libc/gen/warnx.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/gen/warnx.c,v
retrieving revision 1.7
diff -u -r1.7 warnx.c
--- warnx.c	2002/01/31 22:43:39	1.7
+++ warnx.c	2002/03/27 19:08:11
@@ -46,7 +46,7 @@
 #include "namespace.h"
 #endif
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 #include <err.h>
 
Index: lib/libc/sys/Makefile.inc
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/sys/Makefile.inc,v
retrieving revision 1.124
diff -u -r1.124 Makefile.inc
--- Makefile.inc	2002/01/29 19:01:18	1.124
+++ Makefile.inc	2002/03/27 19:08:11
@@ -96,18 +96,18 @@
 
 LintSysNormal.c: ${.CURDIR}/sys/makelintstub \
     ${DESTDIR}/usr/include/sys/syscall.h
-	sh ${.CURDIR}/sys/makelintstub -o ${.TARGET} \
+	CPP=${CPP} ${HOST_SHELL} ${.CURDIR}/sys/makelintstub -o ${.TARGET} \
 	    -s ${DESTDIR}/usr/include/sys/syscall.h ${ASM} ${WEAKASM}
 
 LintSysNoerr.c: ${.CURDIR}/sys/makelintstub \
     ${DESTDIR}/usr/include/sys/syscall.h
-	sh ${.CURDIR}/sys/makelintstub -o ${.TARGET} -n \
-	    -s ${DESTDIR}/usr/include/sys/syscall.h ${NOERR}
+	CPP=${CPP} ${HOST_SHELL} ${.CURDIR}/sys/makelintstub \
+	    -o ${.TARGET} -n -s ${DESTDIR}/usr/include/sys/syscall.h ${NOERR}
 
 LintSysPseudoNoerr.c: ${.CURDIR}/sys/makelintstub \
     ${DESTDIR}/usr/include/sys/syscall.h
-	sh ${.CURDIR}/sys/makelintstub -o ${.TARGET} -p \
-	    -s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDONOERR}
+	CPP=${CPP} ${HOST_SHELL} ${.CURDIR}/sys/makelintstub \
+	    -o ${.TARGET} -p -s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDONOERR}
 
 MAN+=	accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
 	chflags.2 chmod.2 chown.2 chroot.2 clock_settime.2 clone.2 close.2 \
Index: lib/libc/sys/makelintstub
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/sys/makelintstub,v
retrieving revision 1.8
diff -u -r1.8 makelintstub
--- makelintstub	2001/11/13 18:39:10	1.8
+++ makelintstub	2002/03/27 19:08:11
@@ -200,7 +200,7 @@
 trap "rm -f $syscalldump" 0 1 2 15
 
 header
-printf '#include "'"$syscallhdr"'"' | cpp -C >$syscalldump
+printf '#include "'"$syscallhdr"'"' | ${CPP} -C >$syscalldump
 for syscall; do
 	fnname=${syscall%.S}
 	if [ $pflag = YES ]; then
Index: lib/libposix/sys/Makefile.inc
===================================================================
RCS file: /cvsroot/basesrc/lib/libposix/sys/Makefile.inc,v
retrieving revision 1.13
diff -u -r1.13 Makefile.inc
--- Makefile.inc	2002/01/29 19:03:01	1.13
+++ Makefile.inc	2002/03/27 19:08:13
@@ -21,5 +21,6 @@
 
 LintSysPseudo.c: ${.CURDIR}/../libc/sys/makelintstub \
     ${DESTDIR}/usr/include/sys/syscall.h
-	sh ${.CURDIR}/../libc/sys/makelintstub -o ${.TARGET} -p \
+	CPP=${CPP} ${HOST_SHELL} ${.CURDIR}/../libc/sys/makelintstub \
+	    -o ${.TARGET} -p \
 	    -s ${DESTDIR}/usr/include/sys/syscall.h ${PSEUDO}
Index: lib/libutil/fparseln.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libutil/fparseln.c,v
retrieving revision 1.11
diff -u -r1.11 fparseln.c
--- fparseln.c	2002/01/21 23:33:36	1.11
+++ fparseln.c	2002/03/27 19:08:14
@@ -30,7 +30,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #else
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
Index: libexec/makewhatis/makewhatis.c
===================================================================
RCS file: /cvsroot/basesrc/libexec/makewhatis/makewhatis.c,v
retrieving revision 1.24
diff -u -r1.24 makewhatis.c
--- makewhatis.c	2002/03/10 20:36:10	1.24
+++ makewhatis.c	2002/03/27 19:08:16
@@ -47,7 +47,7 @@
 #endif /* not lint */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/types.h>
Index: sbin/mknod/pack_dev.c
===================================================================
RCS file: /cvsroot/basesrc/sbin/mknod/pack_dev.c,v
retrieving revision 1.3
diff -u -r1.3 pack_dev.c
--- pack_dev.c	2002/01/31 22:43:42	1.3
+++ pack_dev.c	2002/03/27 19:08:18
@@ -52,7 +52,7 @@
 #include <unistd.h>
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include "pack_dev.h"
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.lib.mk,v
retrieving revision 1.198
diff -u -r1.198 bsd.lib.mk
--- bsd.lib.mk	2002/03/19 14:39:22	1.198
+++ bsd.lib.mk	2002/03/27 19:08:22
@@ -345,8 +345,13 @@
 	${RANLIB} ${.TARGET}
 
 __archiveinstall: .USE
+.if !defined(UPDATE)
 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-	    ${UPDATE:U-a "${RANLIB} -t"} ${.ALLSRC} ${.TARGET}
+	    -a "${RANLIB} -t" ${.ALLSRC} ${.TARGET}
+.else
+	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+	    ${.ALLSRC} ${.TARGET}
+.endif
 
 __archivesymlinkpic: .USE
 	${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
Index: share/mk/bsd.sys.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.sys.mk,v
retrieving revision 1.70
diff -u -r1.70 bsd.sys.mk
--- bsd.sys.mk	2002/01/27 23:33:51	1.70
+++ bsd.sys.mk	2002/03/27 19:08:23
@@ -61,6 +61,8 @@
 HOST_AR?=	ar
 HOST_RANLIB?=	ranlib
 
+HOST_SHELL?=	/bin/sh
+
 CONFIG?=	config
 CRUNCHGEN?=	crunchgen
 GROFF?=		groff
Index: sys/ufs/ffs/ffs_bswap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ffs/ffs_bswap.c,v
retrieving revision 1.17
diff -u -r1.17 ffs_bswap.c
--- ffs_bswap.c	2002/01/31 19:19:22	1.17
+++ ffs_bswap.c	2002/03/27 19:08:56
@@ -38,7 +38,7 @@
 #endif
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/param.h>
Index: sys/ufs/ffs/ffs_subr.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ffs/ffs_subr.c,v
retrieving revision 1.21
diff -u -r1.21 ffs_subr.c
--- ffs_subr.c	2002/01/31 19:19:22	1.21
+++ ffs_subr.c	2002/03/27 19:08:56
@@ -41,7 +41,7 @@
 #endif
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/param.h>
Index: sys/ufs/ffs/ffs_tables.c
===================================================================
RCS file: /cvsroot/syssrc/sys/ufs/ffs/ffs_tables.c,v
retrieving revision 1.5
diff -u -r1.5 ffs_tables.c
--- ffs_tables.c	2002/01/31 19:19:23	1.5
+++ ffs_tables.c	2002/03/27 19:08:56
@@ -41,7 +41,7 @@
 #endif
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/param.h>
Index: tools/Makefile
===================================================================
RCS file: /cvsroot/basesrc/tools/Makefile,v
retrieving revision 1.40
diff -u -r1.40 Makefile
--- Makefile	2002/03/07 19:12:33	1.40
+++ Makefile	2002/03/27 19:08:57
@@ -5,6 +5,22 @@
 
 .include <bsd.own.mk>
 
+.if exists(/usr/bin/uname)
+UNAME=/usr/bin/uname
+.elif exists(/bin/uname)
+UNAME=/bin/uname
+.else
+UNAME=echo Unknown
+.endif
+
+.ifndef OPSYS
+OPSYS!=                 ${UNAME} -s
+.endif
+
+.if ${OPSYS} != "NetBSD"
+NO_DBSYM=
+.endif
+
 # XXX We can't currently build the toolchain for x86-64.
 .if ${MACHINE_ARCH} != "x86_64"
 TOOLCHAIN_BITS= toolchain .WAIT ${NO_DBSYM:D:Udbsym} mdsetimage
@@ -21,7 +37,7 @@
 	lex .WAIT \
 	${TOOLCHAIN_BITS} \
 		asn1_compile compile_et config lint1 \
-		makefs menuc mklocale msgc pax pwd_mkdb zic
+		makefs menuc msgc pax pwd_mkdb zic
 
 .if ${MKMAN} != "no"
 SUBDIR+=	groff
@@ -31,8 +47,11 @@
 SUBDIR+=	autoconf gettext
 .endif
 
-.if ${MACHINE} == sparc || ${MACHINE} == sparc64
+.if ${OPSYS} == "NetBSD"
+.  if ${MACHINE} == sparc || ${MACHINE} == sparc64
 SUBDIR+=	sparc-installboot
+.  endif
+SUBDIR+= mklocale
 .endif
 
 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb")
Index: tools/compat/Makefile
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- Makefile	2002/02/26 22:29:38	1.8
+++ Makefile	2002/03/27 19:08:57
@@ -8,7 +8,7 @@
 		setgroupent.c setpassent.c setprogname.c snprintf.c \
 		strlcat.c strlcpy.c strmode.c strsep.c unvis.c vis.c \
 		_err.c _errx.c _verr.c _verrx.c _vwarn.c _vwarnx.c \
-		_warn.c _warnx.c __fts13.c
+		_warn.c _warnx.c __fts13.c __glob13.c
 
 # -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
 # other file ops, on many systems, without changing function names.
@@ -33,9 +33,10 @@
 
 SRCS:=		${SRCS:Nndbm.c}
 
-defs.mk: includes.stamp configure config.h.in defs.mk.in
-	CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} LDFLAGS=${HOST_LDFLAGS:Q} \
-		sh ${.CURDIR}/configure --cache-file=config.cache
+defs.mk: includes.stamp configure host_config.h.in defs.mk.in
+	CC=${HOST_CC:Q} CPPFLAGS=${HOST_CPPFLAGS:Q} CFLAGS=${HOST_CFLAGS:Q} \
+		LDFLAGS=${HOST_LDFLAGS:Q} \
+		${HOST_SHELL} ${.CURDIR}/configure --cache-file=config.cache
 	@touch $@
 
 # Run by hand, then "configure" script committed:
@@ -49,9 +50,9 @@
 cleandir: compat.clean
 compat.clean:
 	-rm -r -f include
-	-rm -f config.cache config.h
+	-rm -f config.cache host_config.h
 
-HOST_CPPFLAGS:=	${CPPFLAGS}
+HOST_CPPFLAGS:=	${HOST_CPPFLAGS} ${CPPFLAGS}
 CPPFLAGS:=	# empty
 
 .include <bsd.hostlib.mk>
Index: tools/compat/config.h.in
===================================================================
RCS file: config.h.in
diff -N config.h.in
--- /tmp/cvs17374be	Wed Mar 27 19:17:06 2002
+++ /dev/null	Mon Aug 30 16:41:34 1999
@@ -1,96 +0,0 @@
-/*	$NetBSD: config.h.in,v 1.11 2002/03/07 18:28:46 tv Exp $	*/
-
-#ifndef	__NETBSD_COMPAT_CONFIG_H__
-#define	__NETBSD_COMPAT_CONFIG_H__
-
-/* Values set by "configure" based on available functions in the host. */
-
-#undef HAVE_DIRENT_H
-#undef HAVE_ERR_H
-#undef HAVE_FEATURES_H
-#undef HAVE_FTS_H
-#undef HAVE_INTTYPES_H
-#undef HAVE_LIBGEN_H
-#undef HAVE_NDIR_H
-#undef HAVE_NETDB_H
-#undef HAVE_MACHINE_BSWAP_H
-#undef HAVE_MALLOC_H
-#undef HAVE_STDDEF_H
-#undef HAVE_STRING_H
-#undef HAVE_SYS_DIR_H
-#undef HAVE_SYS_NDIR_H
-#undef HAVE_SYS_SYSLIMITS_H
-#undef HAVE_SYS_SYSMACROS_H
-#undef HAVE_SYS_TYPES_H
-#undef HAVE_UNISTD_H
-#undef HAVE_VIS_H
-#undef STDC_HEADERS
-
-#undef HAVE_ID_T
-#undef HAVE_LONG_LONG
-#undef HAVE_U_QUAD_T
-
-#undef HAVE_DIR_DD_FD
-#undef HAVE_STRUCT_DIRENT_D_NAMLEN
-#undef HAVE_STRUCT_STAT_ST_FLAGS
-#undef HAVE_STRUCT_STAT_ST_GEN
-#undef HAVE_STRUCT_STAT_ST_MTIMENSEC
-#undef HAVE_STRUCT_STATFS_F_IOSIZE
-
-#undef HAVE_DECL_OPTIND
-#undef HAVE_DECL_OPTRESET
-#undef HAVE_DECL_SYS_SIGNAME
-
-#undef HAVE_ASPRINTF
-#undef HAVE_ASNPRINTF
-#undef HAVE_BASENAME
-#undef HAVE_CGETNEXT
-#undef HAVE_DIRFD
-#undef HAVE_DIRNAME
-#undef HAVE_FGETLN
-#undef HAVE_FLOCK
-#undef HAVE_FPARSELN
-#undef HAVE_FUTIMES
-#undef HAVE_GETOPT
-#undef HAVE_GETOPT_LONG
-#undef HAVE_ISBLANK
-#undef HAVE_LCHMOD
-#undef HAVE_LCHOWN
-#undef HAVE_LUTIMES
-#undef HAVE_PREAD
-#undef HAVE_PWCACHE_USERDB
-#undef HAVE_PWRITE
-#undef HAVE_SETENV
-#undef HAVE_SETGROUPENT
-#undef HAVE_SETPASSENT
-#undef HAVE_SETPROGNAME
-#undef HAVE_SNPRINTF
-#undef HAVE_STRLCAT
-#undef HAVE_STRLCPY
-#undef HAVE_STRSEP
-#undef HAVE_VASPRINTF
-#undef HAVE_VASNPRINTF
-#undef HAVE_VSNPRINTF
-
-#undef HAVE_DECL_SETGROUPENT
-#undef HAVE_DECL_SETPASSENT
-
-#undef WORDS_BIGENDIAN
-
-/* Typedefs that might be missing. */
-
-#undef size_t
-#undef uint8_t
-#undef uint16_t
-#undef uint32_t
-#undef uint64_t
-#undef u_int8_t
-#undef u_int16_t
-#undef u_int32_t
-#undef u_int64_t
-
-/* Now pull in the compatibility definitions. */
-
-#include "compat_defs.h"
-
-#endif	/* !__NETBSD_COMPAT_CONFIG_H__ */
Index: tools/compat/configure.ac
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/configure.ac,v
retrieving revision 1.11
diff -u -r1.11 configure.ac
--- configure.ac	2002/03/07 22:48:07	1.11
+++ configure.ac	2002/03/27 19:08:57
@@ -4,7 +4,7 @@
 #
 
 AC_INIT([libnbcompat], [noversion], [lib-bug-people@netbsd.org])
-AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_HEADERS(host_config.h)
 AC_CONFIG_FILES(defs.mk)
 
 AC_C_BIGENDIAN
@@ -35,7 +35,7 @@
 	err.h inttypes.h libgen.h paths.h util.h,,
 	[test -f include/$ac_header || touch include/$ac_header])
 AC_CHECK_HEADERS(rpc/types.h fts.h getopt.h netconfig.h vis.h,,
-	[echo '#include "config.h"' >include/$ac_header.new
+	[echo '#include "host_config.h"' >include/$ac_header.new
 	echo '#include "'$srcdir/../../include/$ac_header'"' >>include/$ac_header.new
 	if cmp include/$ac_header.new include/$ac_header >/dev/null 2>&1; then
 		rm -f include/$ac_header.new
@@ -103,5 +103,11 @@
 dnl # Thus AC_CHECK_LIB(regex...) comes first, and AC_SEARCHLIBS next.
 AC_CHECK_LIB(regex, regfree)
 AC_SEARCH_LIBS(regfree, rx posix)
+
+dnl # On solaris htonl() and friends are in libsocket
+AC_CHECK_LIB(socket, htonl)
+
+dnl # On solaris there is no MAP_ANON
+AC_CHECK_DECLS(MAP_ANON,,, [#include <sys/mman.h>])
 
 AC_OUTPUT
Index: tools/compat/db.h
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/db.h,v
retrieving revision 1.2
diff -u -r1.2 db.h
--- db.h	2002/01/29 10:20:32	1.2
+++ db.h	2002/03/27 19:08:57
@@ -1,5 +1,5 @@
 /*	$NetBSD: db.h,v 1.2 2002/01/29 10:20:32 tv Exp $	*/
 
-#include "config.h"
+#include "host_config.h"
 #define __BIT_TYPES_DEFINED__
 #include "../../include/db.h"
Index: tools/compat/fgetln.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/fgetln.c,v
retrieving revision 1.3
diff -u -r1.3 fgetln.c
--- fgetln.c	2002/01/31 19:23:14	1.3
+++ fgetln.c	2002/03/27 19:08:57
@@ -27,7 +27,7 @@
  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
+#include "host_config.h"
 
 #if !HAVE_FGETLN
 #include <stdlib.h>
Index: tools/compat/flock.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/flock.c,v
retrieving revision 1.3
diff -u -r1.3 flock.c
--- flock.c	2002/03/07 23:14:02	1.3
+++ flock.c	2002/03/27 19:08:57
@@ -41,7 +41,7 @@
  * Otherwise, don't do lokcing; just pretend success.
  */
 
-#include "config.h"
+#include "host_config.h"
 
 #if !HAVE_FLOCK
 #include <errno.h>
Index: tools/compat/getmode.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/getmode.c,v
retrieving revision 1.2
diff -u -r1.2 getmode.c
--- getmode.c	2002/01/31 19:23:14	1.2
+++ getmode.c	2002/03/27 19:08:57
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
+#include "host_config.h"
 #include <stdlib.h>
 
 void *setmode(const char *str) {
Index: tools/compat/host_config.h.in
===================================================================
RCS file: host_config.h.in
diff -N host_config.h.in
--- /dev/null	Mon Aug 30 16:41:34 1999
+++ host_config.h.in	Wed Mar 27 19:08:57 2002
@@ -0,0 +1,97 @@
+/*	$NetBSD: config.h.in,v 1.11 2002/03/07 18:28:46 tv Exp $	*/
+
+#ifndef	__NETBSD_COMPAT_CONFIG_H__
+#define	__NETBSD_COMPAT_CONFIG_H__
+
+/* Values set by "configure" based on available functions in the host. */
+
+#undef HAVE_DIRENT_H
+#undef HAVE_ERR_H
+#undef HAVE_FEATURES_H
+#undef HAVE_FTS_H
+#undef HAVE_INTTYPES_H
+#undef HAVE_LIBGEN_H
+#undef HAVE_NDIR_H
+#undef HAVE_NETDB_H
+#undef HAVE_MACHINE_BSWAP_H
+#undef HAVE_MALLOC_H
+#undef HAVE_STDDEF_H
+#undef HAVE_STRING_H
+#undef HAVE_SYS_DIR_H
+#undef HAVE_SYS_NDIR_H
+#undef HAVE_SYS_SYSLIMITS_H
+#undef HAVE_SYS_SYSMACROS_H
+#undef HAVE_SYS_TYPES_H
+#undef HAVE_UNISTD_H
+#undef HAVE_VIS_H
+#undef STDC_HEADERS
+
+#undef HAVE_ID_T
+#undef HAVE_LONG_LONG
+#undef HAVE_U_QUAD_T
+
+#undef HAVE_DIR_DD_FD
+#undef HAVE_STRUCT_DIRENT_D_NAMLEN
+#undef HAVE_STRUCT_STAT_ST_FLAGS
+#undef HAVE_STRUCT_STAT_ST_GEN
+#undef HAVE_STRUCT_STAT_ST_MTIMENSEC
+#undef HAVE_STRUCT_STATFS_F_IOSIZE
+
+#undef HAVE_DECL_OPTIND
+#undef HAVE_DECL_OPTRESET
+#undef HAVE_DECL_SYS_SIGNAME
+#undef HAVE_DECL_MAP_ANON
+
+#undef HAVE_ASPRINTF
+#undef HAVE_ASNPRINTF
+#undef HAVE_BASENAME
+#undef HAVE_CGETNEXT
+#undef HAVE_DIRFD
+#undef HAVE_DIRNAME
+#undef HAVE_FGETLN
+#undef HAVE_FLOCK
+#undef HAVE_FPARSELN
+#undef HAVE_FUTIMES
+#undef HAVE_GETOPT
+#undef HAVE_GETOPT_LONG
+#undef HAVE_ISBLANK
+#undef HAVE_LCHMOD
+#undef HAVE_LCHOWN
+#undef HAVE_LUTIMES
+#undef HAVE_PREAD
+#undef HAVE_PWCACHE_USERDB
+#undef HAVE_PWRITE
+#undef HAVE_SETENV
+#undef HAVE_SETGROUPENT
+#undef HAVE_SETPASSENT
+#undef HAVE_SETPROGNAME
+#undef HAVE_SNPRINTF
+#undef HAVE_STRLCAT
+#undef HAVE_STRLCPY
+#undef HAVE_STRSEP
+#undef HAVE_VASPRINTF
+#undef HAVE_VASNPRINTF
+#undef HAVE_VSNPRINTF
+
+#undef HAVE_DECL_SETGROUPENT
+#undef HAVE_DECL_SETPASSENT
+
+#undef WORDS_BIGENDIAN
+
+/* Typedefs that might be missing. */
+
+#undef size_t
+#undef uint8_t
+#undef uint16_t
+#undef uint32_t
+#undef uint64_t
+#undef u_int8_t
+#undef u_int16_t
+#undef u_int32_t
+#undef u_int64_t
+
+/* Now pull in the compatibility definitions. */
+
+#include "compat_defs.h"
+
+#endif	/* !__NETBSD_COMPAT_CONFIG_H__ */
Index: tools/compat/namespace.h
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/namespace.h,v
retrieving revision 1.2
diff -u -r1.2 namespace.h
--- namespace.h	2002/01/31 19:20:14	1.2
+++ namespace.h	2002/03/27 19:08:57
@@ -4,9 +4,9 @@
  * Mainly empty header to make reachover bits of libc happy.
  *
  * Since all reachover bits will include this, it's a good place to pull
- * in config.h.
+ * in host_config.h.
  */
-#include "config.h"
+#include "host_config.h"
 
 /* No aliases in reachover-based libc sources. */
 #undef __indr_reference
Index: tools/compat/pread.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/pread.c,v
retrieving revision 1.2
diff -u -r1.2 pread.c
--- pread.c	2002/01/31 19:23:14	1.2
+++ pread.c	2002/03/27 19:08:57
@@ -38,7 +38,7 @@
 
 /* Emulate pread() with lseek()/read()/lseek(). Not thread-safe, of course. */
 
-#include "config.h"
+#include "host_config.h"
 
 #if !HAVE_PREAD
 #include <unistd.h>
Index: tools/compat/pwrite.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/pwrite.c,v
retrieving revision 1.2
diff -u -r1.2 pwrite.c
--- pwrite.c	2002/01/31 19:23:14	1.2
+++ pwrite.c	2002/03/27 19:08:57
@@ -38,7 +38,7 @@
 
 /* Emulate pwrite() with lseek()/write()/lseek(). Not thread-safe, of course. */
 
-#include "config.h"
+#include "host_config.h"
 
 #if !HAVE_PWRITE
 #include <unistd.h>
Index: tools/compat/setenv.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/setenv.c,v
retrieving revision 1.2
diff -u -r1.2 setenv.c
--- setenv.c	2002/01/31 19:23:14	1.2
+++ setenv.c	2002/03/27 19:08:57
@@ -38,7 +38,7 @@
 
 /* Emulate setenv() with getenv()/malloc()/putenv(). */
 
-#include "config.h"
+#include "host_config.h"
 
 #if !HAVE_SETENV
 int setenv(const char *name, const char *value, int overwrite) {
Index: tools/compat/setgroupent.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/setgroupent.c,v
retrieving revision 1.3
diff -u -r1.3 setgroupent.c
--- setgroupent.c	2002/02/26 22:29:39	1.3
+++ setgroupent.c	2002/03/27 19:08:57
@@ -1,6 +1,6 @@
 /*	$NetBSD: setgroupent.c,v 1.3 2002/02/26 22:29:39 tv Exp $	*/
 
-#include "config.h"
+#include "host_config.h"
 
 #if !HAVE_SETGROUPENT || !HAVE_DECL_SETGROUPENT
 #include <grp.h>
Index: tools/compat/setpassent.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/setpassent.c,v
retrieving revision 1.3
diff -u -r1.3 setpassent.c
--- setpassent.c	2002/02/26 22:29:39	1.3
+++ setpassent.c	2002/03/27 19:08:57
@@ -1,6 +1,6 @@
 /*	$NetBSD: setpassent.c,v 1.3 2002/02/26 22:29:39 tv Exp $	*/
 
-#include "config.h"
+#include "host_config.h"
 
 #if !HAVE_SETPASSENT || !HAVE_DECL_SETPASSENT
 #include <pwd.h>
Index: tools/compat/setprogname.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/setprogname.c,v
retrieving revision 1.3
diff -u -r1.3 setprogname.c
--- setprogname.c	2002/01/31 19:21:58	1.3
+++ setprogname.c	2002/03/27 19:08:57
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
+#include "host_config.h"
 
 #if !HAVE_SETPROGNAME
 #include <string.h>
Index: tools/compat/snprintf.c
===================================================================
RCS file: /cvsroot/basesrc/tools/compat/snprintf.c,v
retrieving revision 1.2
diff -u -r1.2 snprintf.c
--- snprintf.c	2002/01/31 19:23:14	1.2
+++ snprintf.c	2002/03/27 19:08:57
@@ -34,7 +34,7 @@
 /* From heimdal lib/roken/snprintf.c. */
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+#include <host_config.h>
 #if 0
 RCSID("$Id: snprintf.c,v 1.2 2002/01/31 19:23:14 tv Exp $");
 #endif
Index: tools/host-mkdep/host-mkdep.in
===================================================================
RCS file: /cvsroot/basesrc/tools/host-mkdep/host-mkdep.in,v
retrieving revision 1.2
diff -u -r1.2 host-mkdep.in
--- host-mkdep.in	2002/01/28 19:26:35	1.2
+++ host-mkdep.in	2002/03/27 19:08:57
@@ -67,7 +67,7 @@
 
 	-[IDU]*)	CPPFLAGS="$CPPFLAGS $1"; shift;;
 
-	-[IDU]|-include)
+	-[IDU]|-include|-idirafter)
 			CPPFLAGS="$CPPFLAGS $1 $2"; shift; shift;;
 
 	-*)		echo "$0: unknown option: $1"; exit 1;; # all other -options
Index: tools/lorder/Makefile
===================================================================
RCS file: /cvsroot/basesrc/tools/lorder/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile	2001/11/19 04:47:43	1.4
+++ Makefile	2002/03/27 19:08:57
@@ -2,10 +2,19 @@
 
 TIMESTAMP=	${TOOLDIR}/bin/nblorder
 
+CLEANFILES+= nblorder
+
 .PATH: ${.CURDIR}/../../usr.bin/lorder
 
 .include <bsd.hostprog.mk>
 
+realall: nblorder
+nblorder: lorder.sh
+	-rm -f $@
+	${SED:U sed} "s!/bin/sh!${HOST_SHELL}!" < ${.ALLSRC} > ${.TARGET}
+
+	
+
 install: ${TIMESTAMP}
-${TIMESTAMP}: lorder.sh
+${TIMESTAMP}: nblorder
 	${HOST_INSTALL_FILE} -m ${BINMODE} ${.ALLSRC} ${.TARGET}
Index: tools/make/buildmake.sh.in
===================================================================
RCS file: /cvsroot/basesrc/tools/make/buildmake.sh.in,v
retrieving revision 1.2
diff -u -r1.2 buildmake.sh.in
--- buildmake.sh.in	2002/01/25 17:50:28	1.2
+++ buildmake.sh.in	2002/03/27 19:09:00
@@ -17,7 +17,7 @@
 SRCDIR=@srcdir@/../../usr.bin/make
 
 for f in $SRCDIR/*.c $SRCDIR/lst.lib/*.c; do
-	docmd "${HOST_CC} ${HOST_CFLAGS} @DEFS@ -DMAKE_BOOTSTRAP -I$SRCDIR -c $f"
+	docmd "${HOST_CC} ${HOST_CFLAGS} @DEFS@ -DMAKE_BOOTSTRAP -I$SRCDIR -DHOST_SHELL=\\\"${HOST_SHELL}\\\" -c $f"
 done
 
 docmd "${HOST_CC} ${HOST_CFLAGS} -o nbmake *.o ${HOST_LDFLAGS}"
Index: tools/makefs/Makefile
===================================================================
RCS file: /cvsroot/basesrc/tools/makefs/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile	2002/03/05 15:08:27	1.4
+++ Makefile	2002/03/27 19:09:00
@@ -13,5 +13,5 @@
 
 ufs.stamp:
 	-rm -f ufs
-	ln -fs ${.CURDIR}/../../sys/ufs ufs
+	ln -s ${.CURDIR}/../../sys/ufs ufs
 	@touch $@
Index: usr.bin/crunch/crunchgen/crunchgen.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/crunch/crunchgen/crunchgen.c,v
retrieving revision 1.33
diff -u -r1.33 crunchgen.c
--- crunchgen.c	2002/02/02 12:25:35	1.33
+++ crunchgen.c	2002/03/27 19:09:01
@@ -37,7 +37,7 @@
 #endif
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <stdlib.h>
Index: usr.bin/ctags/ctags.h
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/ctags/ctags.h,v
retrieving revision 1.5
diff -u -r1.5 ctags.h
--- ctags.h	2002/01/31 22:43:52	1.5
+++ ctags.h	2002/03/27 19:09:01
@@ -36,7 +36,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #define	bool	char
Index: usr.bin/elf2ecoff/elf2ecoff.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/elf2ecoff/elf2ecoff.c,v
retrieving revision 1.17
diff -u -r1.17 elf2ecoff.c
--- elf2ecoff.c	2002/03/23 17:18:42	1.17
+++ elf2ecoff.c	2002/03/27 19:09:01
@@ -42,13 +42,16 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <sys/exec.h>
 #include <sys/exec_elf.h>
 #include <stdio.h>
 #include <sys/exec_ecoff.h>
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
+
+#ifdef HAVE_CONFIG_H
+#include <host_config.h>
+#endif
 
 
 #define	ISLAST(p)	(p->n_un.n_name == 0 || p->n_un.n_name[0] == 0)
Index: usr.bin/gencat/gencat.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/gencat/gencat.c,v
retrieving revision 1.14
diff -u -r1.14 gencat.c
--- gencat.c	2002/01/31 22:43:54	1.14
+++ gencat.c	2002/03/27 19:09:01
@@ -74,7 +74,7 @@
 ******************************************************************/
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #define _NLS_PRIVATE
Index: usr.bin/lex/libyywrap.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/lex/libyywrap.c,v
retrieving revision 1.6
diff -u -r1.6 libyywrap.c
--- libyywrap.c	2002/01/31 22:43:54	1.6
+++ libyywrap.c	2002/03/27 19:09:02
@@ -5,7 +5,7 @@
 #include <sys/cdefs.h>
 
 #if HAVE_CONFIG_H
-#include <config.h>
+#include <host_config.h>
 #endif
 
 int yywrap __P((void));
Index: usr.bin/m4/extern.h
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/m4/extern.h,v
retrieving revision 1.10
diff -u -r1.10 extern.h
--- extern.h	2002/01/31 22:43:55	1.10
+++ extern.h	2002/03/27 19:09:02
@@ -40,7 +40,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <err.h>
Index: usr.bin/make/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/Makefile,v
retrieving revision 1.26
diff -u -r1.26 Makefile
--- Makefile	2002/01/27 01:50:54	1.26
+++ Makefile	2002/03/27 19:09:02
@@ -1,7 +1,7 @@
 #	$NetBSD: Makefile,v 1.26 2002/01/27 01:50:54 reinoud Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
-CPPFLAGS+= -I${.CURDIR}
+CPPFLAGS+= -I${.CURDIR} -DHOST_SHELL=\"/bin/sh\"
 PROG=	make
 SRCS=	arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
 	make.c parse.c str.c suff.c targ.c trace.c var.c util.c 
Index: usr.bin/make/compat.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/compat.c,v
retrieving revision 1.41
diff -u -r1.41 compat.c
--- compat.c	2002/03/14 16:08:37	1.41
+++ compat.c	2002/03/27 19:09:02
@@ -255,7 +255,7 @@
 	 * -e flag as well as -c if it's supposed to exit when it hits an
 	 * error.
 	 */
-	static char	*shargv[4] = { "/bin/sh" };
+	static char	*shargv[4] = { HOST_SHELL  };
 
 	if (DEBUG(SHELL))
 		shargv[1] = (errCheck ? "-exc" : "-xc");
Index: usr.bin/make/main.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/main.c,v
retrieving revision 1.83
diff -u -r1.83 main.c
--- main.c	2002/03/14 16:08:39	1.83
+++ main.c	2002/03/27 19:09:02
@@ -1263,7 +1263,7 @@
 	(void) dup2(fds[1], 1);
 	(void) close(fds[1]);
 
-	(void) execv("/bin/sh", args);
+	(void) execv(HOST_SHELL, args);
 	_exit(1);
 	/*NOTREACHED*/
 
Index: usr.bin/man/config.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/man/config.c,v
retrieving revision 1.15
diff -u -r1.15 config.c
--- config.c	2002/03/22 18:20:58	1.15
+++ config.c	2002/03/27 19:09:02
@@ -44,6 +44,10 @@
 #endif
 #endif /* not lint */
 
+#if HAVE_CONFIG_H
+#include "host_config.h"
+#endif
+
 #include <sys/types.h>
 #include <sys/queue.h>
 
Index: usr.bin/menuc/defs.h
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/menuc/defs.h,v
retrieving revision 1.5
diff -u -r1.5 defs.h
--- defs.h	2002/01/29 10:20:35	1.5
+++ defs.h	2002/03/27 19:09:02
@@ -39,7 +39,7 @@
 /* defs.h: definitions needed for the menu system. */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <stdio.h>
Index: usr.bin/mkdep/mkdep.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/mkdep/mkdep.c,v
retrieving revision 1.10
diff -u -r1.10 mkdep.c
--- mkdep.c	2002/01/31 22:43:55	1.10
+++ mkdep.c	2002/03/27 19:09:02
@@ -47,7 +47,7 @@
 #endif /* not lint */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/param.h>
Index: usr.bin/mklocale/lex.l
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/mklocale/lex.l,v
retrieving revision 1.4
diff -u -r1.4 lex.l
--- lex.l	2002/01/29 10:20:35	1.4
+++ lex.l	2002/03/27 19:09:02
@@ -38,7 +38,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/cdefs.h>
Index: usr.bin/mklocale/yacc.y
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/mklocale/yacc.y,v
retrieving revision 1.9
diff -u -r1.9 yacc.y
--- yacc.y	2002/03/17 22:14:38	1.9
+++ yacc.y	2002/03/27 19:09:02
@@ -38,7 +38,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/cdefs.h>
Index: usr.bin/msgc/defs.h
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/msgc/defs.h,v
retrieving revision 1.2
diff -u -r1.2 defs.h
--- defs.h	2002/01/29 10:20:35	1.2
+++ defs.h	2002/03/27 19:09:02
@@ -39,7 +39,7 @@
 /* defs.h: definitions needed for the message system. */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <stdio.h>
Index: usr.bin/rpcgen/rpc_scan.h
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/rpcgen/rpc_scan.h,v
retrieving revision 1.6
diff -u -r1.6 rpc_scan.h
--- rpc_scan.h	2002/01/31 22:43:58	1.6
+++ rpc_scan.h	2002/03/27 19:09:03
@@ -32,7 +32,7 @@
 /*      @(#)rpc_scan.h  1.3  90/08/29  (C) 1987 SMI   */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 /*
Index: usr.bin/tsort/tsort.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/tsort/tsort.c,v
retrieving revision 1.17
diff -u -r1.17 tsort.c
--- tsort.c	2002/01/31 22:43:58	1.17
+++ tsort.c	2002/03/27 19:09:05
@@ -50,7 +50,7 @@
 #endif /* not lint */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/types.h>
Index: usr.bin/uudecode/uudecode.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/uudecode/uudecode.c,v
retrieving revision 1.14
diff -u -r1.14 uudecode.c
--- uudecode.c	2002/01/31 19:31:31	1.14
+++ uudecode.c	2002/03/27 19:09:05
@@ -47,7 +47,7 @@
 #endif /* not lint */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 /*
Index: usr.bin/xinstall/xinstall.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/xinstall/xinstall.c,v
retrieving revision 1.69
diff -u -r1.69 xinstall.c
--- xinstall.c	2002/03/19 14:17:04	1.69
+++ xinstall.c	2002/03/27 19:09:07
@@ -34,7 +34,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #else
 #define HAVE_FUTIMES 1
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
Index: usr.bin/xlint/common/lint.h
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/xlint/common/lint.h,v
retrieving revision 1.6
diff -u -r1.6 lint.h
--- lint.h	2002/03/07 19:19:14	1.6
+++ lint.h	2002/03/27 19:09:07
@@ -32,9 +32,10 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #else
 #define HAVE_DECL_SYS_SIGNAME 1
+#define HAVE_DECL_MAP_ANON 1
 #endif
 
 #include <sys/types.h>
Index: usr.bin/xlint/lint1/mem1.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/xlint/lint1/mem1.c,v
retrieving revision 1.7
diff -u -r1.7 mem1.c
--- mem1.c	2002/01/31 19:36:54	1.7
+++ mem1.c	2002/03/27 19:09:07
@@ -170,6 +170,7 @@
 
 	mb = xmalloc(sizeof (mbl_t));
 
+#if HAVE_DECL_MAP_ANON
 	/* use mmap instead of malloc to avoid malloc's size overhead */
 
 	prot = PROT_READ | PROT_WRITE;
@@ -177,6 +178,11 @@
 	mb->blk = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
 	if (mb->blk == (void *)-1)
 		err(1, "can't map memory");
+#else
+	mb->blk = malloc(mblklen);
+	if (mb->blk == NULL)
+		err(1, "can't map memory");
+#endif
 
 	mb->size = mblklen;
 
Index: usr.bin/xlint/lint2/mem2.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/xlint/lint2/mem2.c,v
retrieving revision 1.7
diff -u -r1.7 mem2.c
--- mem2.c	2002/01/31 19:36:55	1.7
+++ mem2.c	2002/03/27 19:09:07
@@ -78,12 +78,18 @@
 	/* Align to at least 8 bytes. */
 	sz = (sz + 7) & ~7L;
 	if (nxtfree + sz > mblklen) {
+#if HAVE_DECL_MAP_ANON
 		/* use mmap() instead of malloc() to avoid malloc overhead. */
 		prot = PROT_READ | PROT_WRITE;
 		flags = MAP_ANON | MAP_PRIVATE;
 		mbuf = mmap(NULL, mblklen, prot, flags, -1, (off_t)0);
 		if (mbuf == (void *)-1)
 			err(1, "can't map memory");
+#else
+		mbuf = malloc(mblklen);
+		if (mbuf == NULL)
+			err(1, "can't map memory");
+#endif
 		(void)memset(mbuf, 0, mblklen);
 		nxtfree = 0;
 	}
Index: usr.bin/yacc/defs.h
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/yacc/defs.h,v
retrieving revision 1.11
diff -u -r1.11 defs.h
--- defs.h	2002/01/29 10:20:36	1.11
+++ defs.h	2002/03/27 19:09:09
@@ -39,7 +39,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <assert.h>
Index: usr.sbin/config/defs.h
===================================================================
RCS file: /cvsroot/syssrc/usr.sbin/config/defs.h,v
retrieving revision 1.3
diff -u -r1.3 defs.h
--- defs.h	2002/02/12 23:20:11	1.3
+++ defs.h	2002/03/27 19:09:10
@@ -49,7 +49,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/types.h>
Index: usr.sbin/makefs/makefs.h
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/makefs/makefs.h,v
retrieving revision 1.8
diff -u -r1.8 makefs.h
--- makefs.h	2002/02/14 05:16:16	1.8
+++ makefs.h	2002/03/27 19:09:11
@@ -39,7 +39,7 @@
 #define	_MAKEFS_H
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #else
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
 #define HAVE_STRUCT_STAT_ST_GEN 1
Index: usr.sbin/mtree/extern.h
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/mtree/extern.h,v
retrieving revision 1.23
diff -u -r1.23 extern.h
--- extern.h	2002/02/08 18:15:12	1.23
+++ extern.h	2002/03/27 19:09:12
@@ -38,7 +38,7 @@
 #include "mtree.h"
 
 #if HAVE_CONFIG_H
-#include "config.h" 
+#include "host_config.h" 
 #else 
 #define HAVE_LCHMOD 1
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
Index: usr.sbin/pwd_mkdb/pwd_mkdb.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/pwd_mkdb/pwd_mkdb.c,v
retrieving revision 1.24
diff -u -r1.24 pwd_mkdb.c
--- pwd_mkdb.c	2002/01/31 22:44:06	1.24
+++ pwd_mkdb.c	2002/03/27 19:09:12
@@ -35,7 +35,7 @@
  */
 
 #if HAVE_CONFIG_H
-#include "config.h"
+#include "host_config.h"
 #endif
 
 #include <sys/cdefs.h>
Index: usr.sbin/rpc.pcnfsd/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/rpc.pcnfsd/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile	2001/02/16 01:05:34	1.11
+++ Makefile	2002/03/27 19:09:12
@@ -11,20 +11,13 @@
 DPADD=	${LIBRPCSVC} ${LIBCRYPT}
 LDADD=	-lrpcsvc -lcrypt
 
-.ifnmake getrpcgen
-XRPCGEN != cd ${.CURDIR} && ${MAKE} -B getrpcgen
-.endif
-
-getrpcgen:
-	@set -- X `type ${RPCGEN}` && shift `expr $$# - 1` && echo "$$1"
-
-pcnfsd_svc.c: pcnfsd.x ${XRPCGEN}
+pcnfsd_svc.c: pcnfsd.x
 	${RPCGEN} -C -s udp -s tcp -I ${.CURDIR}/pcnfsd.x -o $@
 
-pcnfsd_xdr.c: pcnfsd.x ${XRPCGEN}
+pcnfsd_xdr.c: pcnfsd.x
 	${RPCGEN} -C -c ${.CURDIR}/pcnfsd.x -o $@
 
-pcnfsd.h: pcnfsd.x ${XRPCGEN}
+pcnfsd.h: pcnfsd.x
 	${RPCGEN} -C -h ${.CURDIR}/pcnfsd.x -o $@
 
 CLEANFILES += pcnfsd_svc.c pcnfsd_xdr.c pcnfsd.h
Index: usr.sbin/rpc.pcnfsd/Makefile.clnt
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/rpc.pcnfsd/Makefile.clnt,v
retrieving revision 1.8
diff -u -r1.8 Makefile.clnt
--- Makefile.clnt	2001/12/12 01:48:55	1.8
+++ Makefile.clnt	2002/03/27 19:09:12
@@ -13,20 +13,13 @@
 
 # Special rules for the generated C code...
 
-.ifnmake getrpcgen
-XRPCGEN != (cd ${.CURDIR} && ${MAKE} getrpcgen)
-.endif
-
-getrpcgen:
-	@set -- X `type ${RPCGEN}` && shift $$(($$# - 1)) && echo "$$1"
-
-pcnfsd_clnt.c: pcnfsd.x ${XRPCGEN}
+pcnfsd_clnt.c: pcnfsd.x
 	${RPCGEN} -l ${.CURDIR}/pcnfsd.x -o $@
 
-pcnfsd_xdr.c: pcnfsd.x ${XRPCGEN}
+pcnfsd_xdr.c: pcnfsd.x
 	${RPCGEN} -c ${.CURDIR}/pcnfsd.x -o $@
 
-pcnfsd.h: pcnfsd.x ${XRPCGEN}
+pcnfsd.h: pcnfsd.x
 	${RPCGEN} -h ${.CURDIR}/pcnfsd.x -o $@
 
 CLEANFILES += pcnfsd_clnt.c pcnfsd_xdr.c pcnfsd.h

--n8g4imXOkfNTN/H1--