From: Gurusamy Sarathy <gsar@cpan.org>
Date: Sun, 6 Feb 2000 19:28:31 +0000 (+0000)
Subject: use builtin __CYGWIN__ rather than -DCYGWIN (from Eric Fifer
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d308986b5b369caa1602a636a5e2ecfa149dfc89;p=p5sagit%2Fp5-mst-13.2.git

use builtin __CYGWIN__ rather than -DCYGWIN (from Eric Fifer
<EFifer@sanwaint.com>)

p4raw-id: //depot/perl@5008
---

diff --git a/EXTERN.h b/EXTERN.h
index c813f81..7601838 100644
--- a/EXTERN.h
+++ b/EXTERN.h
@@ -40,7 +40,7 @@
 #      define dEXTCONST const
 #    endif
 #  else
-#    if defined(CYGWIN) && defined(USEIMPORTLIB)
+#    if defined(__CYGWIN__) && defined(USEIMPORTLIB)
 #      define EXT extern __declspec(dllimport)
 #      define dEXT 
 #      define EXTCONST extern __declspec(dllimport) const
diff --git a/XSUB.h b/XSUB.h
index 7e1c28c..cfcad5d 100644
--- a/XSUB.h
+++ b/XSUB.h
@@ -47,7 +47,7 @@ handled automatically by C<xsubpp>.
 
 #define ST(off) PL_stack_base[ax + (off)]
 
-#if defined(CYGWIN) && defined(USE_DYNAMIC_LOADING)
+#if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
 #  define XS(name) __declspec(dllexport) void name(pTHXo_ CV* cv)
 #else
 #  define XS(name) void name(pTHXo_ CV* cv)
diff --git a/doio.c b/doio.c
index 3e412b8..0463af8 100644
--- a/doio.c
+++ b/doio.c
@@ -573,7 +573,7 @@ Perl_nextargv(pTHX_ register GV *gv)
 		    }
 #endif
 #ifdef HAS_RENAME
