This patch is currently incomplete.  I'm hoping an m4 guru (Gaetan, you're my 
hero) can help finish it.  The recursive part of XORG_TESTSET_CFLAG is 
currently commented out because it doesn't work.  From a high level, it looks 
like the logic is right (it should strip the second argument in the recursive 
call), but it's ending up recursing infinitely... which indicates to me that 
shift() isn't doing what I expect it to.

Aside from that error, this seems to "do the right thing" when I tested it with 
a module using the old CWARNFLAGS and the new BASE_CFLAGS (the only difference 
between the two is that CWARNFLAGS will include -fno-strict-aliasing).

--Jeremy

On Nov 1, 2011, at 1:16 PM, Jeremy Huddleston wrote:

> Signed-off-by: Jeremy Huddleston <[email protected]>
> ---
> xorg-macros.m4.in |   27 +++++++++++++++++++++++++++
> 1 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> index 3b02190..c4a521f 100644
> --- a/xorg-macros.m4.in
> +++ b/xorg-macros.m4.in
> @@ -1378,6 +1378,33 @@ AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], 
> [INTELCC="no"])
> AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
> ]) # XORG_COMPILER_BRAND
> 
> +# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
> +# ---------------
> +# Minimum version: 1.16.0
> +#
> +# Append the given flag to the given variable if the compiler supports it.
> +#
> +AC_DEFUN([XORG_TESTSET_CFLAG], [
> +# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
> +AC_REQUIRE([AC_PROG_CC_C99])
> +ifelse([$#], [0], [AC_MSG_ERROR("Incorrect arguments to 
> XORG_TESTSET_CFLAG")],
> +       [$#], [1], :,
> +       [save_CFLAGS="$CFLAGS"
> +        CFLAGS="$CFLAGS $2"
> +        AC_MSG_CHECKING([if $CC supports $2])
> +        AC_COMPILE_IFELSE([AC_LANG_SOURCE([], [return 0;])],
> +                          supported=yes, supported=no)
> +        CFLAGS="$save_CFLAGS"
> +        if test "$supported" = "yes" ; then
> +            AC_MSG_RESULT([yes])
> +            $1="$$1 $2"
> +        else
> +            AC_MSG_RESULT([no])
> +            dnl XORG_TESTSET_CFLAG($1, shift(shift($@))))
> +        fi
> +       ])
> +]) # XORG_TESTSET_CFLAG
> +
> # XORG_CWARNFLAGS
> # ---------------
> # Minimum version: 1.2.0
> -- 
> 1.7.7
> 

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to