Node:File System Conventions, Next:Shell Substitutions, Previous:File Descriptors, Up:Portable Shell
While autoconf
and friends will usually be run on some Unix
variety, it can and will be used on other systems, most notably DOS
variants. This impacts several assumptions regarding file and
path names.
For example, the following code:
case $foo_dir in /*) # Absolute ;; *) foo_dir=$dots$foo_dir ;; esac
will fail to properly detect absolute paths on those systems, because
they can use a drivespec, and will usually use a backslash as directory
separator. The canonical way to check for absolute paths is:
case $foo_dir in [\\/]* | ?:[\\/]* ) # Absolute ;; *) foo_dir=$dots$foo_dir ;; esac
Make sure you quote the brackets if appropriate and keep the backslash as first character (see Limitations of 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, use the
PATH_SEPARATOR
output variable instead. configure
sets this
to the appropriate value (:
or ;
) when it starts up.
File names need extra care as well. While DOS-based environments
that are Unixy enough to run autoconf
(such as DJGPP) will
usually be able to handle long file names properly, there are still
limitations that can seriously break packages. Several of these issues
can be easily detected by the
doschk
package.
A short overview follows; problems are marked with SFN/LFN to indicate where they apply: SFN means the issues are only relevant to plain DOS, not to DOS boxes under Windows, while LFN identifies problems that exist even under Windows.
autoconf
uses a .in suffix for template files.
This is perfectly OK on Unices:
AC_CONFIG_HEADER(config.h) AC_CONFIG_FILES([source.c foo.bar]) AC_OUTPUT
but it causes problems on DOS, as it requires config.h.in
,
source.c.in
and foo.bar.in
. To make your package more portable
to DOS-based environments, you should use this instead:
AC_CONFIG_HEADER(config.h:config.hin) AC_CONFIG_FILES([source.c:source.cin foo.bar:foobar.in]) AC_OUTPUT
autoconf
.
INSTALL
and a directory called install
. This
also affects make
; if there's a file called INSTALL
in
the directory, make install
will do nothing (unless the
install
target is marked as PHONY).
foobar-part1.c
, foobar-part2.c
and
foobar-prettybird.c
all resolve to the same filename
(FOOBAR-P.C
). The same goes for foo.bar
and
foo.bartender
.
Note: This is not usually a problem under Windows, as it uses numeric
tails in the short version of filenames to make them unique. However, a
registry setting can turn this behaviour off. While this makes it
possible to share file trees containing long file names between SFN
and LFN environments, it also means the above problem applies there
as well.
/
, \
,
?
, *
, :
, <
, >
, |
and "
.
In a SFN environment, other characters are also invalid. These
include +
, ,
, [
and ]
.