sbin: build ping if at least one of INET & INET6 is enabled

It does not build (and serves no purpose) if neither is true (i.e.,
building WITHOUT_INET and WITHOUT_INET6).  Also add an explicit error
in ping to make this case clear.

PR:		260082
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a4ef9e58bc)

OptionalObsoleteFiles: remove ping with INET & INET6 disabled

Reported by:	kevans
Fixes:		a4ef9e58bc ("sbin: build ping if at least one of...")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0179739a00)
This commit is contained in:
Ed Maste 2021-11-28 12:50:13 -05:00
parent c775b6ebab
commit 0f0d52fd6a
3 changed files with 11 additions and 1 deletions

View File

@ -53,7 +53,6 @@ SUBDIR=adjkerntz \
nfsiod \
nos-tun \
pfilctl \
ping \
rcorder \
reboot \
recoverdisk \
@ -69,6 +68,10 @@ SUBDIR=adjkerntz \
tunefs \
umount
.if ${MK_INET} != "no" || ${MK_INET6} != "no"
SUBDIR+= ping
.endif
SUBDIR.${MK_CCD}+= ccdconfig
SUBDIR.${MK_CXX}+= devd
SUBDIR.${MK_HAST}+= hastctl

View File

@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
#define OPTSTR PING4OPTS
#elif defined(INET6)
#define OPTSTR PING6OPTS
#else
#error At least one of INET and INET6 is required
#endif
int

View File

@ -2571,6 +2571,11 @@ OLD_DIRS+=usr/share/i18n/csmapper/KS
OLD_DIRS+=usr/share/i18n/csmapper/GB
.endif
.if ${MK_INET} == no && ${MK_INET6} == no
OLD_FILES+=sbin/ping
OLD_FILES+=usr/share/man/man8/ping.8.gz
.endif
.if ${MK_INET6} == no
OLD_FILES+=sbin/ping6
OLD_FILES+=sbin/rtsol