3 import sys, os, shutil, subprocess
5 os.chdir (os.environ.get ('srcdir', os.path.dirname (__file__)))
7 libs = os.environ.get ('libs', '.libs')
9 ldd = shutil.which ('ldd')
13 ldd = shutil.which ('otool')
15 ldd = [ldd, '-L'] # otool -L
17 print ('check-libstdc++.py: \'ldd\' not found; skipping test')
23 # harfbuzz-icu links to libstdc++ because icu does.
24 for soname in ['harfbuzz', 'harfbuzz-subset', 'harfbuzz-gobject']:
25 for suffix in ['so', 'dylib']:
26 so = os.path.join (libs, 'lib%s.%s' % (soname, suffix))
27 if not os.path.exists (so): continue
29 print ('Checking that we are not linking to libstdc++ or libc++ in %s' % so)
30 ldd_result = subprocess.check_output (ldd + [so])
31 if (b'libstdc++' in ldd_result) or (b'libc++' in ldd_result):
32 print ('Ouch, %s is linked to libstdc++ or libc++' % so)
38 print ('check-libstdc++.py: libharfbuzz shared library not found; skipping test')