target_alias=${target_alias-$host_alias}
+if test "$build" != "$host"; then
+ # We are being configured with some form of cross compiler.
+ GLIBCXX_IS_NATIVE=false
+ case "$host","$target" in
+ # Darwin crosses can use the host system's libraries and headers,
+ # because of the fat library support. Of course, it must be the
+ # same version of Darwin on both sides. Allow the user to
+ # just say --target=foo-darwin without a version number to mean
+ # "the version on this system".
+ *-*-darwin*,*-*-darwin*)
+ hostos=`echo $host | sed 's/.*-darwin/darwin/'`
+ targetos=`echo $target | sed 's/.*-darwin/darwin/'`
+ if test $hostos = $targetos || test $targetos = darwin ; then
+ GLIBCXX_IS_NATIVE=true
+ fi
+ ;;
+
+ *)
+
+ ;;
+ esac
+else
+ GLIBCXX_IS_NATIVE=true
+fi
+
+# Runs configure.host, and assorted other critical bits. Sets
+# up critical shell variables.
+GLIBCXX_CONFIGURE
+
+# For gettimeofday support.
+GLIBCXX_CHECK_GETTIMEOFDAY
+
+# For clock_gettime, nanosleep and sched_yield support.
+GLIBCXX_ENABLE_LIBSTDCXX_TIME
+
+
am__api_version='1.15'
# Find a good install program. We prefer a C program (faster),
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12705 "configure"
+#line 12741 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12811 "configure"
+#line 12847 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
target_alias=${target_alias-$host_alias}
AC_SUBST(target_alias)
+if test "$build" != "$host"; then
+ # We are being configured with some form of cross compiler.
+ GLIBCXX_IS_NATIVE=false
+ case "$host","$target" in
+ # Darwin crosses can use the host system's libraries and headers,
+ # because of the fat library support. Of course, it must be the
+ # same version of Darwin on both sides. Allow the user to
+ # just say --target=foo-darwin without a version number to mean
+ # "the version on this system".
+ *-*-darwin*,*-*-darwin*)
+ hostos=`echo $host | sed 's/.*-darwin/darwin/'`
+ targetos=`echo $target | sed 's/.*-darwin/darwin/'`
+ if test $hostos = $targetos || test $targetos = darwin ; then
+ GLIBCXX_IS_NATIVE=true
+ fi
+ ;;
+
+ *)
+ GCC_NO_EXECUTABLES
+ ;;
+ esac
+else
+ GLIBCXX_IS_NATIVE=true
+fi
+
+# Runs configure.host, and assorted other critical bits. Sets
+# up critical shell variables.
+GLIBCXX_CONFIGURE
+
+# For gettimeofday support.
+GLIBCXX_CHECK_GETTIMEOFDAY
+
+# For clock_gettime, nanosleep and sched_yield support.
+GLIBCXX_ENABLE_LIBSTDCXX_TIME
+
+
AM_INIT_AUTOMAKE([1.15.1 no-define foreign no-dist -Wall -Wno-portability])
AH_TEMPLATE(PACKAGE, [Name of package])
#include "time.h"
#endif
+// Conditional inclusion of sys/time.h for gettimeofday
+#if !defined(_GLIBCXX_USE_CLOCK_MONOTONIC) && \
+ !defined(_GLIBCXX_USE_CLOCK_REALTIME) && \
+ defined(_GLIBCXX_USE_GETTIMEOFDAY)
+#include <sys/time.h>
+#endif
+
+#if defined(_GLIBCXX_USE_CLOCK_GETTIME_SYSCALL)
+#include <unistd.h>
+#include <sys/syscall.h>
+#endif
+
#if defined(HAVE_MALLOC_H)
#include "malloc.h"
#endif
#endif
-extern "C" long int
-EXPORT(timezone) (void)
-{
-#if defined(HAVE_STRUCT_TM) && defined(HAVE_STRUCT_TIMESPEC)
- struct tm result;
- struct timespec ts;
-
-#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_TM_TM_GMTOFF)
- if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
- {
- time_t time = ts.tv_sec;
- localtime_r (&time, &result);
- return result.tm_gmtoff;
- }
- else
-#endif
-#endif
- return timezone;
-}
-
-
-extern "C" int
-EXPORT(daylight) (void)
-{
-#if defined(HAVE_DAYLIGHT)
- return daylight;
-#else
- return 0;
-#endif
-}
-
-
-/* isdst returns 1 if daylight saving time is currently in effect and
- returns 0 if it is not. */
-
-extern "C" int
-EXPORT(isdst) (void)
-{
-#if defined(HAVE_STRUCT_TM) && defined(HAVE_STRUCT_TIMESPEC)
- struct tm result;
- struct timespec ts;
-
-#if defined(HAVE_CLOCK_SETTIME)
- if (clock_gettime (CLOCK_REALTIME, &ts) == 0)
- {
- time_t time = ts.tv_sec;
- localtime_r (&time, &result);
- return result.tm_isdst;
- }
- else
-#endif
-#endif
- return 0;
-}
-
-
-/* tzname returns the string associated with the local timezone.
- The daylight value is 0 or 1. The value 0 returns the non
- daylight saving timezone string and the value of 1 returns the
- daylight saving timezone string. It returns NULL if tzname is
- unavailable. */
-
-extern "C" char *
-EXPORT(tzname) (int daylight)
-{
-#if defined(HAVE_TZNAME)
- return tzname[daylight];
-#else
- return NULL;
-#endif
-}
-
-
/* GetTimeRealtime performs return gettime (CLOCK_REALTIME, ts).
gettime returns 0 on success and -1 on failure. If the underlying
system does not have gettime then GetTimeRealtime returns 1. */
-#if defined(HAVE_STRUCT_TIMESPEC)
+#if defined(HAVE_STRUCT_TIMESPEC) && defined(_GLIBCXX_USE_CLOCK_REALTIME)
extern "C" int
EXPORT(GetTimeRealtime) (struct timespec *ts)
{
-#if defined(HAVE_CLOCK_GETTIME)
- return clock_gettime (CLOCK_REALTIME, ts);
+ timespec tp;
+#if defined(_GLIBCXX_USE_CLOCK_GETTIME_SYSCALL)
+ return syscall (SYS_clock_gettime, CLOCK_REALTIME, ts);
#else
- return 1;
+ return clock_gettime (CLOCK_REALTIME, ts);
#endif
}
}
#endif
-
/* SetTimeRealtime performs return settime (CLOCK_REALTIME, ts).
gettime returns 0 on success and -1 on failure. If the underlying
system does not have gettime then GetTimeRealtime returns 1. */
-#if defined(HAVE_STRUCT_TIMESPEC)
+#if defined(HAVE_STRUCT_TIMESPEC) && defined(_GLIBCXX_USE_CLOCK_REALTIME)
extern "C" int
EXPORT(SetTimeRealtime) (struct timespec *ts)
{
-#if defined(HAVE_CLOCK_GETTIME)
+#if defined(_GLIBCXX_USE_CLOCK_SETTIME_SYSCALL)
+ return syscall (SYS_clock_settime, CLOCK_REALTIME, ts);
+#elif defined(HAVE_CLOCK_SETTIME)
return clock_settime (CLOCK_REALTIME, ts);
#else
return 1;
}
#endif
-
/* InitTimespec returns a newly created opaque type. */
#if defined(HAVE_STRUCT_TIMESPEC)
}
#endif
-
/* KillTimeval deallocates the memory associated with an opaque type. */
#if defined(HAVE_STRUCT_TIMESPEC)
}
#endif
-
/* GetTimespec retrieves the number of seconds and nanoseconds from the
- timespec. */
+ timespec. 1 is returned if successful and 0 otherwise. */
#if defined(HAVE_STRUCT_TIMESPEC)
extern "C" int
}
#endif
-
-/* SetTimespec sets the number of seconds and nanoseconds into timespec. */
+/* SetTimespec sets the number of seconds and nanoseconds into timespec.
+ 1 is returned if successful and 0 otherwise. */
#if defined(HAVE_STRUCT_TIMESPEC)
extern "C" int
}
#endif
+extern "C" long int
+EXPORT(timezone) (void)
+{
+#if defined(HAVE_STRUCT_TIMESPEC)
+ struct tm result;
+ struct timespec ts;
+
+#if defined(HAVE_TM_TM_GMTOFF)
+ if (EXPORT(GetTimeRealtime) (&ts) == 0)
+ {
+ time_t time = ts.tv_sec;
+ localtime_r (&time, &result);
+ return result.tm_gmtoff;
+ }
+ else
+#endif
+#endif
+ {
+#if defined(HAVE_TIMEZONE)
+ return timezone;
+#else
+ return 0;
+#endif
+ }
+}
+
+/* istimezone returns 1 if timezone in wrapclock.cc can resolve the
+ timezone value using the timezone C library call or by using
+ clock_gettime, localtime_r and tm_gmtoff. */
+
+extern "C" int
+EXPORT(istimezone) (void)
+{
+#if defined(HAVE_STRUCT_TIMESPEC)
+#if defined(HAVE_TM_TM_GMTOFF)
+#if defined(_GLIBCXX_USE_CLOCK_REALTIME)
+ return 1;
+#endif
+#endif
+#endif
+ return 0;
+}
+
+extern "C" int
+EXPORT(daylight) (void)
+{
+#if defined(HAVE_DAYLIGHT)
+ return daylight;
+#else
+ return 0;
+#endif
+}
+
+/* isdst returns 1 if daylight saving time is currently in effect and
+ returns 0 if it is not. */
+
+extern "C" int
+EXPORT(isdst) (void)
+{
+#if defined(HAVE_STRUCT_TIMESPEC)
+ struct tm result;
+ struct timespec ts;
+
+ if (EXPORT(GetTimeRealtime) (&ts) == 0)
+ {
+ time_t time = ts.tv_sec;
+ localtime_r (&time, &result);
+ return result.tm_isdst;
+ }
+ else
+ return 0;
+#else
+ return 0;
+#endif
+}
+
+/* tzname returns the string associated with the local timezone.
+ The daylight value is 0 or 1. The value 0 returns the non
+ daylight saving timezone string and the value of 1 returns the
+ daylight saving timezone string. It returns NULL if tzname is
+ unavailable. */
+
+extern "C" char *
+EXPORT(tzname) (int daylight)
+{
+#if defined(HAVE_TZNAME)
+ return tzname[daylight];
+#else
+ return NULL;
+#endif
+}
/* init - init/finish functions for the module */