[Mesa-dev] cflags mess with llvm builds

Dan Nicholson dbn.lists at gmail.com
Tue Oct 5 14:00:32 PDT 2010


On Tue, Oct 5, 2010 at 7:56 AM, Xavier Chantry <chantry.xavier at gmail.com> wrote:
> On Sun, Sep 26, 2010 at 10:42 PM, Dan Nicholson <dbn.lists at gmail.com> wrote:
>>
>> Normally you do that because if the user has custom include paths, you
>> want them to be at the beginning of the command line.
>>
>> It'd be nice if the llvm people could just use pkg-config instead of
>> rolling their own config tool. I thought people had stopped doing that
>> by now.
>>
>
> If llvm used pkg-config, we could then use the following pkg-config
> options to solve the problem ?
>  --cflags-only-I                       output -I flags
>  --cflags-only-other                   output cflags not covered by the
>                                        cflags-only-I option
>
> So the gcc line could be like this :
> $(pkg-config --cflags-only-other llvm) $CFLAGS $(pkg-config
> --cflags-only-I llvm)
>
> or did you have something else in mind / are there other ways too ?

You could do it that way, but the better way is just to be standard
like everyone else.

1. Only output required flags to the user. If it's necessary to use
-fomit-frame-pointer to use LLVM, so be it, but there's no reason
-DNDEBUG should be in there.

2. Just use `pkg-config --cflags` like every other package and the
pkg-config autoconf macros.

I can't see any reason why they can't do that like the hundreds of
other packages that export build flags. That way, we can just do:

PKG_CHECK_MODULES([LLVM], [llvm])

vs.

PKG_CHECK_EXISTS([llvm], [have_llvm=yes], [have_llvm=no])
if test $have_llvm = yes; then
    LLVM_CFLAGS_PRE=`$PKG_CONFIG --cflags-only-other llvm`
    LLVM_CFLAGS_POST=`$PKG_CONFIG --cflags-only-I llvm`
    LLVM_LIBS=`$PKG_CONFIG --libs llvm`
fi

with special handling in the Makefile. But if llvm doesn't want to
play nice, then I guess that's what has to be done.

--
Dan


More information about the mesa-dev mailing list