GNU bug report logs - #11089
LINK determination

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: automake; Severity: minor; Reported by: Jason DeVinney <jasondevinney@HIDDEN>; dated Sun, 25 Mar 2012 15:52:02 UTC; Maintainer for automake is bug-automake@HIDDEN.

Message received at 11089 <at> debbugs.gnu.org:


Received: (at 11089) by debbugs.gnu.org; 28 Mar 2012 12:02:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 28 08:02:41 2012
Received: from localhost ([127.0.0.1]:42420 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SCraK-0002o5-5b
	for submit <at> debbugs.gnu.org; Wed, 28 Mar 2012 08:02:41 -0400
Received: from smtp.mppmu.mpg.de ([134.107.24.58]:41003)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peb@HIDDEN>) id 1SCra3-0002nh-0R
	for 11089 <at> debbugs.gnu.org; Wed, 28 Mar 2012 08:02:38 -0400
Received: by smtp.mppmu.mpg.de (Postfix, from userid 998)
	id 43BFD28283AC; Wed, 28 Mar 2012 13:31:01 +0200 (CEST)
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on smtp.mppmu.mpg.de
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00,T_RP_MATCHES_RCVD
	autolearn=ham version=3.3.2
Received: from mail.mppmu.mpg.de (mail-6.mppmu.mpg.de [134.107.6.12])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.mppmu.mpg.de (Postfix) with ESMTP id D898528283D2;
	Wed, 28 Mar 2012 13:30:52 +0200 (CEST)
Received: from pcl321.mppmu.mpg.de (pcl321.mppmu.mpg.de [134.107.3.54])
	by mail.mppmu.mpg.de (Postfix) with ESMTP id 9F60D1A12EF;
	Wed, 28 Mar 2012 13:30:52 +0200 (CEST)
Received: from pcl321.mppmu.mpg.de (localhost [127.0.0.1])
	by pcl321.mppmu.mpg.de (8.14.2/8.14.1) with ESMTP id q2SBUqWH017981;
	Wed, 28 Mar 2012 13:30:52 +0200
Received: from localhost (peb@localhost)
	by pcl321.mppmu.mpg.de (8.14.2/8.14.2/Submit) with ESMTP id
	q2SBUq4D017977; Wed, 28 Mar 2012 13:30:52 +0200
X-Authentication-Warning: pcl321.mppmu.mpg.de: peb owned process doing -bs
Date: Wed, 28 Mar 2012 13:30:52 +0200 (CEST)
From: Peter Breitenlohner <peb@HIDDEN>
To: Stefano Lattarini <stefano.lattarini@HIDDEN>
Subject: Re: bug#11089: LINK determination
In-Reply-To: <4F71C043.3010201@HIDDEN>
Message-ID: <alpine.LNX.2.00.1203281304120.13913@HIDDEN>
References: <CAPCbydym=jLJrhwDxyETGDRQDmSNiO041ty2q77xFrX+y2ZOXQ@HIDDEN>
	<4F6F37B0.8040406@HIDDEN>
	<CAPCbydysxom4b69XvcXQ8aC=-86wvyfAbBdv=js4yy3-VL9oGg@HIDDEN>
	<4F71C043.3010201@HIDDEN>
