From a947c49bec36957cb5d38e1dc2e22dc0e3465849 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 22 Feb 2014 18:01:32 +0000 Subject: [PATCH] Move the Unix configure script up to the top level. Previously, 'configure' and its assorted machinery lived in the 'unix' subdir, because that seemed like a clean place to keep it given that all the other per-platform Makefiles live in their platform directories. However, this never sat all that happily with autotools, and even less so now that it likes to have object file pathnames parallel source file pathnames: if you have Makefile.am refer to source files outside its subdir as "../terminal.c" and enable subdir-objects then any out-of-tree build calls the corresponding object file "../terminal.o" and so your build products mostly end up at the directory above your build dir! And as of autotools 1.14 my previous compensatory bodge of prefixing every source file path in Makefile.am with "$(srcdir)" has stopped working too. So I'm giving in to necessity, and changing policy by moving the configure machinery up to the top level of the source tree where autotools will be less confused by it. This should not be taken as any indication of the primacy of the Unix port, only of the recalcitrance of autotools. Whereas before we had a trivial script called 'configure' at the top level that invoked unix/configure to effectively do an 'out-of-tree build' (for make purposes) at the top level of the source tree, we now have a similar script in unix/configure. So this _should_ make very little difference: people who were previously running configure from the top level should still be able to, and likewise people who were running it from the unix subdir. [originally from svn r10141] --- Recipe | 6 +++--- configure | 3 --- unix/configure.ac => configure.ac | 0 mkauto.sh | 2 +- mkfiles.pl | 12 ++++++------ mkunxarc.sh | 2 +- unix/configure | 3 +++ 7 files changed, 14 insertions(+), 14 deletions(-) delete mode 100755 configure rename unix/configure.ac => configure.ac (100%) create mode 100755 unix/configure diff --git a/Recipe b/Recipe index 0cd8a402..03b6970b 100644 --- a/Recipe +++ b/Recipe @@ -19,7 +19,7 @@ !makefile lcc windows/Makefile.lcc !makefile gtk unix/Makefile.gtk !makefile unix unix/Makefile.ux -!makefile am unix/Makefile.am +!makefile am Makefile.am !makefile osx macosx/Makefile !makefile devcppproj windows/DEVCPP !makefile vstudio10 windows/VS2010 @@ -247,8 +247,8 @@ CFLAGS += -DMACOSX # List the man pages for the automake makefile. !begin am -man1_MANS = ../doc/plink.1 ../doc/pscp.1 ../doc/psftp.1 ../doc/pterm.1 \ - ../doc/putty.1 ../doc/puttygen.1 ../doc/puttytel.1 +man1_MANS = doc/plink.1 doc/pscp.1 doc/psftp.1 doc/pterm.1 \ + doc/putty.1 doc/puttygen.1 doc/puttytel.1 !end # In automake, chgrp/chmod pterm after installation, if configured to. diff --git a/configure b/configure deleted file mode 100755 index d56f50a3..00000000 --- a/configure +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -$(echo "$0" | sed '$s!configure$!unix/configure!') "$@" diff --git a/unix/configure.ac b/configure.ac similarity index 100% rename from unix/configure.ac rename to configure.ac diff --git a/mkauto.sh b/mkauto.sh index 4a467a51..9759438f 100755 --- a/mkauto.sh +++ b/mkauto.sh @@ -8,4 +8,4 @@ test -f unix.h && cd .. # Run autoconf on our real configure.in. -(cd unix && autoreconf -i && rm -rf autom4te.cache) +autoreconf -i && rm -rf autom4te.cache diff --git a/mkfiles.pl b/mkfiles.pl index 9ec915a0..bb767c16 100755 --- a/mkfiles.pl +++ b/mkfiles.pl @@ -1472,7 +1472,8 @@ if (defined $makefiles{'unix'}) { } if (defined $makefiles{'am'}) { - $dirpfx = "\$(srcdir)/" . &dirpfx($makefiles{'am'}, "/"); + die "Makefile.am in a subdirectory is not supported\n" + if &dirpfx($makefiles{'am'}, "/") ne ""; ##-- Unix/autoconf Makefile.am open OUT, ">$makefiles{'am'}"; select OUT; @@ -1485,8 +1486,7 @@ if (defined $makefiles{'am'}) { # auto-generated parts of this makefile, but Recipe might like to # have it available as a variable so that mandatory-rebuild things # (version.o) can conveniently be made to depend on it. - @sources = ("allsources", "=", - map {"${dirpfx}$_"} sort keys %allsourcefiles); + @sources = ("allsources", "=", sort keys %allsourcefiles); print &splitline(join " ", @sources), "\n\n"; @cliprogs = ("bin_PROGRAMS", "="); @@ -1506,12 +1506,12 @@ if (defined $makefiles{'am'}) { print "endif\n\n"; %objtosrc = (); - foreach $d (&deps("X", undef, $dirpfx, "/", "am")) { + foreach $d (&deps("X", undef, "", "/", "am")) { $objtosrc{$d->{obj}} = $d->{deps}->[0]; } print &splitline(join " ", "AM_CPPFLAGS", "=", - map {"-I$dirpfx$_"} @srcdirs), "\n"; + map {"-I\$(srcdir)/$_"} @srcdirs), "\n"; @amcflags = ("\$(COMPAT)", "\$(XFLAGS)", "\$(WARNINGOPTS)"); print "if HAVE_GTK\n"; @@ -1909,7 +1909,7 @@ if ($do_unix) { system "./mkauto.sh"; die "mkfiles.pl: mkauto.sh returned $?\n" if $? > 0; if ($do_unix == 1) { - chdir ($targetdir = dirname($makefiles{"am"})) + chdir ($targetdir = "unix") or die "$targetdir: chdir: $!\n"; } system "./configure", @confargs; diff --git a/mkunxarc.sh b/mkunxarc.sh index b15e2f45..8b17dc51 100755 --- a/mkunxarc.sh +++ b/mkunxarc.sh @@ -70,7 +70,7 @@ if test "x$ver" != "x"; then md5sum `find . -name '*.[ch]' -print` > manifest; echo "$ver" > version.def) fi -sed "s/^AC_INIT(putty,.*/AC_INIT(putty, $autoconfver)/" unix/configure.ac > uxarc/$arcname/unix/configure.ac +sed "s/^AC_INIT(putty,.*/AC_INIT(putty, $autoconfver)/" configure.ac > uxarc/$arcname/configure.ac (cd uxarc/$arcname && sh mkauto.sh) 2>errors || { cat errors >&2; exit 1; } tar -C uxarc -chzof $arcname.tar.gz $arcname diff --git a/unix/configure b/unix/configure new file mode 100755 index 00000000..b2b033d8 --- /dev/null +++ b/unix/configure @@ -0,0 +1,3 @@ +#!/bin/sh + +$(echo "$0" | sed '$s!configure$!../configure!') "$@"