This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
cygwin update from Eric Fifer <EFifer@sanwaint.com>
authorGurusamy Sarathy <gsar@cpan.org>
Tue, 28 Dec 1999 02:47:04 +0000 (02:47 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Tue, 28 Dec 1999 02:47:04 +0000 (02:47 +0000)
p4raw-id: //depot/perl@4717

MAINTAIN
MANIFEST
ext/DynaLoader/dl_cygwin.xs [deleted file]
ext/POSIX/POSIX.xs
ext/SDBM_File/sdbm/pair.c
hints/cygwin.sh
installperl
mg.c
pod/perlfaq3.pod
t/op/stat.t
util.c

index 4507ca9..be9eaff 100644 (file)
--- a/MAINTAIN
+++ b/MAINTAIN
@@ -154,7 +154,6 @@ ext/DynaLoader/DynaLoader_pm.PL
 ext/DynaLoader/Makefile.PL     
 ext/DynaLoader/README  
 ext/DynaLoader/dl_aix.xs       aix
-ext/DynaLoader/dl_cygwin.xs    cygwin
 ext/DynaLoader/dl_dld.xs       rsanders
 ext/DynaLoader/dl_dlopen.xs    timb
 ext/DynaLoader/dl_hpux.xs      hpux
index 29ce7b6..9e686d6 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -234,7 +234,6 @@ ext/DynaLoader/README               Dynamic Loader notes and intro
 ext/DynaLoader/XSLoader_pm.PL  Simple XS Loader perl module
 ext/DynaLoader/dl_aix.xs       AIX implementation
 ext/DynaLoader/dl_beos.xs      BeOS implementation
-ext/DynaLoader/dl_cygwin.xs    Cygwin implementation
 ext/DynaLoader/dl_dld.xs       GNU dld style implementation
 ext/DynaLoader/dl_dlopen.xs    BSD/SunOS4&5 dlopen() style implementation
 ext/DynaLoader/dl_hpux.xs      HP-UX implementation
diff --git a/ext/DynaLoader/dl_cygwin.xs b/ext/DynaLoader/dl_cygwin.xs
deleted file mode 100644 (file)
index 4055b05..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/* dl_cygwin.xs
- * 
- * Platform:   Win32 (Windows NT/Windows 95)
- * Author:     Wei-Yuen Tan (wyt@hip.com)
- * Created:    A warm day in June, 1995
- *
- * Modified:
- *    August 23rd 1995 - rewritten after losing everything when I
- *                       wiped off my NT partition (eek!)
- */
-/* Modified from the original dl_win32.xs to work with cygwin
-   -John Cerney 3/26/97
-*/
-/* Porting notes:
-
-I merely took Paul's dl_dlopen.xs, took out extraneous stuff and
-replaced the appropriate SunOS calls with the corresponding Win32
-calls.
-
-*/
-
-#define WIN32_LEAN_AND_MEAN
-// Defines from windows needed for this function only. Can't include full
-//  Cygwin windows headers because of problems with CONTEXT redefinition
-//  Removed logic to tell not dynamically load static modules. It is assumed that all
-//   modules are dynamically built. This should be similar to the behavoir on sunOS.
-//   Leaving in the logic would have required changes to the standard perlmain.c code
-//
-#include <stdio.h>
-
-//#include <windows.h>
-#define LOAD_WITH_ALTERED_SEARCH_PATH  (8)
-typedef void *HANDLE;
-typedef HANDLE HINSTANCE;
-#define STDCALL     __attribute__ ((stdcall))
-typedef int STDCALL (*FARPROC)();
-#define MAX_PATH       260
-
-HINSTANCE
-STDCALL
-LoadLibraryExA(
-              char* lpLibFileName,
-              HANDLE hFile,
-              unsigned int dwFlags
-              );
-unsigned int
-STDCALL
-GetLastError(
-            void
-            );
-FARPROC
-STDCALL
-GetProcAddress(
-              HINSTANCE hModule,
-              char* lpProcName
-              );
-
-#include <string.h>
-
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
-#include "dlutils.c"   /* SaveError() etc      */
-
-static void
-dl_private_init(pTHX)
-{
-    (void)dl_generic_private_init(aTHX);
-}
-
-
-MODULE = DynaLoader    PACKAGE = DynaLoader
-
-BOOT:
-    (void)dl_private_init(aTHX);
-
-void *
-dl_load_file(filename,flags=0)
-    char *             filename
-    int                        flags
-    PREINIT:
-    CODE:
-    {
-    char       win32_path[MAX_PATH];
-    cygwin_conv_to_full_win32_path(filename, win32_path);
-    filename = win32_path;
-
-    DLDEBUG(1,PerlIO_printf(Perl_debug_log,"dl_load_file(%s):\n", filename));
-
-    RETVAL = (void*) LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ;
-
-    DLDEBUG(2,PerlIO_printf(Perl_debug_log," libref=%x\n", RETVAL));
-    ST(0) = sv_newmortal() ;
-    if (RETVAL == NULL){
-       SaveError(aTHX_ "%d",GetLastError()) ;
-    } else {
-       sv_setiv( ST(0), PTR2IV(RETVAL) );
-    }
-   }
-       
-
-
-void *
-dl_find_symbol(libhandle, symbolname)
-    void *     libhandle
-    char *     symbolname
-    CODE:
-    DLDEBUG(2,PerlIO_printf(Perl_debug_log,"dl_find_symbol(handle=%x, symbol=%s)\n",
-       libhandle, symbolname));
-    RETVAL = (void*) GetProcAddress((HINSTANCE) libhandle, symbolname);
-    DLDEBUG(2,PerlIO_printf(Perl_debug_log,"  symbolref = %x\n", RETVAL));
-    ST(0) = sv_newmortal() ;
-    if (RETVAL == NULL)
-       SaveError(aTHX_ "%d",GetLastError()) ;
-    else
-       sv_setiv( ST(0), PTR2IV(RETVAL));
-
-
-void
-dl_undef_symbols()
-    PPCODE:
-
-
-
-# These functions should not need changing on any platform:
-
-void
-dl_install_xsub(perl_name, symref, filename="$Package")
-    char *             perl_name
-    void *             symref 
-    char *             filename
-    CODE:
-    DLDEBUG(2,PerlIO_printf(Perl_debug_log,"dl_install_xsub(name=%s, symref=%x)\n",
-               perl_name, symref));
-    ST(0) = sv_2mortal(newRV((SV*)newXS(perl_name,
-                                       (void(*)(pTHX_ CV *))symref,
-                                       filename)));
-
-
-char *
-dl_error()
-    CODE:
-    RETVAL = LastError ;
-    OUTPUT:
-    RETVAL
-
-# end.
index 6fc32b1..4c96f12 100644 (file)
 #else
 #if defined (CYGWIN)
 #    define tzname _tzname
-#    undef MB_CUR_MAX          /* XXX: bug in b20.1 */
 #endif
 #if defined (WIN32)
 #  undef mkfifo
@@ -290,7 +289,7 @@ unsigned long strtoul (const char *, char **, int);
 #endif
 
 #ifdef HAS_TZNAME
-#  ifndef WIN32
+#  if !defined(WIN32) && !defined(CYGWIN)
 extern char *tzname[];
 #  endif
 #else
index a30894b..c2ed213 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "config.h"
 #ifdef CYGWIN
-# define EXT extern
 # define EXTCONST extern const
 #else
 # include "EXTERN.h"
index de48cdf..ba84df4 100644 (file)
@@ -1,46 +1,37 @@
 #! /bin/sh
 # cygwin.sh - hints for building perl using the Cygwin environment for Win32
 #
-# Many of these inflexible settings should be changed to allow command-
-# line overrides and allow for variations in local set-ups.
-# I have made first guesses at some of these, but would welcome 
-# corrections from someone actually using Cygwin.
-#  Andy Dougherty  <doughera@lafayette.edu> Tue Sep 28 12:39:38 EDT 1999
 
-_exe='.exe'
+# not otherwise settable
 exe_ext='.exe'
-# work around case-insensitive file names
 firstmakefile='GNUmakefile'
-sharpbang='#!'
-startsh='#!/bin/sh'
+case "$ldlibpthname" in
+'') ldlibpthname=PATH ;;
+esac
 
-archname='cygwin'
+# mandatory (overrides defaults)
 test -z "$cc" && cc='gcc'
-libpth='/usr/i586-cygwin32/lib /usr/lib /usr/local/lib'
+if test -z "$libpth"
+then
+    libpth=`gcc -print-file-name=libc.a`
+    libpth=`dirname $libpth`
+    libpth=`cd $libpth && pwd`
+fi
 so='dll'
 libs='-lcygwin -lm -lkernel32'
-#optimize='-g'
-# Is -I/usr/include *really* needed?
-# Is -I/usr/local/include *really* needed?  I thought gcc always looked there.
-ccflags="$ccflags -DCYGWIN -I/usr/include -I/usr/local/include"
-# Is -L/usr/lib *really* needed?
-ldflags="$ldflags -L/usr/i586-cygwin32/lib -L/usr/lib -L/usr/local/lib"
-test -z "$usemymalloc" && usemymalloc='n'
-dlsrc='dl_cygwin.xs'
+ccflags="$ccflags -DCYGWIN"
+archname='cygwin'
 cccdlflags=' '
 ld='ld2'
-# Is -L/usr/local/lib *really* needed?
-lddlflags="$lddlflags -L/usr/local/lib"
+
+# optional(ish)
+# - perl malloc needs to be unpolluted
+bincompat5005='undef'
+# - build shared libperl.dll
 useshrplib='true'
 libperl='libperl.a'
