configure.ac: Use pkg-config for gles1/2 if available

When building for gles1/2 we now always try and look for a libglesv1_cm
or libglesv2 .pc file with details about where to find the library and
headers.
This commit is contained in:
Robert Bragg 2010-06-18 13:35:09 +01:00
parent d45ac12628
commit c767feecbb

View File

@ -350,76 +350,89 @@ AS_IF([test "x$COGL_DRIVER" = "xgles"],
[ [
AS_CASE([$glesversion], AS_CASE([$glesversion],
[1*], [1*],
[ [
clutter_gl_header="GLES/gl.h" clutter_gl_header="GLES/gl.h"
AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering]) AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES1]) AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES1])
AC_CHECK_HEADERS([GLES/egl.h], AC_CHECK_HEADERS([GLES/egl.h],
[], [],
[AC_MSG_ERROR([Unable to locate required GLES headers])]) [AC_MSG_ERROR([Unable to locate required GLES headers])])
PKG_CHECK_EXISTS([glesv1_cm],
[BACKEND_PC_FILES="$BACKEND_PC_FILES glesv1_cm"],
[
# check for upper/lower case libgles_em
# The powervr sdk uses lower case.
AC_CHECK_LIB(GLES_CM, [eglInitialize],
[HAVE_LIBGLES=yes],
[HAVE_LIBGLES=no])
# check for upper/lower case libgles_em AS_IF([test "x$HAVE_LIBGLES" = "xyes"],
# The powervr sdk uses lower case. [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLES_CM"],
AC_CHECK_LIB(GLES_CM, [eglInitialize], [
[HAVE_LIBGLES=yes], AC_CHECK_LIB(GLESv1_CM, [eglInitialize],
[HAVE_LIBGLES=no]) [HAVE_LIBGLES=yes],
[HAVE_LIBGLES=no])
AS_IF([test "x$HAVE_LIBGLES" = "xyes"], AS_IF([test "x$HAVE_LIBGLES" = "xyes"],
[FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLES_CM"], [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLESv1_CM"],
[ [
AC_CHECK_LIB(GLESv1_CM, [eglInitialize], AC_CHECK_LIB(gles_cm, [eglInitialize],
[HAVE_LIBGLES=yes], [HAVE_LIBGLES=yes],
[HAVE_LIBGLES=no]) [HAVE_LIBGLES=no])
AS_IF([test "x$HAVE_LIBGLES" = "xyes"], AS_IF([test "x$HAVE_LIBGLES" = "xyes"],
[FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLESv1_CM"], [FLAVOUR_LIBS="$FLAVOUR_LIBS -lgles_cm"],
[ [
AC_CHECK_LIB(gles_cm, [eglInitialize], AC_MSG_ERROR([GLES library not found and egl backend requested.])
[HAVE_LIBGLES=yes], ]
[HAVE_LIBGLES=no]) )
]
)
]
)
])
AS_IF([test "x$HAVE_LIBGLES" = "xyes"], PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"])
[FLAVOUR_LIBS="$FLAVOUR_LIBS -lgles_cm"], ],
[
AC_MSG_ERROR([GLES library not found and egl backend requested.])
]
)
]
)
]
)
],
[2*], [2*],
[ [
clutter_gl_header="GLES2/gl2.h" clutter_gl_header="GLES2/gl2.h"
use_gles2_wrapper=yes use_gles2_wrapper=yes
AC_DEFINE([HAVE_COGL_GLES2], 1, [Have GL/ES for rendering]) AC_DEFINE([HAVE_COGL_GLES2], 1, [Have GL/ES for rendering])
AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES2]) AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES2])
AC_CHECK_HEADERS([EGL/egl.h], PKG_CHECK_EXISTS([glesv2],
[], [BACKEND_PC_FILES="$BACKEND_PC_FILES glesv2"],
[AC_MSG_ERROR([Unable to locate required GLES headers])]) [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLESv2"])
FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLESv2 -lEGL" PKG_CHECK_EXISTS([egl],
], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"],
[
AC_CHECK_HEADERS([EGL/egl.h],
[],
[AC_MSG_ERROR([Unable to locate required EGL headers])])
FLAVOUR_LIBS="$FLAVOUR_LIBS -lEGL"
]
)
],
[fruity], [fruity],
[ [
clutter_gl_header="GLES/gl.h" clutter_gl_header="GLES/gl.h"
AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering]) AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES1]) AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES1])
AC_CHECK_HEADERS([GLES/egl.h], AC_CHECK_HEADERS([GLES/egl.h],
[], [],
[AC_MSG_ERROR([Unable to locate required GLES headers])]) [AC_MSG_ERROR([Unable to locate required GLES headers])])
], ],
[AC_MSG_ERROR([Unknown argument for --with-gles])] [AC_MSG_ERROR([Unknown argument for --with-gles])]
) )
] ]
) )