blob: ce0bdab755f9ac5bbf1d1e68abac3fa1bbb13457 [file] [log] [blame]
Behdad Esfahbod21d0fce2009-11-03 14:28:32 -05001#!/bin/sh
2
3LC_ALL=C
4export LC_ALL
5
Behdad Esfahbod5bc18192011-05-27 15:58:54 -04006test -z "$srcdir" && srcdir=.
Ebrahim Byagowi72bec1c2018-01-05 12:42:20 +03307test -z "$libs" && libs=.libs
Behdad Esfahbod5bc18192011-05-27 15:58:54 -04008stat=0
9
10
Behdad Esfahbod21d0fce2009-11-03 14:28:32 -050011if which ldd 2>/dev/null >/dev/null; then
Ebrahim Byagowi55cae0d2018-01-29 18:05:24 +033012 LDD=ldd
Behdad Esfahbod21d0fce2009-11-03 14:28:32 -050013else
Ebrahim Byagowi55cae0d2018-01-29 18:05:24 +033014 # macOS specific tool
15 if which otool 2>/dev/null >/dev/null; then
16 LDD="otool -L"
17 else
18 echo "check-libstdc++.sh: 'ldd' not found; skipping test"
19 exit 77
20 fi
Behdad Esfahbod21d0fce2009-11-03 14:28:32 -050021fi
22
Behdad Esfahbod134aa7b2012-01-27 02:09:40 -050023tested=false
Behdad Esfahboda981d792018-02-10 15:17:28 -060024# harfbuzz-icu links to libstdc++ because icu does.
Behdad Esfahbod42040a22018-02-12 18:41:36 -080025# harfbuzz-subset uses libstdc++.
26for soname in harfbuzz harfbuzz-gobject; do
Ebrahim Byagowi844f48e2018-02-10 23:13:12 +033027 for suffix in so dylib; do
28 so=$libs/lib$soname.$suffix
29 if ! test -f "$so"; then continue; fi
Behdad Esfahbod8c6bd342014-08-14 13:33:37 -040030
Behdad Esfahboda981d792018-02-10 15:17:28 -060031 echo "Checking that we are not linking to libstdc++ or libc++ in $so"
Ebrahim Byagowi844f48e2018-02-10 23:13:12 +033032 if $LDD $so | grep 'libstdc[+][+]\|libc[+][+]'; then
33 echo "Ouch, linked to libstdc++ or libc++"
34 stat=1
35 fi
36 tested=true
37 done
Behdad Esfahbod134aa7b2012-01-27 02:09:40 -050038done
39if ! $tested; then
Behdad Esfahbodd59e28e2012-08-28 19:08:36 -040040 echo "check-libstdc++.sh: libharfbuzz shared library not found; skipping test"
Behdad Esfahbod4538efa2011-08-05 20:11:06 -040041 exit 77
Behdad Esfahbod21d0fce2009-11-03 14:28:32 -050042fi
43
44exit $stat