diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
index 7d062b32d..9d2c9b5bc 100644
--- a/include/libcamera/internal/egl.h
+++ b/include/libcamera/internal/egl.h
@@ -21,7 +21,9 @@
  * Workaround for build issues on Mesa <= 22.2, see
  * https://github.com/KhronosGroup/EGL-Registry/pull/130
  */
+#ifndef EGL_NO_X11
 #define EGL_NO_X11
+#endif
 
 #define EGL_EGLEXT_PROTOTYPES
 #include <EGL/egl.h>
