Created attachment 27974 [details] [review]
build fixes for solaris
As can be seen at http://build.gnome.org/builders/libnice-opensol-gcc/builds/2/steps/libnice%20build/logs/stdio libnice doesn't build on Solaris. It also needs some defines for msg_* and CMSG_SPACE.
Some of these fixes are definitely needed on Solaris -- the additional library check for certain.
On Solaris 10, though, compiling against the XPG4v2 interfaces causes more trouble that it solves, at least if you're using the no-cost Sun Workshop compiler. This is because libnice currently requires stdbool.h (note: there's a configure *check* for stdbool.h, but most of the source files don't conditionally include it, so it's currently going to cause an error if it's not available) which means C99, and the XPG4v2 interfaces are incompatible with C99.
What worked better for me was to start with this patch but remove the define for _XOPEN_SOURCE_EXTENDED and change the _XOPEN_SOURCE define to 600 -- meaning SUSv3 (only available on Solaris 10 and I'm guessing OpenSolaris). That allowed the stun stuff to compile. I needed an additional tweak for all of the gcc CFLAGS that are hard-coded and one for a missing include (<sys/sockio.h>) in interfaces.c, but the end result was that the compilation succeeded with the Workshop compiler.
I'll happily provide a patch, if there's any chance it might be included in some future version of libnice.
Thanks for the patches, could you please provide me with a proper patch? I don't have Solaris, so all I can do is review/merge your patch, so make sure it works correctly.
Tim Mooney: I don't really understand what issues you found with the original patch, and what needs to be fixed, so please provide a new, proper patch and it will be included in the next release of libnice.
I'm pretty sure we could remove stdbool.h without too many problems also.
Until I saw Olivier's comment I had forgotten I had even commented on this bug.
What I was trying to say in comment #1 is that James' patch (to enable access to functions/symbols that comply with the XPG4v2 interface) doesn't completely work for Solaris, because the stdbool.h header is part of C99, which is incompatible with XPG4v2. You can't use both at the same time, it's a compilation error.
My patch is similar to his, but instead of adding
which means compile for the SUSv3 interface, which is compatible with C99.
Note that I just tried libnice-0.1.3 and it now also requires a new library check (in addition to the one James added for -lsocket) for -lnsl for the inet_* functions.
I will attach a patch with my updated change.
Note that I need a second patch, to remove all the gcc-specific CFLAGS from the Makefile.ams and from configure.ac, before compilation will succeed with the Sun Workshop compiler. It would be nice if the gcc-specific flags could be tested via configure and substituted as necessary. This is how some other projects handle the issue, but it would require an additional configure macro (I think it's part of gnulib, but would have to check).
Created attachment 70630 [details] [review]
updated patch to allow SUSv3 & C99 compilation environments
Fixed in git master
Author: Tim Mooney <Tim.Mooney@ndsu.edu>
Date: Tue Oct 29 16:52:12 2013 +0000
Add special case to make it compile on Solaris