From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6486 invoked by alias); 2 Aug 2002 03:09:49 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 6472 invoked from network); 2 Aug 2002 03:09:45 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 2 Aug 2002 03:09:45 -0000 Received: from hiauly1.hia.nrc.ca (localhost [127.0.0.1]) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) with ESMTP id g7239i00006000; Thu, 1 Aug 2002 23:09:44 -0400 (EDT) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) id g7239gEW005999; Thu, 1 Aug 2002 23:09:42 -0400 (EDT) Message-Id: <200208020309.g7239gEW005999@hiauly1.hia.nrc.ca> Subject: Re: gcc 3.2's cpp breaks configure scripts To: d95hjort@dtek.chalmers.se (H}kan Hjort) Date: Thu, 01 Aug 2002 20:09:00 -0000 From: "John David Anglin" Cc: gcc@gcc.gnu.org, bruno@elisp.org, meyering@lucent.com In-Reply-To: <20020801215213.GA16878@kromwill.dtek.chalmers.se> from "H}kan Hjort" at Aug 1, 2002 11:52:13 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2002-08/txt/msg00061.txt.bz2 > John David Anglin wrote: > > The gcc warning is correct in the cases that I have examined. I don't > > believe that configure should be adding include directories to CPPFLAGS > > that are already being searched as system directories by gcc. This > > changes the include search order as noted in the warning and may > > cause unexpected results. > > > Ah but which are theses directories? There is no way to know as far > as I can see. (If you don't fancy doing some rather serious parsing > of either the specfile, the output from -dumpspecs or from gcc -v -E). Enclosed is a patch to the gettext macros lib-link.m4 and lib-prefix.m4 to prevent them from appending GCC system directories to CPPFLAGS. It uses "gcc -v -E" and checks for the warning. I have tested the patch by building textutils-2.1 using the new macros. Possibly, the macros can be improved but the patch seems to be doing what I want. Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605) 2002-07-31 John David Anglin * lib-link.m4: Don't add GCC system include directories to CPPFLAGS. * lib-prefix.m4: Likewise. --- lib-link.m4.orig Sat Jul 20 03:15:04 2002 +++ lib-link.m4 Thu Aug 1 21:57:16 2002 @@ -345,9 +345,10 @@ dnl But don't add it dnl 1. if it's the standard /usr/include, dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already + dnl 3. if it doesn't exist as a directory. + dnl 4. if it's a GCC system include directory, + dnl 5. if it's already present in $CPPFLAGS or the already dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then @@ -358,6 +359,17 @@ fi fi if test -z "$haveit"; then + if test -d "$additional_includedir"; then + if test -n "$GCC"; then + if test -n "`echo 'main (){}' | $CC -v -E -I$additional_includedir - 2>&1 | grep 'changing search order for system directory'`"; then + haveit=yes + fi + fi + else + haveit=yes + fi + fi + if test -z "$haveit"; then for x in $CPPFLAGS $INC[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) if test "X$x" = "X-I$additional_includedir"; then @@ -366,10 +378,8 @@ fi done if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" fi fi fi --- lib-prefix.m4.orig Sat Feb 16 06:24:09 2002 +++ lib-prefix.m4 Thu Aug 1 22:00:57 2002 @@ -51,6 +51,7 @@ dnl 2. if it's already present in $CPPFLAGS, dnl 3. if it's /usr/local/include and we are using GCC on Linux, dnl 4. if it doesn't exist as a directory. + dnl 5. if it's a GCC system include directory, if test "X$additional_includedir" != "X/usr/include"; then haveit= for x in $CPPFLAGS; do @@ -68,11 +69,20 @@ esac fi fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + if test -n "$GCC"; then + if test -n "`echo 'main (){}' | $CC -v -E -I$additional_includedir - 2>&1 | grep 'changing search order for system directory'`"; then + haveit=yes + fi fi + else + haveit=yes + fi + if test -z "$haveit"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" fi fi fi