Subject: Re: bug#13435: Please don't kill DJGPP support...

From: Stefano Lattarini <[email-masked]>
Date: Wed, 23 Jan 2013 13:16:56 +0100

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

On 01/14/2013 11:29 PM, DJ Delorie wrote:
>
> Stefano Lattarini wrote:
>>
>> Well, then it appear we might actually have no problems in keeping DJGPP
>> support.  If the new code with split info files disabled works as expected,
>> re-instating support for DJGPP (on modern Windows version) will just mean
>> adding back few simple, unproblematic lines of code.
>>
>> I will post a patch in a few days.  No need to hurry, since Automake 1.14
>> (which would have removed DJGPP support) is not due to appear for several
>> months at least.
>
> Ok, thanks!

I've pushed my attempt to the public rewindable branch
'experimental/djgpp-for-WinNT'.  Could you give it a try,
when you have time?

The patch itself is below, for reference.

Thanks,
  Stefano

---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----

>From a126418c850c26dfe366417632fee97f12912462 Mon Sep 17 00:00:00 2001
Message-Id: <a126418c8[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Wed, 23 Jan 2013 12:52:52 +0100
Subject: [PATCH] DGJPP: re-introduce support, on Windows 2000 and later

See automake bug#13435.

The problematic DGJPP-related code should no longer be necessary today:

 * the code to support DJGPP-style split info files ('*.i[0-9][0-9]')
   is no longer needed, since we have dropped support for split info
   files anyway (see commit v1.13.1-60-gcdba479 and automake  bug#13351);

 * on Windows 2000 and later, modern version of DJGPP support file names
   starting with dots.

With that, the remaining pieces of code required to support DJGPP on
non-ancient Windows are few and unobtrusive enough that we re-introduce
them, in order to keep DJGPP alive -- the cost/benefit ratio has become
definitely small enough for that.

Note that support for DJGPP on DOS and Windows 95/98/ME is *not*
reintroduced.  That is no longer worth worrying about.

For reference, here are the commits where we removed DJGPP support:
- v1.13-6-gad08bbf, "Drop support for DJGPP, MS-DOS, Windows 95/98/ME"
- v1.13-7-gff0c7f8, "general: assume dot-starting file names are supported"

* NEWS: Make clear that DJGPP on Windows 2000 and later should still be
supported.
* automake.in (BEGIN): Override $ENV{SHELL} for DJGPP.
* maintainer/syntax-checks.mk (automake_diff_no): Adjust, as there are
now eight (not just seven) different lines between 'automake.in' and
'automake'.
* bootstrap.sh ($BOOTSTRAP_SHELL): Give a more proper default for DJGPP.

Signed-off-by: Stefano Lattarini <[email-masked]>
---
 NEWS                        |  2 +-
 automake.in                 |  9 +++++++++
 bootstrap.sh                | 10 ++++++++--
 maintainer/syntax-checks.mk |  2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 7a25b80..825d24b 100644
--- a/NEWS
+++ b/NEWS
@@ -42,7 +42,7 @@ New in 1.14:
     for more information.

   - Support for DJGPP on MS-DOS and/or Windows 95/98/ME has been removed.
-    Note that both Cygwin and MSYS/MinGW on modern Windows versions will
+    Note that Cygwin, MSYS/MinGW and DJGPP on modern Windows versions will
     continue to be fully supported.

 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/automake.in b/automake.in
index 4776581..f77ab7c 100644
--- a/automake.in
+++ b/automake.in
@@ -32,6 +32,15 @@ BEGIN
   @Automake::perl_libdirs = ('@datadir@/@PACKAGE@-@APIVERSION@')
     unless @Automake::perl_libdirs;
   unshift @INC, @Automake::perl_libdirs;
+
+  # Override SHELL.  This is required on DJGPP so that system() uses
+  # bash, not COMMAND.COM which doesn't quote arguments properly.
+  # Other systems aren't expected to use $SHELL when Automake
+  # runs, but it should be safe to drop the "if DJGPP" guard if
+  # it turns up other systems need the same thing.  After all,
+  # if SHELL is used, ./configure's SHELL is always better than
+  # the user's SHELL (which may be something like tcsh).
+  $ENV{'SHELL'} = '@SHELL@' if exists $ENV{'DJDIR'};
 }

 use Class::Struct ();
diff --git a/bootstrap.sh b/bootstrap.sh
index bb4221d..6291948 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -31,7 +31,13 @@ export AUTOCONF  # might be used by aclocal and/or automake
 export AUTOM4TE  # ditto
 : ${PERL=perl}

-BOOTSTRAP_SHELL=${BOOTSTRAP_SHELL-/bin/sh}
+if test -n "$DJDIR"; then
+  # This is required on DJGPP so that Perl's system() uses bash,
+  # not COMMAND.COM which doesn't quote arguments properly.
+  BOOTSTRAP_SHELL=${BOOTSTRAP_SHELL-/dev/env/DJDIR/bin/bash.exe}
+else
+  BOOTSTRAP_SHELL=${BOOTSTRAP_SHELL-/bin/sh}
+fi

 # Variables to substitute.
 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
@@ -64,7 +70,7 @@ if test -d automake-$APIVERSION; then
 fi
 rm -rf automake-$APIVERSION
 # Can't use "ln -s lib automake-$APIVERSION", that might not work
-# properly on MinGW/MSYS.
+# properly on MinGW/MSYS or DJGPP.
 mkdir automake-$APIVERSION
 cp -rf lib/* automake-$APIVERSION

diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk
index e1d5e6b..6e50d68 100644
--- a/maintainer/syntax-checks.mk
+++ b/maintainer/syntax-checks.mk
@@ -83,7 +83,7 @@ sc_at_in_texi
 ## There are exactly 7 lines that should be modified from automake.in to
 ## automake, and 9 lines that should be modified from aclocal.in to
 ## aclocal.
-automake_diff_no = 7
+automake_diff_no = 8
 aclocal_diff_no = 9
 sc_diff_automake sc_diff_aclocal: sc_diff_% :
 	@set +e; tmp=$*-diffs.tmp; \
-- 
1.8.1.rc3.438.ge9abef6