Ignore:
Timestamp:
Jul 26, 2012, 6:17:57 PM (7 years ago)
Author:
sam
Message:

build: search for the Raspberry Pi GLES libraries during configure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r1653 r1670  
    151151
    152152
    153 LIBS_save="$LIBS"
    154 LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
    155 AC_MSG_CHECKING(for -framework OpenGL)
    156 AC_TRY_LINK([], [],
     153dnl  Find which version of OpenGL to use
     154ac_cv_my_have_gl="no"
     155ac_cv_my_stop_looking_for_gl="no"
     156
     157if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
     158  LIBS_save="$LIBS"
     159  LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
     160  AC_MSG_CHECKING(for -framework OpenGL)
     161  AC_TRY_LINK([], [],
     162   [AC_MSG_RESULT(yes)
     163    ac_cv_my_stop_looking_for_gl="yes"
     164    GL_LIBS="${GL_LIBS} -framework OpenGL"
     165    CXXFLAGS="${CXXFLAGS} -ObjC++"],
     166   [AC_MSG_RESULT(no)])
     167  LIBS="$LIBS_save"
     168fi
     169
     170dnl  Use the Raspberry Pi libraries?
     171if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
     172AC_CHECK_HEADER(bcm_host.h,
    157173 [AC_MSG_RESULT(yes)
    158   GL_LIBS="${GL_LIBS} -framework OpenGL"
    159   CXXFLAGS="${CXXFLAGS} -ObjC++"],
     174  AC_CHECK_LIB(bcm_host, main,
     175   [ac_cv_my_have_gl="yes"
     176    ac_cv_my_stop_looking_for_gl="yes"
     177    AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
     178    GL_LIBS="-lGLESv2_static -lkhrn_static -lvcos -lvchiq_arm -lbcm_host"])],
    160179 [AC_MSG_RESULT(no)])
    161 LIBS="$LIBS_save"
    162 
    163 
    164 dnl Which version of OpenGL to use?
    165 ac_cv_my_have_gl="no"
    166 PKG_CHECK_MODULES(GLES2, glesv2,
    167  [ac_cv_my_have_gl="yes"
    168   AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
    169   GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
    170   GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
    171  [:])
    172 AC_CHECK_HEADER(GLES2/gl2.h,
    173  [AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
    174   ac_cv_my_have_gl="yes"])
    175 
    176 PKG_CHECK_MODULES(GL, gl,
    177  [ac_cv_my_have_gl="yes"
    178   AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
    179  [:])
    180 
    181 AC_CHECK_LIB(GL, glLoadIdentity,
    182  [ac_cv_my_have_gl="yes"
    183   AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
    184   GL_LIBS="-lGL"])
    185 AC_CHECK_HEADER(GL/gl.h,
    186  [LIBS_save="$LIBS"
    187   LIBS="$LIBS -lopengl32"
    188   AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
    189   AC_TRY_LINK([#include <GL/gl.h>],
    190    [glLoadIdentity();],
     180fi
     181
     182dnl  Use the PS3 PSGL?
     183if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
     184  AC_CHECK_HEADER(PSGL/psgl.h,
    191185   [ac_cv_my_have_gl="yes"
    192     AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
    193     AC_MSG_RESULT(yes)
    194     GL_LIBS="-lopengl32"],
    195    [AC_MSG_RESULT(no)])
    196   LIBS="$LIBS_save"])
    197 AC_CHECK_HEADER(PSGL/psgl.h,
    198  [ac_cv_my_have_gl="yes"])
     186    ac_cv_my_stop_looking_for_gl="yes"])
     187fi
     188
     189if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
     190  PKG_CHECK_MODULES(GLES2, glesv2,
     191   [ac_cv_my_have_gl="yes"
     192    AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
     193    GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
     194    GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
     195   [:])
     196fi
     197
     198if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
     199  AC_CHECK_HEADER(GLES2/gl2.h,
     200   [AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
     201    ac_cv_my_have_gl="yes"])
     202fi
     203
     204if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
     205  PKG_CHECK_MODULES(GL, gl,
     206   [ac_cv_my_have_gl="yes"
     207    AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
     208   [:])
     209fi
     210
     211if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
     212  AC_CHECK_LIB(GL, glLoadIdentity,
     213   [ac_cv_my_have_gl="yes"
     214    AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
     215    GL_LIBS="-lGL"])
     216fi
     217
     218if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
     219  AC_CHECK_HEADER(GL/gl.h,
     220   [LIBS_save="$LIBS"
     221    LIBS="$LIBS -lopengl32"
     222    AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
     223    AC_TRY_LINK([#include <GL/gl.h>],
     224     [glLoadIdentity();],
     225     [ac_cv_my_have_gl="yes"
     226      AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
     227      AC_MSG_RESULT(yes)
     228      GL_LIBS="-lopengl32"],
     229     [AC_MSG_RESULT(no)])
     230    LIBS="$LIBS_save"])
     231fi
    199232
    200233if test "${ac_cv_my_have_gl}" = "no"; then
    201234  AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
    202235fi
     236
    203237
    204238dnl Use Glew?
     
    325359  EGL_LIBS="${EGL_LIBS} -lX11"
    326360fi
     361dnl Use the Raspberry Pi libraries?
     362AC_CHECK_LIB(EGL_static, main,
     363 [ac_cv_my_have_egl="yes"
     364  AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl)
     365  EGL_LIBS="-lEGL_static"])
    327366AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no")
    328367
Note: See TracChangeset for help on using the changeset viewer.