diff --git a/Makefile b/Makefile
index 6751b355c67a2a48f01ca06b82453daa3f9c8300..5df93f5b286d1c048526144e3bc18d56c95ee18f 100644
--- a/Makefile
+++ b/Makefile
@@ -1088,6 +1088,7 @@ changelog:
 releasenotes:
 	@$(MAKERELNOTES)
 
+ifeq ($(BUILDX11),yes)
 html: rootexecs postbin changelog releasenotes
 ifneq ($(USECONFIG),FALSE)
 	@if [ "x`which root.exe`" != "x$(DESTDIR)$(BINDIR)/root.exe" ] \
@@ -1099,6 +1100,10 @@ ifneq ($(USECONFIG),FALSE)
 endif
 	@$(MAKELOGHTML)
 	@$(MAKEHTML)
+else
+html:
+	@echo "Error: Generating the html doc requires to enable the X11 component when running configure." && exit 1
+endif
 
 # Use DESTDIR to set a sandbox prior to calling "make install", e.g.:
 #   ./configure --prefix=/usr/