On 04/20/2010 04:37 PM, Joel E. Denny wrote: > On Tue, 20 Apr 2010, Eric Blake wrote: > >>>>> if you use autoconf 2.64 (prior to that, if the existence and >>>>> compilation checks disagree, autoconf went with the existence check). >>>> >>>> We are using autoconf 2.65. >> >> Then I'm confused how /opt/csw/include/getopt.h is getting included at >> all in the first place. > > I guess the check only tries cc. Recall that bison is compiled with cc, > but some test groups need CC. > >> What does config.log say about getopt? > > configure:6857: checking for getopt.h > configure:6857: cc -c -g -I/opt/csw/include conftest.c >&5 > configure:6857: $? = 0 > configure:6857: result: yes
Okay, so the problem is that the header works for C, where getopt.h is adequate, and we don't have the granularity at the moment to repeat header checks for C++. I'm assuming that later in configure we reject -lgnugetopt's getopt_long as broken (unless libgnugetopt has somehow picked up this month's glibc fix), meaning that we still want to declare rpl_getopt and friends; the conflict in getopt() is irrelevant if we are going to be declaring a replacement anyways. Meanwhile, as you reported: >>From /opt/csw/include/getopt.h: > > ------------------------------ > #if defined (__STDC__) && __STDC__ > #ifdef __GNU_LIBRARY__ > /* Many other libraries have conflicting prototypes for getopt, with > differences in the consts, in stdlib.h. To avoid compilation > errors, only prototype getopt for the GNU C library. */ > extern int getopt (int argc, char *const *argv, const char *shortopts); > #else /* not __GNU_LIBRARY__ */ > extern int getopt (); > #endif /* __GNU_LIBRARY__ */ > ... > #else /* not __STDC__ */ > extern int getopt (); <---------- line 122, where the error is reported > ... > endif /* __STDC__ */ since __STDC__ is 0 under CC but 1 under g++, maybe the best fix would be to make /opt/csw/include/getopt.h drop the check for the value of __STDC__? Or have gnulib's getopt.h explicitly define __STDC__ to 1? Or do we modify the logic in getopt.m4 that sets @HAVE_GETOPT_H@ to instead check two language-dependent values, one for C and one for C++, such that the #include_next <getopt.h> only occurs for languages where it will work? -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature