GNU bug report logs - #19311
AC_PROG_CC can force wrong $ac_aux_dir definition in automake 1.14

Previous Next

Package: automake;

Reported by: Jan Engelhardt <jengelh <at> inai.de>

Date: Mon, 8 Dec 2014 17:32:02 UTC

Severity: minor

Done: Mike Frysinger <vapier <at> gentoo.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19311 in the body.
You can then email your comments to 19311 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#19311; Package automake. (Mon, 08 Dec 2014 17:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jan Engelhardt <jengelh <at> inai.de>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Mon, 08 Dec 2014 17:32:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jan Engelhardt <jengelh <at> inai.de>
To: bug-automake <at> gnu.org
Subject: regression: 1.14 may use ac_aux_dir before defined (again)
Date: Mon, 8 Dec 2014 18:15:26 +0100 (CET)
When AC_SYSTEM_EXTENSIONS precedes AM_INIT_AUTOMAKE, it used to throw an 
error - which has been fixed in
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15981 .

I have here another instance of what appears to be a similar issue. This 
one is also a regression (used to work in 1.13.4), and the regression is 
still present in {automake 1.14.1 + patch from #15981}. The problem 
originates in libmemcached/configure.ac, and I have produced the 
following reduced testcase that exhibits the issue:

$ cat <<EOF >configure.ac
AC_INIT([foo], [0])
AC_PROG_CC([cc gcc clang])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 subdir-objects foreign])
AC_OUTPUT([Makefile])
EOF
$ echo '' >Makefile.am
$ md m4
$ autoreconf -fi
configure.ac:2: installing 'build-aux/compile'
configure.ac:5: installing 'build-aux/install-sh'
configure.ac:5: installing 'build-aux/missing'
$ ./configure
checking for cc... cc
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 cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
configure: error: cannot find install-sh, install.sh, or shtool in "." "./.."
"./../.."

With automake-1.13.4, configure would succeed through to the end 
("config.status: creating Makefile").




Information forwarded to bug-automake <at> gnu.org:
bug#19311; Package automake. (Wed, 17 Dec 2014 14:11:01 GMT) Full text and rfc822 format available.

Message #8 received at 19311 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Jan Engelhardt <jengelh <at> inai.de>, 19311 <at> debbugs.gnu.org, 
 Eric Blake <eblake <at> redhat.com>
Subject: Re: bug#19311: regression: 1.14 may use ac_aux_dir before defined
 (again)
Date: Wed, 17 Dec 2014 15:10:19 +0100
retitle 19311 AC_PROG_CC can force wrong $ac_aux_dir definition in automake 1.14
severity 19311 minor
thanks

