diff -rc gcc-orig/config.if gcc-2.95.3/config.if
*** gcc-orig/config.if	1998-10-18 19:37:10.000000000 +0200
--- gcc-2.95.3/config.if	2004-08-03 12:29:32.000000000 +0200
***************
*** 64,70 ****
    return 0;
  }
  EOF
!       ${CC-cc} $dummy.c -o $dummy 2>/dev/null
        if [ "$?" = 0 ]
        then
  	libc_interface=-libc6.`./$dummy`-
--- 64,70 ----
    return 0;
  }
  EOF
!       ${CC-cc} $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS $dummy.c -o $dummy 2>/dev/null
        if [ "$?" = 0 ]
        then
  	libc_interface=-libc6.`./$dummy`-
diff -rc gcc-orig/gcc/cccp.c gcc-2.95.3/gcc/cccp.c
*** gcc-orig/gcc/cccp.c	2001-01-25 15:03:00.000000000 +0100
--- gcc-2.95.3/gcc/cccp.c	2004-08-03 10:54:39.000000000 +0200
***************
*** 373,378 ****
--- 373,382 ----
      char fname[1];
    };
  
+ #undef LOCAL_INCLUDE_DIR
+ #undef SYSTEM_INCLUDE_DIR
+ #undef STANDARD_INCLUDE_DIR
+ 
  /* #include "file" looks in source file dir, then stack.  */
  /* #include <file> just looks in the stack.  */
  /* -I directories are added to the end, then the defaults are added.  */
***************
*** 424,430 ****
--- 428,436 ----
  #ifndef STANDARD_INCLUDE_COMPONENT
  #define STANDARD_INCLUDE_COMPONENT 0
  #endif
+ #ifdef STANDARD_INCLUDE_DIR
      { STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 0 },
+ #endif
  #endif /* not CROSS_COMPILE */
      { 0, 0, 0, 0, 0 }
      };
diff -rc gcc-orig/gcc/gcc.c gcc-2.95.3/gcc/gcc.c
*** gcc-orig/gcc/gcc.c	2001-01-25 15:03:16.000000000 +0100
--- gcc-2.95.3/gcc/gcc.c	2004-08-03 11:48:09.000000000 +0200
***************
*** 1369,1388 ****
  #undef MD_STARTFILE_PREFIX_1
  #endif
  
- #ifndef STANDARD_EXEC_PREFIX
- #define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
- #endif /* !defined STANDARD_EXEC_PREFIX */
- 
  static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
- static const char *standard_exec_prefix_1 = "/usr/lib/gcc/";
  #ifdef MD_EXEC_PREFIX
  static const char *md_exec_prefix = MD_EXEC_PREFIX;
  #endif
  
- #ifndef STANDARD_STARTFILE_PREFIX
- #define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
- #endif /* !defined STANDARD_STARTFILE_PREFIX */
- 
  #ifdef MD_STARTFILE_PREFIX
  static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
  #endif
--- 1369,1379 ----
***************
*** 1390,1401 ****
  static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
  #endif
  static const char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
- static const char *standard_startfile_prefix_1 = "/lib/";
- static const char *standard_startfile_prefix_2 = "/usr/lib/";
  
- #ifndef TOOLDIR_BASE_PREFIX
- #define TOOLDIR_BASE_PREFIX "/usr/local/"
- #endif
  static const char *tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
  static const char *tooldir_prefix;
  
--- 1381,1387 ----
***************
*** 2896,2908 ****
  		  value = argv[++i];
  		else
  		  value = p + 1;
  		add_prefix (&exec_prefixes, value, NULL_PTR, 1, 0, &warn_B);
  		add_prefix (&startfile_prefixes, value, NULL_PTR,
  			    1, 0, &warn_B);
  		add_prefix (&include_prefixes, concat (value, "include",
  						       NULL_PTR),
  			    NULL_PTR, 1, 0, NULL_PTR);
! 
  		/* As a kludge, if the arg is "[foo/]stageN/", just add
  		   "[foo/]include" to the include prefix.  */
  		{
--- 2882,2897 ----
  		  value = argv[++i];
  		else
  		  value = p + 1;
+                 if (strlen(value) > 0 && value[strlen(value) - 1] != '/')
+                     value = concat (value, "/", NULL_PTR);
+                 add_prefix (&startfile_prefixes, value, "BINUTILS", 0, 0, NULL_PTR);
  		add_prefix (&exec_prefixes, value, NULL_PTR, 1, 0, &warn_B);
  		add_prefix (&startfile_prefixes, value, NULL_PTR,
  			    1, 0, &warn_B);
  		add_prefix (&include_prefixes, concat (value, "include",
  						       NULL_PTR),
  			    NULL_PTR, 1, 0, NULL_PTR);
!                 
  		/* As a kludge, if the arg is "[foo/]stageN/", just add
  		   "[foo/]include" to the include prefix.  */
  		{
***************
*** 3060,3073 ****
  #ifndef OS2
    add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
  	      0, 2, warn_std_ptr);
-   add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
- 	      0, 2, warn_std_ptr);
  #endif
  
    add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
  	      0, 1, warn_std_ptr);
