summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-04-25 20:31:33 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-05-02 15:37:30 -0700
commit8a556afbe7ff81987597ca88e315fe66f10e4adc (patch)
treec129c462c1cba821e216ed60555ba0f9937c5cb4
parentef7824119ede1d491936ef1715296b47419f4c9c (diff)
downloadxorg-util-macros-8a556afbe7ff81987597ca88e315fe66f10e4adc.tar.gz
Make XORG_STRICT_OPTION always set STRICT_CFLAGS
Still only adds it to CWARNFLAGS if --enable-strict-compilation is passed, but sets the variable with the right flags for the compiler so it's available for other checks in configure scripts. 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>
-rw-r--r--xorg-macros.m4.in25
1 files changed, 16 insertions, 9 deletions
diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index bdf734e..ccbe931 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1337,7 +1337,13 @@ AC_SUBST(CWARNFLAGS)
# -----------------------
# Minimum version: 1.3.0
#
-# Add configure option to enable strict compilation
+# Add configure option to enable strict compilation flags, such as treating
+# warnings as fatal errors.
+# If --enable-strict-compilation is passed to configure, adds strict flags to
+# $CWARNFLAGS.
+#
+# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or
+# when strict compilation is unconditionally desired.
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])
@@ -1348,16 +1354,17 @@ AC_ARG_ENABLE(strict-compilation,
AS_HELP_STRING([--enable-strict-compilation],
[Enable all warnings from compiler and make them errors (default: disabled)]),
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=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
+ STRICT_CFLAGS="-Werror"
+fi
if test "x$STRICT_COMPILE" = "xyes"; then
- 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
- STRICT_CFLAGS="-Werror"
- fi
+ CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
fi
-CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
+AC_SUBST([STRICT_CFLAGS])
AC_SUBST([CWARNFLAGS])
]) # XORG_STRICT_OPTION