Subject: Distinguish between MKfoo and SUPPORT_foo
To: None <tech-toolchain@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-toolchain
Date: 03/20/2002 10:10:55
--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

So, while building an image for an embedded system, I needed to chop
out some stuff form libc to shrink it a bit (namely, YP and Hesiod),
and rip Kerberos support out of some programs I needed on the flash
image.

Then I came to realize there are really two aspects to this:

	* Providing the YP API, e.g. having the yp_*() functions
	  present in libc.

	* Using the YP API, e.g. using the yp_*() functions in
	  getpwnam(3), rpc.bootparamd(8), etc.

The same issue currently exists with Kerberos support.  Right now we
always build the Kerberos infrastructure (libraries, support programs),
and use the MKKERBEROS variable to decide if e.g. login(1) and telnet(1)
should include Kerberos support.

What I did was split these two things apart.  I now have:

	* MKHESIOD, MKKERBEROS, MKSKEY, MKYP -- Controls whether or
	  not to build the libraries, support programs, etc.

	* SUPPORT_HESIOD, SUPPORT_KERBEROS, SUPPORT_SKEY,
	  SUPPORT_YP -- Controls whether or not users of these
	  facilities use them or not.

If a MKfoo that corresponds to a SUPPORT_foo is set to "no", then
the corresponding SUPPORT_foo is also implicitly set to "no".  All
of these things default to "yes", which matches the behavior before
my changes.

Attached is a diff that does this.  Any objections?

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

--PNTmBPCT7hxwcZjr
Content-Type: text/plain; charset=us-ascii
Content-Description: support-diffs
Content-Disposition: attachment; filename=support-diffs

Index: bin/rcp/Makefile
===================================================================
RCS file: /cvsroot/basesrc/bin/rcp/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- bin/rcp/Makefile	2001/12/12 00:07:45	1.19
+++ bin/rcp/Makefile	2002/03/20 17:09:02
@@ -1,15 +1,15 @@
 #	$NetBSD: Makefile,v 1.19 2001/12/12 00:07:45 tv Exp $
 #	@(#)Makefile	8.1 (Berkeley) 7/19/93
 
-# XXX Kerberos support broken right now.
-NOKERBEROS=	# defined
-
 .include <bsd.own.mk>
 
 PROG=		rcp
 SRCS=		rcp.c util.c
+
+# XXX Kerberos support broken right now.
+SUPPORT_KERBEROS=	no
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 RLOGIN= 	${.CURDIR}/../../usr.bin/rlogin
 .PATH:		${RLOGIN}
 
Index: include/Makefile
===================================================================
RCS file: /cvsroot/basesrc/include/Makefile,v
retrieving revision 1.102
diff -u -r1.102 Makefile
--- include/Makefile	2002/02/22 20:09:01	1.102
+++ include/Makefile	2002/03/20 17:11:00
@@ -1,13 +1,15 @@
 #	$NetBSD: Makefile,v 1.102 2002/02/22 20:09:01 christos Exp $
 #	@(#)Makefile	8.2 (Berkeley) 1/4/94
 
+.include <bsd.own.mk>
+
 # Doing a make includes builds /usr/include
 
 # Missing: mp.h
 
 INCS=	a.out.h ar.h assert.h bitstring.h bm.h cpio.h ctype.h db.h dirent.h \
 	disktab.h dlfcn.h err.h errno.h fmtmsg.h fnmatch.h fstab.h fts.h \
-	getopt.h glob.h grp.h hesiod.h ifaddrs.h \
+	getopt.h glob.h grp.h ifaddrs.h \
 	inttypes.h iso646.h kvm.h langinfo.h libgen.h \
 	limits.h link.h link_aout.h link_elf.h locale.h \
 	login_cap.h malloc.h math.h md2.h md4.h md5.h \
@@ -21,6 +23,9 @@
 INCS+=	arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/telnet.h arpa/tftp.h
 INCS+=	protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
 	protocols/talkd.h protocols/timed.h
+
+INCS+=	hesiod.h
+
 INCS+=	rpcsvc/yp_prot.h rpcsvc/ypclnt.h
 
 .if (${MACHINE_ARCH} != "vax")
Index: lib/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/Makefile,v
retrieving revision 1.75
diff -u -r1.75 Makefile
--- lib/Makefile	2002/03/17 22:14:12	1.75
+++ lib/Makefile	2002/03/20 17:11:03
@@ -5,23 +5,19 @@
 
 SUBDIR=	csu libc .WAIT libarch libbz2 libcdk libcompat libcrypt libcurses libedit \
 	libform libintl libkvm libl libm libmenu libossaudio libpcap libpci \
-	libposix libresolv librmt librpcsvc libskey libterm libusbhid libutil \
+	libposix libresolv librmt librpcsvc libterm libusbhid libutil \
 	libwrap liby libz
 
+.if (${MKSKEY} != "no")
+SUBDIR+= libskey
+.endif
+
 # XXX Crypto bits must be done before libtelnet.
 
 .if (${MKCRYPTO} != "no")
 # OpenSSL libraries.  NOTE!  WE DO NOT TRAVERSE INTO libdes FOR A REASON!
 SUBDIR+= libcrypto libssl
 
-# Heimdal Kerberos 5 libraries
-SUBDIR+= libroken libvers libcom_err libsl libss libasn1 libkrb5 libhdb \
-	 libkadm5srv libkadm5clnt libgssapi
-
-# KTH Kerberos 4 libraries
-SUBDIR+= libkrb libkdb libkadm libkafs
-SUBDIR+= libkstream
-
 .if (${MKCRYPTO_IDEA} != "no")
 SUBDIR+= libcrypto_idea
 .endif	# MKCRYPTO_IDEA != no