-   add_prefix (&startfile_prefixes, standard_exec_prefix_1, "BINUTILS",
- 	      0, 1, warn_std_ptr);
  
    tooldir_prefix = concat (tooldir_base_prefix, spec_machine, 
  			   dir_separator_str, NULL_PTR);
--- 3049,3058 ----
***************
*** 4865,4874 ****
  		      NULL_PTR, 0, 0, NULL_PTR);
  	}		       
  
-       add_prefix (&startfile_prefixes, standard_startfile_prefix_1,
- 		  "BINUTILS", 0, 0, NULL_PTR);
-       add_prefix (&startfile_prefixes, standard_startfile_prefix_2,
- 		  "BINUTILS", 0, 0, NULL_PTR);
  #if 0 /* Can cause surprises, and one can use -B./ instead.  */
        add_prefix (&startfile_prefixes, "./", NULL_PTR, 0, 1, NULL_PTR);
  #endif
--- 4850,4855 ----
diff -rc gcc-orig/gcc/Makefile.in gcc-2.95.3/gcc/Makefile.in
*** gcc-orig/gcc/Makefile.in	2001-01-25 15:02:58.000000000 +0100
--- gcc-2.95.3/gcc/Makefile.in	2004-08-03 12:24:39.000000000 +0200
***************
*** 74,80 ****
  BOOT_CFLAGS = -O2 $(CFLAGS)
  #WARN_CFLAGS = -W -Wall
  # These exists to be overridden by the x-* and t-* files, respectively.
! X_CFLAGS =
  T_CFLAGS =
  
  X_CPPFLAGS =
--- 74,80 ----
  BOOT_CFLAGS = -O2 $(CFLAGS)
  #WARN_CFLAGS = -W -Wall
  # These exists to be overridden by the x-* and t-* files, respectively.
! X_CFLAGS = $(NIX_EXTRA_CFLAGS) $(NIX_EXTRA_LDFLAGS)
  T_CFLAGS =
  
  X_CPPFLAGS =
***************
*** 218,224 ****
         && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
  
  # Dir to search for system headers.  Overridden by cross-make.
! SYSTEM_HEADER_DIR = /usr/include
  
  # Control whether to run fixproto.
  STMP_FIXPROTO = stmp-fixproto
--- 218,228 ----
         && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
  
  # Dir to search for system headers.  Overridden by cross-make.
! # Nix: we override NATIVE_SYSTEM_HEADER_DIR in order to prevent
! # `fixinc' from fixing header files in /usr/include.  However,
! # NATIVE_SYSTEM_HEADER_DIR must point to an existing directory, so set
! # it to some dummy directory.
! SYSTEM_HEADER_DIR = $(NIX_FIXINC_DUMMY)
  
  # Control whether to run fixproto.
  STMP_FIXPROTO = stmp-fixproto
diff -rc gcc-orig/Makefile.in gcc-2.95.3/Makefile.in
*** gcc-orig/Makefile.in	1999-06-23 00:44:42.000000000 +0200
--- gcc-2.95.3/Makefile.in	2004-08-03 10:46:42.000000000 +0200
***************
*** 87,94 ****
  CXXFLAGS = -g -O2
  
  LIBCFLAGS = $(CFLAGS)
! CFLAGS_FOR_TARGET = $(CFLAGS)
! LDFLAGS_FOR_TARGET = 
  LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
  PICFLAG = 
  PICFLAG_FOR_TARGET = 
--- 87,94 ----
  CXXFLAGS = -g -O2
  
  LIBCFLAGS = $(CFLAGS)
! CFLAGS_FOR_TARGET = $(CFLAGS) $(NIX_EXTRA_CFLAGS)
! LDFLAGS_FOR_TARGET = $(NIX_EXTRA_LDFLAGS)
  LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
  PICFLAG = 
  PICFLAG_FOR_TARGET = 
***************
*** 99,105 ****
  
  # Use -O2 to stress test the compiler.
  LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
! CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
  LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
  
  RANLIB = ranlib
--- 99,105 ----
  
  # Use -O2 to stress test the compiler.
  LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
! CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(NIX_EXTRA_CFLAGS)
  LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
  
  RANLIB = ranlib
