OSDN Git Service

Provide CLOCK_REALTIME on Tru64 UNIX
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-oscons-tmplt.c
index d8a6477..340abe9 100644 (file)
@@ -78,11 +78,19 @@ pragma Style_Checks ("M32766");
  **  $ RUN xoscons
  **/
 
+/* Feature macro definitions */
+
 #if defined (__linux__) && !defined (_XOPEN_SOURCE)
 /** For Linux _XOPEN_SOURCE must be defined, otherwise IOV_MAX is not defined
  **/
 #define _XOPEN_SOURCE 500
 
+#elif defined (__alpha__) && defined (__osf__)
+/** For Tru64 UNIX, _XOPEN_SOURCE must be defined, otherwise CLOCK_REALTIME
+ ** is not defined.
+ **/
+#define _XOPEN_SOURCE 500
+
 #elif defined (__mips) && defined (__sgi)
 /** For IRIX 6, _XOPEN5 must be defined and _XOPEN_IOV_MAX must be used as
  ** IOV_MAX, otherwise IOV_MAX is not defined.  IRIX 5 has neither.
@@ -93,6 +101,10 @@ pragma Style_Checks ("M32766");
 #endif
 #endif
 
+/* Include gsocket.h before any system header so it can redefine FD_SETSIZE */
+
+#include "gsocket.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
@@ -130,8 +142,6 @@ pragma Style_Checks ("M32766");
 # include <vxWorks.h>
 #endif
 
-#include "gsocket.h"
-
 #ifdef DUMMY
 
 # if defined (TARGET)
@@ -146,7 +156,7 @@ pragma Style_Checks ("M32766");
 
 # define NATIVE
 
-#endif
+#endif /* DUMMY */
 
 #ifndef TARGET
 # error Please define TARGET
@@ -213,7 +223,7 @@ int counter = 0;
   : : "i" (__LINE__));
 /* Freeform text */
 
-#endif
+#endif /* NATIVE */
 
 #define CST(name,comment) C(#name,String,name,comment)
 
@@ -926,6 +936,21 @@ CND(VEOL2, "Alternative EOL")
 
 #endif /* HAVE_TERMIOS */
 
+/*
+
+   -----------------------------
+   -- Pseudo terminal library --
+   -----------------------------
+
+*/
+
+#if defined (__FreeBSD__) || defined (linux)
+# define PTY_Library "-lutil"
+#else
+# define PTY_Library ""
+#endif
+CST(PTY_Library, "for g-exptty")
+
 /**
  **  Sockets constants
  **/
@@ -1208,55 +1233,6 @@ CND(IP_DROP_MEMBERSHIP, "Leave a multicast group")
 #endif
 CND(IP_PKTINFO, "Get datagram info")
 
-#endif /* HAVE_SOCKETS */
-
-/*
-
-   ------------
-   -- Clocks --
-   ------------
-
-*/
-
-#ifdef CLOCK_REALTIME
-CND(CLOCK_REALTIME, "System realtime clock")
-#endif
-
-#ifdef CLOCK_MONOTONIC
-CND(CLOCK_MONOTONIC, "System monotonic clock")
-#endif
-
-#ifdef CLOCK_FASTEST
-CND(CLOCK_FASTEST, "Fastest clock")
-#endif
-
-#if defined (__sgi)
-CND(CLOCK_SGI_FAST,  "SGI fast clock")
-CND(CLOCK_SGI_CYCLE, "SGI CPU clock")
-#endif
-
-#if defined(__APPLE__)
-/* There's no clock_gettime or clock_id's on Darwin */
-# define CLOCK_RT_Ada "-1"
-
-#elif defined(FreeBSD) || defined(_AIX)
-/* On these platforms use system provided monotonic clock */
-# define CLOCK_RT_Ada "CLOCK_MONOTONIC"
-
-#elif defined(CLOCK_REALTIME)
-/* By default use CLOCK_REALTIME */
-# define CLOCK_RT_Ada "CLOCK_REALTIME"
-#endif
-
-#ifdef CLOCK_RT_Ada
-CNS(CLOCK_RT_Ada, "Ada realtime clock")
-#endif
-
-#ifndef CLOCK_THREAD_CPUTIME_ID
-# define CLOCK_THREAD_CPUTIME_ID -1
-#endif
-CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
-
 /*
 
    ----------------------
@@ -1367,58 +1343,77 @@ CST(Inet_Pton_Linkname, "")
 
 #endif /* HAVE_SOCKETS */
 
-/**
- **  System-specific constants follow
- **  Each section should be activated if compiling for the corresponding
- **  platform *or* generating the dummy version for runtime test compilation.
- **/
-
-#if defined (__vxworks) || defined (DUMMY)
-
 /*
 
-   --------------------------------
-   -- VxWorks-specific constants --
-   --------------------------------
+   ---------------------
+   -- Threads support --
+   ---------------------
+
+   --  Clock identifier definitions
 
-   --  These constants may be used only within the VxWorks version of
-   --  GNAT.Sockets.Thin.
 */
 
-CND(OK,    "VxWorks generic success")
-CND(ERROR, "VxWorks generic error")
+/* Note: On HP-UX, CLOCK_REALTIME is an enum, not a macro. */
 
+#if defined(CLOCK_REALTIME) || defined (__hpux__)
+# define HAVE_CLOCK_REALTIME
 #endif
 
-#if defined (__MINGW32__) || defined (DUMMY)
-/*
+#ifdef HAVE_CLOCK_REALTIME
+CND(CLOCK_REALTIME, "System realtime clock")
+#endif
 
-   ------------------------------
-   -- MinGW-specific constants --
-   ------------------------------
+#ifdef CLOCK_MONOTONIC
+CND(CLOCK_MONOTONIC, "System monotonic clock")
+#endif
 
-   --  These constants may be used only within the MinGW version of
-   --  GNAT.Sockets.Thin.
-*/
+#ifdef CLOCK_FASTEST
+CND(CLOCK_FASTEST, "Fastest clock")
+#endif
 
-CND(WSASYSNOTREADY,     "System not ready")
-CND(WSAVERNOTSUPPORTED, "Version not supported")
-CND(WSANOTINITIALISED,  "Winsock not initialized")
-CND(WSAEDISCON,         "Disconnected")
+#if defined (__sgi)
+CND(CLOCK_SGI_FAST,  "SGI fast clock")
+CND(CLOCK_SGI_CYCLE, "SGI CPU clock")
+#endif
 
+#ifndef CLOCK_THREAD_CPUTIME_ID
+# define CLOCK_THREAD_CPUTIME_ID -1
 #endif
+CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
 
-#ifdef NATIVE
-   putchar ('\n');
+#if defined(__APPLE__)
+/* There's no clock_gettime or clock_id's on Darwin, generate a dummy value */
+# define CLOCK_RT_Ada "-1"
+
+#elif defined(FreeBSD) || defined(_AIX)
+/** On these platforms use system provided monotonic clock instead of
+ ** the default CLOCK_REALTIME. We then need to set up cond var attributes
+ ** appropriately (see thread.c).
+ **/
+# define CLOCK_RT_Ada "CLOCK_MONOTONIC"
+# define NEED_PTHREAD_CONDATTR_SETCLOCK
+
+#elif defined(HAVE_CLOCK_REALTIME)
+/* By default use CLOCK_REALTIME */
+# define CLOCK_RT_Ada "CLOCK_REALTIME"
+#endif
+
+#ifdef CLOCK_RT_Ada
+CNS(CLOCK_RT_Ada, "")
 #endif
 
 #if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
 /*
 
-   --  Sizes of pthread data types (on Darwin these are padding)
+   --  Sizes of pthread data types
+
 */
 
 #if defined (__APPLE__) || defined (DUMMY)
+/*
+   --  (on Darwin, these are just placeholders)
+
+*/
 #define PTHREAD_SIZE            __PTHREAD_SIZE__
 #define PTHREAD_ATTR_SIZE       __PTHREAD_ATTR_SIZE__
 #define PTHREAD_MUTEXATTR_SIZE  __PTHREAD_MUTEXATTR_SIZE__
@@ -1440,24 +1435,65 @@ CND(WSAEDISCON,         "Disconnected")
 #define PTHREAD_ONCE_SIZE       (sizeof (pthread_once_t))
 #endif
 
-CND(PTHREAD_SIZE, "pthread_t")
+CND(PTHREAD_SIZE,            "pthread_t")
+CND(PTHREAD_ATTR_SIZE,       "pthread_attr_t")
+CND(PTHREAD_MUTEXATTR_SIZE,  "pthread_mutexattr_t")
+CND(PTHREAD_MUTEX_SIZE,      "pthread_mutex_t")
+CND(PTHREAD_CONDATTR_SIZE,   "pthread_condattr_t")
+CND(PTHREAD_COND_SIZE,       "pthread_cond_t")
+CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t")
+CND(PTHREAD_RWLOCK_SIZE,     "pthread_rwlock_t")
+CND(PTHREAD_ONCE_SIZE,       "pthread_once_t")
 
-CND(PTHREAD_ATTR_SIZE, "pthread_attr_t")
+#endif /* __APPLE__ || __linux__ */
 
-CND(PTHREAD_MUTEXATTR_SIZE, "pthread_mutexattr_t")
+/**
+ **  System-specific constants follow
+ **  Each section should be activated if compiling for the corresponding
+ **  platform *or* generating the dummy version for runtime test compilation.
+ **/
 
-CND(PTHREAD_MUTEX_SIZE, "pthread_mutex_t")
+#if defined (__vxworks) || defined (DUMMY)
 
-CND(PTHREAD_CONDATTR_SIZE, "pthread_condattr_t")
+/*
 
-CND(PTHREAD_COND_SIZE, "pthread_cond_t")
+   --------------------------------
+   -- VxWorks-specific constants --
+   --------------------------------
 
-CND(PTHREAD_RWLOCKATTR_SIZE, "pthread_rwlockattr_t")
+   --  These constants may be used only within the VxWorks version of
+   --  GNAT.Sockets.Thin.
+*/
 
-CND(PTHREAD_RWLOCK_SIZE, "pthread_rwlock_t")
+CND(OK,    "VxWorks generic success")
+CND(ERROR, "VxWorks generic error")
 
-CND(PTHREAD_ONCE_SIZE, "pthread_once_t")
+#endif /* __vxworks */
 
+#if defined (__MINGW32__) || defined (DUMMY)
+/*
+
+   ------------------------------
+   -- MinGW-specific constants --
+   ------------------------------
+
+   --  These constants may be used only within the MinGW version of
+   --  GNAT.Sockets.Thin.
+*/
+
+CND(WSASYSNOTREADY,     "System not ready")
+CND(WSAVERNOTSUPPORTED, "Version not supported")
+CND(WSANOTINITIALISED,  "Winsock not initialized")
+CND(WSAEDISCON,         "Disconnected")
+
+#endif /* __MINGW32__ */
+
+/**
+ ** End of constants definitions
+ **/
+
+#ifdef NATIVE
+   putchar ('\n');
 #endif
 
 /*