Fix headers inclusion in xf86drmMode.c
authorJulien Cristau <jcristau@debian.org>
Mon, 6 Jul 2015 11:45:31 +0000 (12:45 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 11 Jul 2015 20:21:07 +0000 (21:21 +0100)
Add sys/sysctl.h to get sysctlbyname declaration on kFreeBSD

Updated by Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
to add autoconf check and only include <sys/sysctl.h> if it
is detected by configure as it’s unusable on Linux/x32 (and
others, e.g. other new architectures).

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
configure.ac
xf86drmMode.c

index 001fd3d..2cf9a19 100644 (file)
@@ -53,7 +53,7 @@ AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
 AC_FUNC_ALLOCA
 
-AC_CHECK_HEADERS([sys/mkdev.h])
+AC_CHECK_HEADERS([sys/mkdev.h sys/sysctl.h])
 
 # Initialize libtool
 LT_PREREQ([2.2])
index f4b8d14..529429e 100644 (file)
@@ -46,6 +46,9 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <sys/ioctl.h>
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
 #include <stdio.h>
 #include <stdbool.h>