-#if !defined(DOSISH) && !defined(CYGWIN)
+#if !defined(DOSISH) && !defined(__CYGWIN__)
 		    if (PerlLIO_rename(PL_oldname,SvPVX(sv)) < 0) {
 		        if (ckWARN_d(WARN_INPLACE))	
 			    Perl_warner(aTHX_ WARN_INPLACE, 
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 4c96f12..af43c40 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -106,7 +106,7 @@
    }
 #  define times(t) vms_times(t)
 #else
-#if defined (CYGWIN)
+#if defined (__CYGWIN__)
 #    define tzname _tzname
 #endif
 #if defined (WIN32)
@@ -289,7 +289,7 @@ unsigned long strtoul (const char *, char **, int);
 #endif
 
 #ifdef HAS_TZNAME
-#  if !defined(WIN32) && !defined(CYGWIN)
+#  if !defined(WIN32) && !defined(__CYGWIN__)
 extern char *tzname[];
 #  endif
 #else
diff --git a/ext/SDBM_File/sdbm/pair.c b/ext/SDBM_File/sdbm/pair.c
index c2ed213..4f0fde2 100644
--- a/ext/SDBM_File/sdbm/pair.c
+++ b/ext/SDBM_File/sdbm/pair.c
@@ -8,7 +8,7 @@
  */
 
 #include "config.h"
-#ifdef CYGWIN
+#ifdef __CYGWIN__
 # define EXTCONST extern const
 #else
 # include "EXTERN.h"
diff --git a/ext/SDBM_File/sdbm/sdbm.c b/ext/SDBM_File/sdbm/sdbm.c
index 5952d71..f58f448 100644
--- a/ext/SDBM_File/sdbm/sdbm.c
+++ b/ext/SDBM_File/sdbm/sdbm.c
@@ -128,7 +128,7 @@ sdbm_prep(char *dirname, char *pagname, int flags, int mode)
  * open the files in sequence, and stat the dirfile.
  * If we fail anywhere, undo everything, return NULL.
  */
-#if defined(OS2) || defined(MSDOS) || defined(WIN32) || defined(CYGWIN)
+#if defined(OS2) || defined(MSDOS) || defined(WIN32) || defined(__CYGWIN__)
 	flags |= O_BINARY;
 #	endif
 	if ((db->pagf = open(pagname, flags, mode)) > -1) {
diff --git a/hints/cygwin.sh b/hints/cygwin.sh
index ebe8618..4843200 100644
--- a/hints/cygwin.sh
+++ b/hints/cygwin.sh
@@ -21,7 +21,6 @@ so='dll'
 # - eliminate -lc, implied by gcc
 libswanted=`echo " $libswanted " | sed -e 's/ c / /g'`
 libswanted="$libswanted cygipc cygwin kernel32"
-ccflags="$ccflags -DCYGWIN"
 # - otherwise i686-cygwin
 archname='cygwin'
 
diff --git a/lib/ExtUtils/MM_Cygwin.pm b/lib/ExtUtils/MM_Cygwin.pm
index 7a92290..a5ba410 100644
--- a/lib/ExtUtils/MM_Cygwin.pm
+++ b/lib/ExtUtils/MM_Cygwin.pm
@@ -24,7 +24,6 @@ sub cflags {
       / *= */ and $self->{$`} = $';
     };
     $self->{CCFLAGS} .= " -DUSEIMPORTLIB" if ($Config{useshrplib} eq 'true');
-    $self->{CCFLAGS} .= " -DCYGWIN" unless ($self->{CCFLAGS} =~ /\-DCYGWIN/);
 
     return $self->{CFLAGS} = qq{
 CCFLAGS = $self->{CCFLAGS}
diff --git a/mg.c b/mg.c
index f0c3bf3..8d2e4e3 100644
--- a/mg.c
+++ b/mg.c
@@ -916,7 +916,7 @@ Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg)
     }
     FreeEnvironmentStrings(envv);
 #   else
-#	ifdef CYGWIN
+#	ifdef __CYGWIN__
     I32 i;
     for (i = 0; environ[i]; i++)
        safesysfree(environ[i]);
@@ -930,7 +930,7 @@ Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg)
 	for (i = 0; environ[i]; i++)
 	    safesysfree(environ[i]);
 #	    endif /* PERL_USE_SAFE_PUTENV */
-#	endif /* CYGWIN */
+#	endif /* __CYGWIN__ */
 
     environ[0] = Nullch;
 
diff --git a/perl.h b/perl.h
index 36a7cce..37ef3f1 100644
--- a/perl.h
+++ b/perl.h
@@ -1712,7 +1712,7 @@ typedef pthread_key_t	perl_key;
 #   endif
 #endif
 
-#if defined(CYGWIN)
+#if defined(__CYGWIN__)
 /* USEMYBINMODE
  *   This symbol, if defined, indicates that the program should
  *   use the routine my_binmode(FILE *fp, char iotype) to insure
diff --git a/unixish.h b/unixish.h
index f4fe177..492b24a 100644
--- a/unixish.h
+++ b/unixish.h
@@ -122,7 +122,7 @@
 #  ifdef POSIX_BC
 #    define PERL_SYS_INIT(c,v)	sigignore(SIGFPE); MALLOC_INIT
 #  else
-#    ifdef CYGWIN
+#    ifdef __CYGWIN__
 #      define PERL_SYS_INIT(c,v) Perl_my_setenv_init(&environ); MALLOC_INIT
 #    else
 #      define PERL_SYS_INIT(c,v) MALLOC_INIT
diff --git a/util.c b/util.c
index 13b0010..d58b230 100644
--- a/util.c
+++ b/util.c
@@ -1881,7 +1881,7 @@ Perl_vwarner(pTHX_ U32  err, const char* pat, va_list* args)
 }
 
 #ifndef VMS  /* VMS' my_setenv() is in VMS.c */
-#if !defined(WIN32) && !defined(CYGWIN)
+#if !defined(WIN32) && !defined(__CYGWIN__)
 void
 Perl_my_setenv(pTHX_ char *nam, char *val)
 {
@@ -1931,8 +1931,8 @@ Perl_my_setenv(pTHX_ char *nam, char *val)
 #endif  /* PERL_USE_SAFE_PUTENV */
 }
 
-#else /* WIN32 || CYGWIN */
-#if defined(CYGWIN)
+#else /* WIN32 || __CYGWIN__ */
+#if defined(__CYGWIN__)
 /*
  * Save environ of perl.exe, currently Cygwin links in separate environ's
  * for each exe/dll.  Probably should be a member of impure_ptr.