automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

aclocal --diff on Tru64


From: Ralf Wildenhues
Subject: aclocal --diff on Tru64
Date: Wed, 10 May 2006 23:22:56 +0200
User-agent: Mutt/1.5.11+cvs20060403

`diff /dev/null file' fails on Tru64, as noted in autoconf.texi.
`aclocal --diff' invokes this.  acloca18.test exposes this failure.

Below is a hack to fix this.  It's a hack because it may create (and
delete) a file `devnull' in the current directory.  A proper fix would
either
- pull mktmpdir over from Autoconf and use that for aclocal, and create
  `devnull' in $tmp (including cleanup in `END' and such; much code for
  such a small issue); or
- invoke `true | $diff - $file' or similarly (ugly because it resorts to
  shell interpolation from system).

Before I venture into either one of those options, I'd appreciate a
reality check that this isn't over-engineering, esp. since the user may
override the diff command anyway.  What do you think?  (Since we don't
show the file name in the output, we could easily use a more obscure or
"unique" one, say, including `$$', if that is the only concern.)

Cheers,
Ralf

        * configure.ac (am_cv_prog_diff_dev_null): New variable: whether
        `diff' works on `/dev/null'; substitute it.  Test from Autotest.
        * Makefile.am (do_subst): Substitute it here as well.
        * aclocal.in (diff_dev_null): New global.
        (install_file): If `diff' loses, create an empty file `devnull'
        to compare against.  Remove afterwards.

Index: configure.ac
===================================================================
RCS file: /cvs/automake/automake/configure.ac,v
retrieving revision 1.26
diff -u -r1.26 configure.ac
--- configure.ac        14 May 2005 20:28:50 -0000      1.26
+++ configure.ac        10 May 2006 18:43:14 -0000
@@ -129,6 +129,16 @@
 test "x$am_cv_prog_ln" = xln && result=yes
 AC_MSG_RESULT([$result])
 
+AC_MSG_CHECKING([whether diff likes /dev/null])
+AC_CACHE_VAL([am_cv_prog_diff_dev_null],
+[if diff /dev/null /dev/null >/dev/null 2>&1; then
+  am_cv_prog_diff_dev_null=yes
+else
+  am_cv_prog_diff_dev_null=no
+fi])
+AC_SUBST([am_cv_prog_diff_dev_null])
+AC_MSG_RESULT([$am_cv_prog_diff_dev_null])
+
 # The amount we should wait after modifying files depends on the platform.
 # On Windows '95, '98 and ME, files modifications have 2-seconds
 # granularity and can be up to 3 seconds in the future w.r.t. the
Index: Makefile.am
===================================================================
RCS file: /cvs/automake/automake/Makefile.am,v
retrieving revision 1.242
diff -u -r1.242 Makefile.am
--- Makefile.am 12 Jan 2006 20:11:48 -0000      1.242
+++ Makefile.am 10 May 2006 18:43:13 -0000
@@ -73,7 +73,8 @@
   -e 's,address@hidden@],$(SHELL),g' \
   -e 's,address@hidden@],$(VERSION),g' \
   -e 's,address@hidden@],Generated from address@hidden; do not edit by 
hand.,g' \
-  -e 's,address@hidden@],$(datadir),g'
+  -e 's,address@hidden@],$(datadir),g' \
+  -e 's,address@hidden@],$(am_cv_prog_diff_dev_null),g'
 
 ## These files depend on Makefile so they are rebuilt if $(VERSION),
 ## $(datadir) or other do_subst'ituted variables change.
Index: aclocal.in
===================================================================
RCS file: /cvs/automake/automake/aclocal.in,v
retrieving revision 1.138
diff -u -r1.138 aclocal.in
--- aclocal.in  21 Apr 2006 19:02:29 -0000      1.138
+++ aclocal.in  10 May 2006 18:43:13 -0000
@@ -65,6 +65,9 @@
 # --diff
 my @diff_command;
 
+# whether diff works on /dev/null
+my $diff_dev_null = ('@am_cv_prog_diff_dev_null@');
+
 # --dry-run
 my $dry_run = 0;
 
@@ -193,7 +196,16 @@
       else
        {
          msg 'note', "installing `$dest' from `$src'";
-         $diff_dest = '/dev/null';
+         if ($diff_dev_null eq 'yes')
+           {
+             $diff_dest = '/dev/null';
+           }
+         else
+           {
+             $diff_dest = 'devnull';
+             my $fh = new Automake::XFile "> $diff_dest";
+             $fh->close;
+           }
        }
 
       if (@diff_command)
@@ -210,6 +222,10 @@
          xsystem ('cp', $src, $dest);
        }
     }
+  if ($diff_dest eq 'devnull' && !unlink ($diff_dest))
+    {
+      fatal "could not remove `$diff_dest': $!";
+    }
 }
 
 # Compare two lists of numbers.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]