]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[linux] Fail at link time if building slirp.linux without libslirp
authorMichael Brown <mcb30@ipxe.org>
Thu, 11 Mar 2021 15:08:57 +0000 (15:08 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 11 Mar 2021 15:25:33 +0000 (15:25 +0000)
commit7c8fc2cae8769fff7d9fe8af3cef046995a3fd3e
tree5055737598f38d1d56ce1b8e49a4a269e257f3ea
parent65bd5c05db2a050a4c0f26ccc0b1e9828b00abbf
[linux] Fail at link time if building slirp.linux without libslirp

The iPXE build system is constructed for a standalone codebase with no
external dependencies, and does not have any equivalent of the
standard userspace ./configure script.  We currently check for the
ability to include slirp/libslirp.h and conditionalise portions of
linux_api.c on its presence.  The actual slirp driver code is built
unconditionally, as with all iPXE drivers.

This currently leads to a silent runtime failure if attempting to use
slirp.linux built on a system that was missing slirp/libslirp.h.

Convert this to a link-time failure by deliberately omitting the
relevant symbols from linux_api.c when slirp/libslirp.h is not
present.  This allows other builds (e.g. tap.linux or tests.linux) to
succeed: the link-time failure will occur only if the slirp driver is
included within the build target.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/linux/linux_api.c