@@ -31,6 +27,16 @@
 .endif	# MKCRYPTO_RC5 != no
 
 .endif	# MKCRYPTO != no
+
+.if (${MKKERBEROS} != "no")
+# Heimdal Kerberos 5 libraries
+SUBDIR+= libroken libvers libcom_err libsl libss libasn1 libkrb5 libhdb \
+	 libkadm5srv libkadm5clnt libgssapi
+
+# KTH Kerberos 4 libraries
+SUBDIR+= libkrb libkdb libkadm libkafs
+SUBDIR+= libkstream
+.endif	# MKKERBEROS != no
 
 SUBDIR+=	libtelnet
 
Index: lib/libc/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/Makefile,v
retrieving revision 1.103
diff -u -r1.103 Makefile
--- lib/libc/Makefile	2002/03/17 22:14:17	1.103
+++ lib/libc/Makefile	2002/03/20 17:11:04
@@ -17,13 +17,23 @@
 # The Hesiod functions are always in libc. To choose that getpwent() and friends
 # actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
 
+.include <bsd.own.mk>
+
 LIB=		c
 USE_SHLIBDIR=	yes
-CPPFLAGS+=	-D_LIBC -DNLS -DYP -DHESIOD -DLIBC_SCCS -DSYSLIBC_SCCS \
-		-D_REENTRANT -I${.CURDIR}/include
+CPPFLAGS+=	-D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
+CPPFLAGS+=	-I${.CURDIR}/include
+
+.if (${SUPPORT_HESIOD} != "no")
+CPPFLAGS+=	-DHESIOD
+.endif
+
 CPPFLAGS+=	-DINET6
+CPPFLAGS+=	-DNLS
 
-.include <bsd.own.mk>
+.if (${SUPPORT_YP} != "no")
+CPPFLAGS+=	-DYP
+.endif
 
 .if ${MACHINE_ARCH} == "i386"
 # Set lint to exit on warnings
@@ -81,7 +91,9 @@
 .include "${.CURDIR}/termios/Makefile.inc"
 .include "${.CURDIR}/time/Makefile.inc"
 .include "${.CURDIR}/sys/Makefile.inc"
+.if (${MKYP} != "no")
 .include "${.CURDIR}/yp/Makefile.inc"
+.endif
 
 NLS=	C.msg Pig.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg no.msg \
 	sv.msg pl.msg
Index: lib/libc/net/Makefile.inc
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/net/Makefile.inc,v
retrieving revision 1.58
diff -u -r1.58 Makefile.inc
--- lib/libc/net/Makefile.inc	2001/10/22 17:53:43	1.58
+++ lib/libc/net/Makefile.inc	2002/03/20 17:11:11
@@ -7,7 +7,7 @@
 SRCS+=	__cmsg_alignbytes.c base64.c ethers.c gethnamaddr.c getifaddrs.c \
 	getnetnamadr.c getnetent.c getproto.c \
 	getprotoent.c getprotoname.c getservbyname.c getservbyport.c \
-	getservent.c herror.c hesiod.c inet_lnaof.c inet_makeaddr.c \
+	getservent.c herror.c inet_lnaof.c inet_makeaddr.c \
 	inet_net_ntop.c inet_net_pton.c inet_neta.c inet_ntop.c inet_pton.c \
 	inet_netof.c inet_network.c inet_ntoa.c iso_addr.c linkaddr.c \
 	nsdispatch.c nslexer.l nsparser.y ns_addr.c ns_ntoa.c nsap_addr.c \
@@ -15,6 +15,10 @@
 	res_mkquery.c res_query.c res_send.c send.c sethostent.c \
 	sockatmark.c
 
+.if (${MKHESIOD} != "no")
+SRCS+=	hesiod.c
+.endif
+
 SRCS+=	__dn_comp.c __res_close.c __res_send.c _inet_aton.c _inet_pton.c
 CPPFLAGS+=-DRESOLVSORT -I.
 
@@ -39,9 +43,13 @@
 
 MAN+=	byteorder.3 ethers.3 gethostbyname.3 getifaddrs.3 \
 	getnetent.3 getprotoent.3 \
-	getservent.3 hesiod.3 inet.3 inet_net.3 iso_addr.3 linkaddr.3 ns.3 \
+	getservent.3 inet.3 inet_net.3 iso_addr.3 linkaddr.3 ns.3 \
 	nsdispatch.3 rcmd.3 resolver.3 sockatmark.3
 
+.if (${MKHESIOD} != "no")
+MAN+=	hesiod.3
+.endif
+
 MLINKS+=byteorder.3 htonl.3 byteorder.3 htons.3 byteorder.3 ntohl.3 \
 	byteorder.3 ntohs.3
 MLINKS+=ethers.3 ether_aton.3 ethers.3 ether_hostton.3 ethers.3 ether_line.3 \
@@ -56,9 +64,11 @@
 	getprotoent.3 getprotobynumber.3 getprotoent.3 setprotoent.3
 MLINKS+=getservent.3 endservent.3 getservent.3 getservbyname.3 \
 	getservent.3 getservbyport.3 getservent.3 setservent.3
