--- mesa-12.0.4/src/Makefile.am.orig	2016-11-21 18:15:43.000000000 +0100
+++ mesa-12.0.4/src/Makefile.am	2016-11-21 18:16:59.000000000 +0100
@@ -62,6 +62,9 @@
   $(top_srcdir)/include/GL/glx.h \
   $(top_srcdir)/include/GL/glxext.h \
   $(top_srcdir)/include/GL/glx_mangle.h
+endif
+
+if HAVE_OPENGL
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = mesa/gl.pc
 endif
