This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how-to use _WIN32 preprocessor with cygwin ?


Eric Belhomme <rico@ricospirit.net> wrote:

>> The cygwin-specific gcc compile flag -mwin32 causes the _WIN32 macro
>> to be defined.  Certain cygwin applications predate that
>> arrangement, so confusion is understandable.
>>
> Thanks for your answer :-)
> So I wonder I have  to modify the configure script to add -mwin32
> flag on gcc option if I detect cygwin environment. Question : How to
> detect cygwin environment ?

Or, just use code like this in your C files:

#if defined(_WIN32) || defined(__CYGWIN__)
Win32 or Cygwin
#endif

If you do want to detect Cygwin in a configure script, then you just do
AC_CANONICAL_HOST, and then:

case $host_os in
  *cygwin* ) do cygwin stuff;;
         * ) do other stuff;;
esac



Max.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]