Use the portable autoconf helper to figure out which header to include
for these funcs.  Linux C libs are moving to not implicitly include them
via sys/types.h anymore, and other OS's have long required you to pull
in the right header directly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96618
Signed-off-by: Mike Frysinger <vap...@gentoo.org>
---
 configure.ac    | 1 +
 lib/igt_sysfs.c | 9 +++++++++
 tools/aubdump.c | 8 ++++++++
 3 files changed, 18 insertions(+)

diff --git a/configure.ac b/configure.ac
index 7e8475744f60..51053d51c662 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,6 +57,7 @@ AM_CONDITIONAL(HAVE_RST2MAN, [test "x$RST2MAN" = xyes])
 
 # Checks for functions, headers, structures, etc.
 AC_HEADER_STDC
+AC_HEADER_MAJOR
 AC_CHECK_HEADERS([termios.h linux/kd.h sys/kd.h libgen.h sys/io.h])
 AC_CHECK_MEMBERS([struct sysinfo.totalram],[],[],[AC_INCLUDES_DEFAULT
                  #include <sys/sysinfo.h>
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index f8aae9d5c695..7f2576ca210f 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -22,10 +22,13 @@
  *
  */
 
+#include "config.h"
+
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
 #include <sys/mount.h>
+#include <sys/types.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -34,6 +37,12 @@
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
+#ifdef MAJOR_IN_MKDEV
+#include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#include <sys/sysmacros.h>
+#endif
 #include <i915_drm.h>
 #include <dirent.h>
 #include <unistd.h>
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 2a37c1a7e956..764da18173d4 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -21,6 +21,8 @@
  * IN THE SOFTWARE.
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -37,6 +39,12 @@
 #include <errno.h>
 #include <sys/mman.h>
 #include <dlfcn.h>
+#ifdef MAJOR_IN_MKDEV
+#include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#include <sys/sysmacros.h>
+#endif
 #include <i915_drm.h>
 
 #include "intel_aub.h"
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to