Permalink
Browse files

configure: fix check for OpenGL.

Ensure that the right libraries and includes are added for non-standard
installations of the OpenGL stack.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
  • Loading branch information...
1 parent 0111200 commit d97da5a2d571a536f13c4014c05ee3f8cca6bd66 @gbeauchesne committed Aug 13, 2012
View
@@ -806,6 +806,9 @@ else
AC_MSG_RESULT(== WARNING: OpenGLU support is assumed.)
AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
else
+ PKG_CHECK_MODULES([GL], [gl],
+ [INCLUDES="$INCLUDES $GL_CFLAGS" LIBS="$LIBS $GL_LIBS"],
+ [GL_LIBS="-lGL"])
AC_CHECK_LIB([GL], [main],, AC_MSG_ERROR($missing_library))
AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
AC_CHECK_LIB([GLU], [main],, AC_MSG_ERROR($missing_library))
@@ -344,11 +344,19 @@ AC_DEFUN([MAC_PKG_OPENGL], [
_MAC_SAVE([LIBS], [
HAVE_PKG_OPENGL=yes
- AC_SEARCH_LIBS(glXChooseVisual, [MesaGL GL GLX],
- [], [HAVE_PKG_OPENGL=no], [[$X_LIBS]])dnl
- AC_SEARCH_LIBS(gluErrorString, [MesaGLU GL GLU],
- [], [HAVE_PKG_OPENGL=no], [[$X_LIBS]])dnl
- OPENGL_LIBS="$LIBS"
+ PKG_CHECK_MODULES([GL], [gl], [], [HAVE_PKG_OPENGL=no])
+ PKG_CHECK_MODULES([GLU], [glu], [], [HAVE_PKG_OPENGL=no])
+ if test "$HAVE_PKG_OPENGL" = "yes"; then
+ OPENGL_CFLAGS="$GL_CFLAGS $GLU_CFLAGS"
+ OPENGL_LIBS="$GL_LIBS $GLU_LIBS"
+ else
+ AC_SEARCH_LIBS(glXChooseVisual, [MesaGL GL GLX],
+ [], [HAVE_PKG_OPENGL=no], [[$X_LIBS]])dnl
+ AC_SEARCH_LIBS(gluErrorString, [MesaGLU GL GLU],
+ [], [HAVE_PKG_OPENGL=no], [[$X_LIBS]])dnl
+ OPENGL_CFLAGS=""
+ OPENGL_LIBS="$LIBS"
+ fi
_MAC_SAVE([CPPFLAGS], [
CPPFLAGS="$CPPFLAGS $X_CPPFLAGS"
AC_CHECK_HEADERS([GL/gl.h], , , [#])
@@ -96,6 +96,7 @@ MAC_PKG_OPENGL
if test "$HAVE_PKG_OPENGL" != yes; then
AC_MSG_ERROR([can't compile without OpenGL support])
fi
+AC_SUBST(OPENGL_CFLAGS)
AC_SUBST(OPENGL_LIBS)
HAVE_SOUND=no
@@ -16,7 +16,7 @@ LIBLTDL = $(top_builddir)/libltdl/libltdl.a
LIBLTDL_CPPFLAGS = -I$(top_builddir)/libltdl
endif DLOPEN
-AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" -I$(srcdir)/.. -I$(top_srcdir)/lib $(X_CPPFLAGS) -D_LINUX -DXBMC
+AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" -I$(srcdir)/.. -I$(top_srcdir)/lib $(X_CPPFLAGS) $(OPENGL_CFLAGS) -D_LINUX -DXBMC
AM_LDFLAGS =
AM_CXXFLAGS =
@@ -7,8 +7,7 @@ rs_euphoria_SOURCES = $(COMMON) $(COLOR) $(VECTOR) $(IMAGE) euphoria.cc \
AM_CPPFLAGS += $(IMAGE_CPPFLAGS)
AM_CXXFLAGS += $(IMAGE_CXXFLAGS)
-AM_LDFLAGS += $(IMAGE_LDFLAGS)
-rs_euphoria_LDADD = $(LIBMISC) $(X_LIBS) $(OPENGL_LIBS) $(IMAGE_LIBS)
+rs_euphoria_LDADD = $(LIBMISC) $(X_LIBS) $(OPENGL_LIBS) $(IMAGE_LIBS) $(IMAGE_LDFLAGS)
hack_PROGRAMS = rs-euphoria

0 comments on commit d97da5a

Please sign in to comment.