[cairo-commit] src/cairo-compiler-private.h src/check-def.sh src/check-plt.sh src/compiler-supports-visibility.c src/Makefile.am

Chris Wilson ickle at kemper.freedesktop.org
Fri Jan 11 08:19:37 PST 2008


 src/Makefile.am                    |    5 +++++
 src/cairo-compiler-private.h       |    3 +++
 src/check-def.sh                   |    5 +++++
 src/check-plt.sh                   |    5 +++++
 src/compiler-supports-visibility.c |    6 ++++++
 5 files changed, 24 insertions(+)

New commits:
commit 6d3ed950ea075ff2a5a569365b46c3cfc4152787
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jan 11 16:16:20 2008 +0000

    [check] Skip def/plt tests if the compiler doesn't support symbol hiding.
    
    Compile a trivial program such that it reports whether cairo is hiding
    its internal symbols and skip the tests that depend upon it.
    
    This prevents false errors, such as bug 12726, where the user is
    presented with a scary make check failure.

diff --git a/src/Makefile.am b/src/Makefile.am
index 5986334..f3657c8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -320,6 +320,11 @@ TESTS_ENVIRONMENT = srcdir="$(srcdir)" MAKE="$(MAKE)"
 TESTS = check-def.sh check-plt.sh check-headers.sh check-cairoint.sh
 EXTRA_DIST += $(TESTS)
 
+check-def.sh check-plt.sh: compiler-supports-visibility$(EXEEXT)
+EXTRA_PROGRAMS = compiler-supports-visibility
+CLEANFILES += $(EXTRA_PROGRAMS)
+compiler_supports_visibility_CFLAGS = -I$(srcdir) $(CAIRO_CFLAGS)
+
 SPARSE = sparse
 sparse:
 	@status=true; for f in $(libcairo_la_base_sources); do \
diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index da80b89..14aef47 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -72,10 +72,13 @@ CAIRO_BEGIN_DECLS
 /* slim_internal.h */
 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun)
 #define cairo_private_no_warn	__attribute__((__visibility__("hidden")))
+#define CAIRO_HAS_HIDDEN_SYMBOLS 1
 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
 #define cairo_private_no_warn	__hidden
+#define CAIRO_HAS_HIDDEN_SYMBOLS 1
 #else /* not gcc >= 3.3 and not Sun Studio >= 8 */
 #define cairo_private_no_warn
+#define CAIRO_HAS_HIDDEN_SYMBOLS 0
 #endif
 
 #ifndef WARN_UNUSED_RESULT
diff --git a/src/check-def.sh b/src/check-def.sh
index 58408ef..a2e736a 100755
--- a/src/check-def.sh
+++ b/src/check-def.sh
@@ -2,6 +2,11 @@
 
 LANG=C
 
+if ! ./compiler-supports-visibility; then
+	echo "Compiler doesn't support symbol visibility; skipping test"
+	exit 0
+fi
+
 if ! which nm 2>/dev/null >/dev/null; then
 	echo "'nm' not found; skipping test"
 	exit 0
diff --git a/src/check-plt.sh b/src/check-plt.sh
index 887370c..05cde35 100755
--- a/src/check-plt.sh
+++ b/src/check-plt.sh
@@ -4,6 +4,11 @@ LANG=C
 
 status=0
 
+if ! ./compiler-supports-visibility; then
+	echo "Compiler doesn't support symbol visibility; skipping test"
+	exit 0
+fi
+
 if ! which readelf 2>/dev/null >/dev/null; then
 	echo "'readelf' not found; skipping test"
 	exit 0
diff --git a/src/compiler-supports-visibility.c b/src/compiler-supports-visibility.c
new file mode 100644
index 0000000..488c97c
--- /dev/null
+++ b/src/compiler-supports-visibility.c
@@ -0,0 +1,6 @@
+#include "cairoint.h"
+
+int main (void)
+{
+    return ! CAIRO_HAS_HIDDEN_SYMBOLS;
+}


More information about the cairo-commit mailing list