diff --git a/ChangeLog b/ChangeLog index 90160663..665b7926 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2006-12-05 Ralf Wildenhues + * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): When + creating the awk substitution script, handle one input line at a + time, so that the maximum length of a substituted (multi-line) + value is not limited by the size of the sed pattern space. + The trade-off is a slightly repetitive sed script. + * doc/autoconf.texi (Limitations of Usual Tools): Branch labels + can only have up to 7 characters, due to Solaris 10 /bin/sed. + * tests/torture.at (Substitute a 2000-byte string): Increase the + test with several long lines, they should not be caught by sed + limits any more. + * tests/tools.at (autom4te preselections): New test, to flag entries missing from autom4te.cfg. Report by David Byron . diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 4a0d8749..9ae44ce4 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -13694,7 +13694,7 @@ them. Unicos 9 @command{sed} loops endlessly on patterns like @samp{.*\n.*}. -Sed scripts should not use branch labels longer than 8 characters and +Sed scripts should not use branch labels longer than 7 characters and should not contain comments. @acronym{HP-UX} sed has a limit of 99 commands (not counting @samp{:} commands) and 48 labels, which can not be circumvented by using more than one script diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 6a7398d7..175c5adc 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -420,10 +420,20 @@ if test -n "$ac_eof"; then fi dnl Initialize an awk array of substitutions, keyed by variable name. dnl -dnl First read a whole (potentially multi-line) substitution, -dnl and construct `S["VAR"]='. Then, split it into pieces that fit -dnl in an awk literal. Each piece then gets active characters escaped -dnl (if we escape earlier we risk splitting inside an escape sequence). +dnl The initial line contains the variable name VAR, then a `!'. +dnl Construct `S["VAR"]=' from it. +dnl The rest of the line, and potentially further lines, contain the +dnl substituted value; the last of those ends with $ac_delim. We split +dnl the output both along those substituted newlines and at intervals of +dnl length _AC_AWK_LITERAL_LIMIT. The latter is done to comply with awk +dnl string literal limitations, the former for simplicity in doing so. +dnl +dnl We deal with one input line at a time to avoid sed pattern space +dnl limitations. We kill the delimiter $ac_delim before splitting the +dnl string (otherwise we risk splitting the delimiter). And we do the +dnl splitting before the quoting of awk special characters (otherwise we +dnl risk splitting an escape sequence). +dnl dnl Output as separate string literals, joined with backslash-newline. dnl Eliminate the newline after `=' in a second script, for readability. dnl @@ -437,31 +447,43 @@ dnl m4-double-quote most of the scripting for readability. [cat >>$CONFIG_STATUS <<_ACEOF cat >>"\$tmp/subs.awk" <<\CEOF$ac_eof _ACEOF -sed ' -t line -:line -s/'"$ac_delim"'$//; t gotline -N; b line -:gotline +sed -n ' h -s/^/S["/; s/!.*/"]=/; p +s/^/S["/; s/!.*/"]=/ +p g s/^[^!]*!// -:more -t more +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl h s/\(.\{]_AC_AWK_LITERAL_LIMIT[\}\).*/\1/ -t notlast -s/["\\]/\\&/g; s/\n/\\n/g -s/^/"/; s/$/"/ -b -:notlast -s/["\\]/\\&/g; s/\n/\\n/g -s/^/"/; s/$/"\\/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{]_AC_AWK_LITERAL_LIMIT[\}// -b more +t nl +:delim +h +s/\(.\{]_AC_AWK_LITERAL_LIMIT[\}\).*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{]_AC_AWK_LITERAL_LIMIT[\}// +t delim '