Commit 5fa3ea21 by Dave Korn Committed by Dave Korn

Makefile.in (LIBGNAT_TARGET_PAIRS [windows targets]): Correctly detect cygwin...

	* gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS [windows targets]):
	Correctly detect cygwin, which no longer has the '32' suffix, and use
	appropriate implementations of the sockets and memory packages.
	* sysdep.c (WIN_SETMODE): New define to choose the correct spelling of
	setmode/_setmode for MinGW and Cygwin, respectively.
	(__gnat_set_binary_mode [windows targets]): Use the above, and enable
	the windows version for Cygwin as well as MinGW.
	(__gnat_set_text_mode [windows targets]): Likewise.
	(__gnat_ttyname [windows targets]): Provide a Cygwin implementation
	in addition to the MinGW version.
	(__gnat_is_windows_xp): Make available to Cygwin as well as MinGW.
	(__gnat_get_stack_bounds): Likewise.

From-SVN: r182065
parent 8535715d
2011-12-06 Dave Korn <dave.korn.cygwin@gmail.com>
* gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS [windows targets]):
Correctly detect cygwin, which no longer has the '32' suffix, and use
appropriate implementations of the sockets and memory packages.
* sysdep.c (WIN_SETMODE): New define to choose the correct spelling of
setmode/_setmode for MinGW and Cygwin, respectively.
(__gnat_set_binary_mode [windows targets]): Use the above, and enable
the windows version for Cygwin as well as MinGW.
(__gnat_set_text_mode [windows targets]): Likewise.
(__gnat_ttyname [windows targets]): Provide a Cygwin implementation
in addition to the MinGW version.
(__gnat_is_windows_xp): Make available to Cygwin as well as MinGW.
(__gnat_get_stack_bounds): Likewise.
2011-12-05 Bob Duff <duff@adacore.com> 2011-12-05 Bob Duff <duff@adacore.com>
* sem_ch4.adb: Minor comment fix. * sem_ch4.adb: Minor comment fix.
......
...@@ -1580,18 +1580,32 @@ ifeq ($(strip $(filter-out avr none powerpc% eabispe leon% erc32% unknown elf,$( ...@@ -1580,18 +1580,32 @@ ifeq ($(strip $(filter-out avr none powerpc% eabispe leon% erc32% unknown elf,$(
indepsw.adb<indepsw-gnu.adb indepsw.adb<indepsw-gnu.adb
endif endif
ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),) ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
LIBGNAT_TARGET_PAIRS = \ # Cygwin provides a full Posix environment, and so we use the default
# versions of s-memory and g-socthi rather than the Windows-specific
# MinGW versions. Ideally we would use all the default versions for
# Cygwin and none of the MinGW versions, but for historical reasons
# the Cygwin port has always been a CygMing frankenhybrid and it is
# a long-term project to disentangle them.
ifeq ($(strip $(filter-out cygwin%,$(osys))),)
LIBGNAT_TARGET_PAIRS = \
s-memory.adb<s-memory.adb \
g-socthi.ads<g-socthi.ads \
g-socthi.adb<g-socthi.adb
else
LIBGNAT_TARGET_PAIRS = \
s-memory.adb<s-memory-mingw.adb \
g-socthi.ads<g-socthi-mingw.ads \
g-socthi.adb<g-socthi-mingw.adb
endif
LIBGNAT_TARGET_PAIRS += \
a-dirval.adb<a-dirval-mingw.adb \ a-dirval.adb<a-dirval-mingw.adb \
a-excpol.adb<a-excpol-abort.adb \ a-excpol.adb<a-excpol-abort.adb \
s-gloloc.adb<s-gloloc-mingw.adb \ s-gloloc.adb<s-gloloc-mingw.adb \
s-inmaop.adb<s-inmaop-dummy.adb \ s-inmaop.adb<s-inmaop-dummy.adb \
s-memory.adb<s-memory-mingw.adb \
s-taspri.ads<s-taspri-mingw.ads \ s-taspri.ads<s-taspri-mingw.ads \
s-tasinf.adb<s-tasinf-mingw.adb \ s-tasinf.adb<s-tasinf-mingw.adb \
s-tasinf.ads<s-tasinf-mingw.ads \ s-tasinf.ads<s-tasinf-mingw.ads \
g-socthi.ads<g-socthi-mingw.ads \
g-socthi.adb<g-socthi-mingw.adb \
g-stsifd.adb<g-stsifd-sockets.adb \ g-stsifd.adb<g-stsifd-sockets.adb \
g-soliop.ads<g-soliop-mingw.ads \ g-soliop.ads<g-soliop-mingw.ads \
$(ATOMICS_TARGET_PAIRS) $(ATOMICS_TARGET_PAIRS)
......
...@@ -120,38 +120,44 @@ extern struct tm *localtime_r(const time_t *, struct tm *); ...@@ -120,38 +120,44 @@ extern struct tm *localtime_r(const time_t *, struct tm *);
*/ */
#if defined(WINNT) #if defined (WINNT) || defined (__CYGWIN__)
const char __gnat_text_translation_required = 1; const char __gnat_text_translation_required = 1;
#ifdef __CYGWIN__
#define WIN_SETMODE setmode
#include <io.h>
#else
#define WIN_SETMODE _setmode
#endif
void void
__gnat_set_binary_mode (int handle) __gnat_set_binary_mode (int handle)
{ {
_setmode (handle, O_BINARY); WIN_SETMODE (handle, O_BINARY);
} }
void void
__gnat_set_text_mode (int handle) __gnat_set_text_mode (int handle)
{ {
_setmode (handle, O_TEXT); WIN_SETMODE (handle, O_TEXT);
} }
#ifdef __MINGW32__ #ifdef __CYGWIN__
#include <windows.h>
/* Return the name of the tty. Under windows there is no name for
the tty, so this function, if connected to a tty, returns the generic name
"console". */
char * char *
__gnat_ttyname (int filedes) __gnat_ttyname (int filedes)
{ {
if (isatty (filedes)) extern char *ttyname (int);
return "console";
else return ttyname (filedes);
return NULL;
} }
#endif /* __CYGWIN__ */
#if defined (__CYGWIN__) || defined (__MINGW32__)
#include <windows.h>
#ifndef RTX #ifndef RTX
int __gnat_is_windows_xp (void); int __gnat_is_windows_xp (void);
...@@ -178,7 +184,7 @@ __gnat_is_windows_xp (void) ...@@ -178,7 +184,7 @@ __gnat_is_windows_xp (void)
return is_win_xp; return is_win_xp;
} }
#endif #endif /* !RTX */
/* Get the bounds of the stack. The stack pointer is supposed to be /* Get the bounds of the stack. The stack pointer is supposed to be
initialized to BASE when a thread is created and the stack can be extended initialized to BASE when a thread is created and the stack can be extended
...@@ -198,7 +204,24 @@ __gnat_get_stack_bounds (void **base, void **limit) ...@@ -198,7 +204,24 @@ __gnat_get_stack_bounds (void **base, void **limit)
*limit = tib->StackLimit; *limit = tib->StackLimit;
} }
#endif /* !__MINGW32__ */ #endif /* __CYGWIN__ || __MINGW32__ */
#ifdef __MINGW32__
/* Return the name of the tty. Under windows there is no name for
the tty, so this function, if connected to a tty, returns the generic name
"console". */
char *
__gnat_ttyname (int filedes)
{
if (isatty (filedes))
return "console";
else
return NULL;
}
#endif /* __MINGW32__ */
#else #else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment