From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10671 Path: news.gmane.org!.POSTED!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] configure: check whether linker works too Date: Tue, 25 Oct 2016 11:13:24 +0200 Message-ID: <20161025091324.GB5749@port70.net> References: <004a5919-eb25-d4bf-a680-57049fa4d428@gmail.com> <20161024232308.GE19318@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1477386826 2296 195.159.176.226 (25 Oct 2016 09:13:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Oct 2016 09:13:46 +0000 (UTC) User-Agent: Mutt/1.6.0 (2016-04-01) To: musl@lists.openwall.com Original-X-From: musl-return-10684-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 25 11:13:43 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1byxnd-00080E-HJ for gllmg-musl@m.gmane.org; Tue, 25 Oct 2016 11:13:37 +0200 Original-Received: (qmail 1453 invoked by uid 550); 25 Oct 2016 09:13:37 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 1430 invoked from network); 25 Oct 2016 09:13:36 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:10671 Archived-At: * Laine Gholson [2016-10-24 19:00:55 -0500]: > +if test x"$shared" != xno ; then > + printf "checking whether linker works... " > + echo "int main(void) { return 0; }" > "$tmpc" > + if output=$($CC -nostdlib -shared -o /dev/null "$tmpc" 2>&1) ; then a shared lib does not need main (it does not hurt though). > + printf "yes\n" > + else > + if test x"$shared" = xyes ; then > + printf "no; compiler output follows:\n%s\n" "$output" > + exit 1 > + else > + printf "no; shared library disabled\n" > + shared=no > + fi this silently succeeds with default options when the linker is broken (does not match documented behaviour). > + fi > +fi > + > +printf "checking whether CFLAGS and CPPFLAGS are sane... " > +echo "typedef int x;" > "$tmpc" > +if output=$($CC $CFLAGS $CPPFLAGS -c -o /dev/null "$tmpc" 2>&1) ; then there is some copy-paste repetition in these checks, i think it could be refactored in a cleaner way. (like tryflag etc)