fi
}
+# Libraries needed when we compile a shared library.
+gcc_shared_libs_=
+
# Compile a shared lib using the GCC options for doing so.
# Pass input and output file as parameters respectively.
# Any other optional parmeters are passed to $CC.
local out=$2
shift 2 || return 1
- $CC -Wall -shared --std=gnu99 -fPIC -O2 $* "$in" -o "$out" -ldl
+ $CC -Wall -shared --std=gnu99 -fPIC -O2 $* "$in" -o "$out" $gcc_shared_libs_
}
# There are a myriad of ways to build shared libs,
# on platforms that support building them as follows.
require_gcc_shared_()
{
- gcc_shared_ '-' 'd.so' -xc < /dev/null 2>&1 \
- || skip_ '$CC -shared ... failed to build a shared lib'
+ # Try two different values for gcc_shared_libs_.
+ gcc_shared_libs_='-ldl'
+ if gcc_shared_ '-' 'd.so' -xc < /dev/null 2>&1; then
+ :
+ else
+ gcc_shared_libs_=
+ if gcc_shared_ '-' 'd.so' -xc < /dev/null 2>&1; then
+ :
+ else
+ skip_ '$CC -shared ... failed to build a shared lib'
+ fi
+ fi
rm -f d.so
}