From debbugs-submit-bounces@debbugs.gnu.org Sun May 22 18:30:57 2011 Received: (at submit) by debbugs.gnu.org; 22 May 2011 22:30:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QOHAn-0005UX-9D for submit@debbugs.gnu.org; Sun, 22 May 2011 18:30:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QOHAk-0005UK-NE for submit@debbugs.gnu.org; Sun, 22 May 2011 18:30:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOHAe-00032i-IV for submit@debbugs.gnu.org; Sun, 22 May 2011 18:30:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:42652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOHAe-00032O-Go for submit@debbugs.gnu.org; Sun, 22 May 2011 18:30:48 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOHAd-000364-Dd for bug-automake@gnu.org; Sun, 22 May 2011 18:30:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOHAc-00031D-9C for bug-automake@gnu.org; Sun, 22 May 2011 18:30:47 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.160]:9450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOHAb-00030u-Ns for bug-automake@gnu.org; Sun, 22 May 2011 18:30:46 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1306103443; l=3463; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Date:Subject:To: From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=gepHJdB1rVMyeTx0nDn9PrrU0fo=; b=i/cUBjVR1viuXkoifvIMWPGt//01osd7xbMhe+e6B17ooDrv+RADerIweZ5BHclO9Rs 1oalJCF9tL+JkPnf2pxe30MY9AYpEF3F/KokVVkwK47ghDwt4nJuRrTj1iETp/Tp1Jre0 V2LkxfqzZf0jYCYvbDfFfAY65rskTPKxMj4= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbvU45h26 X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-073-041.pools.arcor-ip.net [88.68.73.41]) by post.strato.de (cohen mo55) (RZmta 25.18) with ESMTPA id y0494en4MMFRLM ; Mon, 23 May 2011 00:30:43 +0200 (MEST) From: Bruno Haible To: bug-automake@gnu.org Subject: error when using nested conditionals Date: Mon, 23 May 2011 00:30:41 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201105230030.42513.bruno@clisp.org> X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.6 (-----) Hi, When a Makefile.am has nested conditionals, then when an inner conditional is not defined _and_ not needed (because it's in an unused part of the Makefile.am), then 'configure' nevertheless emits a fatal error. This causes major problems for the new 'conditional-dependencies' mode of gnulib-tool. How to reproduce: In an empty directory, create these files and then run the following commands. ================================ configure.ac ================================= AC_INIT([dummy], [0]) AM_INIT_AUTOMAKE([foreign]) AC_PROG_CC AC_PROG_RANLIB if test 4 = 5; then use_foo=true gl_FOO else use_foo=false fi AM_CONDITIONAL([USE_FOO], [$use_foo]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT =================================== foo.m4 ==================================== AC_DEFUN([gl_FOO], [ if test 7 = 7; then use_variant_a=true else use_variant_a=false fi AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) ]) ================================= Makefile.am ================================= ACLOCAL_AMFLAGS = -I . noinst_LIBRARIES = libgnu.a libgnu_a_SOURCES = bar.c if USE_FOO include foo.mk else libgnu_a_SOURCES += gazonk.c endif =================================== foo.mk ==================================== if USE_VARIANT_A libgnu_a_SOURCES += foo_a.c else libgnu_a_SOURCES += foo_b.c endif =============================================================================== $ touch bar.c foo_a.c foo_b.c gazonk.c $ aclocal -I . $ automake -a -c $ autoconf $ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking for ranlib... ranlib configure: error: conditional "USE_VARIANT_A" was never defined. Usually this means the macro was only invoked conditionally. The value of USE_VARIANT_A is irrelevant, because it occurs in the "if USE_FOO" part and USE_FOO evaluates to false. I don't see how this error could be worked around in gnulib, because 1) it is a fatal error. 2) What I would need is to extract all AM_CONDITIONALs from foo.m4 and execute them with 'false' or 'true' values (doesn't matter which) before executing the code if test 4 = 5; then use_foo=true gl_FOO else use_foo=false fi But because the files { foo.m4, foo.mk, foo_a.c, foo_b.c } should be considered as a unit, and there's no way to execute _just_ the AM_CONDITIONALs inside gl_FOO and not the other statements, I'm blocked. I do agree that it can be a useful behaviour of Automake to check that all conditional have values, not only those that are really used. But it should better a warning, rather than an error, and there should be a way to turn it off. Bruno -- In memoriam Richard Friedmann From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 15:18:12 2011 Received: (at 8718) by debbugs.gnu.org; 9 Jun 2011 19:18:12 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUkk8-00069H-3o for submit@debbugs.gnu.org; Thu, 09 Jun 2011 15:18:12 -0400 Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUkk4-000693-Rc for 8718@debbugs.gnu.org; Thu, 09 Jun 2011 15:18:10 -0400 Received: by wyb29 with SMTP id 29so1408569wyb.3 for <8718@debbugs.gnu.org>; Thu, 09 Jun 2011 12:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id; bh=euu+hggqL0Js8eOngR5oVqG8erRsGg4TTEDEAiAiFlQ=; b=qhxzPo6hARPadbUCOwTqZG6y1sR9fXqg0QySXoI60lW6QT90I54StvYqLBJeLcskc9 2tnhgNJP47PH5X4bdq4/gkC5IqX/WF1UgwFNPsLX5VFH+IzjHziAQDwLYgZjuLYactD8 NBc056sF7Vru2+iPe7rD3OWsjBrXaQP0I2Q28= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=R1rWRvr95o2DlgvyBTplsZ5Tl1C2DTgmKuwR5sQCBr6RxiHn0RsSrGWVL05MLBP0QV wdFsrGjIaQGloIJfe6lYV2BjNUkJsE7euPXsSbQ+RsTY0T6xFnJrpMvduAhkijkY21jL R6R7ECY+iYINZGbxkYNQUgzAc7Tru/lw4SrII= Received: by 10.216.229.149 with SMTP id h21mr6741127weq.67.1307647083012; Thu, 09 Jun 2011 12:18:03 -0700 (PDT) Received: from bigio.localnet (host170-31-dynamic.56-82-r.retail.telecomitalia.it [82.56.31.170]) by mx.google.com with ESMTPS id c17sm1453713wbh.46.2011.06.09.12.17.57 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Jun 2011 12:18:00 -0700 (PDT) From: Stefano Lattarini To: Bruno Haible Subject: Re: bug#8718: error when using nested conditionals Date: Thu, 9 Jun 2011 21:17:48 +0200 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) References: <201105230030.42513.bruno@clisp.org> In-Reply-To: <201105230030.42513.bruno@clisp.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201106092117.48690.stefano.lattarini@gmail.com> X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.9 (---) On Monday 23 May 2011, Bruno Haible wrote: > Hi, > Hello Bruno, sorry for the delay. > When a Makefile.am has nested conditionals, then when an inner conditional > is not defined _and_ not needed (because it's in an unused part of the > Makefile.am), then 'configure' nevertheless emits a fatal error. > Ah, but the problem is, autoconf *and* the Automake-provided m4 macros have no way to know that the conditional is not needed; this is because autoconf knows nothing about the Makefile.am files, and the current autotools "layerization" does not allow autoconf to use any sort of "callback" to automake to get such information (and trying to implement such a "callback" could open a really, really nasty can of worms IMHO). > This causes major problems for the new 'conditional-dependencies' mode of > gnulib-tool. > > How to reproduce: > > In an empty directory, create these files and then run the following commands. > ================================ configure.ac ================================= > AC_INIT([dummy], [0]) > AM_INIT_AUTOMAKE([foreign]) > AC_PROG_CC > AC_PROG_RANLIB > if test 4 = 5; then > use_foo=true > gl_FOO > else > use_foo=false > fi > AM_CONDITIONAL([USE_FOO], [$use_foo]) > AC_CONFIG_FILES([Makefile]) > AC_OUTPUT > =================================== foo.m4 ==================================== > AC_DEFUN([gl_FOO], > [ > if test 7 = 7; then > use_variant_a=true > else > use_variant_a=false > fi > AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) > ]) > ================================= Makefile.am ================================= > ACLOCAL_AMFLAGS = -I . > noinst_LIBRARIES = libgnu.a > libgnu_a_SOURCES = bar.c > if USE_FOO > include foo.mk > else > libgnu_a_SOURCES += gazonk.c > endif > =================================== foo.mk ==================================== > if USE_VARIANT_A > libgnu_a_SOURCES += foo_a.c > else > libgnu_a_SOURCES += foo_b.c > endif > =============================================================================== > $ touch bar.c foo_a.c foo_b.c gazonk.c > $ aclocal -I . > $ automake -a -c > $ autoconf > $ ./configure > checking for a BSD-compatible install... /usr/bin/install -c > checking whether build environment is sane... yes > checking for a thread-safe mkdir -p... /usr/bin/mkdir -p > checking for gawk... gawk > checking whether make sets $(MAKE)... yes > checking for gcc... gcc > checking whether the C compiler works... yes > checking for C compiler default output file name... a.out > checking for suffix of executables... > checking whether we are cross compiling... no > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether gcc accepts -g... yes > checking for gcc option to accept ISO C89... none needed > checking for style of include used by make... GNU > checking dependency style of gcc... gcc3 > checking for ranlib... ranlib > configure: error: conditional "USE_VARIANT_A" was never defined. > Usually this means the macro was only invoked conditionally. > > The value of USE_VARIANT_A is irrelevant, because it occurs in the "if USE_FOO" > part and USE_FOO evaluates to false. > > I don't see how this error could be worked around in gnulib, because > 1) it is a fatal error. > 2) What I would need is to extract all AM_CONDITIONALs from foo.m4 > and execute them with 'false' or 'true' values (doesn't matter which) > before executing the code > > if test 4 = 5; then > use_foo=true > gl_FOO > else > use_foo=false > fi > > But because the files { foo.m4, foo.mk, foo_a.c, foo_b.c } should be > considered as a unit, and there's no way to execute _just_ the > AM_CONDITIONALs inside gl_FOO and not the other statements, I'm > blocked. > I'm not sure I'm following you here. Cannot you simply initialize the automake conditionals you might need and that you know might be called conditionally to (possibly dummy) defaults in gl_INIT or gl_EARLY or something like that? Sorry if this is a stupid question, but I lack any real knowledge about this 'conditional-dependencies' mode of gnulib-tool you're referring to, so I'm mostly guessing here; links or documentation that can remedy to my ignorance are welcome ;-) > I do agree that it can be a useful behaviour of Automake to check that > all conditional have values, not only those that are really used. But it > should better a warning, rather than an error, > I disagree with this, because a configure-time warning could easily go undetected (much more than an autoconf-time or automake-time warning, anyway), and thus hide potential bugs. > and there should be a way to turn it off. > This is a sensible and justified request in case we fail to find any easy workaround to your current predicament. And it could be easily done with a new m4 macro, say 'AM_IGNORE_UNDEFINED_CONDITIONALS'. But I'd rather try, if possible, to find a solution that works with current Automake too, and avoid the introduction of yet another macro or yet another option. Regards, Stefano From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 09 19:30:09 2011 Received: (at 8718) by debbugs.gnu.org; 9 Jun 2011 23:30:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUofw-0003CP-Lj for submit@debbugs.gnu.org; Thu, 09 Jun 2011 19:30:08 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.162]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUofu-0003BM-4X for 8718@debbugs.gnu.org; Thu, 09 Jun 2011 19:30:07 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1307662199; l=2356; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=9ybyA2UGwvhbNauNLTyL38GH/hk=; b=N6YKUjDgYvFticXohSBCRTLRvWoBsb70eIwQRLoiHIgXenV57NcF6U1DXEKH4oTqzez LpjE8DCvKZUMRQdSOxwdvYcUIwQaMo4DvjyEG4ModeRlwc5PFSfDVpIr773/iyIvgWHqG dQYlxcYwm+RFdW7gk8rgis9ZdasNAzRMJnI= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbP444xzQwQ== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-058-108.pools.arcor-ip.net [88.68.58.108]) by post.strato.de (mrclete mo23) (RZmta 25.18) with ESMTPA id I01ea2n59M4Amx ; Fri, 10 Jun 2011 01:29:59 +0200 (MEST) From: Bruno Haible To: Stefano Lattarini Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 10 Jun 2011 01:29:57 +0200 User-Agent: KMail/1.9.9 References: <201105230030.42513.bruno@clisp.org> <201106092117.48690.stefano.lattarini@gmail.com> In-Reply-To: <201106092117.48690.stefano.lattarini@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <201106100129.58407.bruno@clisp.org> X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) Hi Stefano, > Cannot you simply initialize the=20 > automake conditionals you might need and that you know might be called > conditionally to (possibly dummy) defaults in gl_INIT or gl_EARLY or > something like that? No, I cannot do that. The gnulib users write code like this: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D foo.m4 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D AC_DEFUN([gl_FOO], [ if test 7 =3D 7; then use_variant_a=3Dtrue else use_variant_a=3Dfalse fi AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) ]) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D foo.mk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D if USE_VARIANT_A libgnu_a_SOURCES +=3D foo_a.c else libgnu_a_SOURCES +=3D foo_b.c endif =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D on which I have no influence, and from which I cannot extract/collect the USE_VARIANT_A identifier. > autoconf=20 > knows nothing about the Makefile.am files, and the current autotools > "layerization" does not allow autoconf to use any sort of "callback" to > automake to get such information But when autoconf's generated configure file produces the error configure: error: conditional "USE_VARIANT_A" was never defined. it must have gotten the info "please check that USE_VARIANT_A is defined". =46rom Automake, when it scanned the Makefile.am. What I'm asking for is that - Automake's scanning of Makefile.am keeps track of which conditionals are enabled at each line. - Automake passes to Autoconf the info "please check that either USE_FOO has the value 'false' or USE_VARIANT_A is defined". > it could be easily done with > a new m4 macro, say 'AM_IGNORE_UNDEFINED_CONDITIONALS'. Or with an Automake option that I add to the Makefile.am. I don't mind which way. Bruno =2D-=20 In memoriam Johanna Kirchner From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 04:20:07 2011 Received: (at 8718) by debbugs.gnu.org; 10 Jun 2011 08:20:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUwwp-00024i-AP for submit@debbugs.gnu.org; Fri, 10 Jun 2011 04:20:07 -0400 Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUwwj-000248-6N for 8718@debbugs.gnu.org; Fri, 10 Jun 2011 04:20:05 -0400 Received: by wyb29 with SMTP id 29so1743187wyb.3 for <8718@debbugs.gnu.org>; Fri, 10 Jun 2011 01:19:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id; bh=8TM5n0KAak6RuIaS1vS8YS2r3X96sUYwJ2wfkzDLdis=; b=bUf60I/r2zmNcMncDllAXOZAoOQ/IiaIbm4Yes0/Jrq3znpkE1ZwYIzqMiHzXaW5Ii 1+BDGkYJlhWjJj+dVnKu4mM3nXH/I6wL9P7Z5SBddTs7gvPGgJcc4JYcG6PqUCg89tiK I7FEIh8ZyPTUrxXb3TgMUpSA7qDdQBXlul2QE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=AiLP7188G2HIYLBs0ws8JZ0vEgpMabaDxgb+am4MNMWwM1Np+KZSlR4yoXIIlh45Nl 1oQi08ma2DCyaz/yeXshqwUz8cxRK6ebiqDuxOOgizGPJlf+mFggYg6CItAxRp65wecI mQ5Pyl7JNcSjJgK6O/uA6jjUS8AFoax4LvBtY= Received: by 10.216.229.229 with SMTP id h79mr1689291weq.74.1307693995120; Fri, 10 Jun 2011 01:19:55 -0700 (PDT) Received: from bigio.localnet (host131-97-dynamic.21-79-r.retail.telecomitalia.it [79.21.97.131]) by mx.google.com with ESMTPS id 74sm1248252wem.41.2011.06.10.01.19.52 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 10 Jun 2011 01:19:53 -0700 (PDT) From: Stefano Lattarini To: Bruno Haible Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 10 Jun 2011 10:19:43 +0200 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) References: <201105230030.42513.bruno@clisp.org> <201106092117.48690.stefano.lattarini@gmail.com> <201106100129.58407.bruno@clisp.org> In-Reply-To: <201106100129.58407.bruno@clisp.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201106101019.43898.stefano.lattarini@gmail.com> X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) On Friday 10 June 2011, Bruno Haible wrote: > Hi Stefano, > > > Cannot you simply initialize the > > automake conditionals you might need and that you know might be called > > conditionally to (possibly dummy) defaults in gl_INIT or gl_EARLY or > > something like that? > > No, I cannot do that. The gnulib users > You mean the authors of gnulib modules here, right? > write code like this: > > =================================== foo.m4 ==================================== > AC_DEFUN([gl_FOO], > [ > if test 7 = 7; then > use_variant_a=true > else > use_variant_a=false > fi > AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) > ]) > =================================== foo.mk ==================================== > if USE_VARIANT_A > libgnu_a_SOURCES += foo_a.c > else > libgnu_a_SOURCES += foo_b.c > endif > =============================================================================== > > on which I have no influence, and from which I cannot extract/collect the > USE_VARIANT_A identifier. > OK, I see. Your use case is very clear now, thank you. > > autoconf > > knows nothing about the Makefile.am files, and the current autotools > > "layerization" does not allow autoconf to use any sort of "callback" to > > automake to get such information > > But when autoconf's generated configure file produces the error > > configure: error: conditional "USE_VARIANT_A" was never defined. > > it must have gotten the info "please check that USE_VARIANT_A is defined". > From Automake, when it scanned the Makefile.am. > Nope, it gets the information from the fact each AM_CONDITIONAL invocation does this: AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) Automake never passes any information to autoconf. > What I'm asking for is that > - Automake's scanning of Makefile.am keeps track of which conditionals > are enabled at each line. > - Automake passes to Autoconf the info "please check that either USE_FOO > has the value 'false' or USE_VARIANT_A is defined". > But there is no natural way for automake to pass that information to autoconf or aclocal, unless we set out to make the autotools layering and interdependencies even more complex than they are now. I'm not sure this use case warrants that, since we can found easier (even if suboptimal) workarounds. > > it could be easily done with > > a new m4 macro, say 'AM_IGNORE_UNDEFINED_CONDITIONALS'. > > Or with an Automake option that I add to the Makefile.am. > Oh no, this would imply that automake can communicate stuff to autoconf; and in this case we could use your more correct fix proposed above. > I don't mind which way. > Here is my idea: 'AM_IGNORE_UNDEFINED_CONDITIONALS' can accept two arguments, "yes" and "no" (defaulting to "yes" if no argument is given). The idea is that an usage like: AM_CONDITIONAL([FOO], [:]) AM_IGNORE_UNDEFINED_CONDITIONALS([yes]) if test -n "$user_flag"; then AM_CONDITIONAL([BAR], [test $user_flag = yes]) fi AM_IGNORE_UNDEFINED_CONDITIONALS([no]) if test 1 = 1; then AM_CONDITIONAL([BAZ], [:]) fi will cause the generated configure to check that the FOO and BAZ conditionals are defined, but not to check that the BAR conditional is defined. WDYT? Regards, Stefano From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 05:24:34 2011 Received: (at 8718) by debbugs.gnu.org; 10 Jun 2011 09:24:34 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUxxB-0003S7-W3 for submit@debbugs.gnu.org; Fri, 10 Jun 2011 05:24:34 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.160]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUxx8-0003Rs-Vl for 8718@debbugs.gnu.org; Fri, 10 Jun 2011 05:24:32 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1307697862; l=1937; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=cD4EwO/nMd4ls8XaDPaPTbzorHA=; b=l93vSt6QplVJbEvvlwytuPO49dKMpjsqDF2gl9ySf/x1uUsSUu5IkiOMxAhqyuBeKxM jx72INtAcAbbyv6TgzmgUw8bIHdCBVBW+kNrkgNZwAAHUAahUNRlbSLXaKOToZJWWddSa P4oP84VwSPgAJSR9SYJVn470ochn+z/P5Tk= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbP444xzQwQ== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-058-108.pools.arcor-ip.net [88.68.58.108]) by post.strato.de (mrclete mo30) (RZmta 25.18) with ESMTPA id n020f5n5A7pOjZ ; Fri, 10 Jun 2011 11:24:22 +0200 (MEST) From: Bruno Haible To: Stefano Lattarini Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 10 Jun 2011 11:24:20 +0200 User-Agent: KMail/1.9.9 References: <201105230030.42513.bruno@clisp.org> <201106100129.58407.bruno@clisp.org> <201106101019.43898.stefano.lattarini@gmail.com> In-Reply-To: <201106101019.43898.stefano.lattarini@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201106101124.21470.bruno@clisp.org> X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) Hi Stefano, > 'AM_IGNORE_UNDEFINED_CONDITIONALS' can accept two > arguments, "yes" and "no" (defaulting to "yes" if no argument is given). > The idea is that an usage like: > > AM_CONDITIONAL([FOO], [:]) > AM_IGNORE_UNDEFINED_CONDITIONALS([yes]) > if test -n "$user_flag"; then > AM_CONDITIONAL([BAR], [test $user_flag = yes]) > fi > AM_IGNORE_UNDEFINED_CONDITIONALS([no]) > if test 1 = 1; then > AM_CONDITIONAL([BAZ], [:]) > fi > > will cause the generated configure to check that the FOO and BAZ > conditionals are defined, but not to check that the BAR conditional > is defined. This would fit gnulib's use-case. Thank you. Actually this pair of AM_IGNORE_UNDEFINED_CONDITIONALS invocations looks like something that should be nestable: AM_IGNORE_UNDEFINED_CONDITIONALS([yes]) if test $enable_foo; then AM_CONDITIONAL([FOO], [:]) fi AM_IGNORE_UNDEFINED_CONDITIONALS([yes]) if test -n "$user_flag"; then AM_CONDITIONAL([BAR], [test $user_flag = yes]) fi AM_IGNORE_UNDEFINED_CONDITIONALS([no]) if test 0 = 1; then AM_CONDITIONAL([BAZ], [:]) fi AM_IGNORE_UNDEFINED_CONDITIONALS([no]) should cause the generated configure to not check about FOO, BAR, BAZ. Since the usual way to implement nestable behaviour in Autoconf is m4_pushdef / m4_popdef, maybe it is sufficient to document a single m4_define'd macro, say, AM_CHECK_CONDITIONALS_DEFINED, so that the snippet above can be written as: m4_pushdef([AM_CHECK_CONDITIONALS_DEFINED], []) if test $enable_foo; then AM_CONDITIONAL([FOO], [:]) fi m4_pushdef([AM_CHECK_CONDITIONALS_DEFINED], []) if test -n "$user_flag"; then AM_CONDITIONAL([BAR], [test $user_flag = yes]) fi m4_popdef([AM_CHECK_CONDITIONALS_DEFINED]) if test 0 = 1; then AM_CONDITIONAL([BAZ], [:]) fi m4_popdef([AM_CHECK_CONDITIONALS_DEFINED]) Bruno -- In memoriam Lamana Ould Bou From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 05:32:47 2011 Received: (at 8718) by debbugs.gnu.org; 10 Jun 2011 09:32:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUy58-0003dP-KI for submit@debbugs.gnu.org; Fri, 10 Jun 2011 05:32:47 -0400 Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUy57-0003dC-0F for 8718@debbugs.gnu.org; Fri, 10 Jun 2011 05:32:45 -0400 Received: by wyb29 with SMTP id 29so1785394wyb.3 for <8718@debbugs.gnu.org>; Fri, 10 Jun 2011 02:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=B+5i14/nTXTZzb6jtgYJcZ26CAOZFKSRBpGRxgPKh8U=; b=bcdb73vbchgYcsP4lsqdnrOnSmgM5CqokzwyKhbYMxScFbGIwRKkxTQvOYdiwjFK07 MHWcJc3Dh5PtBXRTE0G6K47y3GyvMOlD9vbEkF+99qLZgVFjC5trU2Wt755rLtpIqPp1 frALJwaxF/Cz80kxCKcEpA2C5D4VmBM/zU3AU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=DiO8UIIpkqWIX7W+OzIHa0PrFphq+n4cNO6FV7SoiilCUyd6jXWiwvIfPnwY9WG5rT CcTQWfvjGO8khHFQH/xKpZeGsJOnjaC6xiO2k4lEzmE554nDhbhZvxfag4SGsh7rOPoh EUoMGtbT8r7Mz5U7dv8NAcehZuRICEzfxiHOg= MIME-Version: 1.0 Received: by 10.216.144.166 with SMTP id n38mr7371823wej.75.1307698358972; Fri, 10 Jun 2011 02:32:38 -0700 (PDT) Received: by 10.216.177.142 with HTTP; Fri, 10 Jun 2011 02:32:38 -0700 (PDT) In-Reply-To: <201106101019.43898.stefano.lattarini@gmail.com> References: <201105230030.42513.bruno@clisp.org> <201106092117.48690.stefano.lattarini@gmail.com> <201106100129.58407.bruno@clisp.org> <201106101019.43898.stefano.lattarini@gmail.com> Date: Fri, 10 Jun 2011 19:32:38 +1000 X-Google-Sender-Auth: 5lcK0Ne7EqOnqkXf8nVE-fBzs-8 Message-ID: Subject: Re: bug#8718: error when using nested conditionals From: Jack Kelly To: Stefano Lattarini Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.6 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Bruno Haible X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.6 (---) On Fri, Jun 10, 2011 at 6:19 PM, Stefano Lattarini wrote: > Here is my idea: 'AM_IGNORE_UNDEFINED_CONDITIONALS' can accept two > arguments, "yes" and "no" (defaulting to "yes" if no argument is given). > The idea is that an usage like: > > -snip- > > will cause the generated configure to check that the FOO and BAZ > conditionals are defined, but not to check that the BAR conditional > is defined. =A0WDYT? I have a counter-proposal. AM_IGNORE_UNDEFINED_CONDITIONALS(REGEX) ignores "undefined-conditional" errors for conditions that match REGEX. To allow multiple packages to register their conditionals, make it append REGEX to a list of regexen to check. If a conditional matches any of these regexen, it is not an error. AM_ENFORCE_UNDEFINED_CONDITIONALS(REGEX) does the opposite: if a conditional is undefined, matches one of the AM_IGNORE_UNDEFINED_CONDITIONALS regexen, but matches one of the AM_ENFORCE_UNDEFINED_CONDITIONALS regexen, then it is still an error. WDYT? -- Jack From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 05:45:08 2011 Received: (at 8718) by debbugs.gnu.org; 10 Jun 2011 09:45:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUyH6-0003u8-2o for submit@debbugs.gnu.org; Fri, 10 Jun 2011 05:45:08 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.161]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUyH3-0003tQ-Fy for 8718@debbugs.gnu.org; Fri, 10 Jun 2011 05:45:06 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1307699099; l=750; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=ou1qYCRKOPOCbEFi1kjB902IvLI=; b=EW1NmehaiMSosss5ckYBnSlkhZJRPegB7YROlfYmatUyW1/NnOhnchkA1vYc80/9CRw m/0bEcBS2xHpfuSPl6E0dy6MMFKM4PdQ5y2iYZaHA0wy7WuUTGx5dPNc4rrKBJDOaOoBZ nY36j+iJZYJAAJiSloR9CNBblS5+fuTmX9c= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbP444xzQwQ== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-058-108.pools.arcor-ip.net [88.68.58.108]) by post.strato.de (jimi mo58) (RZmta 25.18) with ESMTPA id p01ec1n5A9d4qM ; Fri, 10 Jun 2011 11:44:59 +0200 (MEST) From: Bruno Haible To: Jack Kelly Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 10 Jun 2011 11:44:57 +0200 User-Agent: KMail/1.9.9 References: <201105230030.42513.bruno@clisp.org> <201106101019.43898.stefano.lattarini@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201106101144.58532.bruno@clisp.org> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Stefano Lattarini X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) Jack Kelly wrote: > AM_IGNORE_UNDEFINED_CONDITIONALS(REGEX) ignores > "undefined-conditional" errors for conditions that match REGEX. With this proposal, gnulib would have to turn off all "undefined-conditional" errors, that is, use a regex of [.*]. That's because as exemplified in the previous mail, foo.m4 and foo.mk are created by package authors (outside the gnulib maintainers team) whom we don't want to bother with the need to find a regex. Whereas with Stefano's proposal, the disabled error-checking can be limited to the m4 code portions that have been processed through gnulib-tool, leaving it enabled for the package's configure.ac. Bruno -- In memoriam Lamana Ould Bou From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 06:23:59 2011 Received: (at 8718) by debbugs.gnu.org; 10 Jun 2011 10:23:59 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUysg-0004mE-PP for submit@debbugs.gnu.org; Fri, 10 Jun 2011 06:23:58 -0400 Received: from smtp.mppmu.mpg.de ([134.107.24.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUyse-0004lz-Cx; Fri, 10 Jun 2011 06:23:57 -0400 Received: by smtp.mppmu.mpg.de (Postfix, from userid 998) id B04AF282841E; Fri, 10 Jun 2011 12:23:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on smtp.mppmu.mpg.de X-Spam-Level: X-Spam-Status: No, score=-4.4 required=6.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.9 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 C78E128282F7; Fri, 10 Jun 2011 12:23:42 +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 97FCF1A15D1; Fri, 10 Jun 2011 12:23:42 +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 p5AANg77010071; Fri, 10 Jun 2011 12:23:42 +0200 Received: from localhost (peb@localhost) by pcl321.mppmu.mpg.de (8.14.2/8.14.2/Submit) with ESMTP id p5AANg0D010067; Fri, 10 Jun 2011 12:23:42 +0200 X-Authentication-Warning: pcl321.mppmu.mpg.de: peb owned process doing -bs Date: Fri, 10 Jun 2011 12:23:42 +0200 (CEST) From: Peter Breitenlohner To: Stefano Lattarini Subject: Re: bug#8718: error when using nested conditionals In-Reply-To: <201106101019.43898.stefano.lattarini@gmail.com> Message-ID: References: <201105230030.42513.bruno@clisp.org> <201106092117.48690.stefano.lattarini@gmail.com> <201106100129.58407.bruno@clisp.org> <201106101019.43898.stefano.lattarini@gmail.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: 8718 Cc: bug-automake@gnu.org, 8718@debbugs.gnu.org, Bruno Haible , owner@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) On Fri, 10 Jun 2011, Stefano Lattarini wrote: > Nope, it gets the information from the fact each AM_CONDITIONAL invocation > does this: > > AC_CONFIG_COMMANDS_PRE( > [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then > AC_MSG_ERROR([[conditional "$1" was never defined. > Usually this means the macro was only invoked conditionally.]]) > fi])]) Hi Stefano, Bruno, how about the following alternative (for all conditionals, or just for some of them, e.g., those under the regime of AM_IGNORE_UNDEFINED_CONDITIONALS): Replace the AC_MSG_ERROR() above by a warning and set both $1_TRUE and $1_FALSE to something that, when not hidden in a false branch of the Makefile, (1) triggers a make syntax error, and (2) contains sufficient info to deduce the cause for that error. That way there is a warning from configure (often overlooked and/or ignored), but an error from make only if that conditional is actually needed. Regards Peter From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 06:44:59 2011 Received: (at 8718) by debbugs.gnu.org; 10 Jun 2011 10:44:59 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUzD0-0005JK-Qp for submit@debbugs.gnu.org; Fri, 10 Jun 2011 06:44:59 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.160]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUzCw-0005J4-Mq for 8718@debbugs.gnu.org; Fri, 10 Jun 2011 06:44:56 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1307702688; l=966; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=jIZQdLiEroJZ0rnrMbr4Pd2f5vE=; b=KPGFMvM2VKMCe66pFRuM+VyPJd/1Bbr2f3lvZ80lThyu//rTgNzuUZJ/UWzhgaKu0xJ VcsZWdLstykN24wGap0n2UhVwPKWv8kjLfXxKSAVFTe/y9kBABA9eD9CjSQA/VvfZazjD jBSxwWYOsNSMYMdOAp8ea/zxySQHFWCmYjc= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbP444xzQwQ== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-058-108.pools.arcor-ip.net [88.68.58.108]) by post.strato.de (cohen mo39) (RZmta 25.18) with ESMTPA id q01335n5AAZWih ; Fri, 10 Jun 2011 12:44:47 +0200 (MEST) From: Bruno Haible To: Stefano Lattarini Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 10 Jun 2011 12:44:46 +0200 User-Agent: KMail/1.9.9 References: <201105230030.42513.bruno@clisp.org> <201106101019.43898.stefano.lattarini@gmail.com> <201106101124.21470.bruno@clisp.org> In-Reply-To: <201106101124.21470.bruno@clisp.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201106101244.47039.bruno@clisp.org> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) > Since the usual way to implement nestable behaviour in Autoconf is > m4_pushdef / m4_popdef Another idea would to be m4_pushdef AM_CONDITIONAL itself. If you add a third parameter to AM_CONDITIONAL, denoting the conditions in which the conditional needs to be defined, then gnulib could emit code like this: m4_define([AM_CONDITIONAL_ORIG], m4_defn([AM_CONDITIONAL])) AC_DEFUN([gl_LENIENT_CONDITIONAL], [AM_CONDITIONAL_ORIG([$1],[$2],[USE_FOO])]) m4_pushdef([AM_CONDITIONAL], [gl_LENIENT_CONDITIONAL]) if test $enable_foo; then AM_CONDITIONAL([FOO], [:]) fi m4_pushdef([AM_CONDITIONAL], [gl_LENIENT_CONDITIONAL]) if test -n "$user_flag"; then AM_CONDITIONAL([BAR], [test $user_flag = yes]) fi m4_popdef([AM_CONDITIONAL]) if test 0 = 1; then AM_CONDITIONAL([BAZ], [:]) fi m4_popdef([AM_CONDITIONAL]) But it certainly gets hairy... Bruno -- In memoriam Lamana Ould Bou From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 06:48:14 2011 Received: (at submit) by debbugs.gnu.org; 10 Jun 2011 10:48:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUzG9-0005Oc-Sd for submit@debbugs.gnu.org; Fri, 10 Jun 2011 06:48:14 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QUzG7-0005OE-Hq for submit@debbugs.gnu.org; Fri, 10 Jun 2011 06:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUzG1-0001rI-5s for submit@debbugs.gnu.org; Fri, 10 Jun 2011 06:48:06 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:35059) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUzG1-0001rE-0i for submit@debbugs.gnu.org; Fri, 10 Jun 2011 06:48:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]:40990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUzFz-0004BN-29 for bug-automake@gnu.org; Fri, 10 Jun 2011 06:48:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUzFx-0001qv-Ek for bug-automake@gnu.org; Fri, 10 Jun 2011 06:48:02 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.161]:58479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUzFx-0001ql-1L for bug-automake@gnu.org; Fri, 10 Jun 2011 06:48:01 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1307702879; l=720; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=2m2fut5BBYveJbB+tTWHDXwAvU0=; b=jNsO7GgE2mNfJcHJi0Ksee/1h9Nl8usMZe8eZKmPqFWxk9CnqFd5Uq6lMJ3Zsw+tmUR wMDQEJYC/sjDx6Ww/8/4iVerL5eXKA9oDh//V1JJe1BQOIYfokq7Ny0rnn0BnChluTim6 NfyaFZ4xDcfLlOzNS027TTJZSMpWZIUgdYI= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbP444xzQwQ== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-058-108.pools.arcor-ip.net [88.68.58.108]) by post.strato.de (mrclete mo28) (RZmta 25.18) with ESMTPA id 30202cn5AAGaF6 ; Fri, 10 Jun 2011 12:47:58 +0200 (MEST) From: Bruno Haible To: Peter Breitenlohner Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 10 Jun 2011 12:47:56 +0200 User-Agent: KMail/1.9.9 References: <201105230030.42513.bruno@clisp.org> <201106101019.43898.stefano.lattarini@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201106101247.58092.bruno@clisp.org> X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit Cc: bug-automake@gnu.org, 8718@debbugs.gnu.org, Stefano Lattarini , owner@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) Peter, > how about the following alternative (for all conditionals, or just for some > of them, e.g., those under the regime of AM_IGNORE_UNDEFINED_CONDITIONALS): > Replace the AC_MSG_ERROR() above by a warning and set both $1_TRUE and > $1_FALSE to something that, when not hidden in a false branch of the > Makefile, (1) triggers a make syntax error, and (2) contains sufficient info > to deduce the cause for that error. Sounds good. But gnulib would also need a way to disable the warning, because otherwise the maintainers of packages that use gnulib come back to me and ask how they can get rid of the warning. Bruno -- In memoriam Lamana Ould Bou From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 10 07:45:56 2011 Received: (at submit) by debbugs.gnu.org; 10 Jun 2011 11:45:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QV0A0-0007S6-8a for submit@debbugs.gnu.org; Fri, 10 Jun 2011 07:45:56 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QV09z-0007Rn-0d for submit@debbugs.gnu.org; Fri, 10 Jun 2011 07:45:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QV09s-0001hD-7Q for submit@debbugs.gnu.org; Fri, 10 Jun 2011 07:45:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:44122) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV09r-0001h9-UI for submit@debbugs.gnu.org; Fri, 10 Jun 2011 07:45:48 -0400 Received: from eggs.gnu.org ([140.186.70.92]:60556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV09q-0003Xx-4N for bug-automake@gnu.org; Fri, 10 Jun 2011 07:45:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QV09o-0001gv-Aa for bug-automake@gnu.org; Fri, 10 Jun 2011 07:45:45 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:38942) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV09n-0001gp-OX for bug-automake@gnu.org; Fri, 10 Jun 2011 07:45:44 -0400 Received: by wyf19 with SMTP id 19so2185956wyf.0 for ; Fri, 10 Jun 2011 04:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id; bh=7KyDLr6WeihWLQlJ4W32pXzHiVEjHQ+rkE/UKvhqxsU=; b=DufeGCz2XZe7fSlC5Pgvy2bgoPkoU4aHcOcYWw4TisXOVc+p7nkacVt0FKJAuCeRYu B6n8wL66P8bZEdgPRtA2o99hUOikjrrZdclSmVW31nlyQH3iplDTsN0eYEtnHR8LJrs1 aZu94WxcR3yxS+l56WCm71bS/PQV5eWLVZHzA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; b=Y8wKx1RK4Zuchl2OuKDmPFymqvq+PQIIcIrIc+vYs362PXox8jkC+c4mWyAfv+BHFR yEEY/ZVy64yrSH2yNdOzxs1vl/OZTtZeAs8RV+2EqgSvUabUWpeRK56B5JRe++mpb1Y0 u21D7DcWMtecT0DLCRl48NsFfVTIbh2HMMaY8= Received: by 10.227.208.148 with SMTP id gc20mr1953584wbb.95.1307706342456; Fri, 10 Jun 2011 04:45:42 -0700 (PDT) Received: from bigio.localnet (host178-97-dynamic.0-87-r.retail.telecomitalia.it [87.0.97.178]) by mx.google.com with ESMTPS id ex2sm1958606wbb.31.2011.06.10.04.45.39 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 10 Jun 2011 04:45:40 -0700 (PDT) From: Stefano Lattarini To: Bruno Haible , bug-automake@gnu.org Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 10 Jun 2011 13:45:21 +0200 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) References: <201105230030.42513.bruno@clisp.org> <201106101247.58092.bruno@clisp.org> In-Reply-To: <201106101247.58092.bruno@clisp.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201106101345.22922.stefano.lattarini@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.9 (----) X-Debbugs-Envelope-To: submit Cc: Peter Breitenlohner , 8718@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) On Friday 10 June 2011, Bruno Haible wrote: > Peter, > > > how about the following alternative (for all conditionals, or just for some > > of them, e.g., those under the regime of AM_IGNORE_UNDEFINED_CONDITIONALS): > > Replace the AC_MSG_ERROR() above by a warning and set both $1_TRUE and > > $1_FALSE to something that, when not hidden in a false branch of the > > Makefile, (1) triggers a make syntax error, and (2) contains sufficient info > > to deduce the cause for that error. > > Sounds good. But gnulib would also need a way to disable the warning, > because otherwise the maintainers of packages that use gnulib come back to > me and ask how they can get rid of the warning. > > Bruno > I like Peter proposal too, it's neat and shouldn't be difficult to implement and document. But maybe I like Bruno's latest proposal about adding a third argument to AM_CONDITIONAL even more; see: The problem is, how would that scale on more complex situations? That's not quite obvious to me. Peter's proposal seems safer in this regard. Hmmm, I can't really decide between these two proposals offhand. Let's wait a couple of days to see if Ralf can chime in, OK? Otherwise we'll try to sort this out ourselves. For the moment, thank you all for your ideas and contribution. Regards, Stefano From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 16 15:49:11 2011 Received: (at 8718) by debbugs.gnu.org; 16 Jun 2011 19:49:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXIYx-0001mx-6r for submit@debbugs.gnu.org; Thu, 16 Jun 2011 15:49:11 -0400 Received: from mailout-de.gmx.net ([213.165.64.23]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QXIYu-0001mi-Nt for 8718@debbugs.gnu.org; Thu, 16 Jun 2011 15:49:09 -0400 Received: (qmail 27927 invoked by uid 0); 16 Jun 2011 19:49:02 -0000 Received: from 77.58.247.232 by www038.gmx.net with HTTP; Thu, 16 Jun 2011 21:48:59 +0200 (CEST) Content-Type: text/plain; charset="utf-8" Date: Thu, 16 Jun 2011 21:48:59 +0200 From: "Ralf Wildenhues" In-Reply-To: <201106100129.58407.bruno@clisp.org> Message-ID: <20110616194859.134460@gmx.net> MIME-Version: 1.0 References: <201105230030.42513.bruno@clisp.org> <201106092117.48690.stefano.lattarini@gmail.com> <201106100129.58407.bruno@clisp.org> Subject: Re: bug#8718: error when using nested conditionals To: Bruno Haible X-Authenticated: #13673931 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Mutt-Fcc: ~/Mail/outbox X-Mutt-References: <201106100129.58407.bruno@clisp.org> X-Priority: 3 X-Provags-ID: V01U2FsdGVkX18vodVIRlAvIdqtC54cTvoXg1ERGxEPrVGkaz1PPZ M04ZTNhkyBH9ROPKCcGDOqF2hDf1wwtvFRlw== Content-Transfer-Encoding: 8bit X-GMX-UID: TTKRJc9hTlI8TqPAp2hrFjZOU2poZZme X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Stefano Lattarini X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hello, and sorry for the delay, * Bruno Haible wrote on Fri, Jun 10, 2011 at 01:29:57AM CEST: > > Cannot you simply initialize the > > automake conditionals you might need and that you know might be called > > conditionally to (possibly dummy) defaults in gl_INIT or gl_EARLY or > > something like that? > > No, I cannot do that. The gnulib users write code like this: Of course you can do that. > =================================== foo.m4 ==================================== > AC_DEFUN([gl_FOO], > [ > if test 7 = 7; then > use_variant_a=true > else > use_variant_a=false > fi > AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) Instead of this line, you could use AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([...])]) to force the AM_CONDITIONAL statement to be executed at outer shell level, late, and unconditionally. Untested (if it gets the order wrong wrt. the inner AC_CONFIG_COMMANDS_PRE, ping me, there should be another way around it). > ]) It's rather funny that this construct has been floated around this very thread a couple of times without the implied conclusion. I must say I don't like any of the other suggestions in this thread too much. You otherwise like being safe rather than sorry too, and there is no compelling argument to weaken automake's consistency detection here. Cheers, Ralf From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 16 17:43:04 2011 Received: (at 8718) by debbugs.gnu.org; 16 Jun 2011 21:43:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXKLA-0001OC-Bi for submit@debbugs.gnu.org; Thu, 16 Jun 2011 17:43:04 -0400 Received: from mo-p00-ob.rzone.de ([81.169.146.161]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXKL6-0001Ng-MM for 8718@debbugs.gnu.org; Thu, 16 Jun 2011 17:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1308260574; l=2500; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=uFQFZwhnqTjfW7fDm9hSKrSxxCU=; b=nmqsYchHNxbyZsbuJEw7yz6z9Q94bnBdHmzL4laRIde6+JExuu57lfhFDnZh7eY747g E7S4f4ZOmYiEErO/ObCXuckJcsafV22syrQAzDFYsb5EQ1P+su7o5VXaEWuAkZDu/VgmE M/EMY8SRS+H+rxKbkC6eLPwNZDGE3A05mSc= X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbP444xzQwQ== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-058-108.pools.arcor-ip.net [88.68.58.108]) by post.strato.de (klopstock mo64) (RZmta 25.18) with ESMTPA id t00991n5GLWlZd ; Thu, 16 Jun 2011 23:42:53 +0200 (MEST) From: Bruno Haible To: "Ralf Wildenhues" Subject: Re: bug#8718: error when using nested conditionals Date: Thu, 16 Jun 2011 23:42:51 +0200 User-Agent: KMail/1.9.9 References: <201105230030.42513.bruno@clisp.org> <201106100129.58407.bruno@clisp.org> <20110616194859.134460@gmx.net> In-Reply-To: <20110616194859.134460@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201106162342.53075.bruno@clisp.org> X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Stefano Lattarini X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) Hello Ralf, > > =================================== foo.m4 ==================================== > > AC_DEFUN([gl_FOO], > > [ > > if test 7 = 7; then > > use_variant_a=true > > else > > use_variant_a=false > > fi > > AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) > > Instead of this line, you could use > AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([...])]) I cannot force the gnulib users to write autoconf macros which deviate that much from the idioms promoted by the Automake manual. But I can override AM_CONDITIONAL like this: ================================= configure.ac ================================= AC_INIT([dummy], [0]) AM_INIT_AUTOMAKE([foreign]) AC_PROG_CC AC_PROG_RANLIB m4_define([gl_CONDITIONAL_COUNTER], [0]) AC_DEFUN([gl_CONDITIONAL_LATER], [ m4_define([gl_CONDITIONAL_COUNTER], m4_incr(gl_CONDITIONAL_COUNTER)) m4_divert_text([INIT_PREPARE], [[gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=false]) if [$2]; then [gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=true; else [gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=false; fi AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([$1], [[$gl_CONDITIONAL_]]]gl_CONDITIONAL_COUNTER[)]) ]) m4_pushdef([AM_CONDITIONAL], m4_defn([gl_CONDITIONAL_LATER])) if test 4 = 5; then use_foo=true gl_FOO else use_foo=false fi AM_CONDITIONAL([USE_FOO], [$use_foo]) m4_popdef([AM_CONDITIONAL]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT ================================================================================ This solves my problem. Thanks for the idea to use AC_CONFIG_COMMANDS_PRE. I will add this workaround to gnulib. > You otherwise like being safe rather than sorry too, and there is > no compelling argument to weaken automake's consistency detection here. This workaround also will have the effect of weakening Automake's consistency detection, by defining an arbitrary value (false) for each of the occurring conditionals. But that's inevitable as long as this consistency detection is too strict. There's no point in being _that_ safe that you check unused expressions for validity. C compilers don't do it either: When I compile a C program #if 0 #if syntax error ((((,$$?! #endif #endif the second line yields no error and no warning, because the condition in that line is ignored. It is a pity if Autoconf + Automake cannot do the same. Oh well. But at least we've got a workaround now. Thanks. Bruno -- In memoriam Imre Nagy From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 17 01:47:46 2011 Received: (at 8718) by debbugs.gnu.org; 17 Jun 2011 05:47:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXRuE-0003hb-E1 for submit@debbugs.gnu.org; Fri, 17 Jun 2011 01:47:46 -0400 Received: from mailout-de.gmx.net ([213.165.64.23]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QXRuB-0003hO-Uc for 8718@debbugs.gnu.org; Fri, 17 Jun 2011 01:47:44 -0400 Received: (qmail 26866 invoked by uid 0); 17 Jun 2011 05:47:37 -0000 Received: from 77.58.247.232 by www019.gmx.net with HTTP; Fri, 17 Jun 2011 07:47:35 +0200 (CEST) Content-Type: text/plain; charset="utf-8" Date: Fri, 17 Jun 2011 07:47:35 +0200 From: "Ralf Wildenhues" In-Reply-To: <201106162342.53075.bruno@clisp.org> Message-ID: <20110617054735.316800@gmx.net> MIME-Version: 1.0 References: <201105230030.42513.bruno@clisp.org> <201106100129.58407.bruno@clisp.org> <20110616194859.134460@gmx.net> <201106162342.53075.bruno@clisp.org> Subject: Re: bug#8718: error when using nested conditionals To: Bruno Haible X-Authenticated: #13673931 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Mutt-Fcc: ~/Mail/outbox X-Mutt-References: <201106162342.53075.bruno@clisp.org> X-Priority: 3 X-Provags-ID: V01U2FsdGVkX1+2fQhlAlK2CVS8RAGv+vP5yvKg5dUzqXPjOaUSe+ 2Upa7e0gtfRaaH8rfM5wR1s/hYt9K1wGix0A== Content-Transfer-Encoding: 8bit X-GMX-UID: T93PebU8TiE+ZrjEt2Rw40B9ZUVSRFen X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Stefano Lattarini X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) * Bruno Haible wrote on Thu, Jun 16, 2011 at 11:42:51PM CEST: > > > AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) > > > > Instead of this line, you could use > > AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([...])]) > > I cannot force the gnulib users to write autoconf macros which deviate that > much from the idioms promoted by the Automake manual. But I can override > AM_CONDITIONAL like this: Or you could write a gl_AM_CONDITIONAL macro (or similarly) to use instead. > m4_define([gl_CONDITIONAL_COUNTER], [0]) > AC_DEFUN([gl_CONDITIONAL_LATER], > [ > m4_define([gl_CONDITIONAL_COUNTER], m4_incr(gl_CONDITIONAL_COUNTER)) > m4_divert_text([INIT_PREPARE], [[gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=false]) > if [$2]; then [gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=true; else [gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=false; fi > AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([$1], [[$gl_CONDITIONAL_]]]gl_CONDITIONAL_COUNTER[)]) > ]) > m4_pushdef([AM_CONDITIONAL], m4_defn([gl_CONDITIONAL_LATER])) > This solves my problem. Thanks for the idea to use AC_CONFIG_COMMANDS_PRE. > I will add this workaround to gnulib. Please note that this does have a small change in semantics, namely if there is code using AM_COND_IF: that is only valid after the AM_CONDITIONAL has been expanded. Now, current gnulib does not use this (fairly new) macro, but there may be user code which does (or will) use it. You could poison it in the above code, if you really want to keep overriding AM_CONDITIONAL itself. > > You otherwise like being safe rather than sorry too, and there is > > no compelling argument to weaken automake's consistency detection here. > > This workaround also will have the effect of weakening Automake's > consistency detection, by defining an arbitrary value (false) for each > of the occurring conditionals. But that's inevitable as long as this > consistency detection is too strict. It is not too strict. It must be this strict. See below. > There's no point in being _that_ safe that you check unused expressions > for validity. C compilers don't do it either: When I compile a C program > #if 0 > #if syntax error ((((,$$?! > #endif > #endif > the second line yields no error and no warning, because the condition in > that line is ignored. But that's not the same thing. AM_CONDITIONAL sets variables _TRUE and _FALSE to either empty or '#', and at least one of them will always be nonempty. If you skip this initialization code, the Makefile *will* be wrong. You may just have been lucky to not notice that because gnulib uses few negated conditionals if !FOO ... endif or if FOO ... else !FOO ... endif It may be unfortunate that the semantics of conditionals are the way they are, but the safety net around them definitely is not too strict. Thanks, Ralf From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 17 02:59:46 2011 Received: (at 8718) by debbugs.gnu.org; 17 Jun 2011 06:59:46 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXT1u-0008KY-EY for submit@debbugs.gnu.org; Fri, 17 Jun 2011 02:59:46 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QXT1q-0008KK-Gp for 8718@debbugs.gnu.org; Fri, 17 Jun 2011 02:59:43 -0400 Received: (qmail 18483 invoked by uid 0); 17 Jun 2011 06:59:32 -0000 Received: from 77.58.247.232 by www019.gmx.net with HTTP; Fri, 17 Jun 2011 08:59:31 +0200 (CEST) Content-Type: text/plain; charset="utf-8" Date: Fri, 17 Jun 2011 08:59:30 +0200 From: "Ralf Wildenhues" In-Reply-To: <20110617054735.316800@gmx.net> Message-ID: <20110617065930.144520@gmx.net> MIME-Version: 1.0 References: <201105230030.42513.bruno@clisp.org> <201106100129.58407.bruno@clisp.org> <20110616194859.134460@gmx.net> <201106162342.53075.bruno@clisp.org> <20110617054735.316800@gmx.net> Subject: Re: bug#8718: error when using nested conditionals To: Bruno Haible X-Authenticated: #13673931 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Mutt-Fcc: ~/Mail/outbox X-Mutt-References: <20110617054735.316800@gmx.net> X-Priority: 3 X-Provags-ID: V01U2FsdGVkX1+PDS4ajs2PUemCqpkaxyJe4CuQWFXKNuJmRjOR9U naKVzCrJ0wLOnTn9SE5Z75OfWG7hGu9aHbvw== Content-Transfer-Encoding: 8bit X-GMX-UID: M5KPfkANODB6WaHEo2RMLxQ9Ji9SWhLt X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Stefano Lattarini X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) * Ralf Wildenhues wrote on Fri, Jun 17, 2011 at 07:47:35AM CEST: > * Bruno Haible wrote on Thu, Jun 16, 2011 at 11:42:51PM CEST: > > > > AM_CONDITIONAL([USE_VARIANT_A], [$use_variant_a]) > > > > > > Instead of this line, you could use > > > AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([...])]) > > > > I cannot force the gnulib users to write autoconf macros which deviate that > > much from the idioms promoted by the Automake manual. But I can override > > AM_CONDITIONAL like this: > > Or you could write a gl_AM_CONDITIONAL macro (or similarly) to use > instead. > > > m4_define([gl_CONDITIONAL_COUNTER], [0]) > > AC_DEFUN([gl_CONDITIONAL_LATER], > > [ > > m4_define([gl_CONDITIONAL_COUNTER], m4_incr(gl_CONDITIONAL_COUNTER)) > > m4_divert_text([INIT_PREPARE], [[gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=false]) > > if [$2]; then [gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=true; else [gl_CONDITIONAL_]gl_CONDITIONAL_COUNTER=false; fi > > AC_CONFIG_COMMANDS_PRE([AM_CONDITIONAL([$1], [[$gl_CONDITIONAL_]]]gl_CONDITIONAL_COUNTER[)]) > > ]) > > m4_pushdef([AM_CONDITIONAL], m4_defn([gl_CONDITIONAL_LATER])) > > > This solves my problem. Thanks for the idea to use AC_CONFIG_COMMANDS_PRE. > > I will add this workaround to gnulib. > > Please note that this does have a small change in semantics, namely if > there is code using AM_COND_IF: that is only valid after the > AM_CONDITIONAL has been expanded. Now, current gnulib does not use this > (fairly new) macro, but there may be user code which does (or will) use > it. You could poison it in the above code, if you really want to keep > overriding AM_CONDITIONAL itself. More danger ahead: if $foo; then result=ok; else result=bad; fi AM_CONDITIONAL([COND1], [test $result = ok]) if $bar; then result=ok; else result=bad; fi AM_CONDITIONAL([COND2], [test $result = ok]) I've seen such code in third party projects, it will break if you delay the AM_CONDITIONAL evaluation. Haven't checked whether gnulib uses globally valid tests throughout. Cheers, Ralf From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 17 09:59:25 2011 Received: (at 8718) by debbugs.gnu.org; 17 Jun 2011 13:59:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXZa1-0000gg-MU for submit@debbugs.gnu.org; Fri, 17 Jun 2011 09:59:25 -0400 Received: from mo-p00-fb.rzone.de ([81.169.146.163]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXZZz-0000gT-St for 8718@debbugs.gnu.org; Fri, 17 Jun 2011 09:59:24 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1308319157; l=656; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=Re4k3qECUhtok+ys5uOuL3L6atw=; b=o5KlVtJTu3bepoEAN77Gq0h7afHyWO2qXRNsZZsK3y1AW4o6pwbfu8/lJMxQG+UevV2 f425VLaOAXp31hi2pelW0Hvu9hrfB38EDRJn6mEPFy1mPniRx4pP8dXs7LiadQUHlfH8W fPWdHHCJmK+x7bdvFVp+0VpFTSGlAfytzog= Received: from mo-p00-ob.rzone.de (klopstock-mo-p00-ob.mail [192.168.63.66]) by snori-fb-010.store (RZmta 25.18) with ESMTPA id X0502dn5H2PPv7 for <8718@debbugs.gnu.org>; Fri, 17 Jun 2011 12:58:15 +0200 (MEST) X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbP444xzQwQ== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-058-108.pools.arcor-ip.net [88.68.58.108]) by post.strato.de (klopstock mo25) (RZmta 25.18) with ESMTPA id 207151n5H9Utqi ; Fri, 17 Jun 2011 11:56:12 +0200 (MEST) From: Bruno Haible To: "Ralf Wildenhues" Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 17 Jun 2011 11:56:09 +0200 User-Agent: KMail/1.9.9 References: <201105230030.42513.bruno@clisp.org> <20110617054735.316800@gmx.net> <20110617065930.144520@gmx.net> In-Reply-To: <20110617065930.144520@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201106171156.11424.bruno@clisp.org> X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Stefano Lattarini X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) Hi Ralf, > More danger ahead: > > if $foo; then result=ok; else result=bad; fi > AM_CONDITIONAL([COND1], [test $result = ok]) > if $bar; then result=ok; else result=bad; fi > AM_CONDITIONAL([COND2], [test $result = ok]) > > I've seen such code in third party projects, it will break if you delay > the AM_CONDITIONAL evaluation. Thanks for the heads-up. The code I posted does not delay the evaluation of the condition; it only delays the invocation of AM_CONDITIONAL. So it will work fine in this situation. Bruno -- In memoriam The victims of the East German uprising From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 17 10:25:02 2011 Received: (at 8718) by debbugs.gnu.org; 17 Jun 2011 14:25:03 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXZyl-0002nC-D5 for submit@debbugs.gnu.org; Fri, 17 Jun 2011 10:25:02 -0400 Received: from mo-p00-fb.rzone.de ([81.169.146.163]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QXZyg-0002mw-0F for 8718@debbugs.gnu.org; Fri, 17 Jun 2011 10:24:57 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1308320688; l=3426; s=domk; d=haible.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Cc:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=BZTNUta7IVdWYVe+N5dXcJ/f+8E=; b=hu1nqUXsvdETifjsFnxfp16zMVVQNr0NlcZdRAsOs+p8yBaS6bqvko6m5qT3bj96mtQ L/rE/7msf+0utK0iJFopXzmGakoMACqCg4Pz9HVOiyBXPUT5kHib00ihriwrD7hArN4Hn pkUAa/Mgno+/ywaso6jgWShyjeiRcgQLI9k= Received: from mo-p00-ob.rzone.de (cohen-mo-p00-ob.mail [192.168.63.70]) by scum-fb-06.store (RZmta 25.18) with ESMTPA id P07092n5GHtq5e for <8718@debbugs.gnu.org>; Fri, 17 Jun 2011 13:24:30 +0200 (MEST) X-RZG-AUTH: :Ln4Re0+Ic/6oZXR1YgKryK8brksyK8dozXDwHXjf9hj/zDNRbP444xzQwQ== X-RZG-CLASS-ID: mo00 Received: from linuix.haible.de (dslb-088-068-058-108.pools.arcor-ip.net [88.68.58.108]) by post.strato.de (cohen mo56) (RZmta 25.18) with ESMTPA id 501ae0n5H9D5IQ ; Fri, 17 Jun 2011 12:21:40 +0200 (MEST) From: Bruno Haible To: "Ralf Wildenhues" Subject: Re: bug#8718: error when using nested conditionals Date: Fri, 17 Jun 2011 12:21:38 +0200 User-Agent: KMail/1.9.9 References: <201105230030.42513.bruno@clisp.org> <201106162342.53075.bruno@clisp.org> <20110617054735.316800@gmx.net> In-Reply-To: <20110617054735.316800@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201106171221.39929.bruno@clisp.org> X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Stefano Lattarini X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) Ralf Wildenhues wrote: > Please note that this does have a small change in semantics, namely if > there is code using AM_COND_IF Thanks for the heads-up; I'll change the code to handle that as well. > > There's no point in being _that_ safe that you check unused expressions > > for validity. C compilers don't do it either: When I compile a C program > > #if 0 > > #if syntax error ((((,$$?! > > #endif > > #endif > > the second line yields no error and no warning, because the condition in > > that line is ignored. > > But that's not the same thing. AM_CONDITIONAL sets variables > _TRUE and _FALSE to either empty or '#', and at least one of > them will always be nonempty. If you skip this initialization code, the > Makefile *will* be wrong. No, the generated Makefile will be right because all uses of _TRUE and _FALSE will be inside Makefile comments, where the comment marker "#" comes out of the expansion of the outer conditional. > You may just have been lucky to not notice > that because gnulib uses few negated conditionals > if !FOO > ... > endif > > or > if FOO > ... > else !FOO > ... > endif I don't see a problem with negation. Here's a test case: ================================ configure.ac ================================ AC_INIT([dummy], [0]) AM_INIT_AUTOMAKE([foreign]) AC_PROG_CC AC_PROG_RANLIB if test 4 = 5; then use_foo=true AM_CONDITIONAL([USE_VARIANT_A], [false]) else use_foo=false AM_CONDITIONAL([USE_VARIANT_B], [false]) fi AM_CONDITIONAL([USE_FOO], [$use_foo]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT ================================ Makefile.am ================================= if USE_FOO if USE_VARIANT_A all : test1.o endif endif if USE_FOO if !USE_VARIANT_A all : test2.o endif endif if !USE_FOO if USE_VARIANT_B all : test3.o endif endif if !USE_FOO if !USE_VARIANT_B all : test4.o endif endif ============================================================================== Then the generated Makefile.in contains these lines: @USE_FOO_TRUE@@USE_VARIANT_A_TRUE@all : test1.o @USE_FOO_TRUE@@USE_VARIANT_A_FALSE@all : test2.o @USE_FOO_FALSE@@USE_VARIANT_B_TRUE@all : test3.o @USE_FOO_FALSE@@USE_VARIANT_B_FALSE@all : test4.o This means: - If USE_FOO evaluates to false, all uses of @USE_VARIANT_A_TRUE@ and @USE_VARIANT_A_FALSE@ are preceded by @USE_FOO_TRUE@ which is replaced by "#". Thus their values don't matter. - Similarly, if USE_FOO evaluates to true, all uses of @USE_VARIANT_B_TRUE@ and @USE_VARIANT_B_FALSE@ are preceded by @USE_FOO_FALSE@ which is replaced by "#". Thus their values don't matter. And the generated Makefile has: #all : test1.o #all : test2.o #all : test3.o all : test4.o Which is working perfectly fine. And even if it were #@USE_VARIANT_A_TRUE@all : test1.o #@USE_VARIANT_A_FALSE@all : test2.o #all : test3.o all : test4.o it would be working fine. So, there is no problem with the generated Makefiles if the checks would be weakened check only the definedness of conditionals that are actually used in the Makefiles. > the safety net around them definitely is not too strict. I disagree. It is too strict without necessity. Bruno -- In memoriam The victims of the East German uprising From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 21 16:25:00 2011 Received: (at 8718) by debbugs.gnu.org; 21 Jun 2011 20:25:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QZ7VI-0000k4-PR for submit@debbugs.gnu.org; Tue, 21 Jun 2011 16:25:00 -0400 Received: from mailout-de.gmx.net ([213.165.64.23]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QZ7VC-0000jg-Jp for 8718@debbugs.gnu.org; Tue, 21 Jun 2011 16:24:54 -0400 Received: (qmail 27421 invoked by uid 0); 21 Jun 2011 20:24:44 -0000 Received: from 77.58.247.232 by www061.gmx.net with HTTP; Tue, 21 Jun 2011 22:24:42 +0200 (CEST) Content-Type: text/plain; charset="utf-8" Date: Tue, 21 Jun 2011 22:24:42 +0200 From: "Ralf Wildenhues" In-Reply-To: <201106171221.39929.bruno@clisp.org> Message-ID: <20110621202442.188960@gmx.net> MIME-Version: 1.0 References: <201105230030.42513.bruno@clisp.org> <201106162342.53075.bruno@clisp.org> <20110617054735.316800@gmx.net> <201106171221.39929.bruno@clisp.org> Subject: Re: bug#8718: error when using nested conditionals To: Bruno Haible X-Authenticated: #13673931 X-Flags: 0001 X-Mailer: WWW-Mail 6100 (Global Message Exchange) X-Mutt-Fcc: ~/Mail/outbox X-Mutt-References: <201106171221.39929.bruno@clisp.org> X-Priority: 3 X-Provags-ID: V01U2FsdGVkX18pq/UY8Rwpk+okJngnlL9Kf1HUgfMVpl4andVLvC 7WY0vmYnoon8tUzWkyuWphlh9hFHBD1aPSkA== Content-Transfer-Encoding: 8bit X-GMX-UID: b49pIaJxMydhbJzwumplNaNjaGRhZtrK X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Stefano Lattarini X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) * Bruno Haible wrote on Fri, Jun 17, 2011 at 12:21:38PM CEST: > Ralf Wildenhues wrote: > > > There's no point in being _that_ safe that you check unused expressions > > > for validity. C compilers don't do it either: When I compile a C program > > > #if 0 > > > #if syntax error ((((,$$?! > > > #endif > > > #endif > > > the second line yields no error and no warning, because the condition in > > > that line is ignored. > > > > But that's not the same thing. AM_CONDITIONAL sets variables > > _TRUE and _FALSE to either empty or '#', and at least one of > > them will always be nonempty. If you skip this initialization code, the > > Makefile *will* be wrong. > > No, the generated Makefile will be right because all uses of > _TRUE and _FALSE will be inside Makefile comments, where the > comment marker "#" comes out of the expansion of the outer conditional. Stefano already explained this: there is no way that automake (which can see your Makefile.am) can analyze your configure.ac shell code semantics to infer that the situation is in fact safe. And I don't think gnulib-tool can somehow infer that AM_CONDITIONAL invocations from third-party macros other than gnulib, or from the configure.ac in question, do not rely on where the AM_CONDITIONAL is expanded. > So, there is no problem with the generated Makefiles if the checks would > be weakened check only the definedness of conditionals that are actually > used in the Makefiles. gnulib does not control all AM_CONDITIONALs in a configure. Cheers, Ralf From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 26 09:10:11 2011 Received: (at 8718) by debbugs.gnu.org; 26 Jul 2011 13:10:12 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QlhOk-0003BX-Q3 for submit@debbugs.gnu.org; Tue, 26 Jul 2011 09:10:11 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QlhOi-0003BA-Rz for 8718@debbugs.gnu.org; Tue, 26 Jul 2011 09:10:10 -0400 Received: by wwf25 with SMTP id 25so459183wwf.15 for <8718@debbugs.gnu.org>; Tue, 26 Jul 2011 06:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=bJ8gwSoOxQbhiSAU3K3hqEyOvMqjgLIv+xf2STbmJWs=; b=b251f2KFDGpLlbi3JsEu+dWecgG0FlzNCXKz6ZR0HIdS0m59RnA281tUWkbU03AbBv RC2y6EdJ1JQSFMo+TZprQOij3aQfwlA9qrcsMAjZFzOR12DpGCca/8H3Uw6/A3TP2usm gmqmWv5Cl45SZ7nbWD1AGJfTqJyr9+FFd/18A= Received: by 10.227.60.140 with SMTP id p12mr5156424wbh.30.1311685803095; Tue, 26 Jul 2011 06:10:03 -0700 (PDT) Received: from bigio.localnet (host86-103-dynamic.0-87-r.retail.telecomitalia.it [87.0.103.86]) by mx.google.com with ESMTPS id o19sm419353wbh.26.2011.07.26.06.09.58 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 26 Jul 2011 06:09:59 -0700 (PDT) From: Stefano Lattarini To: "Ralf Wildenhues" Subject: Re: bug#8718: error when using nested conditionals Date: Tue, 26 Jul 2011 15:09:45 +0200 User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) References: <201105230030.42513.bruno@clisp.org> <201106171221.39929.bruno@clisp.org> <20110621202442.188960@gmx.net> In-Reply-To: <20110621202442.188960@gmx.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201107261509.46219.stefano.lattarini@gmail.com> X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Bruno Haible X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.9 (---) Hello Ralf, Bruno. On Tuesday 21 June 2011, Ralf Wildenhues wrote: > * Bruno Haible wrote on Fri, Jun 17, 2011 at 12:21:38PM CEST: > > Ralf Wildenhues wrote: > > > > There's no point in being _that_ safe that you check unused expressions > > > > for validity. C compilers don't do it either: When I compile a C program > > > > #if 0 > > > > #if syntax error ((((,$$?! > > > > #endif > > > > #endif > > > > the second line yields no error and no warning, because the condition in > > > > that line is ignored. > > > > > > But that's not the same thing. AM_CONDITIONAL sets variables > > > _TRUE and _FALSE to either empty or '#', and at least one of > > > them will always be nonempty. If you skip this initialization code, the > > > Makefile *will* be wrong. > > > > No, the generated Makefile will be right because all uses of > > _TRUE and _FALSE will be inside Makefile comments, where the > > comment marker "#" comes out of the expansion of the outer conditional. > > Stefano already explained this: there is no way that automake (which can > see your Makefile.am) can analyze your configure.ac shell code semantics > to infer that the situation is in fact safe. > > And I don't think gnulib-tool can somehow infer that AM_CONDITIONAL > invocations from third-party macros other than gnulib, or from the > configure.ac in question, do not rely on where the AM_CONDITIONAL is > expanded. > > > So, there is no problem with the generated Makefiles if the checks would > > be weakened check only the definedness of conditionals that are actually > > used in the Makefiles. > > gnulib does not control all AM_CONDITIONALs in a configure. > > Cheers, > Ralf > In the end, should we close this bug as "wontfix" then? Regards, Stefano From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 01 09:17:50 2011 Received: (at 8718) by debbugs.gnu.org; 1 Sep 2011 13:17:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qz79S-0005mX-7p for submit@debbugs.gnu.org; Thu, 01 Sep 2011 09:17:50 -0400 Received: from mail-ey0-f176.google.com ([209.85.215.176]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qz79Q-0005mL-2B; Thu, 01 Sep 2011 09:17:49 -0400 Received: by eyz10 with SMTP id 10so1801869eyz.21 for ; Thu, 01 Sep 2011 06:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :x-kmail-markup:mime-version:content-type:content-transfer-encoding :message-id; bh=RBZeXdmXkcOzFkWtczeJvy+COw8H1xaRoiVeit1R1hY=; b=JzrXA/HDDaEvedKBiMCB+HqXZq0Y3HD8y5UAifAAQ6mHs0XhE34p6pqLqOlKAm5uSH 8Tok2C91Hvn3i7Lg+1CkXcjtzYSbuQKnkiv3/hcYdPgaco0CvQ3mEKTjpVExpgxw7MIw oO7dHZcUM8q1AfVOFRTxd0rrNp8r13+FhGtsA= Received: by 10.213.32.77 with SMTP id b13mr61791ebd.93.1314882868301; Thu, 01 Sep 2011 06:14:28 -0700 (PDT) Received: from bigio.localnet (host103-28-dynamic.56-82-r.retail.telecomitalia.it [82.56.28.103]) by mx.google.com with ESMTPS id 76sm20199eej.38.2011.09.01.06.14.18 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Sep 2011 06:14:20 -0700 (PDT) From: Stefano Lattarini To: "Ralf Wildenhues" Subject: Re: bug#8718: error when using nested conditionals Date: Thu, 1 Sep 2011 15:14:08 +0200 User-Agent: KMail/1.13.7 (Linux/2.6.30-2-686; KDE/4.6.5; i686; ; ) References: <201105230030.42513.bruno@clisp.org> <201106171221.39929.bruno@clisp.org> <20110621202442.188960@gmx.net> In-Reply-To: <20110621202442.188960@gmx.net> X-KMail-Markup: true MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="Boundary-01=_gU4XOa3cJg22+Uu" Content-Transfer-Encoding: 7bit Message-Id: <201109011514.09006.stefano.lattarini@gmail.com> X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: 8718 Cc: 8718@debbugs.gnu.org, Bruno Haible X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.8 (---) --Boundary-01=_gU4XOa3cJg22+Uu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit tags 8718 + wontfix close 8718 thanks Reference: Hello Ralf, Bruno. On Tuesday 21 June 2011, Ralf Wildenhues wrote: > * Bruno Haible wrote on Fri, Jun 17, 2011 at 12:21:38PM CEST: > > Ralf Wildenhues wrote: > > > > There's no point in being _that_ safe that you check unused expressions > > > > for validity. C compilers don't do it either: When I compile a C program > > > > #if 0 > > > > #if syntax error ((((,$$?! > > > > #endif > > > > #endif > > > > the second line yields no error and no warning, because the condition in > > > > that line is ignored. > > > > > > But that's not the same thing. AM_CONDITIONAL sets variables > > > _TRUE and _FALSE to either empty or '#', and at least one of > > > them will always be nonempty. If you skip this initialization code, the > > > Makefile *will* be wrong. > > > > No, the generated Makefile will be right because all uses of > > _TRUE and _FALSE will be inside Makefile comments, where the > > comment marker "#" comes out of the expansion of the outer conditional. > > Stefano already explained this: there is no way that automake (which can > see your Makefile.am) can analyze your configure.ac shell code semantics > to infer that the situation is in fact safe. > > And I don't think gnulib-tool can somehow infer that AM_CONDITIONAL > invocations from third-party macros other than gnulib, or from the > configure.ac in question, do not rely on where the AM_CONDITIONAL is > expanded. > > > So, there is no problem with the generated Makefiles if the checks would > > be weakened check only the definedness of conditionals that are actually > > used in the Makefiles. > > gnulib does not control all AM_CONDITIONALs in a configure. > > Cheers, > Ralf > Given the lack of consensus of how and whether the limitations analyzed in this reported should be lifted, and the fact that two months have passed without further discussions, I've closed this bug marking it as "wontfix"; feel free to re-open it if the situation changes. Regards, Stefano --Boundary-01=_gU4XOa3cJg22+Uu Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit

tags 8718 + wontfix

close 8718

thanks


Reference:

<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8718>


Hello Ralf, Bruno.


On Tuesday 21 June 2011, Ralf Wildenhues wrote:

> * Bruno Haible wrote on Fri, Jun 17, 2011 at 12:21:38PM CEST:

> > Ralf Wildenhues wrote:

> > > > There's no point in being _that_ safe that you check unused expressions

> > > > for validity. C compilers don't do it either: When I compile a C program

> > > > #if 0

> > > > #if syntax error ((((,$$?!

> > > > #endif

> > > > #endif

> > > > the second line yields no error and no warning, because the condition in

> > > > that line is ignored.

> > >

> > > But that's not the same thing. AM_CONDITIONAL sets variables

> > > <COND>_TRUE and <COND>_FALSE to either empty or '#', and at least one of

> > > them will always be nonempty. If you skip this initialization code, the

> > > Makefile *will* be wrong.

> >

> > No, the generated Makefile will be right because all uses of

> > <COND>_TRUE and <COND>_FALSE will be inside Makefile comments, where the

> > comment marker "#" comes out of the expansion of the outer conditional.

>

> Stefano already explained this: there is no way that automake (which can

> see your Makefile.am) can analyze your configure.ac shell code semantics

> to infer that the situation is in fact safe.

>

> And I don't think gnulib-tool can somehow infer that AM_CONDITIONAL

> invocations from third-party macros other than gnulib, or from the

> configure.ac in question, do not rely on where the AM_CONDITIONAL is

> expanded.

>

> > So, there is no problem with the generated Makefiles if the checks would

> > be weakened check only the definedness of conditionals that are actually

> > used in the Makefiles.

>

> gnulib does not control all AM_CONDITIONALs in a configure.

>

> Cheers,

> Ralf

>

Given the lack of consensus of how and whether the limitations analyzed

in this reported should be lifted, and the fact that two months have passed

without further discussions, I've closed this bug marking it as "wontfix";

feel free to re-open it if the situation changes.


Regards,

Stefano


--Boundary-01=_gU4XOa3cJg22+Uu-- From unknown Sat Sep 06 14:23:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 30 Sep 2011 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator