On 04/15/2010 03:39 PM, Joel E. Denny wrote:
> % cat > tmp.cc
> #define __EXTENSIONS__ 1
> #include <unistd.h>
> #include <getopt.h>
> % CC -I/opt/csw/include tmp.cc
> "/opt/csw/include/getopt.h", line 122: Error: Only one of a set of overloaded 
> functions can be extern "C".
> 1 Error(s) detected.
> % CC -V
> CC: Sun C++ 5.9 SunOS_sparc Patch 124863-19 2009/12/02

This is probably a gnulib bug.  m4/getopt.m4 should reject the system
<getopt.h> if it cannot cleanly compile with the system <unistd.h> (not
a problem, because you will still have the gnulib <getopt.h> to use in
your code).

> % uname -a
> SunOS current9s 5.9 Generic_Virtual sun4u sparc SUNW,SPARC-Enterprise-T5220

I think I still have access to a Solaris 9 machine, but am not sure if
it has /opt/csw/include, so I'm not sure how easy it will be for me to
reproduce this.  But hopefully we can come up with something.

> 
> The trouble is that, because of the __EXTENSIONS__ definition, 
> /usr/include/unistd.h defines getopt with a different prototype than does 
> /opt/csw/include/getopt.h.

It would be helpful if you could show the getopt() declarations in both
headers, and enough context (like how __EXTENSIONS__ affects
<unistd.h>), for comparison.

> 
> Dago is setting CPPFLAGS=-I/opt/csw/include before configuring bison, and 
> __EXTENSIONS__ is being defined in bison-2.4.2.8-cb76/lib/config.h.

Is there anything else in /opt/csw/include that Dago really wants to
use?  Basically, gnulib's replacement getopt.h is good enough that if
you were only using it for getopt, then the solution for now of dropping
that -I should be a good enough workaround for Dago.  But if you were
using it for other files as well, then yes, gnulib should be able to
work around it.

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to