Hi,

the below patch is more or less a proof of concept.  It changes the
mingw-w64-crt configury so that the internal headers from a parallel
mingw-w64-headers directory are preferred and used if available.

If you don't want that, specify --without-headers, which is the option
used from top-level to disable building the header files at all.

Please have a look.


Thanks,
Corinna


        * configure.ac: Add --without-headers option to disable building
        against parallel in-tree mingw-w64-headers headers.
        (_mingw_mac.h): Don't test existence if building with in-tree
        headers.
        * Makefile.am (local_headers): COnditionally add internal header
        paths.
        (sysincludes): Add local_headers.


Index: configure.ac
===================================================================
--- configure.ac        (revision 5336)
+++ configure.ac        (working copy)
@@ -45,6 +45,18 @@
 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_local_headers=`test -d "${srcdir}/../mingw-w64-headers" && echo yes || 
echo no`])
+AC_MSG_RESULT([$with_local_headers])
+AS_CASE([$with_local_headers],
+  [no],[AS_VAR_SET([WITH_LOCAL_HEADERS])],
+  [yes],[],
+  [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 the crt startup])
 AC_ARG_ENABLE([startup],
   [AS_HELP_STRING([--disable-startup],
@@ -221,8 +239,13 @@
 #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_local_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])
 AC_ARG_ENABLE([warnings],
Index: Makefile.am
===================================================================
--- Makefile.am (revision 5336)
+++ Makefile.am (working copy)
@@ -28,6 +28,9 @@
   dlltool_underscores=--no-leading-underscore
 endif
 
+local_headers=@WITH_LOCAL_HEADERS_FALSE@ 
-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
+sysincludes+=$(local_headers)
+
 AM_CPPFLAGS=-D_CRTBLD $(sysincludes)
 AM_CFLAGS=$(cflags_underscores) -pipe -std=gnu99 @ADD_C_CXX_WARNING_FLAGS@ 
@ADD_C_ONLY_WARNING_FLAGS@
 AM_CXXFLAGS=@ADD_C_CXX_WARNING_FLAGS@ @ADD_CXX_ONLY_WARNING_FLAGS@

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to