--- status.m4.old 2004-08-20 11:28:22.000000000 -0400 +++ status.m4 2005-01-24 15:57:04.296915200 -0500 @@ -850,7 +850,15 @@ m4_define([AC_LIST_FILES]) m4_define([AC_LIST_FILES_COMMANDS]) - +# _AC_SED_CMD_LIMIT +# ----------------- +# Evaluate to an m4 number equal to the maximum number of commands to put +# in any single sed program. +# +# Some seds have small command number limits, like on Digital OSF/1 and HP-UX. +m4_define([_AC_SED_CMD_LIMIT], +dnl One cannot portably go further than 100 commands because of HP-UX. +[100]) # _AC_OUTPUT_FILES # ---------------- @@ -860,80 +868,140 @@ # It has to send itself into $CONFIG_STATUS (eg, via here documents). # Upon exit, no here document shall be opened. m4_define([_AC_OUTPUT_FILES], -[cat >>$CONFIG_STATUS <<_ACEOF - +[cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. -dnl Please, pay attention that this sed code depends a lot on the shape -dnl of the sed commands issued by AC_SUBST. So if you change one, change -dnl the other too. -[ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF] -dnl These here document variables are unquoted when configure runs -dnl but quoted when config.status runs, so variables are expanded once. -dnl Insert the sed substitutions of variables. +if test -n "$CONFIG_FILES"; then + +_ACEOF + +m4_pushdef([_AC_SED_CMDS], [])dnl +m4_pushdef([_AC_SED_FRAG_NUM], 0)dnl Fragment number. +m4_pushdef([_AC_SED_LINES], 0)dnl Number of lines in current fragment so far. +m4_pushdef([_AC_SED_LINES_LIMIT], [])dnl Max lines to put in each fragment. +dnl m4_ifdef([_AC_SUBST_VARS], - [AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), -[s,@AC_Var@,$AC_Var,;t t +[# Create sed programs to substitute non-file output variables. + +m4_define([_AC_SED_LINES_LIMIT], m4_eval((_AC_SED_CMD_LIMIT-2)/2))dnl +# Init the delimiter to something very unlikely. +ac_delim='@!_!#_' + +AC_FOREACH([_AC_Var], m4_defn([_AC_SUBST_VARS])[ @address@hidden, +[m4_if(_AC_Var, address@hidden@], +[dnl @END@ marker is here just to end last fragment. +m4_if(_AC_SED_LINES, 0, [],dnl Last segment already ended. +dnl Trigger fake end of frag, without losing number of lines in it. +[m4_define([_AC_SED_LINES_LIMIT],_AC_SED_LINES)])], +dnl Not at @END@; actually do something. +[dnl Start new fragment if needed. +m4_if(_AC_SED_LINES, 0, +[dnl Increment fragment number. +m4_define([_AC_SED_FRAG_NUM],m4_eval(_AC_SED_FRAG_NUM+1))dnl +dnl Record that this frament will need to be used. +m4_define([_AC_SED_CMDS], +m4_defn([_AC_SED_CMDS])[| sed -f $tmp/subs-]_AC_SED_FRAG_NUM[.sed ])dnl +dnl Begin constructing the fragment. +[while :; do + # Store some of the output variables in a file where they can be turned into + # a sed program that config.status will use. + cat >conf$$subs.sed <<_ACEOF +]])dnl New fragment is started. +$ac_delim<_AC_Var>$ac_delim$_AC_Var$ac_delim +m4_define([_AC_SED_LINES], m4_incr(_AC_SED_LINES))dnl Increment line. +])dnl +dnl End fragment if needed. +m4_if(_AC_SED_LINES, _AC_SED_LINES_LIMIT, +[_ACEOF + # Make certain that only the expected number of $ac_delim's have been output + # into the program. If there is a different number, the delimiter has + # appeared in one of the output variables, and this is sure to confuse + # something, so change the delimiter and generate all the sed program + # fragments again. +dnl Note that grep -c doesn't do the right thing because it counts lines +dnl with matches, not total number of matches. + if test `sed -n ' +:d +s/'"$ac_delim"'//; t i +$!b +dnl This can't be looking for more than (_AC_SED_CMD_LIMIT-2)/2*3, which is +dnl plenty small enough to not trip any line length limits. +x; s/x\{m4_eval(_AC_SED_LINES*3)\}/yes/; s/yesx+/no/; /^yes$/!s/.*/no/; p; q +:i +x; s/$/x/; x; t d +' < conf$$subs.sed +` != yes; then + ac_delim=$ac_delim'_' + else break; fi +done +# Have config.status create the needed sed program. +cat >>$CONFIG_STATUS <<\_ACEOF + cat >$tmp/subs-_AC_SED_FRAG_NUM.sed <<\CEOF +[:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +# Output the sed program verbatim to config.status, properly escaping its +# contents as needed. Note that this escaping is now safe because $ac_delim +# contains none of [[\\&,]] and occurs only where it was inserted above. +sed ' +s/[\\&,]/\\&/g +s/$/\\/ +s/'"$ac_delim"''"$ac_delim"'/@,/ +s/'"$ac_delim"'\\$/,; t t/ +' >$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF +]CEOF +_ACEOF + +m4_define([_AC_SED_LINES], 0)dnl ])])dnl + +]) + m4_ifdef([_AC_SUBST_FILES], - [AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_FILES]), -[/@AC_Var@/r $AC_Var -s,@AC_Var@,,;t t -])])dnl -CEOF +[# Create sed programs to substitute non-file output variables. -_ACEOF +m4_define([_AC_SED_LINES_LIMIT], m4_eval((_AC_SED_CMD_LIMIT-2)/2))dnl +AC_FOREACH([_AC_Var], m4_defn([_AC_SUBST_FILES])[ @address@hidden, +[m4_if(_AC_Var, address@hidden@], +[dnl @END@ marker is here just to end last fragment. +m4_if(_AC_SED_LINES, 0, [],dnl Last segment already ended. + dnl Trigger fake end of frag, without losing number of lines in it. + [m4_define([_AC_SED_LINES_LIMIT],_AC_SED_LINES)])], +dnl Not at @END@; actually do something. +[dnl Start new fragment if needed. +m4_if(_AC_SED_LINES, 0, +[dnl Increment fragment number. +m4_define([_AC_SED_FRAG_NUM],m4_eval(_AC_SED_FRAG_NUM+1))dnl +dnl Record that this frament will need to be used. +m4_define([_AC_SED_CMDS], +m4_defn([_AC_SED_CMDS])[| sed -f $tmp/subs-]_AC_SED_FRAG_NUM[.sed ])dnl +dnl Begin constructing the fragment. +[ cat >>$CONFIG_STATUS <<_ACEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +]])dnl New fragment is started. +/@AC_Var@/r $AC_Var +s,@AC_Var@,,;t t +m4_define([_AC_SED_LINES], m4_incr(_AC_SED_LINES))dnl Increment line. +])dnl +m4_if(_AC_SED_LINES, _AC_SED_LINES_LIMIT, +[_ACEOF - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. -dnl One cannot portably go further than 100 commands because of HP-UX. -dnl Here, there are 2 cmd per line, and two cmd are added later. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo [':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b'] && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi +m4_define([_AC_SED_LINES], 0)dnl +])])])dnl +dnl +m4_popdef([_AC_SED_FRAG_NUM])dnl +m4_popdef([_AC_SED_LINES])dnl +m4_popdef([_AC_SED_LINES_LIMIT])dnl +dnl +cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in @@ -1018,8 +1086,8 @@ s,@abs_top_builddir@,$ac_abs_top_builddir,;t t AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [s,@INSTALL@,$ac_INSTALL,;t t ])dnl -dnl The parens around the eval prevent an "illegal io" in Ultrix sh. -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out +" $ac_file_inputs m4_defn([_AC_SED_CMDS])>$tmp/out +m4_popdef([_AC_SED_CMDS])dnl rm -f $tmp/stdin dnl This would break Makefile dependencies. dnl if diff $ac_file $tmp/out >/dev/null 2>&1; then