diff --git a/Makefile.am b/Makefile.am
index 40c2f67a2e8c75552e7f9fe05abfe7f79db551f1..18f42034e7c342a76e43f59d0436e87c1dbb599f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -130,11 +130,13 @@ inputprotopkgconfig_DATA = inputproto.pc
 
 kbdir = $(includedir)/X11/extensions
 kb_HEADERS = \
-	include/X11/extensions/XKBgeom.h \
 	include/X11/extensions/XKB.h \
 	include/X11/extensions/XKBproto.h \
 	include/X11/extensions/XKBsrv.h \
 	include/X11/extensions/XKBstr.h
+if LEGACY
+kb_HEADERS += include/X11/extensions/XKBgeom.h
+endif
 
 kbprotopkgconfigdir = $(datadir)/pkgconfig
 kbprotopkgconfig_DATA = kbproto.pc
@@ -256,11 +258,13 @@ endif
 
 videodir = $(includedir)/X11/extensions
 video_HEADERS = \
-	include/X11/extensions/vldXvMC.h \
 	include/X11/extensions/Xv.h \
 	include/X11/extensions/XvMC.h \
 	include/X11/extensions/XvMCproto.h \
 	include/X11/extensions/Xvproto.h
+if LEGACY
+video_HEADERS += include/X11/extensions/vldXvMC.h
+endif
 
 videoprotopkgconfigdir = $(datadir)/pkgconfig
 videoprotopkgconfig_DATA = videoproto.pc
diff --git a/include/X11/extensions/meson.build b/include/X11/extensions/meson.build
index dbd70c2a02495d77af8735a1a91ae24f1b880f89..1d85cf834b31617596743a1e1d62096cc34bb707 100644
--- a/include/X11/extensions/meson.build
+++ b/include/X11/extensions/meson.build
@@ -53,7 +53,6 @@ install_headers(
     'syncconst.h',
     'syncproto.h',
     'syncstr.h',
-    'vldXvMC.h',
     'xcmiscproto.h',
     'xcmiscstr.h',
     'xf86bigfont.h',
@@ -77,7 +76,6 @@ install_headers(
     'XI2proto.h',
     'XI.h',
     'XIproto.h',
-    'XKBgeom.h',
     'XKB.h',
     'XKBproto.h',
     'XKBsrv.h',
@@ -110,6 +108,7 @@ if get_option('legacy') == true
         'lgewire.h',
         'Print.h',
         'Printstr.h',
+        'vldXvMC.h',
         'windowswm.h',
         'windowswmstr.h',
         'xcalibrateproto.h',
@@ -117,6 +116,7 @@ if get_option('legacy') == true
         'Xeviestr.h',
         'xf86rush.h',
         'xf86rushstr.h',
+        'XKBgeom.h',
         subdir : 'X11/extensions'
     )
 endif