This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: MinGW and NATIVE_SYSTEM_HEADER_DIR


The tm.h macro STANDARD_INCLUDE_DIR tells the compiler where to look
for include files.  On most UNIX systems, this is /usr/include.
However, on MinGW it is /mingw/include.

There is an unwritten rule that the t-file variable
NATIVE_SYSTEM_HEADER_DIR should match STANDARD_INCLUDE_DIR.  If it
does not, then the compiler will not look in the correct place for
header files during the build process when running fixincludes.

MinGW fails to follow the rule; it does not set
NATIVE_SYSTEM_HEADER_DIR, but does set STANDARD_INCLUDE_DIR.  This
problem shows up when building a cross compiler with --sysroot because
that configuration uses $(sysroot)/$(NATIVE_SYSTEM_HEADER_DIR).

This patch makes MinGW follow the rule.  I've also updated the
documentation.  It would be neat to make the value of
NATIVE_SYSTEM_HEADER_DIR get set automatically, but that's a bigger
change, and it may not always be right to use exactly the same path, so I went for the easy approach.

Tested by building a "Canadian native" MinGW compiler on
x86_64-none-linux-gnu.  I also checked that MinGW does by default
install its headers in /mingw/include.  I am not set up to build MinGW
native, though, so I didn't try that.  

I guess I will commit this patch in a day or two if there are no
objections, but if the MinGW maintainers could comment, I'd much
appreciate that.  If I do check it in, I'll of course pop it back out
at the first sign of trouble. 

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-08-02  Mark Mitchell  <mark@codesourcery.com>

	* config/i386/t-mingw32 (NATIVE_SYSTEM_HEADER_DIR): Set it.
	* doc/fragments.texi (NATIVE_SYSTEM_HEADER_DIR): Document it.

Index: config/i386/t-mingw32
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/t-mingw32,v
retrieving revision 1.4
diff -c -5 -p -r1.4 t-mingw32
*** config/i386/t-mingw32	5 Apr 2004 03:58:45 -0000	1.4
--- config/i386/t-mingw32	2 Aug 2005 17:07:33 -0000
***************
*** 1,2 ****
--- 1,5 ----
  # We hide calls to w32api needed for w32 thread support here:
  LIB2FUNCS_EXTRA = $(srcdir)/config/i386/gthr-win32.c
+ 
+ # Match SYSTEM_INCLUDE_DIR
+ NATIVE_SYSTEM_HEADER_DIR = /mingw/include
Index: doc/fragments.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/fragments.texi,v
retrieving revision 1.8
diff -c -5 -p -r1.8 fragments.texi
*** doc/fragments.texi	5 Nov 2004 01:36:56 -0000	1.8
--- doc/fragments.texi	2 Aug 2005 17:07:33 -0000
*************** Sometimes it is desirable that when buil
*** 149,158 ****
--- 149,164 ----
  @file{libgcc.a} certain options should always be passed on to the
  compiler.  In that case, set @code{MULTILIB_EXTRA_OPTS} to be the list
  of options to be used for all builds.  If you set this, you should
  probably set @code{CRTSTUFF_T_CFLAGS} to a dash followed by it.
  
+ @findex NATIVE_SYSTEM_HEADER_DIR
+ @item NATIVE_SYSTEM_HEADER_DIR
+ If the default location for system headers is not @file{/usr/include},
+ you must set this to the directory containing the headers.  This value
+ should match the value of the @code{SYSTEM_INCLUDE_DIR} macro.
+ 
  @findex SPECS
  @item SPECS
  Unfortunately, setting @code{MULTILIB_EXTRA_OPTS} is not enough, since
  it does not affect the build of target libraries, at least not the
  build of the default multilib.  One possible work-around is to use


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]