delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/11/30/23:00:49

X-Spam-Check-By: sourceware.org
Message-ID: <456FA8DD.3030409@byu.net>
Date: Thu, 30 Nov 2006 21:00:29 -0700
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: autoconf AT gnu DOT org, cygwin AT cygwin DOT com, bob_rossi AT cox DOT net
Subject: Re: cygwin -mno-cygwin AC_CHECK_SIZEOF
References: <20061201023212 DOT GH19404 AT cox DOT net>
In-Reply-To: <20061201023212.GH19404@cox.net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bob Rossi on 11/30/2006 7:32 PM:
> Hi,
> 
> If I'm using cygwin, with the -mno-cygwin gcc/g++ compiler option, then
> mingw is used.

Or more precisely, the -mno-cygwin switch in cygwin's gcc is a shorthand
for invoking a cross-compiler that produces mingw executables.

> It seems that mingw uses a \r\n for a newline.

Yes, mingw is a native Windows target, which means a mingw executable
produces DOS line endings unless you open a file in binary mode; autoconf
currently does not produce test executables that do this, on the grounds
that requesting binary mode is not portable to other platforms.

> 
> AC_CHECK_SIZEOF does these two things on cygwin with autoconf 2.60.
>   fprintf(f, "%d\n", sizeof($1));
> which prints "4\r\n" if the size is 4 and then
>   AC_CV_NAME=`cat conftestval`, ...
> now cygwin's cat doesn't understand \r\n, so

Or better worded, on a binary mount, cygwin's cat treats \r literally,
like any other unix implementation of cat would do.

>   ac_cv_sizeof_int=`cat conftestval`
> results in "4\r", which breaks the configure.in scripts that check with
> if statements for "$ac_cv_sizeof_int" = "4".
> 
> What is the best way to resolve something like this?

Perhaps experiment with a cygwin text mount, so that cygwin cat will
ignore the \r.  Or experiment with the recent add-on to cygwin's bash,
where exporting SHELLOPTS with the cygwin-specific shell option igncr set
will tell subsequent /bin/sh invocations to strip \r from command
substitution.  Or rather than trying to cross-compile, with mixed results
between mingw test binaries but cygwin build framework; just use the MSYS
environment so that your entire build process is native.

Actually, maybe it would work if you invoked configure properly - since
- -mno-cygwin is requesting a cross-compiler, you REALLY should be invoking
it like this:
./configure --host=i686-pc-mingw32 --build=i686-pc-cygwin \
  CC='gcc -mno-cygwin'
And the fact that you are now telling configure the truth that you are
cross-compiling, even though the cross binaries are executable, may be
enough for autoconf to try harder for discovering how AC_CHECK_SIZEOF
should behave without tripping up on line endings (and if that is not the
case, maybe we should consider patching autoconf to make it happen that way).

- --
Life is short - so eat dessert first!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFb6jc84KuGfSFAYARAsm8AKDHGKnsrS9YCeo0Ae+7gBFpMwNcgACgjufm
sZldUr3kV4auZC/oe9KdtpM=
=6KKf
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019