automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Portable, Provable, Path separator test?


From: Tim Van Holder
Subject: Portable, Provable, Path separator test?
Date: Wed, 24 Jan 2001 20:59:01 +0100

I'd like to add (at some point) a macro that detects the path separator
used on the _build_ system. This is important for:
 a) the path walking macros; they set IFS to ':' assuming this will
    break up the PATH into its constituent directories.
 b) MANY makefiles, which often use PATH=../src:$PATH or something
    similar to use locally built versions before globally installed
    ones (example: the libintl makefile). Also, this method is used
    by the texinfo component of automake
 c) Build scripts (such as the autoconf test suite) may also use
    ':' as assumed path separator.

On DOS, this breaks, as PATH will usually look like C:\Windows;C:\Dos.

I'd suggest this at the top of configure (either in AC_INIT_PREPARE,
or in AS_SANITIZE_SHELL.

dnl Apparently this is a good 'is this DOS/Windows?' test
if test -n "$COMSPEC$ComSpec"; then
  ac_pathsep=';'
else
  ac_pathsep=':'
fi

and a macro (AC_PATHSEP) that AC_SUBSTs PATH_SEPARATOR (or PATHSEP,
but I've been using PATH_SEPARATOR in my patched autoconf for over a
year now) to this value (for use in makefiles/build scripts).
Those will obviously have to be adjusted as well (with the caveat
that quoting will be required, as ';' is special in a shell).

So for automake, this rule (from texinfo.am):

.texi.dvi:
        address@hidden@:$$TEXINPUTS \
## Must set MAKEINFO like this so that version.texi will be found even
## if it is in srcdir.
          MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<

would become:

.texi.dvi:
        TEXINPUTS="@TEXINFODIR@@address@hidden" \
## Must set MAKEINFO like this so that version.texi will be found even
## if it is in srcdir.
          MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<


My main problem is the DOS/Windows check, as the shells in some of
those environments (Cygwin, notably) use kludges to get a Unixy look
in PATH , which would cause using ';' as pathsep to fail.
In particular, Cygwin uses /cygdrive/c/foo instead of c:/foo, and
DJGPP's bash will (if the envvar PATH_SEPARATOR is set to ':'),
transform some envvars (including PATH) to use /dev/c/foo notation.
The latter is particularly annoying as it would DTRT for some, but
not all paths if ':' was used as pathsep.
So I would like to know if there was another, better, test to
determine the proper path separator on a system.
Of course, instead of a test, we could always default ac_pathsep to
':', and leave it to a site file to override it (which is how I'm
handling it at the moment).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]