User-Agent: Alpine 2.00 (LNX 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11089
Cc: 11089 <at> debbugs.gnu.org, bug-automake@HIDDEN,
	"automake-patches@HIDDEN" <automake-patches@HIDDEN>,
	Automake List <automake@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.2 (----)

On Tue, 27 Mar 2012, Stefano Lattarini wrote:

> [Adding automake-patches]
>
> Reference: <http://debbugs.gnu.org/11089>
>
>> On Sun, Mar 25, 2012 at 11:20 AM, Stefano Lattarini wrote:
>>
>> I'd describe this as an automake limitation; not sure if it's worth
>> fixing (since yours is not a common use case, and the issue you're
>> facing has a simple-enough workaround, as you've already found out);
>> but it would be worth documenting IMHO.

this situation is actually more common than one might think.  E.g., the
Makefile.am for gnuplot-4.6.0/src/ contains
 	gnuplot_SOURCES = alloc.c ETC.
 	if BUILD_WXWIDGETS
 	gnuplot_SOURCES += wxterminal/wxt_gui.cpp
 	endif
but that actually ought to be
 	gnuplot_SOURCES = alloc.c ETC.
 	if BUILD_WXWIDGETS
 	gnuplot_SOURCES += wxterminal/wxt_gui.cpp
 	gnuplot_LINK = $(CXXLINK)
 	else
         gnuplot_LINK = $(LINK)
 	endif

> On a second thought, I've been unable to find a way to document Jason's
> workaround that doesn't sound cumbersome and clumsy; so maybe it's better
> to just drop this documentation change.
>
> Still, having a test case verifying that such a workaround actually works
> is still worthwhile and easy to do.  This is what the attached patch does.
> I will push it this evening or tomorrow if there is no objection.

the workaround described earlier in this thread and used in the test case:
 	if HAVE_CXX
 	foo_LINK = $(CXXLINK)
 	else
 	foo_LINK = $(LINK)
 	endif
works nicely and is simple enough when not using libtool libraries.  When
linking foo with (installed or uninstalled) libtool libraries, the default
definition of foo_LINK generated by Automake would be something like
 	foo_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	        --mode=link $(CXXLD) $(foo_CXXFLAGS) $(CXXFLAGS) \
 	        $(foo_LDFLAGS) $(LDFLAGS) -o $@
and a more elaborate workaround is needed.

What is the best way to handle this situation?  An additional test case?

Regards
Peter Breitenlohner <peb@HIDDEN>




Information forwarded to bug-automake@HIDDEN:
bug#11089; Package automake. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Mar 2012 12:02:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 28 08:02:56 2012
Received: from localhost ([127.0.0.1]:42423 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SCraY-0002oV-UR
	for submit <at> debbugs.gnu.org; Wed, 28 Mar 2012 08:02:56 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53019)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <peb@HIDDEN>) id 1SCraX-0002oN-0j
	for submit <at> debbugs.gnu.org; Wed, 28 Mar 2012 08:02:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <peb@HIDDEN>) id 1SCr67-0002Sz-IE
	for submit <at> debbugs.gnu.org; Wed, 28 Mar 2012 07:31:31 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI
	autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:47721)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <peb@HIDDEN>) id 1SCr67-0002Sp-F7
	for submit <at> debbugs.gnu.org; Wed, 28 Mar 2012 07:31:27 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34727)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <peb@HIDDEN>) id 1SCr65-0007Vt-LC
	for bug-automake@HIDDEN; Wed, 28 Mar 2012 07:31:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <peb@HIDDEN>) id 1SCr5y-0002Py-Uj
	for bug-automake@HIDDEN; Wed, 28 Mar 2012 07:31:25 -0400
Received: from smtp.mppmu.mpg.de ([134.107.24.58]:49275)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <peb@HIDDEN>)
	id 1SCr5j-0002NN-Sz; Wed, 28 Mar 2012 07:31:04 -0400
Received: by smtp.mppmu.mpg.de (Postfix, from userid 998)
	id 43BFD28283AC; Wed, 28 Mar 2012 13:31:01 +0200 (CEST)
Received: from mail.mppmu.mpg.de (mail-6.mppmu.mpg.de [134.107.6.12])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.mppmu.mpg.de (Postfix) with ESMTP id D898528283D2;
	Wed, 28 Mar 2012 13:30:52 +0200 (CEST)
Received: from pcl321.mppmu.mpg.de (pcl321.mppmu.mpg.de [134.107.3.54])
	by mail.mppmu.mpg.de (Postfix) with ESMTP id 9F60D1A12EF;
	Wed, 28 Mar 2012 13:30:52 +0200 (CEST)
Received: from pcl321.mppmu.mpg.de (localhost [127.0.0.1])
	by pcl321.mppmu.mpg.de (8.14.2/8.14.1) with ESMTP id q2SBUqWH017981;
	Wed, 28 Mar 2012 13:30:52 +0200
Received: from localhost (peb@localhost)
	by pcl321.mppmu.mpg.de (8.14.2/8.14.2/Submit) with ESMTP id
	q2SBUq4D017977; Wed, 28 Mar 2012 13:30:52 +0200
X-Authentication-Warning: pcl321.mppmu.mpg.de: peb owned process doing -bs
Date: Wed, 28 Mar 2012 13:30:52 +0200 (CEST)
From: Peter Breitenlohner <peb@HIDDEN>
To: Stefano Lattarini <stefano.lattarini@HIDDEN>
Subject: Re: bug#11089: LINK determination
In-Reply-To: <4F71C043.3010201@HIDDEN>
Message-ID: <alpine.LNX.2.00.1203281304120.13913@HIDDEN>
References: <CAPCbydym=jLJrhwDxyETGDRQDmSNiO041ty2q77xFrX+y2ZOXQ@HIDDEN>
	<4F6F37B0.8040406@HIDDEN>
	<CAPCbydysxom4b69XvcXQ8aC=-86wvyfAbBdv=js4yy3-VL9oGg@HIDDEN>
	<4F71C043.3010201@HIDDEN>
User-Agent: Alpine 2.00 (LNX 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: submit
Cc: 11089 <at> debbugs.gnu.org, bug-automake@HIDDEN,
	"automake-patches@HIDDEN" <automake-patches@HIDDEN>,
	Automake List <automake@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

On Tue, 27 Mar 2012, Stefano Lattarini wrote:

> [Adding automake-patches]
>
> Reference: <http://debbugs.gnu.org/11089>
>
>> On Sun, Mar 25, 2012 at 11:20 AM, Stefano Lattarini wrote:
>>
>> I'd describe this as an automake limitation; not sure if it's worth
>> fixing (since yours is not a common use case, and the issue you're
>> facing has a simple-enough workaround, as you've already found out);
>> but it would be worth documenting IMHO.

this situation is actually more common than one might think.  E.g., the
Makefile.am for gnuplot-4.6.0/src/ contains
 	gnuplot_SOURCES = alloc.c ETC.
 	if BUILD_WXWIDGETS
 	gnuplot_SOURCES += wxterminal/wxt_gui.cpp
 	endif
but that actually ought to be
 	gnuplot_SOURCES = alloc.c ETC.
 	if BUILD_WXWIDGETS
 	gnuplot_SOURCES += wxterminal/wxt_gui.cpp
 	gnuplot_LINK = $(CXXLINK)
 	else
         gnuplot_LINK = $(LINK)
 	endif

> On a second thought, I've been unable to find a way to document Jason's
> workaround that doesn't sound cumbersome and clumsy; so maybe it's better
> to just drop this documentation change.
>
> Still, having a test case verifying that such a workaround actually works
> is still worthwhile and easy to do.  This is what the attached patch does.
> I will push it this evening or tomorrow if there is no objection.

the workaround described earlier in this thread and used in the test case:
 	if HAVE_CXX
 	foo_LINK = $(CXXLINK)
 	else
 	foo_LINK = $(LINK)
 	endif
works nicely and is simple enough when not using libtool libraries.  When
linking foo with (installed or uninstalled) libtool libraries, the default
definition of foo_LINK generated by Automake would be something like
 	foo_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	        --mode=link $(CXXLD) $(foo_CXXFLAGS) $(CXXFLAGS) \
 	        $(foo_LDFLAGS) $(LDFLAGS) -o $@
and a more elaborate workaround is needed.

What is the best way to handle this situation?  An additional test case?

Regards
Peter Breitenlohner <peb@HIDDEN>




Information forwarded to bug-automake@HIDDEN:
bug#11089; Package automake. Full text available.

Message received at 11089 <at> debbugs.gnu.org:


Received: (at 11089) by debbugs.gnu.org; 27 Mar 2012 13:59:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 27 09:59:16 2012
Received: from localhost ([127.0.0.1]:41296 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SCWvb-0005MR-De
	for submit <at> debbugs.gnu.org; Tue, 27 Mar 2012 09:59:16 -0400
Received: from mail-bk0-f44.google.com ([209.85.214.44]:55577)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1SCWvK-0005Lo-6Y
	for 11089 <at> debbugs.gnu.org; Tue, 27 Mar 2012 09:59:13 -0400
Received: by bkuw5 with SMTP id w5so4789915bku.3
	for <11089 <at> debbugs.gnu.org>; Tue, 27 Mar 2012 06:27:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:mime-version:to:cc:subject:references
	:in-reply-to:content-type;
	bh=4A0qAL41so2AYvG0YtN6C1lpKE11MWrdLiFU3G2ev14=;
	b=KFe9BixOoXZcTXTm3YqTR26MJNF93SKHh/3xJXYyvHMuwMVcu2G/C+c/cFJ4i6IrY6
	hZBGibBf0nfoCAgS5kry59kw4xhpx2wmoXOA05K41gSYyHw9EFP+jgr+mTGtq9ZCz5B/
	OvZ+h8fZe+E5g9dxc8Dm4eihowZMy7Bp+RE92FocJmCuGtdIQW/oD2+swQz9kBRFv9Mj
	c43i+Da8QBFrZWfuXASFbF9QuarSIYiwGhBVzpBP01ULNFclfDpNL+NODRPhi1sZSC8Z
	Ew301E6s6zm6Nl/fDLslK3mN5L9CmyKKMUiOaD6pyy6Rk59/ZGRjJc36MHs1UCCuJKnL
	Avyw==
Received: by 10.204.136.200 with SMTP id s8mr9692934bkt.97.1332854861594;
	Tue, 27 Mar 2012 06:27:41 -0700 (PDT)
Received: from [82.54.101.252]
	(host252-101-dynamic.54-82-r.retail.telecomitalia.it.
	[82.54.101.252])
	by mx.google.com with ESMTPS id je3sm39172433bkb.15.2012.03.27.06.27.38
	(version=SSLv3 cipher=OTHER); Tue, 27 Mar 2012 06:27:40 -0700 (PDT)
Message-ID: <4F71C043.3010201@HIDDEN>
Date: Tue, 27 Mar 2012 15:27:31 +0200
From: Stefano Lattarini <stefano.lattarini@HIDDEN>
MIME-Version: 1.0
To: Jason DeVinney <jasondevinney@HIDDEN>
Subject: Re: bug#11089: LINK determination
References: <CAPCbydym=jLJrhwDxyETGDRQDmSNiO041ty2q77xFrX+y2ZOXQ@HIDDEN>	<4F6F37B0.8040406@HIDDEN>
	<CAPCbydysxom4b69XvcXQ8aC=-86wvyfAbBdv=js4yy3-VL9oGg@HIDDEN>
In-Reply-To: <CAPCbydysxom4b69XvcXQ8aC=-86wvyfAbBdv=js4yy3-VL9oGg@HIDDEN>
Content-Type: multipart/mixed; boundary="------------000704030408050208050309"
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11089
Cc: 11089 <at> debbugs.gnu.org,
	"automake-patches@HIDDEN" <automake-patches@HIDDEN>,
	Automake List <automake@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

This is a multi-part message in MIME format.
--------------000704030408050208050309
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

[Adding automake-patches]

Reference: <http://debbugs.gnu.org/11089>

> On Sun, Mar 25, 2012 at 11:20 AM, Stefano Lattarini wrote:
>
> I'd describe this as an automake limitation; not sure if it's worth
> fixing (since yours is not a common use case, and the issue you're
> facing has a simple-enough workaround, as you've already found out);
> but it would be worth documenting IMHO.
>
On a second thought, I've been unable to find a way to document Jason's
workaround that doesn't sound cumbersome and clumsy; so maybe it's better
to just drop this documentation change.

Still, having a test case verifying that such a workaround actually works
is still worthwhile and easy to do.  This is what the attached patch does.
I will push it this evening or tomorrow if there is no objection.

Regards,
  Stefano


--------------000704030408050208050309
Content-Type: text/x-diff;
 name="0001-tests-workaround-for-automatic-linker-determination-.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment;
 filename*0="0001-tests-workaround-for-automatic-linker-determination-.pa";
 filename*1="tch"

From 6805810d314e2b4ecb8ff14e04779d8f0ad2b4f8 Mon Sep 17 00:00:00 2001
Message-Id: <6805810d314e2b4ecb8ff14e04779d8f0ad2b4f8.1332854587.git.stefano.lattarini@HIDDEN>
From: Stefano Lattarini <stefano.lattarini@HIDDEN>
Date: Mon, 26 Mar 2012 15:26:46 +0200
Subject: [PATCH] tests: workaround for automatic linker determination and
 conditionals

See automake bug#11089.

Automake is not very smart in automatically determining the command
to be used to link a program whose source files' languages are
conditionally defined.  For example, an input like:

  if HAVE_CXX
  foo_SOURCES = more.c++
  else
  foo_SOURCES = less.c
  endif

will cause the build rules for 'foo' to *unconditionally* use the
C++ compiler for linking, even when the 'HAVE_CXX' conditional
evaluates to false (which might mean that no C++ compiler is
available).

This behaviour is not really correct, but it's easy enough to work
around, and it's only relevant for fringe use cases (at best).  So
let's just test that the workaround really works.

* tests/link_cond.test: New test.
* tests/list-of-tests.mk: Add it.
* THANKS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini@HIDDEN>
---
 THANKS                 |    1 +
 tests/link_cond.test   |   90 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/list-of-tests.mk |    1 +
 3 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100755 tests/link_cond.test

diff --git a/THANKS b/THANKS
index 455cc62..702c97b 100644
--- a/THANKS
+++ b/THANKS
@@ -149,6 +149,7 @@ James Youngman		jay@HIDDEN
 Jan Engelhardt		jengelh@HIDDEN
 Janos Farkas		chexum@HIDDEN
 Jared Davis		abiword@HIDDEN
+Jason DeVinney		jasondevinney@HIDDEN
 Jason Duell		jcduell@HIDDEN
 Jason Molenda		crash@HIDDEN
 Javier Jardón		jjardon@HIDDEN
diff --git a/tests/link_cond.test b/tests/link_cond.test
new file mode 100755
index 0000000..0d61865
--- /dev/null
+++ b/tests/link_cond.test
@@ -0,0 +1,90 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that automatic determination of the linker works well with
+# conditional use of languages in a single program.
+# This currently doesn't truly work, but we have an easy workaround
+# at least, that is tested here.
+# See automake bug#11089.
+
+required='cc c++'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_CXX
+AM_CONDITIONAL([HAVE_CXX], [test $have_cxx = yes])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+if HAVE_CXX
+foo_SOURCES = more.c++
+else
+foo_SOURCES = less.c
+endif
+## FIXME: ideally, this workaround shouldn't be needed.
+if HAVE_CXX
+foo_LINK = $(CXXLINK)
+else
+foo_LINK = $(LINK)
+endif
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+rm -f *.c++
+cat > less.c <<'END'
+/* Valid C but deliberately invalid C++ */
+main ()
+{
+  int new = 0;
+  return new;
+}
+END
+
+./configure have_cxx=no
+CXX=false $MAKE -e
+
+# Sanity check.
+rm -f foo foo.exe
+CC=false $MAKE -e && Exit 99
+
+$MAKE distclean
+
+rm -f *.c
+cat > more.c++ <<'END'
+/* Valid C++ but deliberately invalid C */
+using namespace std;
+int main (void)
+{
+  return 0;
+}
+END
+
+./configure have_cxx=yes
+CC=false $MAKE -e
+
+# Sanity check.
+rm -f foo foo.exe
+CXX=false $MAKE -e && Exit 99
+
+:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 819cd06..2548174 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -553,6 +553,7 @@ libtoo11.test \
 license.test \
 license2.test \
 link_c_cxx.test \
+link_cond.test \
 link_dist.test \
 link_f90_only.test \
 link_fc.test \
-- 
1.7.9


--------------000704030408050208050309--




Information forwarded to bug-automake@HIDDEN:
bug#11089; Package automake. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Mar 2012 17:21:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 26 13:21:03 2012
Received: from localhost ([127.0.0.1]:39939 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SCDb1-0003iD-Ri
	for submit <at> debbugs.gnu.org; Mon, 26 Mar 2012 13:21:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59603)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <jasondevinney@HIDDEN>) id 1SCDWC-0003av-Mv
	for submit <at> debbugs.gnu.org; Mon, 26 Mar 2012 13:15:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jasondevinney@HIDDEN>) id 1SCD1z-0004Hj-Tk
	for submit <at> debbugs.gnu.org; Mon, 26 Mar 2012 12:44:33 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:49765)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jasondevinney@HIDDEN>) id 1SCD1z-0004HW-OK
	for submit <at> debbugs.gnu.org; Mon, 26 Mar 2012 12:44:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42028)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jasondevinney@HIDDEN>) id 1SCD1t-0003TP-Iv
	for bug-automake@HIDDEN; Mon, 26 Mar 2012 12:44:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <jasondevinney@HIDDEN>) id 1SCD1m-0004FD-Q7
	for bug-automake@HIDDEN; Mon, 26 Mar 2012 12:44:24 -0400
