From: Gurusamy Sarathy Date: Thu, 2 Mar 2000 19:40:44 +0000 (+0000) Subject: patch to fix mingw32 build under USE_IMP_SYS (from Benjamin Stuhl); X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8fb7c905b2ebbea240082c064c2444b482a14f7;p=p5sagit%2Fp5-mst-13.2.git patch to fix mingw32 build under USE_IMP_SYS (from Benjamin Stuhl); some parts not applied p4raw-id: //depot/perl@5445 --- diff --git a/win32/Makefile b/win32/Makefile index 88e270d..ddc7a9f 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -589,10 +589,7 @@ CORE_NOCFG_H = \ .\include\dirent.h \ .\include\netdb.h \ .\include\sys\socket.h \ - .\win32.h \ - .\perlhost.h \ - .\vdir.h \ - .\vmem.h + .\win32.h CORE_H = $(CORE_NOCFG_H) .\config.h @@ -798,8 +795,9 @@ $(MINIWIN32_OBJ) : $(CORE_NOCFG_H) $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*F).c # -DPERL_IMPLICIT_SYS needs C++ for perllib.c +# This is the only file that depends on perlhost.h, vmem.h, and vdir.h !IF "$(USE_IMP_SYS)$(USE_OBJECT)" == "defineundef" -perllib$(o) : perllib.c +perllib$(o) : perllib.c .\perlhost.h .\vdir.h .\vmem.h $(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c !ENDIF diff --git a/win32/makefile.mk b/win32/makefile.mk index 724fb63..fd34a06 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -712,10 +712,7 @@ CORE_NOCFG_H = \ .\include\dirent.h \ .\include\netdb.h \ .\include\sys\socket.h \ - .\win32.h \ - .\perlhost.h \ - .\vdir.h \ - .\vmem.h + .\win32.h CORE_H = $(CORE_NOCFG_H) .\config.h @@ -1000,8 +997,10 @@ $(MINIWIN32_OBJ) : $(CORE_NOCFG_H) # -DPERL_IMPLICIT_SYS needs C++ for perllib.c # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless -# unless the .IF is true), so instead we use a .ELSE with the default -perllib$(o) : perllib.c +# unless the .IF is true), so instead we use a .ELSE with the default. +# This is the only file that depends on perlhost.h, vmem.h, and vdir.h + +perllib$(o) : perllib.c .\perlhost.h .\vdir.h .\vmem.h .IF "$(USE_IMP_SYS)$(USE_OBJECT)" == "defineundef" $(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c .ELSE diff --git a/win32/perllib.c b/win32/perllib.c index 2a0cb85..f240e2f 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -337,6 +337,9 @@ RunPerl(int argc, char **argv, char **env) EXTERN_C void set_w32_module_name(void); +#ifdef __MINGW32__ +EXTERN_C /* GCC in C++ mode mangles the name, otherwise */ +#endif BOOL APIENTRY DllMain(HANDLE hModule, /* DLL module handle */ DWORD fdwReason, /* reason called */ diff --git a/win32/win32.c b/win32/win32.c index 5fb1f46..4ccae52 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -15,7 +15,11 @@ #define Win32_Winsock #endif #include -#include +#ifndef __MINGW32__ /* GCC/Mingw32-2.95.2 forgot the WINAPI on CommandLineToArgvW() */ +# include +#else + LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCommandLine, int * pNumArgs); +#endif #include #include @@ -58,7 +62,12 @@ int _CRT_glob = 0; #endif #if defined(__MINGW32__) -# define _stat stat +/* Mingw32 is missing some prototypes */ +FILE * _wfopen(LPCWSTR wszFileName, LPCWSTR wszMode); +FILE * _wfdopen(int nFd, LPCWSTR wszMode); +FILE * _freopen(LPCWSTR wszFileName, LPCWSTR wszMode, FILE * pOldStream); +int _flushall(); +int _fcloseall(); #endif #if defined(__BORLANDC__) diff --git a/win32/win32.h b/win32/win32.h index b0ccd14..a0d0761 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -211,10 +211,6 @@ typedef long gid_t; #define flushall _flushall #define fcloseall _fcloseall -#ifndef CP_UTF8 -# define CP_UTF8 65001 -#endif - #ifdef PERL_OBJECT # define MEMBER_TO_FPTR(name) &(name) #endif @@ -228,6 +224,11 @@ typedef long gid_t; #endif /* __MINGW32__ */ +/* both GCC/Mingw32 and MSVC++ 4.0 are missing this, so we put it here */ +#ifndef CP_UTF8 +# define CP_UTF8 65001 +#endif + /* compatibility stuff for other compilers goes here */