build: Better fileio test, required for utils

The existing fileio configure test only tests for unistd/fcntl header
existence, which isn't sufficient. This change instead tests for linking
poll().

The utils programs need fileio so the meson build is made conditional
for those.

Change-Id: I7edf632cf81ed3e78f2f02488e95c28d78edfc31
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
diff --git a/meson.build b/meson.build
index c6c6fe9..d884c6a 100644
--- a/meson.build
+++ b/meson.build
@@ -64,9 +64,16 @@
     add_project_arguments('-DMCTP_DEFAULT_ALLOC', language : 'c')
 endif
 
-if get_option('fileio').require(
-    compiler.check_header('unistd.h') and compiler.check_header('fcntl.h')
-    ).allowed()
+feat_fileio = get_option('fileio').require(
+    compiler.links('''
+        #include <poll.h>
+        #include <unistd.h>
+        void main()
+        {
+            poll(NULL, 0, -1);
+        }
+    '''))
+if feat_fileio.allowed()
     add_project_arguments('-DMCTP_HAVE_FILEIO', language : 'c')
 endif
 
@@ -140,7 +147,9 @@
     link_with: libmctp,
 )
 
-subdir('utils')
+if feat_fileio.allowed()
+    subdir('utils')
+endif
 
 if get_option('tests').allowed()
     subdir('tests')