Received: from mail-gy0-f169.google.com ([209.85.160.169]:39572)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <jasondevinney@HIDDEN>)
	id 1SCD1m-0004E0-Jm; Mon, 26 Mar 2012 12:44:18 -0400
Received: by ghrr18 with SMTP id r18so4697062ghr.0
	for <multiple recipients>; Mon, 26 Mar 2012 09:44:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:cc:content-type:content-transfer-encoding;
	bh=ey/jHLBHHI/8Wzr+zi9IgY6P/stz3+sQ47OBlWdlZaU=;
	b=APEsxbKM6P4od84K47YMllK+jCB79wKGrlcNPuMMDvaddublIyiEdkgIIpjU+zi+dZ
	PXMUUtFdEICtAFKqtUsmybgIrsX7HtI7OcEBrb8rOLgxSTuUBvOWf3EbVONexq+3qeoL
	bQQDjtroji+erF1ixocCwSaKOuJe2lboFI+8RkEaQalnNw4lRfPuMMiZneSupdXm7CA7
	09uJqd0DH6MXfq63geIBL8dfocBf0lDKr//YriJVup36jtr3DmKJMZx3vtA+1uszfbrj
	xW11tESBtGLK6qbytLw4eeIwJ2EEc2WKh9OW87HZaN+ZJQiQgF6v2YoqWZjvkqMile4A
	e0tQ==
