[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: config.status produces incompatible defines.awk and config.h

From: Hoyt, David
Subject: RE: config.status produces incompatible defines.awk and config.h
Date: Fri, 3 Sep 2010 14:26:48 -0700

cygwin's an option. But the issue, as it turns out, wasn't with msys - we were 
using CVSNT which apparently changes line endings when a file is checked out on 
a Windows client. That caused the problems we saw. I still think the patch is 
useful if there's a place that it can be applied. As I said before, I'm not an 
autotools expert and don't know where the fix ultimately lies -- I gave my best 
estimate and the ultimate fix I'll have to leave up to the experts. If the fix 
means using $ac_cr or $ac_cs_awk_cr somewhere, that's fine. Hopefully what I've 
given you is an idea of where they need to be added or used. From what I can 
tell, the latest in git isn't using those macros. From the link I provided 

/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {

looks like it needs to be:

/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|$ac_cs_awk_cr\$)/ {

and then 2 lines below it, this needs to be added:

sub(/$ac_cs_awk_cr\$/, "", line)

That should allow config.status to properly process Windows-style line endings. 
I haven't tested it on every platform out there, so I can't say for sure that 
it will just work -- but please take it as a suggestion/enhancement (I 
understand if you prefer to discard it -- just trying to give back to the 

It would be useful if I use autotools in a Windows environment (e.g. with msys) 
and I'm writing files such as config.h.in using Windows-native tools (and 
therefore introducing Windows-style line endings). Which, consequently, is what 
I'll be doing. :) For now, I'll have to use dos2unix...

And my apologies for any *'s being added to URLs -- our email filter does that 
to prevent people from clicking on potentially malicious links.

-----Original Message-----
From: Eric Blake [mailto:address@hidden 
Sent: Friday, September 03, 2010 9:12 AM
To: Hoyt, David
Cc: address@hidden
Subject: Re: config.status produces incompatible defines.awk and config.h

On 09/02/2010 05:30 PM, Hoyt, David wrote:
> I'm unsure if this is a binutils-specific issue or not, since I'm told that 
> gcc-related projects use their own configuration environment. But I noticed 
> the following when attempting to compile binutils...
> config.h was not being created correctly on my Windows 7 (x86_64) machine 
> using the latest released tools from msys/mingw, causing all sorts of build 
> problems. After investigating the issue, it was narrowed down to a problem 
> with how config.status produces and then uses defines.awk. That awk file uses 
> a regular expression that looks for lines like "#undef VALUE_HERE" to 
> eventually change them to "#define VALUE_HERE 1" if configure deems it so, 
> but it wasn't finding them due to mismatches from Windows-style line endings.

Thanks for the report.  Autoconf already has some attempted support for 
CRLF line endings in config.status, but it has had issues over time. 
Which version of autoconf are you dealing with?  It may be that you are 
facing an issue with gcc using an older version of autoconf, where 
upgrading to a newer version would resolve things.

Also, have you considered using binary-mode mounts under cygwin, rather 
than text-mode mounts under msys?  That right there would eliminate your 
CR issues, although it implies a different set of cross-compilation 
issues to deal with.  That's probably straying outside what this list 
can support, but I know there are better forums out there for people who 
are actively working on development of gcc for various windows targets.

> +++ defines.awk       Thu Sep  2 15:56:01 2010
> @@ -51,8 +51,9 @@
>     for (key in D) D_is_set[key] = 1
>     FS = " "
>   }
> -/^[\t ]*#[\t ]*(define|undef)[\t 
> ]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t
>  (]|$)/ {
> +/^[\t ]*#[\t ]*(define|undef)[\t 
> ]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t
>  (]|\r$)/ {
>     line = $ 0
> +  sub(/\r$/, "", line)

As written, this patch is not portable.  Rather, if the current 
autoconf.git does not already address the issue, then you will need to 
use the same approach as is already in lib/autoconf/status.m4; notice 
how $ac_cr and $ac_cs_awk_cr are used to find a portable spelling of CR 
that will work for whichever awk will be processing the define script.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://*libvirt.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]