recompilation. You should include the file @file{stamp-h.in} your
package's distribution, so that @command{make} considers
@file{config.h.in} up to date. Don't use @command{touch}
-(@pxref{Limitations of Usual Tools}); instead, use @command{echo} (using
+(@pxref{touch, , Limitations of Usual Tools}); instead, use
+@command{echo} (using
@command{date} would cause needless differences, hence @acronym{CVS}
conflicts, etc.).
Look for the best available @code{grep} or @code{ggrep} that accepts the
longest input lines possible, and that supports multiple @option{-e} options.
Set the output variable @code{GREP} to whatever is chosen.
-@xref{Limitations of Usual Tools}, for more information about
+@xref{grep, , Limitations of Usual Tools}, for more information about
portability problems with the @command{grep} command family.
@end defmac
@ovindex SED
Set output variable @code{SED} to a Sed implementation that conforms to
Posix and does not have arbitrary length limits. Report an error if no
-acceptable Sed is found. @xref{Limitations of Usual Tools}, for more
+acceptable Sed is found. @xref{sed, , Limitations of Usual Tools}, for more
information about portability problems with Sed.
@end defmac
@cindex unbalanced parentheses, managing
One of the pitfalls of portable shell programming is that @command{case}
-statements require unbalanced parentheses (@pxref{Limitations of
-Builtins, , Limitations of Shell Builtins}). With syntax highlighting
+statements require unbalanced parentheses (@pxref{case, , Limitations of
+Shell Builtins}). With syntax highlighting
editors, the presence of unbalanced @samp{)} can interfere with editors
that perform syntax highlighting of macro contents based on finding the
matching @samp{(}. Another concern is how much editing must be done
Expand into a shell @samp{case} statement, where @var{word} is matched
against one or more patterns. @var{if-matched} is run if the
corresponding pattern matched @var{word}, else @var{default} is run.
+Avoids several portability issues (@pxref{case, , Limitations of Shell
+Builtins}).
@end defmac
@c Deprecated, to be replaced by a better API
Emits @var{word} to the standard output, followed by a newline. @var{word}
must be a single shell word (typically a quoted string). The bytes of
@var{word} are output as-is, even if it starts with "-" or contains "\".
-Redirections can be placed outside the macro invocation.
+Redirections can be placed outside the macro invocation. This is much
+more portable than using @command{echo} (@pxref{echo, , Limitations of
+Shell Builtins}).
@end defmac
@defmac AS_ECHO_N (@var{word})
converted to @samp{1}. To exit with successful status, it is necessary
to supply an explicit @var{status} that expands to @samp{0}. This macro
works around shells that see the exit status of the command prior to
-@code{exit} inside a @samp{trap 0} handler (@pxref{Limitations of
-Builtins, , Limitations of Shell Builtins}).
+@code{exit} inside a @samp{trap 0} handler (@pxref{trap, , Limitations
+of Shell Builtins}).
@end defmac
@defmac AS_IF (@var{test1}, @ovar{run-if-true1}, @dots{}, @ovar{run-if-false})
as necessary. This is equivalent to @samp{mkdir -p -- @var{file-name}},
except that it is portable to older versions of @command{mkdir} that
lack support for the @option{-p} option or for the @option{--}
-delimiter. Also, @code{AS_MKDIR_P}
+delimiter (@pxref{mkdir, , Limitations of Usual Tools}). Also,
+@code{AS_MKDIR_P}
succeeds if @var{file-name} is a symbolic link to an existing directory,
even though Posix is unclear whether @samp{mkdir -p} should
succeed in that case. If creation of @var{file-name} fails, exit the
@asindex{SET_STATUS}
Emit shell code to set the value of @samp{$?} to @var{status} without
forking. However, this is not guaranteed to abort a shell running with
-@code{set -e} (@pxref{Limitations of Builtins, , Limitations of Shell
-Builtins}).
+@code{set -e} (@pxref{set, , Limitations of Shell Builtins}).
@end defmac
@defmac AS_TR_CPP (@var{expression})
@defmac AS_UNSET (@var{var})
@asindex{UNSET}
Unsets the shell variable @var{var}, working around bugs in older
-shells (@pxref{Limitations of Builtins, , Limitations of Shell
+shells (@pxref{unset, , Limitations of Shell
Builtins}). @var{var} can be a literal or indirect variable name.
@end defmac
@noindent
Make sure you quote the brackets if appropriate and keep the backslash as
-first character (@pxref{Limitations of Builtins, , Limitations of Shell
-Builtins}).
+first character (@pxref{case, , Limitations of Shell Builtins}).
Also, because the colon is used as part of a drivespec, these systems don't
use it as path separator. When creating or accessing paths, you can use the
@noindent
(actually, there is some complication due to bugs in @command{unset};
-see @pxref{Limitations of Builtins, , Limitations of Shell Builtins}).
+see @pxref{unset, , Limitations of Shell Builtins}).
@item FPATH
The Korn shell uses @env{FPATH} to find shell functions, so avoid
It is probably not worth worrying about these shells any more.
With @acronym{AIX} sh, a @command{trap} on 0 installed in a shell function
-triggers at function exit rather than at script exit, see @xref{Limitations
-of Builtins}.
+triggers at function exit rather than at script exit, see @xref{trap, ,
+Limitations of Shell Builtins}.
@node Limitations of Builtins
@section Limitations of Shell Builtins
The use of @samp{break 2} etc.@: is safe.
+@anchor{case}
@item @command{case}
@c -----------------
@prindex @command{case}
Also please see the discussion of the @command{pwd} command.
+@anchor{echo}
@item @command{echo}
@c -----------------
@prindex @command{echo}
@code{AC_MSG_ERROR} macro that has a workaround for this problem.
+@anchor{export}
@item @command{export}
@c -------------------
@prindex @command{export}
@command{/bin/sh} for example).
+@anchor{set}
@item @command{set}
@c ----------------
@prindex @command{set}
@samp{@var{foo}} contains backslashes.
+@anchor{trap}
@item @command{trap}
@c -----------------
@prindex @command{trap}
@end quotation
+@anchor{unset}
@item @command{unset}
@c ------------------
@prindex @command{unset}
@noindent
@xref{Special Shell Variables}, for some neutralizing values. Also, see
-@ref{Limitations of Builtins}, documentation of @command{export}, for
+@ref{export, , Limitations of Builtins}, for
the case of environment variables.
@item @command{wait}
|bar
@end example
-@command{$EGREP} also suffers the limitations of @command{grep}.
+@command{$EGREP} also suffers the limitations of @command{grep}
+(@pxref{grep, , Limitations of Usual Tools}).
@item @command{expr}
@c -----------------
while @acronym{GNU} @command{find} reports @samp{./foo-./foo}.
+@anchor{grep}
@item @command{grep}
@c -----------------
@prindex @command{grep}
@samp{.c} files. This is no longer a practical problem, since current
@command{ls} implementations send diagnostics to standard error.
+@anchor{mkdir}
@item @command{mkdir}
@c ------------------
@prindex @command{mkdir}
Just as with @command{rm}, some platforms refuse to remove a working
directory.
+@anchor{sed}
@item @command{sed}
@c ----------------
@prindex @command{sed}
the macro @code{AM_INIT_AUTOMAKE} has some options controlling which
level of portability to use.
+@anchor{touch}
@item @command{touch}
@c ------------------
@prindex @command{touch}
T || :; rm -f U}.
However, even this approach can run into common bugs in @acronym{BSD}
implementations of the @option{-e} option of @command{sh} and
-@command{set} (@pxref{Limitations of Builtins}), so if you are worried
+@command{set} (@pxref{set, , Limitations of Shell Builtins}), so if you
+are worried
about porting to buggy @acronym{BSD} shells it may be simpler to migrate
complicated @command{make} actions into separate scripts.
like @samp{sleep 1} to work around timestamp truncation bugs.
Commands like @samp{cp -p} and @samp{touch -r} typically do not copy
-file timestamps to their full resolutions (@pxref{Limitations of Usual
+file timestamps to their full resolutions (@pxref{touch, , Limitations of Usual
Tools}). Hence you should be wary of rules like this:
@example