+.if (${MKHESIOD} != "no")
 MLINKS+=hesiod.3 hesiod_end.3 hesiod.3 hesiod_free_list.3 \
 	hesiod.3 hesiod_init.3 hesiod.3 hesiod_resolve.3 \
 	hesiod.3 hesiod_to_bind.3
+.endif
 MLINKS+=inet.3 addr.3 inet.3 inet_addr.3 inet.3 inet_aton.3 \
 	inet.3 inet_lnaof.3 inet.3 inet_makeaddr.3 inet.3 inet_netof.3 \
 	inet.3 inet_network.3 inet.3 inet_ntoa.3 inet.3 network.3 \
Index: lib/librpcsvc/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/librpcsvc/Makefile,v
retrieving revision 1.35
diff -u -r1.35 Makefile
--- lib/librpcsvc/Makefile	2002/01/29 11:22:25	1.35
+++ lib/librpcsvc/Makefile	2002/03/20 17:11:26
@@ -1,8 +1,11 @@
 #	$NetBSD: Makefile,v 1.35 2002/01/29 11:22:25 tv Exp $
 
+.include <bsd.own.mk>
+
 RPCSRCS=	bootparam_prot.x klm_prot.x mount.x nfs_prot.x\
 		nlm_prot.x rex.x rnusers.x rusers.x rquota.x rstat.x rwall.x\
 		sm_inter.x spray.x yp.x yppasswd.x
+
 SRCS=		${RPCSRCS:.x=.c} ${HDRS}
 HDRS=           ${RPCSRCS:.x=.h}
 CLEANFILES+=	${SRCS} ${HDRS}
Index: lib/libtelnet/Makefile
===================================================================
RCS file: /cvsroot/basesrc/lib/libtelnet/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- lib/libtelnet/Makefile	2002/01/29 17:58:36	1.14
+++ lib/libtelnet/Makefile	2002/03/20 17:11:31
@@ -16,7 +16,7 @@
 COPTS+=	-O0
 .endif
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 SRCS+=	enc_des.c kerberos.c
 SRCS+=	kerberos5.c
 
Index: lib/libwrap/Makefile.cflags
===================================================================
RCS file: /cvsroot/basesrc/lib/libwrap/Makefile.cflags,v
retrieving revision 1.5
diff -u -r1.5 Makefile.cflags
--- lib/libwrap/Makefile.cflags	1999/08/31 13:58:58	1.5
+++ lib/libwrap/Makefile.cflags	2002/03/20 17:11:31
@@ -1,11 +1,17 @@
 #	$NetBSD: Makefile.cflags,v 1.5 1999/08/31 13:58:58 itojun Exp $
 
+.include <bsd.own.mk>
+
 CPPFLAGS+=-DFACILITY=LOG_AUTHPRIV -DSEVERITY=LOG_INFO
 CPPFLAGS+=-DREAL_DAEMON_DIR=\"/usr/libexec\" -DHOSTS_ACCESS -DDAEMON_UMASK=022
 CPPFLAGS+=-DRFC931_TIMEOUT=10 -DALWAYS_HOSTNAME -DSYS_ERRLIST_DEFINED
 CPPFLAGS+=-DHOSTS_ALLOW=\"/etc/hosts.allow\" -DHOSTS_DENY=\"/etc/hosts.deny\"
-CPPFLAGS+=-DPROCESS_OPTIONS -DNETGROUP
+CPPFLAGS+=-DPROCESS_OPTIONS
 CPPFLAGS+=-Dss_family=__ss_family -Dss_len=__ss_len
+
+.if (${SUPPORT_YP} != "no")
+CPPFLAGS+=-DNETGROUP
+.endif
 
 # -DPARANOID is not used by libwrap, only by programs that use it.
 # in this case inetd does not use it (probably rightly so) and so
Index: libexec/Makefile
===================================================================
RCS file: /cvsroot/basesrc/libexec/Makefile,v
retrieving revision 1.40
diff -u -r1.40 Makefile
--- libexec/Makefile	2000/08/06 20:42:22	1.40
+++ libexec/Makefile	2002/03/20 17:11:37
@@ -8,7 +8,7 @@
 	rlogind rmail rshd rpc.rquotad rpc.rstatd rpc.rusersd rpc.rwalld \
 	rpc.sprayd talkd telnetd tftpd uucpd
 
-.if (${MKCRYPTO} != "no")
+.if (${MKKERBEROS} != "no")
 # Heimdal/KTH Kerberos
 SUBDIR+= hpropd kadmind kfd kpasswdd
 .endif
Index: libexec/ftpd/Makefile
===================================================================
RCS file: /cvsroot/basesrc/libexec/ftpd/Makefile,v
retrieving revision 1.45
diff -u -r1.45 Makefile
--- libexec/ftpd/Makefile	2001/12/01 10:25:29	1.45
+++ libexec/ftpd/Makefile	2002/03/20 17:11:37
@@ -18,7 +18,7 @@
 
 WARNS=2
 
-.ifdef SKEY
+.if (${SUPPORT_SKEY} != "no")
 CPPFLAGS+=-DSKEY
 DPADD+= ${LIBSKEY}
 LDADD+= -lskey
Index: libexec/telnetd/Makefile
===================================================================
RCS file: /cvsroot/basesrc/libexec/telnetd/Makefile,v
retrieving revision 1.30
diff -u -r1.30 Makefile
--- libexec/telnetd/Makefile	2000/12/30 17:29:25	1.30
+++ libexec/telnetd/Makefile	2002/03/20 17:11:38
@@ -18,7 +18,7 @@
 CPPFLAGS+=-I${.CURDIR}/../../lib
 CPPFLAGS+=-I${.CURDIR}
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+=-DAUTHENTICATION -DENCRYPTION
 CPPFLAGS+=-I${DESTDIR}/usr/include/krb5
 CPPFLAGS+=-DKRB5
