diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-04-25 20:26:48 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-05-01 10:29:07 -0700 |
commit | ef7824119ede1d491936ef1715296b47419f4c9c (patch) | |
tree | 6a3bb54408dd2d664267725d1c5ddfe1609b18f1 /xorg-macros.m4.in | |
parent | 5bb0cddcc5359d764015299021718f42b0a4055c (diff) |
Create XORG_COMPILER_BRAND macro to centralize compiler checks
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@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Diffstat (limited to 'xorg-macros.m4.in')
-rw-r--r-- | 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 |