Bug 50741 - portability of xorg/util/macros/tree/xorg-macros.m4.in
portability of xorg/util/macros/tree/xorg-macros.m4.in
Status: RESOLVED FIXED
Product: xorg
Classification: Unclassified
Component: Build/Modular
git
Other All
: medium major
Assigned To: Xorg Project Team
Xorg Project Team
2012BRB_Reviewed
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-05 10:12 UTC by Jeremy C. Reed
Modified: 2012-06-18 17:32 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy C. Reed 2012-06-05 10:12:38 UTC
See http://cgit.freedesktop.org/xorg/util/macros/commit/xorg/macros.m4.in?id=b8a13e531db208a7c4c9a43b74b196104e7c66ed

Multiple users on NetBSD have seen like:

 checking if cc -std=gnu99 supports -Wredundant-decls... yes
 checking if cc -std=gnu99 supports -Werror=implicit... no
 checking if cc -std=gnu99 supports -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED... eval: 1: Syntax error: Bad substitution
 *** Error code 2

For the generated configure, a workaround patch is quoting it:

-               cacheid=`$as_echo xorg_cv_cc_flag_-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED`
+               cacheid=`$as_echo "xorg_cv_cc_flag_-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED"`


Some explanation is at http://mail-index.netbsd.org/tech-pkg/2012/06/05/msg009446.html

The macro for configure.ac has:

XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EX
PLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])


Regardless if this is a bug or not in the sh (note this sh is used on non-NetBSD platforms too), is it okay to split up the check to two macros?

diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index d589ebd..d122edf 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1646,7 +1646,8 @@ XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
 # when there are problems that should be fixed.
 
 if test "x$SELECTIVE_WERROR" = "xyes" ; then
-XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
+XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN])
+XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_IMPLICIT_DECL_ALLOWED])
 XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull])
 XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self])
 XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main])
Comment 1 Jeremy C. Reed 2012-06-05 11:34:15 UTC
Just to clarify: Shell variables aren't allowed to have spaces in their names.
Comment 2 Jeremy Huddleston 2012-06-05 11:43:47 UTC
I'd rather XORG_TESTSET_CFLAG use an appropriate environment variable as the solution.  The suggested change would result in -Werror=implicit appearing twice.
Comment 3 Jeremy Huddleston 2012-06-05 11:46:20 UTC
Adding Jon, since this is fallout from the result caching changes.
Comment 4 Thomas Klausner 2012-06-10 02:26:41 UTC
OBATA Akio writes that the problem may have been solved in the meantime:

http://mail-index.netbsd.org/pkgsrc-users/2012/06/09/msg016498.html
Comment 5 Jon TURNEY 2012-06-16 04:26:53 UTC
If I'm understanding correctly, the current version of xorg-macros doesn't trip over the shell bug which caused this to fail on NetBSD.  So, I don't think any further action needs to be taken and I'm marking this bug as resolved.  Please re-open this bug if my understanding is defective.

(In reply to comment #0) 
> Regardless if this is a bug or not in the sh (note this sh is used on
> non-NetBSD platforms too), is it okay to split up the check to two macros?

I can't really speak to if this is desirable.  At the moment, we do one check to see if the compiler supports both flags.
Comment 6 Gaetan Nadon 2012-06-18 17:32:31 UTC
> (In reply to comment #0) 
> > Regardless if this is a bug or not in the sh (note this sh is used on
> > non-NetBSD platforms too), is it okay to split up the check to two macros?
> 
> I can't really speak to if this is desirable.  At the moment, we do one check
> to see if the compiler supports both flags.

To answer the question, one must follow the evolution of the macros as changes need to be backward compatible. Older xorg packages must behave the same way as they did when built with the latest xorg-utils package. Another theoretical reason is for functional decomposition to improve reusability.