--- a/examples/gl_interop/gl_interop.c
+++ b/examples/gl_interop/gl_interop.c
@@ -26,7 +26,9 @@
 
 #include <starpu.h>
 #include <unistd.h>
-#include <GL/glut.h>
+
+#if (defined(STARPU_USE_CUDA) && defined(STARPU_OPENGL_RENDER))
+#include <GL/freeglut.h>
 
 void dummy(void *buffers[], void *cl_arg)
 {
@@ -72,6 +74,7 @@ void callback_func(void *foo) {
 	/* Tell it was already the last submitted task */
 	starpu_drivers_request_termination();
 }
+#endif
 
 int main(int argc, char **argv)
 {
--- a/examples/gl_interop/gl_interop_idle.c
+++ b/examples/gl_interop/gl_interop_idle.c
@@ -29,7 +29,9 @@
 
 #include <starpu.h>
 #include <unistd.h>
-#include <GL/glut.h>
+
+#if (defined(STARPU_USE_CUDA) && defined(STARPU_OPENGL_RENDER))
+#include <GL/freeglut.h>
 
 void dummy(void *buffers[], void *cl_arg)
 {
@@ -89,6 +91,7 @@ static void idle(void)
 {
 	starpu_driver_run_once(&drivers[0]);
 }
+#endif
 
 int main(int argc, char **argv)
 {