-dlext='dll'
-dynamic_ext=' '
-
-# What if they aren't using $prefix=/usr/local ??
-# Why is this needed at all?  Doesn't Configure suggest this?
-test -z "$man1dir" && man1dir=/usr/local/man/man1
-test -z "$man3dir" && man3dir=/usr/local/man/man3
 
-case "$ldlibpthname" in
-'') ldlibpthname=PATH ;;
-esac
+# strip exe's and dll's
+#ldflags="$ldflags -s"
+#ccdlflags="$ccdlflags -s"
+#lddlflags="$lddlflags -s"
index fd1314f..d1d2995 100755 (executable)
@@ -162,13 +162,13 @@ if ($Is_Cygwin) {
 
    if ($dlsrc ne "dl_none.xs") {
       -f $perldll || die "No perl DLL built\n";
-
+   }
 # Install the DLL
 
-      safe_unlink("$installbin/$perldll");
-      copy("$perldll", "$installbin/$perldll");
-      chmod(0755, "$installbin/$perldll");
-   }
+   safe_unlink("$installbin/$perldll");
+   copy("$perldll", "$installbin/$perldll");
+   chmod(0755, "$installbin/$perldll");
+   
 } # if ($Is_W32 or $Is_Cygwin)
 
 # This will be used to store the packlist
diff --git a/mg.c b/mg.c
index a7af352..fb2b8f1 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -848,7 +848,7 @@ Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg)
 #      ifdef CYGWIN
     I32 i;
     for (i = 0; environ[i]; i++)
-       Safefree(environ[i]);
+       safesysfree(environ[i]);
 #      else
 #          ifndef PERL_USE_SAFE_PUTENV
     I32 i;
index 26f7a69..18c436b 100644 (file)
@@ -483,7 +483,7 @@ The Win95/NT installation, when using the ActiveState port of Perl,
 will modify the Registry to associate the C<.pl> extension with the
 perl interpreter.  If you install another port, perhaps even building
 your own Win95/NT Perl from the standard sources by using a Windows port
-of gcc (e.g., with cygwin32 or mingw32), then you'll have to modify
+of gcc (e.g., with cygwin or mingw32), then you'll have to modify
 the Registry yourself.  In addition to associating C<.pl> with the
 interpreter, NT people can use: C<SET PATHEXT=%PATHEXT%;.PL> to let them
 run the program C<install-linux.pl> merely by typing C<install-linux>.
index 0af55bb..b44617d 100755 (executable)
@@ -14,9 +14,10 @@ print "1..58\n";
 $Is_MSWin32 = $^O eq 'MSWin32';
 $Is_Dos = $^O eq 'dos';
 $Is_Dosish = $Is_Dos || $^O eq 'os2' || $Is_MSWin32;
+$Is_Cygwin = $^O =~ /cygwin/;
 chop($cwd = ($Is_MSWin32 ? `cd` : `pwd`));
 
-$DEV = `ls -l /dev` unless $Is_Dosish;
+$DEV = `ls -l /dev` unless $Is_Dosish or $Is_Cygwin;
 
 unlink "Op.stat.tmp";
 if (open(FOO, ">Op.stat.tmp")) {
@@ -163,7 +164,7 @@ else
     {print "not ok 33\n";}
 if (! -b '.') {print "ok 34\n";} else {print "not ok 34\n";}
 
-if ($^O eq 'amigaos' or $Is_Dosish) {
+if ($^O eq 'amigaos' or $Is_Dosish or $Is_Cygwin) {
   print "ok 35 # skipped: no -u\n"; goto tty_test;
 }
 
diff --git a/util.c b/util.c
index 416a437..6cbfbcd 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1889,7 +1889,7 @@ Perl_my_setenv_init(char ***penviron)
 }
 
 void
-my_setenv(char *nam, char *val)
+Perl_my_setenv(char *nam, char *val)
 {
     /* You can not directly manipulate the environ[] array because
      * the routines do some additional work that syncs the Cygwin
@@ -1901,13 +1901,13 @@ my_setenv(char *nam, char *val)
        if (!oldstr)
            return;
        unsetenv(nam);
-       Safefree(oldstr);
+       safesysfree(oldstr);
        return;
     }
     setenv(nam, val, 1);
     environ = *Perl_main_environ; /* environ realloc can occur in setenv */
     if(oldstr && environ[setenv_getix(nam)] != oldstr)
-       Safefree(oldstr);
+       safesysfree(oldstr);
 }
 #else /* if WIN32 */