Index: regress/lib/Makefile
===================================================================
RCS file: /cvsroot/basesrc/regress/lib/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- regress/lib/Makefile	2001/07/17 03:42:23	1.9
+++ regress/lib/Makefile	2002/03/20 17:11:40
@@ -2,7 +2,11 @@
 
 .include <bsd.own.mk>
 
-SUBDIR+= csu libc libposix libskey
+SUBDIR+= csu libc libposix
+
+.if (${MKSKEY} != "no")
+SUBDIR+= libskey
+.endif
 
 .if ${MKCRYPTO} == "yes"
 SUBDIR+= libcrypto 
Index: usr.bin/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/Makefile,v
retrieving revision 1.122
diff -u -r1.122 Makefile
--- usr.bin/Makefile	2002/03/01 11:23:14	1.122
+++ usr.bin/Makefile	2002/03/20 17:14:14
@@ -8,7 +8,7 @@
 	chpass cksum cmp col colcrt colrm column comm compress \
 	crontab crunch ctags cut dirname du eject elf2aout elf2ecoff env \
 	error expand false fdformat fgen file find finger fmt fold fpr \
-	from fsplit fstat ftp gencat getconf getopt gprof head hesinfo \
+	from fsplit fstat ftp gencat getconf getopt gprof head \
 	hexdump id indent innetgr ipcrm ipcs join jot kdump ktrace ktruss \
 	lam last lastcomm ldd leave less lex locate lock \
 	logger login logname look lorder m4 machine mail \
@@ -18,18 +18,33 @@
 	pagesize passwd paste patch pkill pmc pr printenv printf quota \
 	radioctl rdist renice rev rlogin rpcgen rpcinfo rs rsh rup \
 	ruptime rusers rwall rwho script sed shar shlock \
-	showmount shuffle skey skeyinfo skeyinit soelim sort split \
+	showmount shuffle soelim sort split \
 	su systat tail talk tcopy tee telnet tftp time \
 	tip tn3270 top touch tput tr true tset tsort tty ul \
 	uname unexpand unifdef uniq units unvis usbhidaction usbhidctl users \
 	uudecode uuencode vacation vgrind vi vis vmstat w \
 	wall wc what whatis whereis which who whois window \
-	write xargs xinstall xlint xstr yacc yes ypcat \
-	ypmatch ypwhich
+	write xargs xinstall xlint xstr yacc yes
 
+.if (${MKHESIOD} != "no")
+SUBDIR+= hesinfo
+.endif
+
+.if (${MKKERBEROS} != "no")
+SUBDIR+= compile_et kdestroy kf kinit klist kpasswd mk_cmds string2key
+.endif
+
+.if (${MKSKEY} != "no")
+SUBDIR+= skey skeyinfo skeyinit
+.endif
+
+.if (${MKYP} != "no")
+SUBDIR+= ypcat ypmatch ypwhich
+.endif
+
 .if (${MKCRYPTO} != "no")
 SUBDIR+= openssl
-SUBDIR+= bdes compile_et kdestroy kf kinit klist kpasswd mk_cmds string2key
+SUBDIR+= bdes
 SUBDIR+= ssh
 .endif
 
Index: usr.bin/chpass/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/chpass/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- usr.bin/chpass/Makefile	1997/10/24 09:00:22	1.10
+++ usr.bin/chpass/Makefile	2002/03/20 17:14:15
@@ -1,16 +1,27 @@
 #	$NetBSD: Makefile,v 1.10 1997/10/24 09:00:22 lukem Exp $
 #	@(#)Makefile	8.2 (Berkeley) 4/2/94
 
+.include <bsd.own.mk>
+
 PROG=	chpass
-SRCS=	chpass.c edit.c field.c pw_yp.c table.c util.c getpwent.c
+SRCS=	chpass.c edit.c field.c table.c util.c getpwent.c
 BINOWN=	root
 BINMODE=4555
 .PATH:	${.CURDIR}/../../lib/libc/gen
 LINKS=	${BINDIR}/chpass ${BINDIR}/chfn ${BINDIR}/chpass ${BINDIR}/chsh
 MLINKS=	chpass.1 chfn.1 chpass.1 chsh.1
-CPPFLAGS+=-DYP -I${.CURDIR}/../../lib/libc/include
-DPADD+= ${LIBRPCSVC} ${LIBUTIL}
-LDADD+= -lrpcsvc -lutil
+
+CPPFLAGS+=-I${.CURDIR}/../../lib/libc/include
+
+.if (${SUPPORT_YP} != "no")
+SRCS+=	pw_yp.c
+CPPFLAGS+=-DYP
+DPADD+=	${LIBRPCSVC}
+LDADD+=	-lrpcsvc
+.endif
+
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
 
 .include <bsd.prog.mk>
 
Index: usr.bin/lock/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/lock/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- usr.bin/lock/Makefile	2000/10/18 00:24:18	1.10
+++ usr.bin/lock/Makefile	2002/03/20 17:14:17
@@ -9,7 +9,7 @@
 
 .include <bsd.prog.mk>
 
-.ifdef SKEY
+.if (${SUPPORT_SKEY} != "no")
 CPPFLAGS+=-DSKEY
 DPADD+= ${LIBSKEY}
 LDADD+= -lskey
