<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
On Tue, 2011-11-01 at 13:16 -0700, Jeremy Huddleston wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Signed-off-by: Jeremy Huddleston <<A HREF="mailto:jeremyhu@apple.com">jeremyhu@apple.com</A>>
---
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.
</PRE>
</BLOCKQUOTE>
What is the definition of "support"?<BR>
I vaguely recall reading compiler manuals stating that (some) non supported flags are ignored so as not to break the build. These may appear to be "supported" but do not do anything useful. Would "support" here means "it does anything (including nothing) but not break the build"?<BR>
<BR>
This should be clarified to avoid one using this macro as a way to test for the presence of a particular working compiler feature.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
+#
+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
</PRE>
</BLOCKQUOTE>
<BR>
<BR>
Same comment regarding AC_LANG_SOURCE vs AC_LANG_PROGRAM.<BR>
<BR>
The following macro usage does not produce any error, perhaps it should:
<BLOCKQUOTE>
<PRE>
XORG_TESTSET_CFLAG([GIVEN])
</PRE>
</BLOCKQUOTE>
As for recursion, recall the discussion about AC_PATH_PROGS_FEATURE_CHECK introduced in autoconf 2.62 which xcb wanted to use mainly because of the recursion capabilities. I am no expert in m4, but there are examples where it has been done. I recall having a look at the time and it was not trivial in the autoconf code.<BR>
<BR>
<BR>
<BR>
<BR>
</BODY>
</HTML>