Support building on Windows
[jansson.git] / test / suites / api / check-exports
1 #!/bin/sh
2 #
3 # This test checks that libjansson.so exports the correct symbols.
4 #
5
6 SOFILE="../src/.libs/libjansson.so"
7
8 # The list of symbols, which the shared object should export, is read
9 # from the def file, which is used in Windows builds
10 grep 'json_' $top_srcdir/src/jansson.def \
11     | sed -e 's/ //g' \
12     | sort \
13     >$test_log/exports
14
15 nm -D $SOFILE >/dev/null >$test_log/symbols 2>/dev/null \
16     || exit 77  # Skip if "nm -D" doesn't seem to work
17
18 grep ' T ' $test_log/symbols | cut -d' ' -f3 | sort >$test_log/output
19
20 if ! cmp -s $test_log/exports $test_log/output; then
21     diff -u $test_log/exports $test_log/output >&2
22     exit 1
23 fi