diff --git a/config/udev.c b/config/udev.c
index 8c6c4b6..314acba 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -39,6 +39,10 @@
 #include "globals.h"
 #include "systemd-logind.h"
 
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
+
 #define UDEV_XKB_PROP_KEY "xkb"
 
 #define LOG_PROPERTY(path, prop, val)                                   \
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 3bd22b8..855b3d5 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -506,4 +506,7 @@
 /* Have epoll_create1() */
 #undef HAVE_EPOLL_CREATE1
 
+/* Have <sys/sysmacros.h> header */
+#undef HAVE_SYS_SYSMACROS_H
+
 #endif /* _DIX_CONFIG_H_ */
