autoconf
[Top][All Lists]
Advanced

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

Re: cygwin -mno-cygwin AC_CHECK_SIZEOF


From: Keith MARSHALL
Subject: Re: cygwin -mno-cygwin AC_CHECK_SIZEOF
Date: Fri, 1 Dec 2006 14:56:26 +0000

Bob Rossi wrote, quoting Eric Blake:
>> So, if you INSIST on using the cygwin environment to cross-compile
>> mingw binaries, you should use:
>> 
>> ./configure --build=i686-pc-cygwin --host=i686-pc-mingw32 \
>>   CC='gcc -mno-cygwin' CXX='g++ -mno-cygwin'
>
> Well, if I do that, I get this:
>
>  checking for MAP_ANON in sys/mman.h... no
>  checking for /dev/zero... configure: error: cannot check for file
>  existence when cross compiling
>
> This comes from the
>  AC_CHECK_FILE(/dev/zero)

That's because AC_CHECK_FILE tests a feature of the *host*, not the
*build* environment.  If you use AC_CHECK_FILE in your configure.ac,
(or if you insist, configure.in) then you *cannot* cross compile the
application.  And, if you want to build MinGW apps under Cygwin, you
*must* be able to cross compile.

(RTFM: File: autoconf.info,  Node: Files
|You might also need to check for the existence of files.  Before using
|these macros, ask yourself whether a run-time test might not be a better
|solution.  Be aware that, like most Autoconf macros, they test a feature
|of the host machine, and therefore, they die when cross-compiling.
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| - Macro: AC_CHECK_FILE (FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|     Check whether file FILE exists on the native system.  If it is
|     found, execute ACTION-IF-FOUND, otherwise do ACTION-IF-NOT-FOUND,
|     if given.
)

Eric has already told you the solution -- use MSYS, and build natively.
-mno-cygwin is a Cygwin kludge to make gcc and friends emulate a properly
named i586-pc-mingw32 cross tool chain, but it doesn't make configure
properly identify the *host* environment as mingw32; if you do not use
--host=i586-pc-mingw32, (or an acceptable alias), then the host will
still be identified as Cygwin, and, even though you've suppressed the
dependency on cygwin-1.dll, there is still a strong possibility that
your application will fail to deploy on a MinGW host.

Regards,
Keith.




reply via email to

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