sys/capability.h will be removed before FreeBSD 13. The (now) correct header to use on all supported versions of FreeBSD is sys/capsicum.h; there's no need for autoconf checks etc. to check for both.
A commit references this bug: Author: emaste Date: Tue Nov 6 00:05:18 UTC 2018 New revision: 340171 URL: https://svnweb.freebsd.org/changeset/base/340171 Log: capability.h: add comment about planned removal timeline PR: 233007 MFC after: 1 week Sponsored by: The FreeBSD Foundation Changes: head/sys/sys/capability.h
r340171 referenced this PR by accident; the intent was to reference PR 228878.
https://github.com/freebsd/pkg/issues/1640
The upstream change is not yet in a pkg release. Is a new release coming soon? pkg is now the only holdout preventing the removal of sys/capability.h.
pkg 1.11 does not use sys/capability.h anymore