MIME-Version: 1.0
Received: by 10.60.0.196 with SMTP id 4mr28075112oeg.0.1332780255397; Mon, 26
	Mar 2012 09:44:15 -0700 (PDT)
Received: by 10.182.6.137 with HTTP; Mon, 26 Mar 2012 09:44:15 -0700 (PDT)
In-Reply-To: <4F6F37B0.8040406@HIDDEN>
References: <CAPCbydym=jLJrhwDxyETGDRQDmSNiO041ty2q77xFrX+y2ZOXQ@HIDDEN>
	<4F6F37B0.8040406@HIDDEN>
Date: Mon, 26 Mar 2012 12:44:15 -0400
Message-ID: <CAPCbydysxom4b69XvcXQ8aC=-86wvyfAbBdv=js4yy3-VL9oGg@HIDDEN>
Subject: Re: LINK determination
From: Jason DeVinney <jasondevinney@HIDDEN>
To: Stefano Lattarini <stefano.lattarini@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 26 Mar 2012 13:20:42 -0400
Cc: bug-automake@HIDDEN, automake@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.1 (------)

Stefano,

Thanks for the reply. I am satisfied with this. I just wanted to make
sure I wasn't missing something.

Cheers,
Jason

On Sun, Mar 25, 2012 at 11:20 AM, Stefano Lattarini
<stefano.lattarini@HIDDEN> wrote:
> Severity: minor
>
> [CC:ing bug-automake, so that we won't forget about the issue]
>
> On 03/23/2012 03:32 AM, Jason DeVinney wrote:
>> Hi all,
>>
> Hi Jason, sorry for the delay.
>
>> I have a upc program with *.upc source files. I have some macros that
>> make UPC code look effectively like C code and so it is easy to
>> compile this program as a C program as well. My Makefile.am has the
>> following lines
>>
>> bin_PROGRAMS =3D foo
>> common_sources =3D file1.upc file2.upc
>>
>> if BUILD_UPC
>> =A0foo_LINK =3D $(UPCLINK)
>> =A0foo_SOURCES =3D $(common_sources)
>> else
>> =A0foo_LINK =3D $(LINK)
>> =A0foo_SOURCES =3D $(common_sources:.upc=3D_c.c)
>> fi
>>
>> I also have some code in my Makefile.am to tell make how to create
>> (with links) the file1_c.c and file2_c.c files. The BUILD_UPC variable
>> is set with AC_SUBST in my configure.ac based on a configure option
>> (--disable-upc). If no option is given then BUILD_UPC is set to 1, but
>> if --disable-upc is given BUILD_UPC is zero. automake is correctly
>> automatically determining which compiler to use in both cases, but for
>> some reason it wants to use the UPCLINK linker in both cases. I read
>> section 8.13.3.1 How the Linker is Chosen, in the automake
>> documentation and it says that automake determines which linker to use
>> based on the foo_SOURCES variable, so I can't see why I need to
>> include the two foo_LINK lines in my Makefile.am (I would like to
>> avoid this). Does anyone know why this is happening? Am I forgetting
>> something?
>>
> I'd describe this as an automake limitation; not sure if it's worth
> fixing (since yours is not a common use case, and the issue you're
> facing has a simple-enough workaround, as you've already found out);
> but it would be worth documenting IMHO. =A0Care to write a patch?
> Otherwise, I'll try to cook one up myself before the 1.11.4 release
> (but I'm short of time these days, so no promise).
>
> Thanks,
> =A0Stefano




Information forwarded to bug-automake@HIDDEN:
bug#11089; Package automake. Full text available.
Changed bug submitter to 'Jason DeVinney <jasondevinney@HIDDEN>' from 'Stefano Lattarini <stefano.lattarini@HIDDEN>' Request was from Stefano Lattarini <stefano.lattarini@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Mar 2012 15:51:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 25 11:51:54 2012
Received: from localhost ([127.0.0.1]:38401 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SBpjU-0005GP-Hg
	for submit <at> debbugs.gnu.org; Sun, 25 Mar 2012 11:51:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38736)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1SBpjE-0005Fz-Ve
	for submit <at> debbugs.gnu.org; Sun, 25 Mar 2012 11:51:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1SBpF8-0006q8-Cq
	for submit <at> debbugs.gnu.org; Sun, 25 Mar 2012 11:20:32 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:32959)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1SBpF8-0006pt-7q
	for submit <at> debbugs.gnu.org; Sun, 25 Mar 2012 11:20:30 -0400
Received: from eggs.gnu.org ([208.118.235.92]:38708)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1SBpF6-0002h0-HS
	for bug-automake@HIDDEN; Sun, 25 Mar 2012 11:20:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1SBpF4-0006pM-Eo
	for bug-automake@HIDDEN; Sun, 25 Mar 2012 11:20:27 -0400
Received: from mail-wg0-f41.google.com ([74.125.82.41]:39069)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>)
	id 1SBpF0-0006oU-Sv; Sun, 25 Mar 2012 11:20:23 -0400
Received: by wgbds1 with SMTP id ds1so1930789wgb.0
	for <multiple recipients>; Sun, 25 Mar 2012 08:20:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:mime-version:to:cc:subject:references
	:in-reply-to:content-type:content-transfer-encoding;
	bh=X8JAHKFn4JLNeKJm3cdkluVhfrTfj32wfYp3rHvYQMk=;
	b=AVEDKX7tks1GF223C8ua0DOZF5iuSuUuJxkzrmJN54PvUkWWgVkUVr1El58eBZSX4g
	rMJbxm5qrg4Hr3j2MchE0nPfwezqq/qPGsCqYFOtwHHUloHSmM3ieiAhFuDhrFpKE1gZ
	iwHRshb8lru5un3Hj5rkfn6QhP6BRV48H0CCBn5AOvG3Vcyu7f614DqctiL6U5rbCyL3
	eIdZIt5z/cl9I+Md0HLbZt/Uix62F9sJeS5y4Bqp9M973sDPN9xe668oTniUYr1fkJBL
	eDgMiUjxCg5F9N1ZijSYb3ICdXOkULG+JaYDaDiOq9Y3DaELez/CTMnPEbmljPRmlvpP
	kwxA==
Received: by 10.180.14.73 with SMTP id n9mr11555244wic.16.1332688820213;
	Sun, 25 Mar 2012 08:20:20 -0700 (PDT)
Received: from [82.60.36.155]
	(host155-36-dynamic.60-82-r.retail.telecomitalia.it. [82.60.36.155])
	by mx.google.com with ESMTPS id fl2sm53785737wib.4.2012.03.25.08.20.18
	(version=SSLv3 cipher=OTHER); Sun, 25 Mar 2012 08:20:19 -0700 (PDT)
Message-ID: <4F6F37B0.8040406@HIDDEN>
Date: Sun, 25 Mar 2012 17:20:16 +0200
From: Stefano Lattarini <stefano.lattarini@HIDDEN>
MIME-Version: 1.0
To: Jason DeVinney <jasondevinney@HIDDEN>
Subject: Re: LINK determination
References: <CAPCbydym=jLJrhwDxyETGDRQDmSNiO041ty2q77xFrX+y2ZOXQ@HIDDEN>
In-Reply-To: <CAPCbydym=jLJrhwDxyETGDRQDmSNiO041ty2q77xFrX+y2ZOXQ@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
Cc: bug-automake@HIDDEN, automake@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.1 (------)

Severity: minor

[CC:ing bug-automake, so that we won't forget about the issue]

On 03/23/2012 03:32 AM, Jason DeVinney wrote:
> Hi all,
>
Hi Jason, sorry for the delay.

> I have a upc program with *.upc source files. I have some macros that
> make UPC code look effectively like C code and so it is easy to
> compile this program as a C program as well. My Makefile.am has the
> following lines
> 
> bin_PROGRAMS = foo
> common_sources = file1.upc file2.upc
> 
> if BUILD_UPC
>  foo_LINK = $(UPCLINK)
>  foo_SOURCES = $(common_sources)
> else
>  foo_LINK = $(LINK)
>  foo_SOURCES = $(common_sources:.upc=_c.c)
> fi
> 
> I also have some code in my Makefile.am to tell make how to create
> (with links) the file1_c.c and file2_c.c files. The BUILD_UPC variable
> is set with AC_SUBST in my configure.ac based on a configure option
> (--disable-upc). If no option is given then BUILD_UPC is set to 1, but
> if --disable-upc is given BUILD_UPC is zero. automake is correctly
> automatically determining which compiler to use in both cases, but for
> some reason it wants to use the UPCLINK linker in both cases. I read
> section 8.13.3.1 How the Linker is Chosen, in the automake
> documentation and it says that automake determines which linker to use
> based on the foo_SOURCES variable, so I can't see why I need to
> include the two foo_LINK lines in my Makefile.am (I would like to
> avoid this). Does anyone know why this is happening? Am I forgetting
> something?
>
I'd describe this as an automake limitation; not sure if it's worth
fixing (since yours is not a common use case, and the issue you're
facing has a simple-enough workaround, as you've already found out);
but it would be worth documenting IMHO.  Care to write a patch?
Otherwise, I'll try to cook one up myself before the 1.11.4 release
(but I'm short of time these days, so no promise).

Thanks,
  Stefano




Acknowledgement sent to Stefano Lattarini <stefano.lattarini@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-automake@HIDDEN. Full text available.
Report forwarded to bug-automake@HIDDEN:
bug#11089; Package automake. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.