summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@freedesktop.org>2010-07-18 16:55:31 -0700
committerIan Romanick <idr@freedesktop.org>2010-07-18 16:55:31 -0700
commit9a48bdd102c7cc51a8049e5df86c8e538d0f1d13 (patch)
treefa87bfd23155103f31057f424aa966df5a6415b9
parent640b86e028431a566b1c21e9be3f52e2bf18e87c (diff)
Add checks to configure.ac for the window system
Soon the library will need to call the window system depenedent GetProcAddress funtion.
-rw-r--r--configure.ac55
1 files changed, 55 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index af5c479..0c4f964 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,12 @@ AC_TYPE_UINT8_T
AC_HEADER_STDC
AC_CHECK_FUNCS(fopen_s)
+AC_ARG_WITH([winsys],
+ [AS_HELP_STRING([--with-winsys],
+ [select windowing system to use between glx, egl, and wgl @<:@default=check@:>@])],
+ [],
+ [with_winsys=check])
+
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[use debug compiler flags and macros @<:@default=disabled@:>@])],
@@ -63,6 +69,55 @@ else
fi
CXXFLAGS="$CXXFLAGS $WARN"
+# Determine which window system layer to use. If none is selected or detected,
+# see if the required functions are statically available (this maybe the case
+# on OpenGL ES 2.0 or on OS X).
+
+if test "x$with_winsys" = xcheck ; then
+ AC_CHECK_HEADER("GL/glx.h", [have_glx=yes], [], [])
+ AC_CHECK_HEADER("EGL/egl.h", [have_egl=yes], [], [])
+ AC_CHECK_HEADER("GL/wgl.h", [have_wgl=yes], [], [])
+
+ if test "x$have_glx" = xyes ; then
+ if test "x$have_egl" = xyes -o "x$have_wgl" = xyes ; then
+ AC_MSG_ERROR("cannot determine which window system to use")
+ fi
+
+ with_winsys=glx
+ fi
+
+ if test "x$have_egl" = xyes ; then
+ if test "x$have_wgl" = xyes ; then
+ AC_MSG_ERROR("cannot determine which window system to use")
+ fi
+
+ with_winsys=egl
+ fi
+
+ if test "x$have_wgl" = xyes ; then
+ with_winsys=wgl
+ fi
+fi
+
+if test "x$with_winsys" = xglx ; then
+ AC_DEFINE([HAVE_GLX], [1], [Use GLX as the window system layer.])
+elif test "x$with_winsys" = xegl ; then
+ AC_DEFINE([HAVE_EGL], [1], [Use EGL as the window system layer.])
+elif test "x$with_winsys" = xwgl ; then
+ AC_DEFINE([HAVE_WGL], [1], [Use WGL as the window system layer.])
+elif test "x$with_winsys" = xcheck -o "x$with_winsys" = xno; then
+ # No window system. Check that the OpenGL library makes OpenGL 2.0
+ # symbols statically available.
+ AC_CHECK_FUNCS(glCreateShader,
+ [],
+ [AC_MSG_ERROR("cannot find glCreateShader. Update library path or select a window system via --with-winsys")]
+ )
+else
+ AC_MSG_ERROR("invalid window system selection")
+fi
+
+
+
AC_OUTPUT([Makefile
src/Makefile
test/Makefile