build: check that outb is present in io.h

The flashrom plugin can use inb/outb to do a CMOS reset. The build gates
this on whether io.h exists (since bc43ad) as with glibc if io.h exists,
inb/outb are defined. However on musl, io.h always exists but it may not
define inb/outb.

Thus, fwupd builds with musl on non-x86 platforms will fail to link. Fix
this by checking for both io.h and that outb() is defined.

Signed-off-by: Ross Burton <ross.burton@arm.com>
This commit is contained in:
Ross Burton 2021-11-09 16:26:45 +00:00 committed by Mario Limonciello
parent 683fae6be3
commit 774a7098ad

View File

@ -308,7 +308,7 @@ endif
if cc.has_header('sys/socket.h')
conf.set('HAVE_SOCKET_H', '1')
endif
if cc.has_header('sys/io.h')
if cc.has_header('sys/io.h') and cc.has_function('outb', prefix: '#include <sys/io.h>')
conf.set('HAVE_IO_H', '1')
endif
if cc.has_header('linux/ethtool.h')