summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-30 17:25:16 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-30 17:28:41 -0500
commit802153469d8763ed0dfe58590cee91aac1c49246 (patch)
treec08888f8e793377415a88e69bdf393835d5da867
parent4f40f29ade4a6b2c0b27ba902281718662cdde82 (diff)
downloaddimension-802153469d8763ed0dfe58590cee91aac1c49246.tar.xz
Test for GLX usability.
-rw-r--r--configure.ac3
-rw-r--r--tests/libdimension/Makefile.am7
-rw-r--r--tests/libdimension/display-stubs.c36
-rw-r--r--tests/libdimension/display.c (renamed from tests/libdimension/tests.c)11
-rw-r--r--tests/libdimension/tests.h11
5 files changed, 57 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index b4147fd..81c299c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,9 @@ AC_COMPILE_IFELSE([
AC_MSG_RESULT([no])]
)
+AC_CHECK_HEADER([GL/glx.h], [enable_glx=yes], [enable_glx=no])
+AM_CONDITIONAL([GLX], [test "$enable_glx" != "no"])
+
dnl Generate Makefiles
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_FILES([Makefile
diff --git a/tests/libdimension/Makefile.am b/tests/libdimension/Makefile.am
index 252deba..4dbe761 100644
--- a/tests/libdimension/Makefile.am
+++ b/tests/libdimension/Makefile.am
@@ -39,7 +39,7 @@ if !GL
XFAIL_TESTS += gl-test
endif
-libdimension_tests_la_SOURCES = tests.c tests.h
+libdimension_tests_la_SOURCES = tests.h
if PGO
libdimension_tests_la_LIBADD = $(top_builddir)/libdimension/libdimension-pgo.la
@@ -47,7 +47,12 @@ else
libdimension_tests_la_LIBADD = $(top_builddir)/libdimension/libdimension.la
endif
+if GLX
+libdimension_tests_la_SOURCES += display.c
libdimension_tests_la_LIBADD += -lX11 -lGL
+else
+libdimension_tests_la_SOURCES += display-stubs.c
+endif
error_test_SOURCES = error.c
error_test_LDADD = libdimension-tests.la
diff --git a/tests/libdimension/display-stubs.c b/tests/libdimension/display-stubs.c
new file mode 100644
index 0000000..03cc19d
--- /dev/null
+++ b/tests/libdimension/display-stubs.c
@@ -0,0 +1,36 @@
+/*************************************************************************
+ * Copyright (C) 2009-2010 Tavian Barnes <tavianator@gmail.com> *
+ * *
+ * This file is part of The Dimension Test Suite. *
+ * *
+ * The Dimension Test Suite is free software; you can redistribute it *
+ * and/or modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * The Dimension Test Suite is distributed in the hope that it will be *
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
+ *************************************************************************/
+
+#include "tests.h"
+
+dmnsn_display *
+dmnsn_new_display(const dmnsn_canvas *canvas)
+{
+ return NULL;
+}
+
+void
+dmnsn_delete_display(dmnsn_display *display)
+{
+}
+
+void
+dmnsn_display_flush(dmnsn_display *display)
+{
+}
diff --git a/tests/libdimension/tests.c b/tests/libdimension/display.c
index e2e0d18..3fb07e4 100644
--- a/tests/libdimension/tests.c
+++ b/tests/libdimension/display.c
@@ -18,8 +18,19 @@
*************************************************************************/
#include "tests.h"
+#include <GL/glx.h>
+#include <GL/gl.h>
#include <stdlib.h>
+struct dmnsn_display {
+ Display *dpy;
+ Window win;
+ Colormap cmap;
+ GLXContext cx;
+ XEvent event;
+ XVisualInfo *vi;
+};
+
/* XIfEvent callback */
static Bool
WaitForNotify(Display *d, XEvent *e, char *arg)
diff --git a/tests/libdimension/tests.h b/tests/libdimension/tests.h
index 995a063..294670d 100644
--- a/tests/libdimension/tests.h
+++ b/tests/libdimension/tests.h
@@ -21,8 +21,6 @@
#define TESTS_H
#include "dimension.h"
-#include <GL/glx.h>
-#include <GL/gl.h>
#include <unistd.h>
#include <stdio.h>
@@ -35,14 +33,7 @@ extern "C" {
* Windowing
*/
-typedef struct {
- Display *dpy;
- Window win;
- Colormap cmap;
- GLXContext cx;
- XEvent event;
- XVisualInfo *vi;
-} dmnsn_display;
+typedef struct dmnsn_display dmnsn_display;
dmnsn_display *dmnsn_new_display(const dmnsn_canvas *canvas);
void dmnsn_delete_display(dmnsn_display *display);