This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: cpp include directory search order warning
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Cc: zack at codesourcery dot com
- Date: Wed, 7 Aug 2002 12:48:48 -0400 (EDT)
- Subject: PATCH: cpp include directory search order warning
Here is a fix for the problems noted in this thread:
<http://gcc.gnu.org/ml/gcc/2002-07/msg01463.html>.
The warning from remove_dup_dirs is changed to an information message
generated only when the "-v" option is used. This allows various
autoconf macros to reorder the search patch for includes and change
system directories to non-system directories without any warnings from
the preprocessor. This will fix the problems caused by the warning.
However, don't complain to me about an incorrectly ordered include
search :-)
Without the fix, it is not possible to install libintl, libiconv,
etc in either the GCC prefix or local_prefix directories without
there being cpp warnings building packages which use these libraries.
In some cases, these warnings break configure scripts.
I changed the message itself because it's about the change of a
system directory to a non-system directory, and not about reordering.
The change to configure.in just fixes a minor problem of duplicated
directories when local_prefix and prefix have the same value.
I have attempted to summarize the site configuration issues regarding
include searching and library searching in a paragraph added to
install.texi.
Tested with no regressions on hppa2.0-hp-hpux11.00.
OK for main?
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2002-08-07 John David Anglin <dave@hiauly1.hia.nrc.ca>
* configure.in (PREFIX_INCLUDE_DIR): Don't define if prefix and
local_prefix are the same.
* cppinit.c (remove_dup_dirs): Change warnings to verbose information
messages. Revise message text.
* doc/install.texi (--with-local-prefix): Further document usage of
this option.
* configure: Rebuilt.
Index: configure.in
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/configure.in,v
retrieving revision 1.613
diff -u -3 -p -r1.613 configure.in
--- configure.in 2 Aug 2002 15:57:09 -0000 1.613
+++ configure.in 7 Aug 2002 15:37:21 -0000
@@ -2202,7 +2202,7 @@ case "$target" in
;;
esac
-if test "$prefix" != "/usr" && test "$prefix" != "/usr/local" ; then
+if test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" ; then
AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
fi
Index: cppinit.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cppinit.c,v
retrieving revision 1.249
diff -u -3 -p -r1.249 cppinit.c
--- cppinit.c 6 Aug 2002 20:35:41 -0000 1.249
+++ cppinit.c 7 Aug 2002 15:37:22 -0000
@@ -296,18 +296,16 @@ remove_dup_dirs (pfile, head)
for (other = head; other != cur; other = other->next)
if (INO_T_EQ (cur->ino, other->ino) && cur->dev == other->dev)
{
- if (cur->sysp && !other->sysp)
+ if (cur->sysp && !other->sysp && CPP_OPTION (pfile, verbose))
{
- cpp_error (pfile, DL_WARNING,
- "changing search order for system directory \"%s\"",
- cur->name);
+ fprintf (stderr, _("system directory \"%s\"\n"), cur->name);
if (strcmp (cur->name, other->name))
- cpp_error (pfile, DL_WARNING,
- " as it is the same as non-system directory \"%s\"",
- other->name);
+ fprintf (stderr,
+ _(" is the same as non-system directory \"%s\"\n"),
+ other->name);
else
- cpp_error (pfile, DL_WARNING,
- " as it has already been specified as a non-system directory");
+ fprintf (stderr,
+ _(" was previously specified as a non-system directory\n"));
}
cur = remove_dup_dir (pfile, prev);
break;
Index: doc/install.texi
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/doc/install.texi,v
retrieving revision 1.130
diff -u -3 -p -r1.130 install.texi
--- doc/install.texi 6 Aug 2002 15:08:07 -0000 1.130
+++ doc/install.texi 7 Aug 2002 15:37:23 -0000
@@ -467,6 +467,21 @@ any in that directory---are not part of
programs---perhaps many others. (GCC installs its own header files in
another directory which is based on the @option{--prefix} value.)
+The local-prefix include directory is searched before the GCC-prefix
+include directory. Some autoconf macros use @option{-I} to change the
+search order for directories containing installed packages. This can
+result in a GCC system directory being changed to a non-system directory.
+It may be advisable to not use either of these two prefixes for package
+installation if this is a concern. On the otherhand, GCC autmatically
+searches for ordinary libraries using @env{GCC_EXEC_PREFIX} without
+the user having to specify a linker search path. Therefore, using
+the GCC-prefix directory for packages may provide a site configuration
+that is easier use. It is possible to use the same value for both
+@option{--with-local-prefix} and @option{--prefix} provided the value
+is not @file{/usr}. This can be used to avoid the default search of
+@file{/usr/local/include} when GCC is installed in a non-standard
+location.
+
@strong{Do not} specify @file{/usr} as the @option{--with-local-prefix}!
The directory you use for @option{--with-local-prefix} @strong{must not}
contain any of the system's standard header files. If it did contain