Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Reply-To: From: "Michael H. Cox" To: Subject: RE: gcc-3.2-3: bootstrap build fails (HAVE_DECL_GETOPT not in config.h?) Date: Fri, 22 Nov 2002 01:26:01 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal In-Reply-To: <20021120000137.GB27204@redhat.com> > -----Original Message----- > From: Christopher Faylor [mailto:cgf AT redhat DOT com] > Sent: Tuesday, November 19, 2002 5:02 PM > To: cygwin AT cygwin DOT com > Subject: Re: gcc-3.2-3: bootstrap build fails (HAVE_DECL_GETOPT not in > config.h?) > > > On Wed, Nov 20, 2002 at 10:14:59AM +1100, Nigel Stewart & Fiona > Smith wrote: > >Michael, > > > >I have encountered the same problem on my setup. > > > >Regards, > > I have not encountered the same problem in my setup. You may have something wrong with your setup, i.e. you may have other changes besides what's in gcc-3.2-3. I looked at the gcc/include/getopt.h in CVS at gcc.gnu.org and they have the following change (which is basically what I came up with also): =================================================================== RCS file: /cvs/gcc/gcc/include/getopt.h,v retrieving revision 1.6 retrieving revision 1.6.30.1 diff -u -r1.6 -r1.6.30.1 --- gcc/include/getopt.h 2001/03/14 19:44:38 1.6 +++ gcc/include/getopt.h 2002/11/09 18:12:56 1.6.30.1 @@ -111,7 +111,7 @@ errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ -# if !defined (HAVE_DECL_GETOPT) +# if !defined (HAVE_DECL_GETOPT) && !defined (__cplusplus) extern int getopt (); # endif #endif /* __GNU_LIBRARY__ */ =================================================================== Although there still maybe a more general problem with the way GCC's cpp finds header files. The compile of pure.cc is finding the in /usr/include which includes , but instead of getting the getopt.h in /usr/include, it's grabbing the one in ./gcc/include. I vaguely remember something in the ISO C standard regarding C pre-processing that states all angle-bracket includes strictly search for files in the "standard directories" before searching in the "" include directories. Therefore the ./gcc/include/getopt.h shouldn't come into play. In addition to the change shown above, to make the file more portable, line 102 #if defined (__STDC__) && __STDC__ should be changed to #if (defined (__STDC__) && __STDC__) || defined (__cplusplus) since ISO C++ Appendix C.1.9 Clause 16.8.1 says that "Whether __STDC__ is defined and if so, what its value is, are implementation-defined". G++ defines it, but doesn't have to. If getopt.h was compiled with a C++ compiler that chose not to define/set __STDC__, the build would again break. Mike > > HTH, > cgf > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/