On 12/08/2014 06:15 PM, Jan Engelhardt wrote:
>
> When AC_SYSTEM_EXTENSIONS precedes AM_INIT_AUTOMAKE, it used to throw an
> error - which has been fixed in
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15981 .
>
> I have here another instance of what appears to be a similar issue. This
> one is also a regression (used to work in 1.13.4), and the regression is
> still present in {automake 1.14.1 + patch from #15981}. The problem
> originates in libmemcached/configure.ac, and I have produced the
> following reduced testcase that exhibits the issue:
>
> $ cat <<EOF >configure.ac
> AC_INIT([foo], [0])
> AC_PROG_CC([cc gcc clang])
> AC_CONFIG_AUX_DIR([build-aux])
> AC_CONFIG_MACRO_DIR([m4])
> AM_INIT_AUTOMAKE([1.11 subdir-objects foreign])
> AC_OUTPUT([Makefile])
> EOF
> $ echo '' >Makefile.am
> $ md m4
> $ autoreconf -fi
> configure.ac:2: installing 'build-aux/compile'
> configure.ac:5: installing 'build-aux/install-sh'
> configure.ac:5: installing 'build-aux/missing'
> $ ./configure
> checking for cc... cc
> 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 cc accepts -g... yes
> checking for cc option to accept ISO C89... none needed
> configure: error: cannot find install-sh, install.sh, or shtool in "." "./.."
> "./../.."
>
> With automake-1.13.4, configure would succeed through to the end
> ("config.status: creating Makefile").
>
>
This is due to the fact that automake actually rewrite AC_PROG_CC
in order to integrate it with the 'compile' script, and to do so, it
needs the $am_aux_dir variable to be defined.  That in turns requires
AC_CONFIG_AUX_DIR to be called beforehand.  If that macro isn't
called explicitly before the AC_PROG_CC invocation, then the code in
AM_AUX_DIR_EXPAND will force-expand it with its default behavior,
which is to have configure look into '.', '..' and '../..' for the
required auxiliary scripts, and bail out if they are not found.
Which is what is causing your issue.

The issue can be solved by moving the AC_CONFIG_AUX_DIR call before
the AC_PROG_CC call.  Arguably, a more user-friendly behavior would
be to automake patch AC_CONFIG_AUX_DIR so that it fails hard and with
a clear error message if it gets invoked after AM_AUX_DIR_EXPAND has
been called (explicitly or implicitly).  Patches welcome (either for
code or docs).

An even better solution *might* be to shuffle the expansion of
AC_CONFIG_AUX_DIR so that it goes immediately after the AC_INIT
explansion, but that requires more m4 magic than my rusty brain
can grasp at the momwnt; and in addition, I'm not sure whether
such a change could cause new backward incompatibilities (possibly
subtle ones).  Looping in Eric,Blake explicitly, who, being the m4
maintainer and one of the main Autoconf devs, is probably the best
person to give feedback.

Thanks,
  Stefano






Changed bug title to 'AC_PROG_CC can force wrong $ac_aux_dir definition in automake 1.14' from 'regression: 1.14 may use ac_aux_dir before defined (again)' Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 17 Dec 2014 14:11:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 17 Dec 2014 14:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#19311; Package automake. (Wed, 17 Dec 2014 16:15:02 GMT) Full text and rfc822 format available.

Message #15 received at 19311 <at> debbugs.gnu.org (full text, mbox):

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: jengelh <at> inai.de, 19311 <at> debbugs.gnu.org
Subject: [FYI] {minor} Expose automake bug#19311
Date: Wed, 17 Dec 2014 17:13:52 +0100
AC_PROG_CC called before AC_CONFIG_AUX_DIR can silently force wrong
$ac_aux_dir definition.

* t/auxdir-pr19311.sh: New.
* t/list-of-tests.mk: Add it as an XFAIL test.

Signed-off-by: Stefano Lattarini <stefano.lattarini <at> gmail.com>
---
 t/auxdir-pr19311.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
 t/list-of-tests.mk  |  2 ++
 2 files changed, 47 insertions(+)
 create mode 100644 t/auxdir-pr19311.sh

diff --git a/t/auxdir-pr19311.sh b/t/auxdir-pr19311.sh
new file mode 100644
index 0000000..56c71a1
--- /dev/null
+++ b/t/auxdir-pr19311.sh
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2014 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/>.
+
+# Automake bug#19311: AC_PROG_CC called before AC_CONFIG_AUX_DIR can
+# silently force wrong $ac_aux_dir definition.
+
+am_create_testdir=empty
+required=cc
+. test-init.sh
+
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+AC_PROG_CC
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE
+AC_OUTPUT([Makefile])
+END
+
+: > Makefile.am
+
+mkdir build-aux
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+test -f build-aux/compile
+test -f build-aux/install-sh
+
+./configure
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index e6ee856..8d458f5 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -30,6 +30,7 @@ t/pm/Version3.pl
 
 XFAIL_TESTS = \
 t/all.sh \
+t/auxdir-pr19311.sh \
 t/cond17.sh \
 t/gcj6.sh \
 t/override-conditional-2.sh \
@@ -185,6 +186,7 @@ t/auxdir-autodetect.sh \
 t/auxdir-computed.tap \
 t/auxdir-misplaced.sh \
 t/auxdir-nonexistent.sh \
+t/auxdir-pr19311.sh \
 t/auxdir-unportable.tap \
 t/backcompat.sh \
 t/backcompat2.sh \
-- 
2.1.3





Reply sent to Mike Frysinger <vapier <at> gentoo.org>:
You have taken responsibility. (Sun, 20 Feb 2022 19:10:02 GMT) Full text and rfc822 format available.

Notification sent to Jan Engelhardt <jengelh <at> inai.de>:
bug acknowledged by developer. (Sun, 20 Feb 2022 19:10:02 GMT) Full text and rfc822 format available.

Message #20 received at 19311-done <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: 19311-done <at> debbugs.gnu.org
Subject: Re: bug#19311: [FYI] {minor} Expose automake bug#19311
Date: Sun, 20 Feb 2022 14:09:24 -0500
On 17 Dec 2014 17:13, Stefano Lattarini wrote:
> AC_PROG_CC called before AC_CONFIG_AUX_DIR can silently force wrong
> $ac_aux_dir definition.

looks like this was merged to fix this bug but forgot to close the report
-mike




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 21 Mar 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 96 days ago.

Previous Next


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