From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8059 Path: news.gmane.org!not-for-mail From: Shiz Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH v3 2/3] build: fix musl-targeting toolchain test Date: Sun, 28 Jun 2015 23:08:20 +0200 Message-ID: <1435525701-64741-2-git-send-email-hi@shiz.me> References: <1435525701-64741-1-git-send-email-hi@shiz.me> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1435525748 26799 80.91.229.3 (28 Jun 2015 21:09:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Jun 2015 21:09:08 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8072-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jun 28 23:09:08 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Z9Jp5-0004o3-Qd for gllmg-musl@m.gmane.org; Sun, 28 Jun 2015 23:09:07 +0200 Original-Received: (qmail 5801 invoked by uid 550); 28 Jun 2015 21:09:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5632 invoked from network); 28 Jun 2015 21:08:46 -0000 X-Virus-Scanned: amavisd-new at shiz.me X-Mailer: git-send-email 2.4.3 In-Reply-To: <1435525701-64741-1-git-send-email-hi@shiz.me> Xref: news.gmane.org gmane.linux.lib.musl.general:8059 Archived-At: the old test was broken in that it would never fail on a toolchains built without dynamic linking support, leading to the wrapper script possibly being installed on compilers that do not support it. in addition, the new test is portable across compilers: the old test only worked on GCC. the new test works by testing whether the toolchain libc defines __GLIBC__: most non-musl Linux libc's do define this for compatibility even when they are not glibc, so this is a safe bet to check for musl. in addition, the compiler runtime would need to have a somewhat glibc-compatible ABI in the first place, so any non-glibc compatible libc's compiler runtime might not work. it is safer to disable these cases by default and have the user enable the wrappers manually there using --enable-wrapper if they certain it works. --- configure | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/configure b/configure index e3d4ab4..b07375a 100755 --- a/configure +++ b/configure @@ -237,17 +237,16 @@ echo "$cc_family" # Figure out toolchain wrapper to build # if test "$wrapper" = auto -o "$wrapper" = detect ; then +echo "#include " > "$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 <