/[autoconf]/autoconf/doc/autoconf.texi
ViewVC logotype

Diff of /autoconf/doc/autoconf.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.555 by eggert, Fri Oct 26 19:52:07 2001 UTC revision 1.556 by eggert, Wed Oct 31 19:26:21 2001 UTC
# Line 8190  Most modern shells provide the current l Line 8190  Most modern shells provide the current l
8190  Its value is the line number of the beginning of the current command.  Its value is the line number of the beginning of the current command.
8191  Autoconf attempts to execute @command{configure} with a modern shell.  Autoconf attempts to execute @command{configure} with a modern shell.
8192  If no such shell is available, it attempts to implement @code{LINENO}  If no such shell is available, it attempts to implement @code{LINENO}
8193  with a simple Awk+Sed prepass that replaces the first instance of the  with a Sed prepass that replaces the each instance of the string
8194  string @code{$LINENO} in each line with the line's number.  @code{$LINENO} (not followed by an alphanumeric character) with the
8195    line's number.
8196    
8197  You should not rely on @code{LINENO} within @command{eval}, as the  You should not rely on @code{LINENO} within @command{eval}, as the
8198  behavior differs in practice.  Also, the possibility of the Awk+Sed  behavior differs in practice.  Also, the possibility of the Sed
8199  prepass means that you should not rely on @code{$LINENO} when quoted,  prepass means that you should not rely on @code{$LINENO} when quoted,
8200  when in here-documents, or when in long commands that cross line  when in here-documents, or when in long commands that cross line
8201  boundaries or that have multiple instances of $LINENO.  Subshells  boundaries.  Subshells should be OK, though.  In the following
8202  should be OK, though.  In the following example, lines 1, 6, and 10  example, lines 1, 6, and 9 are portable, but the other instances of
8203  are portable, but the other instances of @code{LINENO} are not:  @code{LINENO} are not:
8204    
8205  @example  @example
8206  @group  @group
# Line 8211  cat <<EOF Line 8212  cat <<EOF
8212  EOF  EOF
8213  ( echo 6. $LINENO )  ( echo 6. $LINENO )
8214  eval 'echo 7. $LINENO'  eval 'echo 7. $LINENO'
8215  echo 8. $LINENO $LINENO  echo 8. '$LINENO'
8216  echo 9. '$LINENO'  echo 9. $LINENO '
8217  echo 10. $LINENO '  10.' $LINENO
 11.' $LINENO  
8218  @end group  @end group
8219  @group  @group
8220  $ @kbd{bash-2.05 lineno}  $ @kbd{bash-2.05 lineno}
# Line 8223  $ @kbd{bash-2.05 lineno} Line 8223  $ @kbd{bash-2.05 lineno}
8223  4. 2  4. 2
8224  6. 6  6. 6
8225  7. 1  7. 1
8226  8. 8 8  8. $LINENO
8227  9. $LINENO  9. 9
8228  10. 10  10. 9
 11. 10  
8229  @end group  @end group
8230  @group  @group
8231  $ @kbd{zsh-3.0.6 lineno}  $ @kbd{zsh-3.0.6 lineno}
# Line 8235  $ @kbd{zsh-3.0.6 lineno} Line 8234  $ @kbd{zsh-3.0.6 lineno}
8234  4. 2  4. 2
8235  6. 6  6. 6
8236  7. 7  7. 7
8237  8. 8 8  8. $LINENO
8238  9. $LINENO  9. 9
8239  10. 10  10. 9
 11. 10  
8240  @end group  @end group
8241  @group  @group
8242  $ @kbd{pdksh-5.2.14 lineno}  $ @kbd{pdksh-5.2.14 lineno}
# Line 8247  $ @kbd{pdksh-5.2.14 lineno} Line 8245  $ @kbd{pdksh-5.2.14 lineno}
8245  4. 2  4. 2
8246  6. 6  6. 6
8247  7. 0  7. 0
8248  8. 8 8  8. $LINENO
8249  9. $LINENO  9. 9
8250  10. 10  10. 9
 11. 10  
8251  @end group  @end group
8252  @group  @group
8253  $ @kbd{awk '/\$LINENO/@{printf "%d:", NR@}; @{print@}' lineno |}  $ @kbd{sed '=' <lineno |}
8254  > @kbd{sed '/\$LINENO/s/^\([^:]*\):\(.*\)\$LINENO/\2\1/' |}  > @kbd{  sed '}
8255  > @kbd{sh}  > @kbd{    N}
8256    > @kbd{    s,$,-,}
8257    > @kbd{    : loop}
8258    > @kbd{    s,^\([0-9]*\)\(.*\)[$]LINENO\([^a-zA-Z0-9_]\),\1\2\1\3,}
8259    > @kbd{    t loop}
8260    > @kbd{    s,-$,,}
8261    > @kbd{    s,^[0-9]*\n,,}
8262    > @kbd{  ' |}
8263    > @kbd{  sh}
8264  1. 1  1. 1
8265  3. 3  3. 3
8266  4. 4  4. 4
# Line 8264  $ @kbd{awk '/\$LINENO/@{printf "%d:", NR Line 8269  $ @kbd{awk '/\$LINENO/@{printf "%d:", NR
8269  8. 8  8. 8
8270  9. 9  9. 9
8271  10. 10  10. 10
 11. 11  
8272  @end group  @end group
8273  @end example  @end example
8274    

Legend:
Removed from v.1.555  
changed lines
  Added in v.1.556

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26