Mailing List Archive

check for stale configure much earlier
Hi.

We have a Makefile rule that checks if configure's source files are
newer than configure itself and if so, error out. This was intended to
prevent people from being caught out by a stale configure after changing
configure.ac.

Unfortunately this turns out to be quite annoying particularly on slow
systems since it doesn't happen until all of the work in configure has
been wasted. Instead, I'd like to configure to handle this itself as
early as possible. Any objections?

diff --git a/Makefile.in b/Makefile.in
index 3c285682..4144a834 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -184,16 +184,11 @@ FIXPATHSCMD = $(SED) $(PATHSUBS)
FIXALGORITHMSCMD= $(SHELL) $(srcdir)/fixalgorithms $(SED) \
@UNSUPPORTED_ALGORITHMS@

-all: configure-check $(CONFIGFILES) $(MANPAGES) $(TARGETS)
+all: $(CONFIGFILES) $(MANPAGES) $(TARGETS)

$(LIBSSH_OBJS): Makefile.in config.h
$(SSHOBJS): Makefile.in config.h
$(SSHDOBJS): Makefile.in config.h
-configure-check: $(srcdir)/configure
-
-$(srcdir)/configure: configure.ac $(srcdir)/m4/*.m4
- @echo "ERROR: configure is out of date; please run ${AUTORECONF} (and configure)" 1>&2
- @exit 1

.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
diff --git a/configure.ac b/configure.ac
index 3e9fd700..747fa90f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,17 @@
AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([ssh.c])
+
+# Check for stale configure as early as possible.
+for i in $srcdir/configure.ac $srcdir/m4/*.m4; do
+ if test "$i" -nt "$srcdir/configure"; then
+ AC_MSG_WARN([$i newer than configure, running autoreconf])
+ (cd $srcdir && autoreconf) || AC_MSG_ERROR([autoreconf failed])
+ AC_MSG_WARN([reexecing $0 $@])
+ exec $0 "$@"
+ fi
+done
+
AC_LANG([C])

AC_CONFIG_HEADERS([config.h])
--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new)
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: check for stale configure much earlier [ In reply to ]
On Sat, 23 Jul 2022, Darren Tucker wrote:

> + AC_MSG_WARN([$i newer than configure, running autoreconf])
> + (cd $srcdir && autoreconf) || AC_MSG_ERROR([autoreconf failed])

I’d rather have it error out here, possibly with a command line flag
to override this. Running autoreconf without the right AUTOCONF_VERSION
and AUTOMAKE_VERSION set is going to be trouble in ports, for example.

bye,
//mirabilos
--
Infrastrukturexperte • tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/
Telephon +49 228 54881-393 • Fax: +49 228 54881-235
HRB AG Bonn 5168 • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

****************************************************
/?\ The UTF-8 Ribbon
? ? Campaign against Mit dem tarent-Newsletter nichts mehr verpassen:
 ?  HTML eMail! Also, https://www.tarent.de/newsletter
? ? header encryption!
****************************************************
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: check for stale configure much earlier [ In reply to ]
On Tue, 26 Jul 2022 at 08:00, Thorsten Glaser <t.glaser@tarent.de> wrote:
> On Sat, 23 Jul 2022, Darren Tucker wrote:
> > + AC_MSG_WARN([$i newer than configure, running autoreconf])
> > + (cd $srcdir && autoreconf) || AC_MSG_ERROR([autoreconf failed])
>
> I’d rather have it error out here, possibly with a command line flag
> to override this. Running autoreconf without the right AUTOCONF_VERSION
> and AUTOMAKE_VERSION set is going to be trouble in ports, for example.

Well it would have been more convenient for me, but point taken. I've
committed it without the part where it runs "autoreconf".

--
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new)
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev