Hi there,

Installing automake in an environment where all my source files are
read-only, I get some small problems as automake expect in a lot of cases to
be able to overwrite some of the distributed files that I get read-only in
my environment (as they are in fact symbolic links to shared sources).

I thus had to change a few things in automake.

---------------------------------------------

in "automake.in:"
=================

The rule to generate aclocal.m4 must ensure that it can overwrite it, so I
rename the original aclocal.m4 as aclocal.m4.bak and re-create a writable
version of aclocal.m4 by using "cat" from the backup file.

When regenerating Makefile.in I use the same trick to ensure that
Makefile.in can be written, while creating a backup file.

in "remake.am":
===============

I again take care to be able to write configure before calling autoconf,
although I've also submitted a patch to remove configure just before
re-creating it :-)

in "sanity.m4":
===============

I just remove "conftestfile" before creating it.

in "texi-vers.am":
==================

I remove both the version file and the time stamp just before creating them.

in "subdir4.test":
==================

I removed "depcomp" before touching it; I'm not sure why this is done at all
as "defs" already copies $srcdir/depcomp in the test directory (and this
file is then read-only here). Perhaps one may just not touch the local
depcomp file? I had anyway to do something as otherwise the test failed and
prevent automatically installing on all my machines.

------------------------------------

in "header.m4":
===============

Just by security I removed the various stamp files before creating them, but
I do not put this in tha patch below for two reasons: 

I'm not sure the stamp files are distributed; if they are'nt then removing
them should never be needed (only distributed files are usually found
read-only). (BTW there is also a java class.$dir.stamp file I consider in
automake.in; I don't remove it because I think it will not be distributed,
but I can't check as I do not yet have automake'd any java package).

After doing that I looked at the generated code (in config.status) and don't
understand at all what it does :-(, so I prefer not to change anything. My
main concern is that "$am_file" in the second argument to AC_OUTPUT_COMMANDS
seem to be expanded by configure, while the for loop is executed only by
config.status (and then am_file is only given a value in config.status, not
in configure)...

Any hint on this code would be welcome, even if it is just out of curiosity
:-)

------------------------------------

To solve the first points, I propose the following patch against
CVS-automake:

Changelog:

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

2000-09-12      Bernard Dautrevaux      <[EMAIL PROTECTED]>
        * automake.in: make a backup and a writable copy of aclocal.m4
before
        calling aclocal; idem for Makefile.in before calling automake
        
        * remake.am: make a backup and a writable copy of configure before
        calling autoconf

        * sanity.m4: remove conftestfile before creating it, in case it is
read-only

        * texi-vers.am: remove both version.texi and the stamp file before
creating them

        * subdir4.test: remove the "depcomp" copied by "defs" befroe
touching it, in
        case it is read-only.

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

The patch:

----------8<----------------------------------------------------------------
--
*** old/automake.in     2000/09/11 11:26:14     1.1.1.3
--- new/automake.in     2000/09/11 17:41:52
***************
*** 3196,3205 ****
  
        &pretty_print_rule ("\$(ACLOCAL_M4):", "\t\t", @ac_deps);
! 
!       $output_rules .=  ("\t"
!                          . 'cd $(srcdir) && $(ACLOCAL)'
!                          . (&variable_defined ('ACLOCAL_AMFLAGS')
                              ? ' $(ACLOCAL_AMFLAGS)' : '')
!                          . "\n");
      }
  }
--- 3196,3210 ----
  
        &pretty_print_rule ("\$(ACLOCAL_M4):", "\t\t", @ac_deps);
!  
!       $output_rules .=  ( "\tif test -r \$(ACLOCAL_M4); then \\\n"
!                         . "\t    rm -f \$(ACLOCAL_M4).bak; \\\n"
!                         . "\t    mv \$(ACLOCAL_M4) \$(ACLOCAL_M4).bak &&
\\\n"
!                         . "\t        cat \$(ACLOCAL_M4).bak >
\$(ACLOCAL_M4); \\\n"
!                         . "\tfi\n"
!                         . "\tcd \$(srcdir) && \\\n"
!                         . "\t    \$(ACLOCAL)"
!                         . (&variable_defined ('ACLOCAL_AMFLAGS')
                              ? ' $(ACLOCAL_AMFLAGS)' : '')
!                         . "\n");
      }
  }
***************
*** 3275,3282 ****
                        . ' ' . join (' ', @include_stack)
                        . "\n"
