I've done some more testing. It turns out that gnulib _correctly_
rejects /opt/csw/include/getopt.h as incompatible with the current
compiler, if you use autoconf 2.64 (prior to that, if the existence
and
compilation checks disagree, autoconf went with the existence check).
The errors I'm seeing are due to the fact that Dagobert is using CC,
not
cc, and I think -I/opt/csw/include is a red herring. In fact, I can
reproduce problems on Fedora 12 when using g++, now that we replace
getopt even for glibc 1.11, to work around bugs recently fixed in
newer
glibc.
So I'm working on some patches to allow clean C++ compilation of
getopt
(even if they won't be accepted upstream in glibc); and with luck,
that
will also fix Dagobert's problem with CC.
- Joel Denny writes:
it starts to feel like /opt/csw/include/getopt.h's approach
of quickly giving up on determining the best getopt argument list is
easiest. However, for C++, it can't give up because there's no
such thing
as an unspecified argument list.
- Dagobert wants a small modification of his CSWlibgnugetopt package
and not
a complete reimplementation.
So here's my suggestion. Change /opt/csw/include/getopt.h like this,
and be
done with it. All the __STDC__ checks can be removed. No one uses
K&R C
nowadays any more. Only ANSI/ISO C and C++ are relevant.