Ver código fonte

build: put the OpenGL detection code in a separate .m4 file and assume

that the OpenGL framework on OS X provides GL version 2 at least.
legacy
Sam Hocevar sam 12 anos atrás
pai
commit
bab0d4c7c5
5 arquivos alterados com 136 adições e 119 exclusões
  1. +5
    -0
      .gitignore
  2. +1
    -0
      Makefile.am
  3. +2
    -2
      bootstrap
  4. +127
    -0
      build/autotools/m4/lol-gl.m4
  5. +1
    -117
      configure.ac

+ 5
- 0
.gitignore Ver arquivo

@@ -18,6 +18,11 @@
Makefile
Makefile.in
aclocal.m4
build/autotools/m4/libtool.m4
build/autotools/m4/ltoptions.m4
build/autotools/m4/ltsugar.m4
build/autotools/m4/ltversion.m4
build/autotools/m4/lt~obsolete.m4
autom4te.cache
config.h.in
config.h


+ 1
- 0
Makefile.am Ver arquivo

@@ -7,6 +7,7 @@ DIST_SUBDIRS = $(SUBDIRS) binaries

EXTRA_DIST = bootstrap TODO
AUTOMAKE_OPTIONS = dist-bzip2
ACLOCAL_AMFLAGS = -I build/autotools/m4

check: lolcheck



+ 2
- 2
bootstrap Ver arquivo

@@ -119,7 +119,7 @@ if test -n "$auxdir"; then
if test ! -d "$auxdir"; then
mkdir "$auxdir"
fi
aclocalflags="${aclocalflags} -I $auxdir -I ."
aclocalflags="-I $auxdir -I . ${aclocalflags}"
fi

# Honour M4PATH because sometimes M4 doesn't
@@ -128,7 +128,7 @@ IFS=:
tmp="$M4PATH"
for x in $tmp; do
if test -n "$x"; then
aclocalflags="${aclocalflags} -I $x"
aclocalflags="-I $x ${aclocalflags}"
fi
done
IFS=$save_IFS


+ 127
- 0
build/autotools/m4/lol-gl.m4 Ver arquivo

@@ -0,0 +1,127 @@

# LOL_CHECK_OPENGL()
# ------------------
AC_DEFUN([LOL_CHECK_OPENGL],
[
dnl Find which version of OpenGL to use
ac_cv_my_have_gl="no"
ac_cv_my_stop_looking_for_gl="no"

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
LIBS_save="$LIBS"
LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
AC_MSG_CHECKING(for -framework OpenGL)
AC_TRY_LINK([], [],
[AC_MSG_RESULT(yes)
ac_cv_my_have_gl="yes"
GL_LIBS="${GL_LIBS} -framework OpenGL"
CXXFLAGS="${CXXFLAGS} -ObjC++"
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
[AC_MSG_RESULT(no)])
LIBS="$LIBS_save"
fi

dnl Use the Raspberry Pi libraries?
if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_HEADERS(bcm_host.h,
[AC_CHECK_LIB(vcos, main,
[ac_cv_my_have_gl="yes"
ac_cv_my_stop_looking_for_gl="yes"
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
dnl FIXME: -lEGL does not belong here but the configure test fails
dnl when cross-compiling, so we add it manually here.
GL_LIBS="${GL_LIBS} -lGLESv2 -lEGL -lvcos -lvchiq_arm -lbcm_host"])])
fi

dnl Use the PS3 PSGL?
if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_HEADERS(PSGL/psgl.h,
[ac_cv_my_have_gl="yes"
ac_cv_my_stop_looking_for_gl="yes"])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
PKG_CHECK_MODULES(GLES2, glesv2,
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
[:])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_HEADER(GLES2/gl2.h,
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
AC_CHECK_LIB(GLESv2, glEnable,
[GL_LIBS="${GL_LIBS} -lGLESv2"])])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
PKG_CHECK_MODULES(GL, gl,
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
[:])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_LIB(GL, glEnable,
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
GL_LIBS="-lGL"])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_HEADER(GL/gl.h,
[LIBS_save="$LIBS"
LIBS="$LIBS -lopengl32"
AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
AC_TRY_LINK([#include <GL/gl.h>],
[glLoadIdentity();],
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
AC_MSG_RESULT(yes)
GL_LIBS="-lopengl32"],
[AC_MSG_RESULT(no)])
LIBS="$LIBS_save"])
fi

if test "${ac_cv_my_have_gl}" = "no"; then
AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
fi


dnl Use Glew?
ac_cv_my_have_glew="no"
PKG_CHECK_MODULES(GLEW, glew,
[ac_cv_my_have_glew="yes"
GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
[:])
AC_CHECK_HEADER(glew.h,
[LIBS_save="${LIBS}"
LIBS="${LIBS} -lglew32 ${GL_LIBS}"
AC_MSG_CHECKING(for glewInit in -lglew32)
AC_TRY_LINK(
[#include <glew.h>],
[glewInit();],
[ac_cv_my_have_glew="yes"
GL_LIBS="-lglew32 ${GL_LIBS}"
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
LIBS="${LIBS_save}"])
if test "${ac_cv_my_have_glew}" != "no"; then
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
fi
AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")

dnl Poor man's GL feature detection if all else failed.
save_LIBS="${LIBS}"
LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
AC_CHECK_FUNCS(glBegin)
LIBS="${save_LIBS}"

])# LOL_CHECK_OPENGL



+ 1
- 117
configure.ac Ver arquivo

@@ -152,123 +152,7 @@ dnl Are we on a Direct3D 9 platform?
#fi
#AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")


dnl Find which version of OpenGL to use
ac_cv_my_have_gl="no"
ac_cv_my_stop_looking_for_gl="no"

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
LIBS_save="$LIBS"
LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
AC_MSG_CHECKING(for -framework OpenGL)
AC_TRY_LINK([], [],
[AC_MSG_RESULT(yes)
GL_LIBS="${GL_LIBS} -framework OpenGL"
CXXFLAGS="${CXXFLAGS} -ObjC++"],
[AC_MSG_RESULT(no)])
LIBS="$LIBS_save"
fi

dnl Use the Raspberry Pi libraries?
if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_HEADERS(bcm_host.h,
[AC_CHECK_LIB(vcos, main,
[ac_cv_my_have_gl="yes"
ac_cv_my_stop_looking_for_gl="yes"
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
dnl FIXME: -lEGL does not belong here but the configure test fails
dnl when cross-compiling, so we add it manually here.
GL_LIBS="${GL_LIBS} -lGLESv2 -lEGL -lvcos -lvchiq_arm -lbcm_host"])])
fi

dnl Use the PS3 PSGL?
if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_HEADERS(PSGL/psgl.h,
[ac_cv_my_have_gl="yes"
ac_cv_my_stop_looking_for_gl="yes"])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
PKG_CHECK_MODULES(GLES2, glesv2,
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
GL_CFLAGS="${GL_CFLAGS} ${GLES2_CFLAGS}"
GL_LIBS="${GL_LIBS} ${GLES2_LIBS}"],
[:])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_HEADER(GLES2/gl2.h,
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
AC_CHECK_LIB(GLESv2, glEnable,
[GL_LIBS="${GL_LIBS} -lGLESv2"])])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
PKG_CHECK_MODULES(GL, gl,
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available)],
[:])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_LIB(GL, glEnable,
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hackish
GL_LIBS="-lGL"])
fi

