From: Alexandre Duret-Lutz Date: Mon, 24 Feb 2003 22:09:21 +0000 (+0000) Subject: * lib/am/texibuild.am: Don't remove the target info files. Instead, X-Git-Tag: Release-1-7-3b~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fee13fe9b4e034529fc2ff8fd04fee766a3920c;p=thirdparty%2Fautomake.git * lib/am/texibuild.am: Don't remove the target info files. Instead, back up and restore them if makeinfo fails. * tests/txinfo20.test: New file. * tests/Makefile.am (TESTS): Add txinfo20.test. --- diff --git a/ChangeLog b/ChangeLog index ea5f4c01d..b54fcc481 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-02-22 Bruno Haible + Alexandre Duret-Lutz + + * lib/am/texibuild.am: Don't remove the target info files. Instead, + back up and restore them if makeinfo fails. + * tests/txinfo20.test: New file. + * tests/Makefile.am (TESTS): Add txinfo20.test. + 2003-02-23 Alexandre Duret-Lutz * automake.texi (FAQ, CVS, maintainer-mode, wildcards) diff --git a/Makefile.in b/Makefile.in index c8a50d2a2..cfe5432d4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -198,9 +198,18 @@ uninstall-binSCRIPTS: done .texi.info: - @rm -f $@ $@-[0-9] $@-[0-9][0-9] + backupdir=somedir && rm -rf $$backupdir && mkdir $$backupdir && \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then \ + mv $$f $$backupdir; \ + fi \ + done; \ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ - -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ + rc=$$?; \ + test $$rc != 0 && mv $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + rm -rf $$backupdir; \ + exit $$rc .texi.dvi: TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ @@ -255,9 +264,10 @@ uninstall-info-am: @list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ (if cd $(DESTDIR)$(infodir); then \ - echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9])"; \ - rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9]; \ + echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ done @@ -280,11 +290,10 @@ mostlyclean-aminfo: automake.vrs automake.dvi automake.pdf automake.ps maintainer-clean-aminfo: - list='$(INFO_DEPS)'; for i in $$list; do \ - rm -f $$i; \ - if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ - rm -f $$i-[0-9]*; \ - fi; \ + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done # This directory's subdirectories are mostly independent; you can cd @@ -492,7 +501,7 @@ distcheck: dist mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd` \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ @@ -600,7 +609,9 @@ install-info-am: $(INFO_DEPS) @list='$(INFO_DEPS)'; \ for file in $$list; do \ if test -f $$file; then d=.; else d=$(srcdir); fi; \ - for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9]; do \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ if test -f $$ifile; then \ relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ echo " $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile"; \ diff --git a/NEWS b/NEWS index 89a5dc4a6..0974445fe 100644 --- a/NEWS +++ b/NEWS @@ -51,6 +51,8 @@ New in 1.7a: versions of Automake, because AC_PROG_CC defines this variable since Autoconf 2.54.) +* Texinfo rules back up and restore info files when makeinfo fails. + New in 1.7: * Autoconf 2.54 is required. diff --git a/aclocal.m4 b/aclocal.m4 index 444454ad7..fe224085c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -583,11 +583,17 @@ AC_CACHE_CHECK([dependency style of $depcc], if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 && + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ + >/dev/null 2>conftest.err && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_$1_dependencies_compiler_type=$depmode - break + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi fi done diff --git a/configure b/configure index 72cc8a09a..92b3fbd1c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57a for GNU Automake 1.7a. +# Generated by GNU Autoconf 2.57 for GNU Automake 1.7a. # # Report bugs to . # @@ -852,7 +852,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF GNU Automake configure 1.7a -generated by GNU Autoconf 2.57a +generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. @@ -867,7 +867,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU Automake $as_me 1.7a, which was -generated by GNU Autoconf 2.57a. Invocation command line was +generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1454,15 +1454,6 @@ echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then @@ -2196,7 +2187,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by GNU Automake $as_me 1.7a, which was -generated by GNU Autoconf 2.57a. Invocation command line was +generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -2251,7 +2242,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ GNU Automake config.status 1.7a -configured by $0, generated by GNU Autoconf 2.57a, +configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 diff --git a/lib/am/texibuild.am b/lib/am/texibuild.am index 00fecc5db..d7665a239 100644 --- a/lib/am/texibuild.am +++ b/lib/am/texibuild.am @@ -20,19 +20,38 @@ ?GENERIC_INFO?%SOURCE_SUFFIX%%DEST_SUFFIX%: ?!GENERIC_INFO?%DEST_PREFIX%%DEST_SUFFIX%: %SOURCE_INFO% %DEPS% -## Note that we also remove the possible output files before running -## makeinfo. Otherwise, if the texinfo file shrinks (or if you start -## using --no-split), you'll be left with some dead info files lying -## around -- dead files which will end up in the distribution. -## *.iNN files are used on DJGPP. See the comments in install-info-am - @rm -f $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9] ## It is wrong to have `info' files dependent on %DIRSTAMP%, because ## `info' files are distributed and %DIRSTAMP% isn't: a distributed file ## should never be dependent upon a non-distributed built file. ## Therefore we ensure that %DIRSTAMP% exists in the rule. ?DIRSTAMP? @test -f %DIRSTAMP% || $(MAKE) %DIRSTAMP% - $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \ - -o $@ `test -f '%SOURCE_INFO%' || echo '$(srcdir)/'`%SOURCE_INFO% +## Back up the info files before running makeinfo. This is the cheapest +## way to ensure that +## 1) If the texinfo file shrinks (or if you start using --no-split), +## you'll not be left with some dead info files lying around -- dead +## files which would end up in the distribution. +## 2) If the texinfo file has some minor mistakes which cause makeinfo +## to fail, the info files are not removed. (They are needed by the +## developer while he writes documentation.) +## *.iNN files are used on DJGPP. See the comments in install-info-am + restore=: && \ + backupdir="$(am__leading_dot)am$$$$" && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then \ + mv $$f $$backupdir; \ + restore=mv; \ + fi; \ + done; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \ + -o $@ `test -f '%SOURCE_INFO%' || echo '$(srcdir)/'`%SOURCE_INFO%; \ + then rc=0; else \ + rc=$$?; \ +## Beware that backup info files might come from a subdirectory. + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; \ + exit $$rc ?GENERIC?%SOURCE_SUFFIX%.dvi: ?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP% diff --git a/tests/Makefile.am b/tests/Makefile.am index 194ffd4aa..8c3f92161 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -425,6 +425,7 @@ txinfo16.test \ txinfo17.test \ txinfo18.test \ txinfo19.test \ +txinfo20.test \ transform.test \ unused.test \ vars.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index b9bd15e83..c6caa3f4a 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -519,6 +519,7 @@ txinfo16.test \ txinfo17.test \ txinfo18.test \ txinfo19.test \ +txinfo20.test \ transform.test \ unused.test \ vars.test \ diff --git a/tests/txinfo20.test b/tests/txinfo20.test new file mode 100755 index 000000000..bcc3b8ad0 --- /dev/null +++ b/tests/txinfo20.test @@ -0,0 +1,82 @@ +#! /bin/sh +# Copyright (C) 2003 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Make sure info files survive makeinfo errors. + +required=makeinfo +. ./defs || exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am << 'END' +info_TEXINFOS = main.texi sub/main.texi +END + +mkdir sub + +cat > main.texi << 'END' +\input texinfo +@setfilename main +@settitle main +@node Top +Hello walls. +@bye +END + +cp main.texi sub/main.texi + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure +$MAKE + +# Feign more info files. +: > main-1 +: > sub/main-1 + +# Break main.texi +$sleep +cp main.texi main.old +cat > main.texi << 'END' +\input texinfo +@setfilename main +@settitle main +@node Top +@unknown_macro{Hello walls.} +@bye +END + +# makeinfo will bail out, but we should conserve the old info files. +$MAKE && exit 1 +test -f main +test -f main-1 + +# Restore main.texi, and break sub/main.texi +cp main.texi sub/main.texi +mv main.old main.texi +$MAKE && exit 1 +test -f main +test ! -f main-1 +test -f sub/main +test -f sub/main-1