[PATCH libXi multitouch 3/4] Define macros for unstable protocol development

Chase Douglas chase.douglas at canonical.com
Sun Sep 18 16:32:48 PDT 2011


On 09/18/2011 10:37 AM, Dan Nicholson wrote:
> On Sep 17, 2011 9:54 AM, "Chase Douglas" <chase.douglas at canonical.com
> <mailto:chase.douglas at canonical.com>> wrote:
>>
>> On 09/17/2011 06:53 AM, Gaetan Nadon wrote:
>> > On Sat, 2011-09-17 at 06:52 +1000, Peter Hutterer wrote:
>> >> On Wed, Sep 14, 2011 at 10:33:56PM -0700, Chase Douglas wrote:
>> >> > Signed-off-by: Chase Douglas <chase.douglas at canonical.com
> <mailto:chase.douglas at canonical.com> <mailto:chase.douglas at canonical.com
> <mailto:chase.douglas at canonical.com>>>
>> >> > ---
>> >> >  configure.ac <http://configure.ac> |    3 +++
>> >> >  1 files changed, 3 insertions(+), 0 deletions(-)
>> >> >
>> >> > diff --git a/configure.ac <http://configure.ac> b/configure.ac
> <http://configure.ac>
>> >> > index 6c2f731..f3d6d8e 100644
>> >> > --- a/configure.ac <http://configure.ac>
>> >> > +++ b/configure.ac <http://configure.ac>
>> >> > @@ -39,6 +39,9 @@ if ! test "x$UNSTABLE_LIB" = xyes; then
>> >> >      AC_MSG_ERROR([This branch contains elements which have not
> yet been finalised.  When this branch is updated, you will probably need
> to recompile both the any clients using the library, and may experience
> crashes or undefined behaviour if you do not.])
>> >> >  fi
>> >> >
>> >> > +# Define macros for compiling with unstable protocols
>> >> > +AC_SUBST(CFLAGS, "-DXINPUT2_1_USE_UNSTABLE_PROTOCOL
> -DXINPUT2_2_USE_UNSTABLE_PROTOCOL")
>> > CFLAGS is a user environment and should never be set in configure.ac
> <http://configure.ac>. In
>> > some case it is, for a configure test, but restored to the original
>> > value. Refer to Automake documentation for a complete discussion on env
>> > variable usage.
>>
>> A couple points:
>>
>> * This is only temporary while the protocol is under development. It
>> will not be part of any official libXi release.
>>
>> * When I have used AC_SUBST before, it has only appended flags to the
>> CFLAGS env var. This is exactly what we want.
> 
> I suggest just using AC_DEFINE for macros. Then it doesn't toy with
> environment variables and the setting is stored in a file (config.h) for
> you. This will break with "make CFLAGS=-O" or anything like that. Carl
> Worth has said some words on this before, but I'm on my phone right now.

I looked into this, but it would require including config.h in all libXi
source files that include XI2.h. That's half the files in libXi. I want
a lightweight solution that does not modify the code.

I just don't think it's a big deal to use AC_SUBST for CFLAGS for a
temporary change during development. If you want special CFLAGS, you can
set them before running ./configure. They will be merged with the CFLAGS
set in configure.ac.

-- Chase


More information about the xorg-devel mailing list