[PATCH:macros 1/2] Create XORG_COMPILER_BRAND macro to centralize compiler checks

Ian Romanick idr at freedesktop.org
Tue Apr 26 11:29:43 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/25/2011 08:35 PM, Alan Coopersmith wrote:
> Check for gcc vs. intel vs. sun in one place, instead of
> continuing to grow more places the check is replicated.
> 
> Add clang check here too, as it's now seeing a lot of use to build X.
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

For both patches in the series:

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>  xorg-macros.m4.in |   24 ++++++++++++++++++++----
>  1 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> index 76462b5..bdf734e 100644
> --- a/xorg-macros.m4.in
> +++ b/xorg-macros.m4.in
> @@ -1290,6 +1290,23 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
>  
>  ]) # XORG_LINT_LIBRARY
>  
> +# XORG_COMPILER_BRAND
> +# -------------------
> +# Minimum version: 1.14.0
> +#
> +# Checks for various brands of compilers and sets flags as appropriate:
> +#   GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes"
> +#   clang compiler - sets CLANGCC to "yes"
> +#   Intel compiler - sets INTELCC to "yes"
> +#   Sun/Oracle Solaris Studio cc - sets SUNCC to "yes"
> +#
> +AC_DEFUN([XORG_COMPILER_BRAND], [
> +AC_REQUIRE([AC_PROG_CC_C99])
> +AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"])
> +AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
> +AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
> +]) # XORG_COMPILER_BRAND
> +
>  # XORG_CWARNFLAGS
>  # ---------------
>  # Minimum version: 1.2.0
> @@ -1298,6 +1315,7 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno])
>  #
>  AC_DEFUN([XORG_CWARNFLAGS], [
>  AC_REQUIRE([AC_PROG_CC_C99])
> +AC_REQUIRE([XORG_COMPILER_BRAND])
>  if  test "x$GCC" = xyes ; then
>      CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
>  -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
> @@ -1308,7 +1326,6 @@ if  test "x$GCC" = xyes ; then
>  	;;
>      esac
>  else
> -    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
>      if test "x$SUNCC" = "xyes"; then
>  	CWARNFLAGS="-v"
>      fi
> @@ -1324,6 +1341,7 @@ AC_SUBST(CWARNFLAGS)
>  AC_DEFUN([XORG_STRICT_OPTION], [
>  # If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
>  AC_REQUIRE([AC_PROG_CC_C99])
> +AC_REQUIRE([XORG_COMPILER_BRAND])
>  AC_REQUIRE([XORG_CWARNFLAGS])
>  
>  AC_ARG_ENABLE(strict-compilation,
> @@ -1331,13 +1349,11 @@ AC_ARG_ENABLE(strict-compilation,
>  			  [Enable all warnings from compiler and make them errors (default: disabled)]),
>  			  [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
>  if test "x$STRICT_COMPILE" = "xyes"; then
> -	AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
> -	AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
>  	if test "x$GCC" = xyes ; then
>  		STRICT_CFLAGS="-pedantic -Werror"
>  	elif test "x$SUNCC" = "xyes"; then
>  		STRICT_CFLAGS="-errwarn"
> -    elif test "x$INTELCC" = "xyes"; then
> +	elif test "x$INTELCC" = "xyes"; then
>  		STRICT_CFLAGS="-Werror"
>  	fi
>  fi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk23DxcACgkQX1gOwKyEAw/viACcCjm7YEMQh4y8rrbK7DWUzx19
xJYAnAyKAlvjqCCRNgKix6uVoZPY2YjZ
=Yt6P
-----END PGP SIGNATURE-----


More information about the xorg-devel mailing list