[cfe-dev] [patch] Add configure option for C include search path

Daniel Dunbar daniel at zuster.org
Wed Nov 11 10:35:06 PST 2009


Sorry it's taken me a while to weigh in on this thread.

I support adding a configure option for this stuff, if it solves a
real problem, but in the long term this is not the direction we want
to go (so don't spend too much time thinking about the design).

Clang is designed as a cross compiler, so we don't ultimately want to
make decisions at build time.

My plan for a more robust long term solution to this is starting to
get outlined here:
  http://clang.llvm.org/UniversalDriver.html

The basic idea is simple: clang gets a new option "-target" which
specifies the target configuration. The default should make sense.

Internally, the clang driver essentially maintains a database of
"configurations", which specifies all (or a subset) of the runtime
configuration information that clang needs to work (include paths,
runtime support library locations, default flags, etc.).

The way I see this integrating is that the driver will have a few
options for how it gets its configuration database. For example,
 1. At configure time, autoconf will simple try to build
configurations for the local system, or map them to know
configurations.
 2. The driver will probably have some builtin database of known
configurations (similar to what we have now, but instead of a union of
everything this will clearly define that something is the "ubuntu9..."
configuration.
 3. At runtime, the driver will have some support for finding the
right configuration, or for inferring a new configuration.
 4. The user will have tools (through the driver or another
application) for managing the database.

One main implication is that users shouldn't generally need to specify
include paths on the command line -- either we should "know enough"
that we can construct the right configuration, or we have good enough
"infer" logic to construct a reasonable configuration.

Does this make sense?

 - Daniel

On Tue, Nov 10, 2009 at 6:12 PM, Chandler Carruth <chandlerc at google.com> wrote:
> On Tue, Nov 10, 2009 at 6:09 PM, Rafael Espindola <espindola at google.com> wrote:
>> 2009/11/4 Rafael Espindola <espindola at google.com>:
>>> The attached patches adds support defining the C search paths with configure:
>>>
>>> ../src/configure --with-include-dirs=foo:bar:zed
>>>
>>> Will create a clang binary that searches for C headers in foo, bar and
>>> zed. If the
>>> option is not given, the current runtime search is done.
>>
>> Ping for the C option.
>
> In general, I think what you described for C meshes well w/ the C++
> syntax we hashed out. Everywhere there are multiple paths, they are
> separated with colons, and all have the same semantic meaning as
> described by the option name. Fortunately, C only needs one semantic
> meaning, a flat list of paths.
>
> -Chandler
>
>>
>>> Cheers,
>>> --
>>> Rafael Ávila de Espíndola
>>>
>>
>> Cheers,
>> --
>> Rafael Ávila de Espíndola
>>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list