[igt-dev] [PATCH v3 1/7] build: check that outb is present in io.h

Bernd Kuhls bernd at kuhls.net
Mon Oct 30 19:58:03 UTC 2023


With glibc if io.h exists, inb/outb are always defined.
However on musl, io.h always exists but it may not define inb/outb.

Thus, igt-gpu-tools 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: Bernd Kuhls <bernd at kuhls.net>
---
v3: no changes

 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index b35a00faa..cee8a7446 100644
--- a/meson.build
+++ b/meson.build
@@ -220,7 +220,7 @@ endif
 if cc.has_header('libgen.h')
 	config.set('HAVE_LIBGEN_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>')
 	config.set('HAVE_SYS_IO_H', 1)
 endif
 if cc.links('''
-- 
2.39.2



More information about the igt-dev mailing list