Index: usr.bin/login/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/login/Makefile,v
retrieving revision 1.34
diff -u -r1.34 Makefile
--- usr.bin/login/Makefile	2000/10/18 00:24:18	1.34
+++ usr.bin/login/Makefile	2002/03/20 17:14:17
@@ -11,13 +11,13 @@
 BINMODE=4555
 CPPFLAGS+=-DLOGIN_CAP
 
-.ifdef SKEY
+.if (${SUPPORT_SKEY} != "no")
 CPPFLAGS+=-DSKEY
 DPADD+= ${LIBSKEY}
 LDADD+=	-lskey
 .endif
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 SRCS+= k5login.c
 CPPFLAGS+=-DKERBEROS5 -I${DESTDIR}/usr/include/krb5
 LDADD+= -lkrb5 -lasn1
Index: usr.bin/passwd/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/passwd/Makefile,v
retrieving revision 1.30
diff -u -r1.30 Makefile
--- usr.bin/passwd/Makefile	2000/10/18 00:24:19	1.30
+++ usr.bin/passwd/Makefile	2002/03/20 17:14:19
@@ -4,18 +4,26 @@
 .include <bsd.own.mk>
 
 PROG=	passwd
-SRCS=	local_passwd.c passwd.c pwd_gensalt.c yp_passwd.c
-DPADD+= ${LIBRPCSVC} ${LIBCRYPT} ${LIBUTIL}
-LDADD+= -lrpcsvc -lcrypt -lutil
-CPPFLAGS+=-I${.CURDIR} -DYP -DLOGIN_CAP
+SRCS=	local_passwd.c passwd.c pwd_gensalt.c
 
+CPPFLAGS+=-I${.CURDIR} -DLOGIN_CAP
+
+.if (${SUPPORT_YP} != "no")
+SRCS+=	yp_passwd.c
+CPPFLAGS+=-DYP
+DPADD+=	${LIBRPCSVC}
+LDADD+=	-lrpcsvc
 LINKS=	${BINDIR}/passwd ${BINDIR}/yppasswd
 MLINKS=	passwd.1 yppasswd.1
+.endif
+
+DPADD+= ${LIBCRYPT} ${LIBUTIL}
+LDADD+= -lcrypt -lutil
 
 BINOWN=	root
 BINMODE=4555
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+= -DKERBEROS5 -I${DESTDIR}/usr/include/krb5
 SRCS+=	krb5_passwd.c
 
Index: usr.bin/ssh/libssh/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/ssh/libssh/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- usr.bin/ssh/libssh/Makefile	2002/03/08 02:00:58	1.11
+++ usr.bin/ssh/libssh/Makefile	2002/03/20 17:14:20
@@ -24,7 +24,7 @@
 # only needed during build - prevent installation of library
 libinstall::
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+= -DKRB5 -DAFS -I${DESTDIR}/usr/include/krb5
 CPPFLAGS+= -DKRB4 -I${DESTDIR}/usr/include/kerberosIV
 SRCS+= radix.c
Index: usr.bin/ssh/ssh/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/ssh/ssh/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- usr.bin/ssh/ssh/Makefile	2001/05/15 15:26:11	1.9
+++ usr.bin/ssh/ssh/Makefile	2002/03/20 17:14:20
@@ -14,7 +14,7 @@
 SRCS=	ssh.c readconf.c clientloop.c sshtty.c \
 	sshconnect.c sshconnect1.c sshconnect2.c
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+=-DKRB5 -DAFS -I${DESTDIR}/usr/include/krb5
 LDADD+=	-lkrb5 -lkafs -lasn1
 DPADD+=	${LIBKRB5} ${LIBKAFS} ${LIBASN1}
Index: usr.bin/ssh/sshd/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/ssh/sshd/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- usr.bin/ssh/sshd/Makefile	2001/06/23 19:37:43	1.9
+++ usr.bin/ssh/sshd/Makefile	2002/03/20 17:14:20
@@ -13,7 +13,7 @@
 	auth-chall.c auth2-chall.c groupaccess.c \
 	auth-skey.c auth-bsdauth.c
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+=-DKRB5 -DAFS -I${DESTDIR}/usr/include/krb5
 SRCS+=	auth-krb5.c
 LDADD+=	-lkrb5 -lkafs -lasn1
@@ -34,7 +34,7 @@
 LDADD+=	-lwrap
 DPADD+=	${LIBWRAP}
 
-.ifdef SKEY
+.if (${SUPPORT_SKEY} != "no")
 CPPFLAGS+=-DSKEY
 LDADD+=	-lskey
 DPADD+=	${LIBSKEY}
Index: usr.bin/su/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/su/Makefile,v
retrieving revision 1.26
diff -u -r1.26 Makefile
--- usr.bin/su/Makefile	2001/01/11 00:54:57	1.26
+++ usr.bin/su/Makefile	2002/03/20 17:14:21
@@ -19,7 +19,7 @@
 # list of groups.
 #CPPFLAGS+=-DSU_INDIRECT_GROUP
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 .ifdef AFS
 DPADD+= ${LIBKAFS}
 LDADD+= -lkafs
@@ -36,7 +36,7 @@
 
 .include <bsd.prog.mk>
 
-.ifdef SKEY
+.if (${SUPPORT_SKEY} != "no")
 CPPFLAGS+=-DSKEY
 DPADD+= ${LIBSKEY}
 LDADD+= -lskey
Index: usr.bin/telnet/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/telnet/Makefile,v
retrieving revision 1.25
diff -u -r1.25 Makefile
--- usr.bin/telnet/Makefile	2000/08/03 22:58:32	1.25
+++ usr.bin/telnet/Makefile	2002/03/20 17:14:26
@@ -55,7 +55,7 @@
 DPADD+=	${LIBIPSEC}
 CPPFLAGS+=-DINET6
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+=-DAUTHENTICATION -DENCRYPTION -DKRB4
 CPPFLAGS+=-DKRB5 -DFORWARD
 
Index: usr.sbin/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/Makefile,v
retrieving revision 1.169
diff -u -r1.169 Makefile
--- usr.sbin/Makefile	2001/12/17 21:22:51	1.169
+++ usr.sbin/Makefile	2002/03/20 17:14:33
@@ -14,12 +14,20 @@
 	mtree ndbootd netgroup_mkdb nfsd ntp pcictl pkg_install pppd pstat \
 	pwd_mkdb quot quotacheck quotaon rarpd rbootd rdate \
 	repquota rmt rpc.bootparamd rpc.lockd rpc.pcnfsd \
-	rpc.statd rpc.yppasswdd rpcbind rwhod sa screenblank sesd \
+	rpc.statd rpcbind rwhod sa screenblank sesd \
 	sliplogin slstats spray sup sushi syslogd tadpolectl tcpdchk \
 	tcpdmatch tcpdump timed traceroute trpt trsp unlink \
 	usbdevs user videomode vipw vnconfig wiconfig wsconscfg \
-	wsfontload wsmuxctl ypbind yppoll ypserv ypset zdump zic
+	wsfontload wsmuxctl zdump zic
 
+.if (${MKKERBEROS} != "no")
+SUBDIR+= hprop kadmin kdc kstash ktutil
+.endif
+
+.if (${MKYP} != "no")
+SUBDIR+= rpc.yppasswdd ypbind yppoll ypserv ypset
+.endif
+
 .if !defined(USE_NEW_TOOLCHAIN)
 SUBDIR+= mdsetimage
 .endif
@@ -32,7 +40,7 @@
 SUBDIR+=pvcsif pvctxctl
 
 .if (${MKCRYPTO} != "no")
-SUBDIR+= hprop kadmin kdc kstash ktutil racoon
+SUBDIR+= racoon
 .endif
 
 .include <bsd.subdir.mk>
Index: usr.sbin/amd/Makefile.inc
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/amd/Makefile.inc,v
retrieving revision 1.16
diff -u -r1.16 Makefile.inc
--- usr.sbin/amd/Makefile.inc	2001/01/07 08:00:57	1.16
+++ usr.sbin/amd/Makefile.inc	2002/03/20 17:14:34
@@ -12,6 +12,14 @@
 CPPFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR}/../include -I${IDIST}/libamu \
 	-I${IDIST}/include -I${LIBAMUOBJDIR}
 
+.if (${SUPPORT_HESIOD} != "no")
+CPPFLAGS+=-DHAVE_MAP_HESIOD=1
+.endif
+
+.if (${SUPPORT_YP} != "no")
+CPPFLAGS+=-DHAVE_MAP_NIS=1
+.endif
+
 .if !defined(LIB) || empty(LIB)
 LDADD+=	-L${LIBAMUOBJDIR} -lamu
 .if ${MKPIC} == "no"
Index: usr.sbin/amd/amd/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/amd/amd/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- usr.sbin/amd/amd/Makefile	2001/01/07 08:00:54	1.19
+++ usr.sbin/amd/amd/Makefile	2002/03/20 17:14:34
@@ -10,14 +10,23 @@
 SRCS=	am_ops.c amd.c amfs_auto.c amfs_direct.c amfs_error.c amfs_host.c \
 	amfs_inherit.c amfs_link.c amfs_linkx.c amfs_nfsl.c amfs_nfsx.c \
 	amfs_program.c amfs_root.c amfs_toplvl.c amfs_union.c amq_subr.c \
-	amq_svc.c autil.c clock.c conf.c get_args.c info_file.c info_hesiod.c \
-	info_ndbm.c info_nis.c info_passwd.c \
+	amq_svc.c autil.c clock.c conf.c get_args.c info_file.c \
+	info_ndbm.c info_passwd.c \
 	info_union.c map.c mapc.c mntfs.c nfs_prot_svc.c nfs_start.c \
 	nfs_subr.c ops_autofs.c ops_cdfs.c \
 	ops_mfs.c ops_nfs.c ops_nfs3.c ops_nullfs.c ops_pcfs.c \
 	ops_tfs.c ops_tmpfs.c ops_ufs.c ops_umapfs.c ops_unionfs.c \
 	opts.c restart.c rpc_fwd.c sched.c srvr_amfs_auto.c srvr_nfs.c \
 	conf_parse.c conf_tok.c
+
+.if (${SUPPORT_HESIOD} != "no")
+SRCS+=	info_hesiod.c
+.endif
+
+.if (${SUPPORT_YP} != "no")
+SRCS+=	info_nis.c
+.endif
+
 # the following are not supported on NetBSD
 #	info_ldap.c info_nisplus.c ops_cachefs.c ops_efs.c ops_lofs.c ops_xfs.c
 MAN+=	amd.8