if test "x${ac_cv_my_stop_looking_for_gl}" = "xno"; then
AC_CHECK_HEADER(GL/gl.h,
[LIBS_save="$LIBS"
LIBS="$LIBS -lopengl32"
AC_MSG_CHECKING(for glLoadIdentity in -lopengl32)
AC_TRY_LINK([#include <GL/gl.h>],
[glLoadIdentity();],
[ac_cv_my_have_gl="yes"
AC_DEFINE(HAVE_GL_2X, 1, Define to 1 if GL 2.x is available) # FIXME: hack
AC_MSG_RESULT(yes)
GL_LIBS="-lopengl32"],
[AC_MSG_RESULT(no)])
LIBS="$LIBS_save"])
fi

if test "${ac_cv_my_have_gl}" = "no"; then
AC_MSG_ERROR([[No OpenGL or OpenGL ES implementation found]])
fi


dnl Use Glew?
ac_cv_my_have_glew="no"
PKG_CHECK_MODULES(GLEW, glew,
[ac_cv_my_have_glew="yes"
GL_CFLAGS="${GLEW_CFLAGS} ${GL_CFLAGS}"
GL_LIBS="${GLEW_LIBS} ${GL_LIBS}"],
[:])
AC_CHECK_HEADER(glew.h,
[LIBS_save="${LIBS}"
LIBS="${LIBS} -lglew32 ${GL_LIBS}"
AC_MSG_CHECKING(for glewInit in -lglew32)
AC_TRY_LINK(
[#include <glew.h>],
[glewInit();],
[ac_cv_my_have_glew="yes"
GL_LIBS="-lglew32 ${GL_LIBS}"
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
LIBS="${LIBS_save}"])
if test "${ac_cv_my_have_glew}" != "no"; then
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available)
AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew)
fi
AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no")

dnl Poor man's GL feature detection if all else failed.
save_LIBS="${LIBS}"
LIBS="${LIBS} ${GL_LIBS} ${GLES2_LIBS}"
AC_CHECK_FUNCS(glBegin)
LIBS="${save_LIBS}"
LOL_CHECK_OPENGL()


dnl Use SDL? (always required on Linux or Win32)


Carregando…
Cancelar
Salvar