From a35192b07cabc373e56eec6de2b9bd4fdd7bdee8 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Thu, 1 Mar 2018 17:37:42 +0000 Subject: [PATCH 1/3] meson: add option to enable/disable the test suite --- meson.build | 5 ++++- meson_options.txt | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b2ebaef..9632c7a 100644 --- a/meson.build +++ b/meson.build @@ -242,7 +242,10 @@ libepoxy_inc = [ subdir('include/epoxy') subdir('src') -subdir('test') + +if get_option('tests') + subdir('test') +endif if get_option('docs') doxygen = find_program('doxygen', required: false) diff --git a/meson_options.txt b/meson_options.txt index b5d7c98..dc30e68 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -15,3 +15,7 @@ option('x11', type: 'boolean', value: true, description: 'Enable X11 support (GLX or EGL-X11)') +option('tests', + type: 'boolean', + value: true, + description: 'Build the test suite') From 1267f82021d58a447f5614ceef20509bea47bca3 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 2 Mar 2018 17:01:54 +0000 Subject: [PATCH 2/3] meson: generalise build_apple to has_dlvsym build_apple was introduced in 756dca as a proxy for the fact that Apple's libc doesn't have dlvsym(), which is glibc-specific so also isn't present in other libc implementations such as musl. Instead of detecting whether we are building for Apple or not, just probe the to see if we have dlvsym. --- meson.build | 3 --- test/meson.build | 9 ++++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 9632c7a..ceac94f 100644 --- a/meson.build +++ b/meson.build @@ -81,15 +81,12 @@ endif # The remaining platform specific API for GL/GLES are enabled # depending on the platform we're building for if host_system == 'windows' - build_apple = false build_wgl = true has_znow = true elif host_system == 'darwin' - build_apple = true build_wgl = false has_znow = false else - build_apple = false build_wgl = false has_znow = true endif diff --git a/test/meson.build b/test/meson.build index c5788b4..62f2f3d 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,3 +1,6 @@ +dl_dep = cc.find_library('dl', required: false) +has_dlvsym = cc.has_function('dlvsym', dependencies: dl_dep) + has_gles1 = gles1_dep.found() has_gles2 = gles2_dep.found() build_x11_tests = enable_x11 and x11_dep.found() @@ -92,8 +95,8 @@ if build_glx [ 'glx_has_extension_nocontext', [ 'glx_has_extension_nocontext.c' ], [], [], true ], [ 'glx_static', [ 'glx_static.c' ], [ '-DNEEDS_TO_BE_STATIC'], [ '-static' ], libtype == 'static' ], [ 'glx_shared_znow', [ 'glx_static.c', ], [], [ '-Wl,-z,now' ], has_znow ], - [ 'glx_alias_prefer_same_name', [ 'glx_alias_prefer_same_name.c', 'dlwrap.c', 'dlwrap.h' ], [], [ '-rdynamic' ], not build_apple ], - [ 'glx_gles2', [ 'glx_gles2.c', 'dlwrap.c', 'dlwrap.h' ], [], [ '-rdynamic' ], not build_apple ], + [ 'glx_alias_prefer_same_name', [ 'glx_alias_prefer_same_name.c', 'dlwrap.c', 'dlwrap.h' ], [], [ '-rdynamic' ], has_dlvsym ], + [ 'glx_gles2', [ 'glx_gles2.c', 'dlwrap.c', 'dlwrap.h' ], [], [ '-rdynamic' ], has_dlvsym ], ] foreach test: glx_tests @@ -114,7 +117,7 @@ if build_glx endif endforeach - if not build_apple + if has_dlvsym # GLX/EGL tests if build_egl glx_egl_sources = [ From f9098b0c1866eba179ad124884aeb146eae30d0a Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Wed, 7 Mar 2018 13:33:14 +0000 Subject: [PATCH 3/3] autotools: check for dlvsym As per the previous commit, instead of assuming that Apple doesn't have dlvsym but everywhere else does, actually check for dlvsym() existing as that function is glibc-specific. --- configure.ac | 12 ++++++------ src/gen_dispatch.py | 0 test/Makefile.am | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) mode change 100644 => 100755 src/gen_dispatch.py diff --git a/configure.ac b/configure.ac index ee882c5..1af6445 100644 --- a/configure.ac +++ b/configure.ac @@ -137,7 +137,6 @@ AS_CASE([$host_os], [darwin*], [ build_wgl=no - build_apple=yes has_znow=no EPOXY_LINK_LIBS="" ], @@ -177,11 +176,6 @@ if test x$build_wgl = xyes; then AC_DEFINE([BUILD_WGL], [1], [build WGL tests]) fi -AM_CONDITIONAL(BUILD_APPLE, test x$build_apple = xyes) -if test x$build_apple = xyes; then - AC_DEFINE([BUILD_APPLE], [1], [build APPLE is apple (for testing)]) -fi - AM_CONDITIONAL(HAS_ZNOW, test x$has_znow = xyes) AC_CHECK_LIB([GLESv1_CM], [glFlush], [has_gles1=yes], [has_gles1=no]) @@ -190,6 +184,12 @@ AM_CONDITIONAL(HAS_GLES1, test x$has_gles1 = xyes) AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"]) AC_SUBST([DLOPEN_LIBS]) +savelibs=$LIBS +LIBS=$DLOPEN_LIBS +AC_CHECK_FUNCS([dlvsym], [have_dlvsym=1], [have_dlvsym=0]) +AM_CONDITIONAL(HAVE_DLVSYM, test $have_dlvsym = 1) +LIBS=$savelibs + VISIBILITY_CFLAGS="" AS_CASE(["$host"], diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py old mode 100644 new mode 100755 diff --git a/test/Makefile.am b/test/Makefile.am index d0c1a5d..1513099 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -96,7 +96,7 @@ endif if BUILD_EGL if BUILD_GLX -if !BUILD_APPLE +if HAVE_DLVSYM EGL_AND_GLX_TESTS = \ egl_gl \ egl_and_glx_different_pointers_egl_glx \ @@ -107,8 +107,8 @@ endif endif endif -if !BUILD_APPLE -GLX_NON_APPLE_TESTS = \ +if HAVE_DLVSYM +GLX_DLVSYM_TESTS = \ glx_alias_prefer_same_name \ glx_gles2 \ $() @@ -122,7 +122,7 @@ GLX_TESTS = \ glx_has_extension_nocontext \ glx_static \ $(GLX_SHARED_ZNOW) \ - $(GLX_NON_APPLE_TESTS) \ + $(GLX_DLVSYM_TESTS) \ $() GLX_UTIL_LIB = libglx_common.la