--- a/gl/lib/mountlist.c
+++ b/gl/lib/mountlist.c
@@ -17,6 +17,10 @@
 
 #include <config.h>
 
+#ifdef MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
 #include "mountlist.h"
 
 #include <limits.h>