Index: usr.sbin/amd/include/config.h
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/amd/include/config.h,v
retrieving revision 1.19
diff -u -r1.19 config.h
--- usr.sbin/amd/include/config.h	2001/05/13 18:11:56	1.19
+++ usr.sbin/amd/include/config.h	2002/03/20 17:14:37
@@ -60,8 +60,10 @@
 /* Define if have file maps (everyone should have it!) */
 #define HAVE_MAP_FILE 1
 
+#if 0
 /* Define if have NIS maps */
 #define HAVE_MAP_NIS 1
+#endif
 
 /* Define if have NIS+ maps */
 /* #undef HAVE_MAP_NISPLUS */
@@ -72,8 +74,10 @@
 /* Define if have NDBM maps */
 #define HAVE_MAP_NDBM 1
 
+#if 0
 /* Define if have HESIOD maps */
 #define HAVE_MAP_HESIOD 1
+#endif
 
 /* Define if have LDAP maps */
 /* #undef HAVE_MAP_LDAP */
Index: usr.sbin/racoon/racoon/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/racoon/racoon/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- usr.sbin/racoon/racoon/Makefile	2001/10/19 23:59:56	1.11
+++ usr.sbin/racoon/racoon/Makefile	2002/03/20 17:14:46
@@ -20,7 +20,7 @@
 LIBPFKEYDIR!=	cd ${.CURDIR}/../libpfkey; ${PRINTOBJDIR}
 LDADD+=	-L${LIBPFKEYDIR} -lpfkey
 DPADD+=	${LIBPFKEYDIR}/libpfkey.a
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 LDADD+=	-lgssapi -lkrb5 -lcom_err -lroken -lasn1
 DPADD+=	${LIBGSSAPI} ${LIBKRB5} ${LIBCOM_ERR} ${LIBROKEN} ${LIBASN1}
 .endif
@@ -34,7 +34,7 @@
 CPPFLAGS+=-DYY_NO_UNPUT
 CPPFLAGS+=-I${LIBPFKEYSRCDIR}
 CPPFLAGS+=-I${RACOONSRCDIR}/missing
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+=-DHAVE_GSSAPI 
 .endif
 YHEADER=1
@@ -43,7 +43,7 @@
 SRCS+=	print-isakmp.c
 CPPFLAGS+=-DRACOON_PKG_VERSION="\"${PKGVERSION}\""
 CPPFLAGS+=-I${TCPDUMPSRCDIR} -I${TCPDUMPSRCDIR}/lbl -DHAVE_PRINT_ISAKMP_C=1
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+=-I${DESTDIR}/usr/include/krb5
 .endif
 
Index: usr.sbin/rpc.bootparamd/Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/rpc.bootparamd/Makefile,v
retrieving revision 1.20
diff -u -r1.20 Makefile
--- usr.sbin/rpc.bootparamd/Makefile	2002/02/02 17:11:38	1.20
+++ usr.sbin/rpc.bootparamd/Makefile	2002/03/20 17:14:46
@@ -1,10 +1,15 @@
 #	$NetBSD: Makefile,v 1.20 2002/02/02 17:11:38 tv Exp $
 
+.include <bsd.own.mk>
+
 PROG=	rpc.bootparamd
 SRCS=	bootparamd.c bootparam_prot_svc.c
 MAN=	bootparams.5 rpc.bootparamd.8
 MLINKS=	rpc.bootparamd.8 bootparamd.8
+
+.if (${SUPPORT_YP} != "no")
 CPPFLAGS+=-DYP
+.endif
 
 DPADD=	${LIBRPCSVC} ${LIBUTIL}
 LDADD=	-lrpcsvc -lutil
Index: usr.sbin/rpc.bootparamd/bootparamd.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/rpc.bootparamd/bootparamd.c,v
retrieving revision 1.39
diff -u -r1.39 bootparamd.c
--- usr.sbin/rpc.bootparamd/bootparamd.c	2001/04/11 06:21:49	1.39
+++ usr.sbin/rpc.bootparamd/bootparamd.c	2002/03/20 17:14:46
@@ -41,7 +41,9 @@
 #include <rpc/rpc.h>
 #include <rpc/pmap_clnt.h>
 #include <rpcsvc/bootparam_prot.h>
+#ifdef YP
 #include <rpcsvc/ypclnt.h>
+#endif
 
 #include "pathnames.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
--- usr.sbin/rpc.pcnfsd/Makefile	2001/02/16 01:05:34	1.11
+++ usr.sbin/rpc.pcnfsd/Makefile	2002/03/20 17:14:46
@@ -1,9 +1,15 @@
 #	$NetBSD: Makefile,v 1.11 2001/02/16 01:05:34 enami Exp $
 
+.include <bsd.own.mk>
+
 PROG=	rpc.pcnfsd
 MAN=	pcnfsd.8
 MLINKS= pcnfsd.8 rpc.pcnfsd.8
-CPPFLAGS += -DUSER_CACHE -DWTMP -DUSE_YP -I${.OBJDIR}
+CPPFLAGS += -DUSER_CACHE -DWTMP -I.
+
+.if (${SUPPORT_YP} != "no")
+CPPFLAGS+=-DUSE_YP
+.endif
 
 SRCS=	pcnfsd_v1.c pcnfsd_v2.c pcnfsd_misc.c \
 	pcnfsd_cache.c pcnfsd_print.c pcnfsd_svc.c pcnfsd_xdr.c
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
--- usr.sbin/rpc.pcnfsd/Makefile.clnt	2001/12/12 01:48:55	1.8
+++ usr.sbin/rpc.pcnfsd/Makefile.clnt	2002/03/20 17:14:46
@@ -2,11 +2,17 @@
 
 #	This Makefile builds a client used for testing.
 
