static=yes
wrapper=auto
gcc_wrapper=no
+clang_wrapper=no
for arg ; do
case "$arg" in
--enable-visibility|--enable-visibility=yes) visibility=yes ;;
--disable-visibility|--enable-visibility=no) visibility=no ;;
--enable-wrapper|--enable-wrapper=yes) wrapper=detect ;;
---enable-wrapper=all) wrapper=yes ; gcc_wrapper=yes ;;
+--enable-wrapper=all) wrapper=yes ; gcc_wrapper=yes ; clang_wrapper=yes ;;
--enable-wrapper=gcc) wrapper=yes ; gcc_wrapper=yes ;;
+--enable-wrapper=clang) wrapper=yes ; clang_wrapper=yes ;;
--disable-wrapper|--enable-wrapper=no) wrapper=no ;;
--enable-gcc-wrapper|--enable-gcc-wrapper=yes) wrapper=yes ; gcc_wrapper=yes ;;
--disable-gcc-wrapper|--enable-gcc-wrapper=no) wrapper=no ;;
cc_family=unknown
if fnmatch '*gcc\ version*' "$cc_ver" ; then
cc_family=gcc
+elif fnmatch '*clang\ version*' "$cc_ver" ; then
+cc_family=clang
fi
echo "$cc_family"
# Figure out toolchain wrapper to build
#
if test "$wrapper" = auto -o "$wrapper" = detect ; then
+echo "#include <stdlib.h>" > "$tmpc"
+echo "#if ! __GLIBC__" >> "$tmpc"
+echo "#error no" >> "$tmpc"
+echo "#endif" >> "$tmpc"
printf "checking for toolchain wrapper to build... "
-if test "$cc_family" = gcc ; then
+if test "$wrapper" = auto && ! $CC -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
+echo "none"
+elif test "$cc_family" = gcc ; then
gcc_wrapper=yes
-if test "$wrapper" = auto ; then
-while read line ; do
-case "$line" in */ld-musl-*) gcc_wrapper=no ;; esac
-done <<EOF
-$($CC -dumpspecs)
-EOF
-fi
-test "$gcc_wrapper" = yes && echo "gcc"
+echo "gcc"
+elif test "$cc_family" = clang ; then
+clang_wrapper=yes
+echo "clang"
else
echo "none"
if test "$wrapper" = detect ; then
tools="$tools tools/musl-gcc"
tool_libs="$tool_libs lib/musl-gcc.specs"
fi
+if test "$clang_wrapper" = yes ; then
+tools="$tools tools/musl-clang tools/ld.musl-clang"
+fi
#
# Find the target architecture
test "x$static" = xno && echo "STATIC_LIBS ="
test "x$shared" = xno && echo "SHARED_LIBS ="
test "x$cc_family" = xgcc && echo 'WRAPCC_GCC = $(CC)'
+test "x$cc_family" = xclang && echo 'WRAPCC_CLANG = $(CC)'
exec 1>&3 3>&-
printf "done\n"