Changes.
[cairo/gpu.git] / src / check-def.sh
bloba33e71e6caf7817e4c762a320d78462f184fa672
1 #!/bin/sh
3 LANG=C
5 if which nm 2>/dev/null >/dev/null; then
7 else
8 echo "'nm' not found; skipping test"
9 exit 0
12 test -z "$srcdir" && srcdir=.
13 test -z "$MAKE" && MAKE=make
14 stat=0
16 $MAKE check-has-hidden-symbols.i > /dev/null || exit 1
17 if tail -1 check-has-hidden-symbols.i | grep CAIRO_HAS_HIDDEN_SYMBOLS >/dev/null; then
18 echo "Compiler doesn't support symbol visibility; skipping test"
19 exit 0
22 if [ "`uname -s`" = "Linux" ]; then
23 get_cairo_syms='( objdump -t "$so" | grep "^[^ ]* [^l.*]*[.]"; objdump -t "$so" | grep "[.]hidden.*\\<cairo"; ) | sed "s/.* //"'
24 else
25 get_cairo_syms='nm "$so" | grep " [BCDGINRSTVW] " | cut -d" " -f3'
28 defs="cairo.def"
29 $MAKE $defs > /dev/null
30 for def in $defs; do
31 lib=`echo "$def" | sed 's/[.]def$//'`
32 lib=`echo "$lib" | sed 's@.*/@@'`
33 so=.libs/lib${lib}.so
35 test -f "$so" || continue
37 echo Checking that $so has the same symbol list as $def
40 echo EXPORTS
41 eval $get_cairo_syms | c++filt --no-params | grep -v '^_cairo_test_\|^_fini\|^_init\|^_save[fg]pr\|^_rest[fg]pr\|^_Z' | sort -u
42 # cheat: copy the last line from the def file!
43 tail -n1 "$def"
44 } | diff "$def" - >&2 || stat=1
45 done
47 exit $stat