[libdispatch-dev] Solaris portability - PATCH - m4/private-extern.m4

Joakim Johansson jocke at tbricks.com
Tue Jul 27 03:17:27 PDT 2010

As mentioned, one final niggle was in the detection of the support for '__attribute__((visibility("hidden")))’.

It turns out that this breaks on Solaris when you actually try to reference such a symbol with:

conftest.c:56: warning: visibility attribute not supported in this configuration; ignored

even though a compile with such declarations works just fine.

The attached patch modifies the detection to not just compile such a symbol, but also to reference it through an assignment and enabling the treatment of warnings as errors.

When tested, this yields the correct detection of support on both Darwin and Solaris (yes/no respectively).

I believe this is the final patch needed to build libdispatch cleanly on Solaris using:

sh ./autogen.sh
./configure --disable-static 
gmake CFLAGS=-m64
(requires an installed version of libkqueue)


octo.tbricks.com:~/Network/gcd/trunk> svn diff m4/private-extern.m4 
Index: m4/private-extern.m4
--- m4/private-extern.m4	(revision 188)
+++ m4/private-extern.m4	(working copy)
@@ -4,10 +4,12 @@
 AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
     dispatch_cv_hidden_visibility_attribute, [
-        AC_TRY_LINK([], 
-                    [extern __attribute__ ((visibility ("hidden"))) int foo;],
+	AC_TRY_LINK([int foo; extern __attribute__ ((visibility ("hidden"))) int foo;], 
+		[foo = 0;],

More information about the libdispatch-dev mailing list