Version 1 was here:
https://www.redhat.com/archives/libguestfs/2020-April/thread.html#00160
Version 2 side-steps the objections to the first patch by using a
well-formed alternate nbdkit.pc file and running ordinary pkg-config
against it, so any parsing of --cflags etc will be done by pkg-config.
The first patch is essentially the same idea as:
https://github.com/libguestfs/libnbd/commit/dc87a1a6d6918ac5477e1d6b22599...
(which follows on from similar tricks in libguestfs and libvirt).
Rich.