From: Alexandre Duret-Lutz Date: Sat, 12 Feb 2005 11:42:25 +0000 (+0000) Subject: * automake.in (read_am_file): Define variable containing long X-Git-Tag: Release-1-9b~187 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f060cce8e6ad9d768c6bcd90c0819546b0aa6b3;p=thirdparty%2Fautomake.git * automake.in (read_am_file): Define variable containing long lines as VAR_PRETTY to work around tools with limited input width. * tests/longlin2.test: New file. * tests/Makefile.am (TESTS): Add it. Report from Albert Chin. --- diff --git a/ChangeLog b/ChangeLog index 9ad3f2a39..ee44f88b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-02-12 Alexandre Duret-Lutz + + * automake.in (read_am_file): Define variable containing long + lines as VAR_PRETTY to work around tools with limited input width. + * tests/longlin2.test: New file. + * tests/Makefile.am (TESTS): Add it. + Report from Albert Chin. + 2005-02-09 Alexandre Duret-Lutz Fix for PR automake/447: diff --git a/automake.in b/automake.in index 7501d74a9..103cf9808 100755 --- a/automake.in +++ b/automake.in @@ -5925,6 +5925,7 @@ sub read_am_file ($$) my $comment = ''; my $blank = 0; my $saw_bk = 0; + my $var_look = VAR_ASIS; use constant IN_VAR_DEF => 0; use constant IN_RULE_DEF => 1; @@ -6093,21 +6094,35 @@ sub read_am_file ($$) $last_var_value = $3; $last_where = $where->clone; if ($3 ne '' && substr ($3, -1) eq "\\") - { + { # We preserve the `\' because otherwise the long lines # that are generated will be truncated by broken # `sed's. $last_var_value = $3 . "\n"; - } + } + # Normally we try to output variable definitions in the + # same format they were input. However, POSIX compliant + # systems are not required to support lines longer than + # 2048 bytes (most notably, some sed implementation are + # limited to 4000 bytes, and sed is used by config.status + # to rewrite Makefile.in into Makefile). Moreover nobody + # would really write such long lines by hand since it is + # hardly maintainable. So if a line is longer that 1000 + # bytes (an arbitrary limit), assume it has been + # automatically generated by some tools, and flatten the + # variable definition. Otherwise, keep the variable as it + # as been input. + $var_look = VAR_PRETTY if length ($last_var_value) >= 1000; if (!/\\$/) { Automake::Variable::define ($last_var_name, VAR_MAKEFILE, $last_var_type, $cond, $last_var_value, $comment, - $last_where, VAR_ASIS) + $last_where, $var_look) if $cond != FALSE; $comment = $spacing = ''; + $var_look = VAR_ASIS; } } elsif (/$INCLUDE_PATTERN/o) diff --git a/tests/Makefile.am b/tests/Makefile.am index 80779b6f0..14f3ab39d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -321,6 +321,7 @@ lisp6.test \ listval.test \ location.test \ longline.test \ +longlin2.test \ ltcond.test \ ltcond2.test \ ltconv.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 837565d63..2bc7a32a3 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -441,6 +441,7 @@ lisp6.test \ listval.test \ location.test \ longline.test \ +longlin2.test \ ltcond.test \ ltcond2.test \ ltconv.test \ diff --git a/tests/longlin2.test b/tests/longlin2.test new file mode 100755 index 000000000..ec1eee24e --- /dev/null +++ b/tests/longlin2.test @@ -0,0 +1,54 @@ +#! /bin/sh +# Copyright (C) 2005 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. + +# Long lines should be wrapped. +# Report from Albert Chin. + +. ./defs || exit 1 + +set -e + +n=1 +files= +match= +while test $n -le 100 +do + files="$files filename$n" + match="..........$match" + n=`expr $n + 1` +done +files2=`echo "$files" | sed s/filename/filenameb/g` + +cat >Makefile.am <