PATCH to fix include paths

Per Bothner per@bothner.com
Wed Sep 26 22:58:00 GMT 2001


Zack Weinberg <zack@codesourcery.com> writes:

> Here's a question: Do we _ever_ want to override the compiled-in paths
> from the makefile, or do we always want to use the ones set at
> configure time?  If it's the latter, why don't we zap this entire mess
> and move the #defines to auto-host.h?  That would also obviate the
> need for recompilations when the Makefile changes (normally in an
> unrelated manner).

Ok, how about this patch then?

       * cppdefault.c (cpp_include_defaults):  Also search PREFIX_INCLUDE_DIR.
       * Makefile.in (includedir):  Rename to local_includedir.
       (includedir):  Define as $(prefix)/include.
        * config.in (PREFIX_INCLUDE_DIR):  New variable.
        * configure.in (PREFIX_INCLUDE_DIR):  Test for new variable.

Index: cppdefault.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppdefault.c,v
retrieving revision 1.3
diff -u -r1.3 cppdefault.c
--- cppdefault.c	2001/04/06 06:13:27	1.3
+++ cppdefault.c	2001/09/27 05:55:57
@@ -47,6 +47,9 @@
     /* /usr/local/include comes before the fixincluded header files.  */
     { LOCAL_INCLUDE_DIR, 0, 0, 1 },
 #endif
+#ifdef PREFIX_INCLUDE_DIR
+    { PREFIX_INCLUDE_DIR, 0, 0, 1 },
+#endif
 #ifdef GCC_INCLUDE_DIR
     /* This is the dir for fixincludes and for gcc's private headers.  */
     { GCC_INCLUDE_DIR, "GCC", 0, 0 },
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.739
diff -u -r1.739 Makefile.in
--- Makefile.in	2001/09/25 15:26:49	1.739
+++ Makefile.in	2001/09/27 05:56:00
@@ -306,7 +306,8 @@
 # Directory in which the compiler finds target-independent g++ includes.
 gcc_gxx_include_dir = @gcc_gxx_include_dir@
 # Directory to search for site-specific includes.
-includedir = $(local_prefix)/include
+local_includedir = $(local_prefix)/include
+includedir = $(prefix)/include
 # where the info files go
 infodir = @infodir@
 # Where cpp should go besides $prefix/bin if necessary
@@ -1983,7 +1984,7 @@
   -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
   -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \
   -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
-  -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
+  -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
   -DCROSS_INCLUDE_DIR=\"$(gcc_tooldir)/sys-include\" \
   -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\"
 
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.540
diff -u -r1.540 configure.in
--- configure.in	2001/09/12 16:15:55	1.540
+++ configure.in	2001/09/27 05:56:01
@@ -1694,6 +1694,10 @@
 fi
 AC_MSG_RESULT($gcc_cv_as_dwarf2_debug_line)
 
+if test "$prefix" != "/usr" && test "$prefix" != "/usr/local" ; then
+  AC_DEFINE_UNQUOTED(PREFIX_INCLUDE_DIR, "$prefix/include")
+fi
+
 # Figure out what language subdirectories are present.
 # Look if the user specified --enable-languages="..."; if not, use
 # the environment variable $LANGUAGES if defined. $LANGUAGES might
Index: config.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.in,v
retrieving revision 1.117
diff -u -r1.117 config.in
--- config.in	2001/09/11 16:49:53	1.117
+++ config.in	2001/09/27 05:56:01
@@ -497,6 +497,8 @@
 /* Define 0/1 to force the choice for exception handling model. */
 #undef CONFIG_SJLJ_EXCEPTIONS
 
+/* Define if cpp should also search $prefix/include. */
+#undef PREFIX_INCLUDE_DIR
 
 /* Bison unconditionally undefines `const' if neither `__STDC__' nor
    __cplusplus are defined.  That's a problem since we use `const' in

-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/



More information about the Gcc-patches mailing list