Subject: Re: bug#9960: Compiling Emacs trunk with MSVC

From: Eli Zaretskii <[email-masked]>
Date: Sat, 12 Nov 2011 22:37:58 +0200

> Date: Sat, 12 Nov 2011 10:10:34 -0700
> From: Christoph Scholtes <[email-masked]>
> CC: Eli Zaretskii <[email-masked]>, [email-masked]
> 
> On a clean checkout or after make maintainer-clean `getopt.h' needs to 
> be regenerated. In order for this to work with nmake I needed to make 
> the following change:
> 
> === modified file 'lib/makefile.w32-in'
> --- lib/makefile.w32-in	2011-11-05 11:34:56 +0000
> +++ lib/makefile.w32-in	2011-11-06 13:34:03 +0000
> @@ -212,7 +212,7 @@
> 
>   HAVE_GETOPT_H = HAVE_GETOPT_H
>   INCLUDE_NEXT = include_next
> -PRAGMA_SYSTEM_HEADER = \#pragma GCC system_header
> +PRAGMA_SYSTEM_HEADER = ^#pragma GCC system_header
>   PRAGMA_COLUMNS =
>   NEXT_GETOPT_H = <getopt.h>
>   ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h
> 
> This is not meant as a permanent fix, but just an example of what is 
> necessary to make it work with nmake.
> 
> See:
> http://msdn.microsoft.com/en-us/library/f8txf85h%28v=vs.80%29.aspx
> 
> Should we define an ESCAPE_SPECIAL_CHAR variable in 
> nmake.defs/gmake.defs to handle this or is there a way to make the 
> platform specific decision in the makefile.w32-in without too much 
> duplication?

This pragma is only needed when Emacs is compiled with MinGW, because
this pragma is specific to GCC.  So a better solution would be to
define PRAGMA_SYSTEM_HEADER itself on gmake.defs, and define it as
empty on nmake.defs (to edit away "@PRAGMA_SYSTEM_HEADER@").