!                     . "\tcd \$(top_srcdir) && \$(AUTOMAKE) "
                      . ($cygnus_mode ? '--cygnus' : ('--' .
$strictness_name))
!                     . ($cmdline_use_dependencies ? '' : ' --ignore-deps')
!                     . ' ' . $input . $colon_infile . "\n\n");
  
      # This rule remakes the Makefile.
--- 3280,3295 ----
                        . ' ' . join (' ', @include_stack)
                        . "\n"
!                     . "\tcd \$(top_srcdir) \\\n"
!                     . "\t  && ( \\\n"
!                     . "\t      if test -r  " . $input . $colon_infile .
".in; then \\\n"
!                     . "\t          rm -f " . $input . $colon_infile .
".in.bak; \\\n"
!                     . "\t          mv " . $input . $colon_infile . ".in "
. $input . $colon_infile . ".in.bak && \\\n"
!                     . "\t              cat " . $input . $colon_infile .
".in.bak > " . $input . $colon_infile . ".in; \\\n"
!                     . "\t      fi; \\\n"
!                     . "\t      \$(AUTOMAKE) "
                      . ($cygnus_mode ? '--cygnus' : ('--' .
$strictness_name))
!                     . ($cmdline_use_dependencies ? '' : ' --include-deps')
!                     . " " . $input . $colon_infile . " \\\n"
!                     . "\t      )\n\n" );
  
      # This rule remakes the Makefile.
*** old/remake.am       1999/01/07 15:06:03     1.1.1.1
--- new/remake.am       2000/09/11 17:42:01
***************
*** 22,24 ****
  ## Explicitly look in srcdir for benefit of non-GNU makes.
  $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in
$(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
!       cd $(srcdir) && $(AUTOCONF)
--- 22,30 ----
  ## Explicitly look in srcdir for benefit of non-GNU makes.
  $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in
$(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
!       if test -r $(srcdir)/configure; then \
!           rm -f $(srcdir)/configure.bak; \
!           mv $(srcdir)/configure $(srcdir)/configure.bak && \
!               cat $(srcdir)/configure.bak > $(srcdir)/configure; \
!       fi
!       cd $(srcdir) && \
!           ($(AUTOCONF) || cat $(srcdir)/configure.bak >
$(srcdir)/configure)
*** old/m4/sanity.m4    2000/09/11 11:27:10     1.1.1.1
--- new/m4/sanity.m4    2000/09/11 17:41:56
***************
*** 7,10 ****
--- 7,11 ----
  # Just in case
  sleep 1
+ rm -f conftestfile
  echo timestamp > conftestfile
  # Do `set' in a subshell so we don't clobber the current shell's
*** old/texi-vers.am    2000/09/11 11:26:48     1.1.1.3
--- new/texi-vers.am    2000/09/11 17:42:02
***************
*** 33,39 ****
        @cmp -s @VTI@.tmp $(srcdir)/@VTEXI@ \
          || (echo "Updating $(srcdir)/@VTEXI@"; \
              cp @VTI@.tmp $(srcdir)/@VTEXI@)
        -@rm -f @VTI@.tmp
!       @cp $(srcdir)/@VTEXI@ $@
  
  mostlyclean-@VTI@:
--- 33,40 ----
        @cmp -s @VTI@.tmp $(srcdir)/@VTEXI@ \
          || (echo "Updating $(srcdir)/@VTEXI@"; \
+             rm -f $(srcdir)/@VTEXI@ && \
              cp @VTI@.tmp $(srcdir)/@VTEXI@)
        -@rm -f @VTI@.tmp
!       @rm -f $@ && cp $(srcdir)/@VTEXI@ $@
  
  mostlyclean-@VTI@:
*** old/tests/subdir4.test      2000/09/11 11:28:55     1.1
--- new/tests/subdir4.test      2000/09/12 08:35:33
***************
*** 31,34 ****
--- 31,35 ----
  # would mistakenly give the following diagnostic:
  #  automake: configure.in: required file `lib/depcomp' not found
+ rm -f depcomp
  : > depcomp
  
----------8<----------------------------------------------------------------
--

As usual all comments are welcome.

TIA

        Bernard

PS: Does this kind of patches have to be sent on this list or is there an
automake-patches list that would be more appropriate? there isn't any
described on www.gnu.org, but as I do not find *any* -patches list there
that doesn't prove anything :-)

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:    +33 (0) 1 47 68 80 80
Fax:    +33 (0) 1 47 88 97 85
e-mail: [EMAIL PROTECTED]
                [EMAIL PROTECTED]
-------------------------------------------- 

Reply via email to