From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11022 invoked by alias); 7 Jun 2010 20:24:34 -0000 Received: (qmail 11005 invoked by uid 22791); 7 Jun 2010 20:24:33 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail.gmx.net (HELO mail.gmx.net) (213.165.64.20) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Mon, 07 Jun 2010 20:24:31 +0000 Received: (qmail invoked by alias); 07 Jun 2010 20:24:17 -0000 Received: from xdsl-78-35-53-156.netcologne.de (EHLO localhost.localdomain) [78.35.53.156] by mail.gmx.net (mp010) with SMTP; 07 Jun 2010 22:24:17 +0200 Received: from ralf by localhost.localdomain with local (Exim 4.69) (envelope-from ) id 1OLirn-0007z4-8u; Mon, 07 Jun 2010 22:24:15 +0200 Date: Mon, 07 Jun 2010 20:24:00 -0000 From: Ralf Wildenhues To: Ian Lance Taylor , bug-autoconf@gnu.org Cc: Paolo Bonzini , binutils@sourceware.org, gdb-patches@sourceware.org Subject: Re: [PATCH] Fix PR bootstrap/42798 Message-ID: <20100607202412.GB30591@gmx.de> Mail-Followup-To: Ian Lance Taylor , bug-autoconf@gnu.org, Paolo Bonzini , binutils@sourceware.org, gdb-patches@sourceware.org References: <20100602111845.GA16161@ins.uni-bonn.de> <4C064B77.3020207@gnu.org> <20100603063319.GC28276@gmx.de> <20100603065852.GA28617@gmx.de> <20100606112828.GC29478@gmx.de> <20100607061142.GA29811@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-10-28) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-06/txt/msg00190.txt.bz2 [ adding bug-autoconf ] * Ian Lance Taylor wrote on Mon, Jun 07, 2010 at 04:03:47PM CEST: > Ralf Wildenhues writes: > > * Ian Lance Taylor wrote on Sun, Jun 06, 2010 at 11:42:13PM CEST: > > > >> My question about a basename declaration in the system header was a > >> genuine question. My concern is that on some systems this patch might > >> decide incorrectly whether or not basename is defined, which could > >> then possibly lead to a compilation error when libiberty.h is > >> included. > > > > This concern should be addressed with my reply > > : > > In short, the Autoconf change is designed to handle exactly this case > > right both in C and in C++ mode. > > That doesn't really address my concern. That shows that autoconf will > get a workable answer if I use only C++. But there is only one > config.h file. gold has both .c and .cc files (the .c files are used > via AC_REPLACE_FUNCS). It's not obvious to me that a version of > HAVE_DECL_BASENAME for C++ will necessarily work when compiling C. OK, fair point. The current Autoconf solution for AC_CHECK_DECLS assumes that the developer either uses the answer for the compiler language tested only, or that the answer is consistent between the C and the C++ compiler. When we find a case where this assumption does not hold, we can still work with the current framework by using AC_CHECK_DECL (without 'S') and setting per-language defines, e.g.: AC_LANG_PUSH([C]) AC_CHECK_DECLS([basename]) dnl defines HAVE_DECL_BASENAME AC_LANG_POP([C]) AC_LANG_PUSH([C++]) AC_CHECK_DECL([basename(char *)], [AC_DEFINE([HAVE_DECL_BASENAME_CXX], [1], [Define to 1 if you have a C++ declaration ]dnl [of `basename(char *)'])]) AC_LANG_POP([C++]) and then go from there. But I don't think we need to go there unless we find a system that warrants this. Autoconf is assuming similar in a number of cases already: With AC_C_RESTRICT, it first tries a spelling of restrict that is likely to work with both C++ and C compilers, but only the C compiler is tested (and when you mix compilers from different vendors, such as GNU and Solaris, this is a problem). Cheers, Ralf