mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: [PATCH] fix wrapper auto detection in configure
Date: Fri, 22 Jan 2016 22:56:03 +0100	[thread overview]
Message-ID: <20160122215603.GG9621@port70.net> (raw)

the libc header based test is wrong if there are no such headers on the
system only a free standing cc, which should be enough for a musl build.

check for *-musl* in the target triplet instead.
---
 configure | 60 ++++++++++++++++++++++++++++--------------------------------
 1 file changed, 28 insertions(+), 32 deletions(-)

diff --git a/configure b/configure
index 5b97f71..a629290 100755
--- a/configure
+++ b/configure
@@ -255,15 +255,38 @@ fi
 echo "$cc_family"
 
 #
+# Find the target architecture
+#
+printf "checking target system type... "
+test -n "$target" || target=$($CC -dumpmachine 2>/dev/null) || target=unknown
+printf "%s\n" "$target"
+
+#
+# Convert to just ARCH
+#
+case "$target" in
+# Catch these early to simplify matching for 32-bit archs
+mips64*|powerpc64*) fail "$0: unsupported target \"$target\"" ;;
+arm*) ARCH=arm ;;
+aarch64*) ARCH=aarch64 ;;
+i?86*) ARCH=i386 ;;
+x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
+x86_64*) ARCH=x86_64 ;;
+mips*) ARCH=mips ;;
+microblaze*) ARCH=microblaze ;;
+or1k*) ARCH=or1k ;;
+powerpc*) ARCH=powerpc ;;
+sh[1-9bel-]*|sh|superh*) ARCH=sh ;;
+unknown) fail "$0: unable to detect target arch; try $0 --target=..." ;;
+*) fail "$0: unknown or unsupported target \"$target\"" ;;
+esac
+
+#
 # 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 "$wrapper" = auto && ! $CC -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
+if test "$wrapper" = auto && fnmatch '*-musl*' "$target" ; then
 echo "none"
 elif test "$cc_family" = gcc ; then
 gcc_wrapper=yes
@@ -288,33 +311,6 @@ tools="$tools obj/musl-clang obj/ld.musl-clang"
 fi
 
 #
-# Find the target architecture
-#
-printf "checking target system type... "
-test -n "$target" || target=$($CC -dumpmachine 2>/dev/null) || target=unknown
-printf "%s\n" "$target"
-
-#
-# Convert to just ARCH
-#
-case "$target" in
-# Catch these early to simplify matching for 32-bit archs
-mips64*|powerpc64*) fail "$0: unsupported target \"$target\"" ;;
-arm*) ARCH=arm ;;
-aarch64*) ARCH=aarch64 ;;
-i?86*) ARCH=i386 ;;
-x86_64-x32*|x32*|x86_64*x32) ARCH=x32 ;;
-x86_64*) ARCH=x86_64 ;;
-mips*) ARCH=mips ;;
-microblaze*) ARCH=microblaze ;;
-or1k*) ARCH=or1k ;;
-powerpc*) ARCH=powerpc ;;
-sh[1-9bel-]*|sh|superh*) ARCH=sh ;;
-unknown) fail "$0: unable to detect target arch; try $0 --target=..." ;;
-*) fail "$0: unknown or unsupported target \"$target\"" ;;
-esac
-
-#
 # Try to get a conforming C99 freestanding environment
 #
 tryflag CFLAGS_C99FSE -std=c99
-- 
2.7.0




             reply	other threads:[~2016-01-22 21:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 21:56 Szabolcs Nagy [this message]
2016-01-22 23:47 ` Rich Felker
2016-01-23  0:32   ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160122215603.GG9621@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).