public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: d95hjort@dtek.chalmers.se (H}kan Hjort)
Cc: gcc@gcc.gnu.org, bruno@elisp.org, meyering@lucent.com
Subject: Re: gcc 3.2's cpp breaks configure scripts
Date: Thu, 01 Aug 2002 20:09:00 -0000	[thread overview]
Message-ID: <200208020309.g7239gEW005999@hiauly1.hia.nrc.ca> (raw)
In-Reply-To: <20020801215213.GA16878@kromwill.dtek.chalmers.se> from "H}kan Hjort" at Aug 1, 2002 11:52:13 pm

> 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  <dave@hiauly1.hia.nrc.ca>

	* 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

  reply	other threads:[~2002-08-02  3:09 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200208021635.g72GZDrs008047@hiauly1.hia.nrc.ca>
2002-08-01 14:52 ` H}kan Hjort
2002-08-01 20:09   ` John David Anglin [this message]
2002-08-02 11:01   ` Bruno Haible
2002-08-02 12:29     ` John David Anglin
2002-08-02 14:42       ` Paul Eggert
2002-08-03 13:48         ` Nix
2002-08-03 14:55           ` John David Anglin
2002-08-03 15:24             ` Zack Weinberg
2002-08-03 19:34           ` Gareth Pearce
2002-08-03 14:42         ` John David Anglin
2002-08-03 15:36           ` Gabriel Dos Reis
2002-08-03 16:07           ` Zack Weinberg
2002-08-03 20:33             ` John David Anglin
2002-08-03 21:58               ` Miles Bader
2002-08-03 21:58             ` Daniel Jacobowitz
2002-08-11 10:27 John David Anglin
2002-08-12 14:40 ` Nix
  -- strict thread matches above, loose matches on Subject: below --
2002-08-01 16:54 Gareth Pearce
     [not found] <no.id>
2002-08-01 12:02 ` John David Anglin
2002-08-01  0:15 Gareth Pearce
2002-08-01  0:35 ` Jakub Jelinek
2002-08-01  0:03 Gareth Pearce
2002-08-01  0:07 ` Jakub Jelinek
2002-07-31 23:52 Gareth Pearce
2002-07-31  8:58 Jeff Garzik
2002-07-31  9:07 ` Gareth Pearce
2002-07-31 12:44   ` Joe Buck
2002-08-01 10:32     ` Phil Edwards
2002-08-01 11:15       ` Neil Booth
2002-08-01 12:31         ` Phil Edwards
2002-07-31  9:19 ` Andreas Schwab
2002-07-31  9:39   ` Jeff Garzik
2002-07-31  9:39     ` Jan-Benedict Glaw
2002-07-31  9:54       ` Michael Matz
2002-08-01  9:45         ` Kai Henningsen
2002-08-01 12:40           ` Kevin Handy
2002-08-01  9:45   ` Kai Henningsen
2002-08-01 14:47     ` Joe Buck
2002-08-08 20:39       ` Roger Corman
2002-08-09 12:07         ` Joe Buck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200208020309.g7239gEW005999@hiauly1.hia.nrc.ca \
    --to=dave@hiauly1.hia.nrc.ca \
    --cc=bruno@elisp.org \
    --cc=d95hjort@dtek.chalmers.se \
    --cc=gcc@gcc.gnu.org \
    --cc=meyering@lucent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).