1#!/usr/bin/env python3 2 3import sys, os, shutil, subprocess 4 5os.chdir (os.getenv ('srcdir', os.path.dirname (__file__))) 6 7libs = os.getenv ('libs', '.libs') 8 9ldd = shutil.which ('ldd') 10if ldd: 11 ldd = [ldd] 12else: 13 ldd = shutil.which ('otool') 14 if ldd: 15 ldd = [ldd, '-L'] # otool -L 16 else: 17 print ('check-libstdc++.py: \'ldd\' not found; skipping test') 18 sys.exit (77) 19 20stat = 0 21tested = False 22 23# harfbuzz-icu links to libstdc++ because icu does. 24for 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 28 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) 33 stat = 1 34 35 tested = True 36 37if not tested: 38 print ('check-libstdc++.py: libharfbuzz shared library not found; skipping test') 39 sys.exit (77) 40 41sys.exit (stat) 42