[distcc] adding command-line parsing

Martin Pool mbp at samba.org
Thu Jul 17 06:14:59 GMT 2003


On  9 Jul 2003, Wayne Davison <wayned at users.sourceforge.net> wrote:
> 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
> 
> Unfortunately that would make it incompatible with both of it's oldest
> calling syntaxes:
> 
>     CC=distcc
>     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.

Actually, it's the first word that does not look like an object or
source file, so that we can handle

  gcc foo.o -o foo

But that's by the by; as you say I think it's pretty handy to be able
to concisely invoke it that way.  I use a Debian (not Gentoo) system
at work and being able to quickly switch between cc and gcc is nice.

> 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).

Yes, I can see it would be useful.

> 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 --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).

I quite like #2.

I suppose another reason I hesitate to add it is that most of the
time, users should not have to specify any options.  Hosts are
probably better stored in a file for most cases, and most of the other
options should not need to be set except for debugging.  Is that true?
Do you find yourself using options often?

-- 
Martin 



More information about the distcc mailing list