From 55cae0d72eecb5116008815b598481dd1404fc6a Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Mon, 29 Jan 2018 18:05:24 +0330 Subject: [PATCH] [test] Use 'otool -L' where ldd doesn't exist (macOS) (#732) --- src/check-libstdc++.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/check-libstdc++.sh b/src/check-libstdc++.sh index 4295180c4..e4aaeb2b4 100755 --- a/src/check-libstdc++.sh +++ b/src/check-libstdc++.sh @@ -9,10 +9,15 @@ stat=0 if which ldd 2>/dev/null >/dev/null; then - : + LDD=ldd else - echo "check-libstdc++.sh: 'ldd' not found; skipping test" - exit 77 + # macOS specific tool + if which otool 2>/dev/null >/dev/null; then + LDD="otool -L" + else + echo "check-libstdc++.sh: 'ldd' not found; skipping test" + exit 77 + fi fi tested=false @@ -21,7 +26,7 @@ for suffix in so dylib; do if ! test -f "$so"; then continue; fi echo "Checking that we are not linking to libstdc++ or libc++" - if ldd $so | grep 'libstdc[+][+]\|libc[+][+]'; then + if $LDD $so | grep 'libstdc[+][+]\|libc[+][+]'; then echo "Ouch, linked to libstdc++ or libc++" stat=1 fi