summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-12-06 12:09:57 -0800
committerEric Anholt <eric@anholt.net>2013-12-06 15:50:01 -0800
commit0d7d26537d8d8309ed462fcc5852c7bae9244fee (patch)
treec8fe3d51e19ebef7a206b74d8112aedbbe205253
parent19053c4d6ffa391f51657e267e35db9e99b205e4 (diff)
downloadlibepoxy-0d7d26537d8d8309ed462fcc5852c7bae9244fee.tar.gz
Conditionalize building GLX and EGL tests and headers.
Note that the generated code is still generated, they just aren't built and installed. The goal with that is that someone could take the built .c and .h files and drop it into their own project, if they want to avoid shared libs.
-rw-r--r--configure.ac21
-rw-r--r--include/epoxy/Makefile.am5
-rw-r--r--src/Makefile.am12
-rw-r--r--test/Makefile.am27
-rw-r--r--test/headerguards.c13
-rw-r--r--test/miscdefines.c6
6 files changed, 76 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index c2e0a88..90c5f76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,27 @@ AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_SYS_LARGEFILE
+case $host_os in
+ mingw*)
+ build_egl=no
+ build_glx=no
+ ;;
+ *)
+ build_egl=yes
+ build_glx=yes
+ ;;
+esac
+
+AM_CONDITIONAL(BUILD_EGL, test x$build_egl = xyes)
+if test x$build_egl = xyes; then
+ AC_DEFINE([BUILD_EGL], [1], [build EGL tests])
+fi
+
+AM_CONDITIONAL(BUILD_GLX, test x$build_glx = xyes)
+if test x$build_glx = xyes; then
+ AC_DEFINE([BUILD_GLX], [1], [build GLX tests])
+fi
+
if test "x$GCC" = xyes; then
save_CFLAGS="$CFLAGS"
AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
diff --git a/include/epoxy/Makefile.am b/include/epoxy/Makefile.am
index 3622239..816a67a 100644
--- a/include/epoxy/Makefile.am
+++ b/include/epoxy/Makefile.am
@@ -26,5 +26,10 @@ epoxyinclude_HEADERS = \
$(GLX_INCLUDES) \
$()
+if BUILD_EGL
EGL_INCLUDES = egl.h
+endif
+
+if BUILD_GLX
GLX_INCLUDES = glx.h
+endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 36c1704..d28eb0f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,10 +30,18 @@ lib_LTLIBRARIES = libepoxy.la
epoxyinclude_DATA = \
$(GENERATED_GL_INCLUDES) \
- $(GENERATED_GLX_INCLUDES) \
- $(GENERATED_EGL_INCLUDES) \
+ $(INSTALL_GLX_INCLUDES) \
+ $(INSTALL_EGL_INCLUDES) \
$()
+if BUILD_EGL
+INSTALL_EGL_INCLUDES = $(GENERATED_EGL_INCLUDES)
+endif
+
+if BUILD_GLX
+INSTALL_GLX_INCLUDES = $(GENERATED_GLX_INCLUDES)
+endif
+
GENERATED_GL_INCLUDES = \
$(builddir)/../include/epoxy/gl_generated.h \
$(builddir)/../include/epoxy/gl_generated_vtable_defines.h \
diff --git a/test/Makefile.am b/test/Makefile.am
index ef6ca11..6e53a5d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -21,8 +21,8 @@
EPOXY = $(builddir)/../src/libepoxy.la
check_LTLIBRARIES = \
- libegl_common.la \
- libglx_common.la \
+ $(EGL_LIBS) \
+ $(GLX_LIBS) \
$()
libegl_common_la_SOURCES = \
@@ -41,17 +41,33 @@ AM_CPPFLAGS = \
$(X11_CFLAGS)
TESTS = \
+ $(EGL_TESTS) \
+ $(GLX_TESTS) \
+ headerguards \
+ miscdefines \
+ $()
+
+check_PROGRAMS = $(TESTS)
+
+if BUILD_EGL
+EGL_TESTS = \
egl_has_extension_nocontext \
+ $()
+
+EGL_LIBS = libegl_common.la
+endif
+
+if BUILD_GLX
+GLX_TESTS = \
glx_beginend \
glx_public_api \
glx_public_api_core \
glx_glxgetprocaddress_nocontext \
glx_has_extension_nocontext \
- headerguards \
- miscdefines \
$()
-check_PROGRAMS = $(TESTS)
+GLX_LIBS = libglx_common.la
+endif
egl_has_extension_nocontext_LDFLAGS = $(X11_LIBS) $(EPOXY) libegl_common.la
egl_has_extension_nocontext_DEPENDENCIES = libegl_common.la
@@ -70,4 +86,3 @@ glx_glxgetprocaddress_nocontext_DEPENDENCIES = libglx_common.la
glx_has_extension_nocontext_LDFLAGS = $(X11_LIBS) $(EPOXY) libglx_common.la
glx_has_extension_nocontext_DEPENDENCIES = libglx_common.la
-
diff --git a/test/headerguards.c b/test/headerguards.c
index a270b53..d3e4445 100644
--- a/test/headerguards.c
+++ b/test/headerguards.c
@@ -21,16 +21,29 @@
* IN THE SOFTWARE.
*/
+#include <config.h>
+
#include <epoxy/gl.h>
+
+#ifdef BUILD_EGL
#include <epoxy/egl.h>
+#endif
+
+#ifdef BUILD_GLX
#include <epoxy/glx.h>
+#endif
+#ifdef BUILD_EGL
#include <EGL/egl.h>
#include <EGL/eglext.h>
+#endif
+
+#ifdef BUILD_GLX
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glx.h>
#include <GL/glxext.h>
+#endif
int main(int argc, char **argv)
{
diff --git a/test/miscdefines.c b/test/miscdefines.c
index 6e181de..e4bc79a 100644
--- a/test/miscdefines.c
+++ b/test/miscdefines.c
@@ -22,8 +22,14 @@
*/
#include <epoxy/gl.h>
+
+#ifdef BUILD_EGL
#include <epoxy/egl.h>
+#endif
+
+#ifdef BUILD_GLX
#include <epoxy/glx.h>
+#endif
#if GL_VERSION_3_2 != 1
#error bad GL_VERSION_3_2