summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-01-11 16:16:20 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-01-11 16:16:20 +0000
commit6d3ed950ea075ff2a5a569365b46c3cfc4152787 (patch)
treea7ffa60f2ce695147a908bf0368a31a81e921a3d
parentbe146f02e0e220aa70217bf348beef301a56f898 (diff)
[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.
-rw-r--r--src/Makefile.am5
-rw-r--r--src/cairo-compiler-private.h3
-rwxr-xr-xsrc/check-def.sh5
-rwxr-xr-xsrc/check-plt.sh5
-rw-r--r--src/compiler-supports-visibility.c6
5 files changed, 24 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5986334b..f3657c84 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 da80b89e..14aef47d 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 58408efa..a2e736a3 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 887370c6..05cde35f 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 00000000..488c97c2
--- /dev/null
+++ b/src/compiler-supports-visibility.c
@@ -0,0 +1,6 @@
+#include "cairoint.h"
+
+int main (void)
+{
+ return ! CAIRO_HAS_HIDDEN_SYMBOLS;
+}