[distcc] adding command-line parsing

Wayne Davison wayned at users.sourceforge.net
Wed Jul 9 16:26:03 GMT 2003

On Wed, Jul 09, 2003 at 10:09:26AM +0200, Markus Werle wrote:
> I already showed in this thread that it is quite simple to
> just use the convention that only args after
> --compiler=<somecompiler> are treated as compiler options.

Unfortunately that would make it incompatible with both of it's oldest
calling syntaxes:

    CC="distcc gcc"

I personally think that the --compiler option is overkill, and having
distcc treat the first (non-distcc-option) word on the line as the
compiler name is a good idiom to preserve.  I can also see that having
the ability to control distcc through options would be a nice addition
to the various existing ways to control distcc, but not as a replacement
for them (e.g. I would continue to use masquerade mode in my setup).

The problem then becomes, how can you still support the first syntax
above while adding a new option syntax.  One way would be to have a
"start parsing options" idiom that must occur first that cannot occur
on a normal compiler command-line.  Like this:

    distcc --distcc --hosts=foo,bar --verbose gcc

The --distcc tells us two things:  (1) start parsing distcc options, and
(2) there must be a compiler name at the end of the options.

Alternately, we make all distcc options start with a unique prefix, e.g.

    distcc --distcc-hosts=foo,bar --distcc-verbose gcc
    distcc --distcc-help
    distcc --distcc-version

This lets you snarf all strings that start with --distcc-, and stop
whenever the prefix is no longer there.  This idiom would not require
the compiler name to be present (since the current heuristic on
defaulting to "cc" could be used if the first non-distcc string looks
like an option).

Either of these would preserve the current distcc calling syntaxes:

    distcc -o foo -c foo.c
    distcc gcc -o foo -c foo.c

while also adding the ability to include new distcc-affecting command-
line options (if the user desires to use them).


More information about the distcc mailing list