Hi,

I'd like to resurrect a patch which has been refused last year, but
I think it's still helpful and maybe the opinions have changed a bit.

For people building just the latest mingw64-headers and mingw64-crt,
it's kind of surprising that mingw64-crt requires that the headers
are already installed.  In theory, the right thing to do should be
that mingw64-crt is build after mingw64-headers, and then prefer the
just built in-tree headers over the already installed headers.  The
below patch does that, unless the --without-headers option is set.

This should work in all typical scenarios:

- cross build gcc:

  The headers have to be build first.  At the time crt gets build,
  the in-tree headers already have been built for gcc, so they
  are nicely available for the crt build.

- native build gcc:

  The installed headers are potentially old.  Building crt with the
  latest in-tree headers is preferrable to circumnavigate potential
  bugs in the older headers.

- native mingw-only build:

  Same as above.

I can't come up with a scenario in which it would be bad to use the
in-tree headers, unless you don't build the headers, but crt only.
This should be fixable, shouldn't it?


TIA,
Corinna


        * configure.ac: Add --without-headers option.  Set WITH_LOCAL_HEADERS
        by default unless no parallel mingw-w64-headers directory exists.
        * configure: Regenerate.
        * Makefile.am: Add local header paths to sysincludes if
        WITH_LOCAL_HEADERS is set.


Index: configure.ac
===================================================================
--- configure.ac        (revision 5645)
+++ configure.ac        (working copy)
@@ -45,6 +45,19 @@
 dnl ---
 AM_PROG_CC_C_O
 
+AC_MSG_CHECKING([whether to use the local in-tree headers])
+AC_ARG_WITH([headers],
+  [AS_HELP_STRING([--without-headers],
+    [Do not use the in-tree mingw-w64 headers])],
+  [],
+  [with_headers=`test -d "${srcdir}/../mingw-w64-headers" && echo yes || echo 
no`])
+AC_MSG_RESULT([$with_headers])
+AS_CASE([$with_headers],
+  [no],[],
+  [yes],[AS_VAR_SET([WITH_LOCAL_HEADERS])],
+  [AC_MSG_ERROR([invalid argument.  Must be either yes or no.])])
+AM_CONDITIONAL([WITH_LOCAL_HEADERS], [AS_VAR_TEST_SET([WITH_LOCAL_HEADERS])])
+
 AC_MSG_CHECKING([whether to build a w32api package for Cygwin])
 AC_ARG_ENABLE([w32api],
   [AS_HELP_STRING([--enable-w32api],
@@ -228,7 +241,11 @@
 #AC_FUNC_VPRINTF
 #AC_CHECK_FUNCS([alarm atexit btowc fesetround floor ftruncate gettimeofday 
isascii localeconv mbrlen memmove memset pow rint setlocale sqrt strcasecmp 
strchr strncasecmp strtoull strtoumax])
 
-AC_CHECK_HEADER([_mingw_mac.h], [], [AC_MSG_ERROR([Please check if the 
mingw-w64 header set and the build/host option are set properly.])])
+AS_CASE([$with_headers],
+  [yes],[],
+  [AC_CHECK_HEADER([_mingw_mac.h],
+                   [],
+                   [AC_MSG_ERROR([Please check if the mingw-w64 header set and 
the build/host option are set properly.])])])
 
 #Warnings and errors, default level is 3
 AC_MSG_CHECKING([for warning levels])
Index: Makefile.am
===================================================================
--- Makefile.am (revision 5645)
+++ Makefile.am (working copy)
@@ -12,11 +12,17 @@
 
 #AUTOMAKE_OPTIONS = color-tests
 
+if WITH_LOCAL_HEADERS
+local_headers=-I$(abs_top_srcdir)/../mingw-w64-headers/crt 
-I$(abs_top_srcdir)/../mingw-w64-headers/include 
-I$(abs_builddir)/../mingw-w64-headers 
-I$(abs_builddir)/../mingw-w64-headers/crt
+else
+local_headers=
+endif
+sysincludes=$(local_headers)
+
 if WITHSYSROOT
-  sysincludes=-I@TARGET_SYSTEM_ROOT@/include
+  sysincludes+=-I@TARGET_SYSTEM_ROOT@/include
   withsys=--with-sysroot=@TARGET_SYSTEM_ROOT@
 else
-  sysincludes=
   withsys=
 endif
 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to