-CPPFLAGS += -DUSER_CACHE -DWTMP -DUSE_YP -I${.OBJDIR}
+.include <bsd.own.mk>
 
 PROG=	clnt.pcnfsd
 SRCS=	pcnfsd_test.c pcnfsd_clnt.c pcnfsd_xdr.c
 NOMAN=	# defined
+
+CPPFLAGS+= -DUSER_CACHE -DWTMP -I.
+
+.if (${SUPPORT_YP} != "no")
+CPPFLAGS+=-DUSE_YP
+.endif
 
 DPADD=	${LIBRPCSVC}
 LDADD=	-lrpcsvc
Index: gnu/usr.bin/cvs/cvs/Makefile
===================================================================
RCS file: /cvsroot/gnusrc/gnu/usr.bin/cvs/cvs/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- gnu/usr.bin/cvs/cvs/Makefile	2001/05/15 09:56:30	1.5
+++ gnu/usr.bin/cvs/cvs/Makefile	2002/03/20 17:38:06
@@ -21,7 +21,7 @@
 DPADD+= ${LIBDIFF} ${LIBCVS} ${LIBCRYPT} ${LIBZ}
 LDADD+= ${LIBDIFF} ${LIBCVS} -lcrypt -lz
 
-.if (${MKKERBEROS} != "no")
+.if (${SUPPORT_KERBEROS} != "no")
 CPPFLAGS+= -DENCRYPTION
 CPPFLAGS+= -DHAVE_KERBEROS -I${DESTDIR}/usr/include/kerberosIV
 DPADD+= ${LIBKRB} ${LIBDES} ${LIBCOM_ERR} ${LIBROKEN} ${LIBCRYPT}
Index: gnu/usr.sbin/sendmail/Makefile.inc
===================================================================
RCS file: /cvsroot/gnusrc/gnu/usr.sbin/sendmail/Makefile.inc,v
retrieving revision 1.5
diff -u -r1.5 Makefile.inc
--- gnu/usr.sbin/sendmail/Makefile.inc	2001/03/21 17:37:11	1.5
+++ gnu/usr.sbin/sendmail/Makefile.inc	2002/03/20 17:38:23
@@ -2,10 +2,14 @@
 
 WARNS?=	0
 
-CPPFLAGS+=	-DNEWDB -DNIS
+CPPFLAGS+=	-DNEWDB
 CPPFLAGS+=	-DMAP_REGEX -DTCPWRAPPERS -DNETISO
 CPPFLAGS+=	-DNEEDSGETIPNODE -DNETINET6
 CPPFLAGS+=	-I. -I${DIST}/sendmail/sendmail -I${DIST}/sendmail/include
+
+.if (${SUPPORT_YP} != "no")
+CPPFLAGS+=	-DNIS
+.endif
 
 .if ${MKCRYPTO} != "no"
 CPPFLAGS+=	-DSTARTTLS -D_FFR_TLS_TOREK
Index: share/mk/bsd.own.mk
===================================================================
RCS file: /cvsroot/sharesrc/share/mk/bsd.own.mk,v
retrieving revision 1.274
diff -u -r1.274 bsd.own.mk
--- share/mk/bsd.own.mk	2002/03/18 18:42:52	1.274
+++ share/mk/bsd.own.mk	2002/03/20 17:39:12
@@ -176,9 +176,6 @@
 DESTDIR?=
 .endif
 
-# Defining `SKEY' causes support for S/key authentication to be compiled in.
-SKEY=		yes
-
 # where the system object and source trees are kept; can be configurable
 # by the user in case they want them in ~/foosrc and ~/fooobj, for example
 BSDSRCDIR?=	/usr/src
@@ -360,8 +357,7 @@
 
 # Supported NO* options (if defined, MK* will be forced to "no",
 # regardless of user's mk.conf setting).
-.for var in CRYPTO DOC KERBEROS LINKLIB LINT MAN NLS OBJ \
-	    PIC PICINSTALL PROFILE SHARE
+.for var in CRYPTO DOC LINKLIB LINT MAN NLS OBJ PIC PICINSTALL PROFILE SHARE
 .if defined(NO${var})
 MK${var}:=	no
 .endif
@@ -372,8 +368,8 @@
 .endif
 
 # MK* options which default to "yes".
-.for var in BFD CATPAGES CRYPTO DOC GCC GDB IEEEFP INFO KERBEROS LINKLIB LINT \
-	    MAN NLS OBJ PIC PICINSTALL PROFILE SHARE
+.for var in BFD CATPAGES CRYPTO DOC GCC GDB HESIOD IEEEFP INFO KERBEROS \
+	LINKLIB LINT MAN NLS OBJ PIC PICINSTALL PROFILE SHARE SKEY YP
 MK${var}?=	yes
 .endfor
 
@@ -415,5 +411,15 @@
 MKGDB:=	no
 MKGCC:=	no
 .endif
+
+# Set defaults for the SUPPORT_xxx variables.  They all default to "yes"
+# unless the corresponding MKxxx variable is set to "no".
+.for var in HESIOD KERBEROS SKEY YP
+.if (${MK${var}} == "no")
+SUPPORT_${var}:= no
+.else
+SUPPORT_${var}?= yes
+.endif
+.endfor
 
 .endif		# _BSD_OWN_MK_

--PNTmBPCT7hxwcZjr--