diff options
author | Erlang/OTP <[email protected]> | 2015-07-08 20:31:17 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2015-07-08 20:31:17 +0200 |
commit | f90a1c457fce5bb4ebc81729bae7c91f82f23e1d (patch) | |
tree | 85a9de6b48df8b04a6ce2b955a2c77079f0d6fe9 | |
parent | fc30c4d8342d47bf5d2e0fa680d127e9afce6079 (diff) | |
parent | f7da0720b17556a9e3df108463643ba10ab1b3a0 (diff) | |
download | otp-f90a1c457fce5bb4ebc81729bae7c91f82f23e1d.tar.gz otp-f90a1c457fce5bb4ebc81729bae7c91f82f23e1d.tar.bz2 otp-f90a1c457fce5bb4ebc81729bae7c91f82f23e1d.zip |
Merge branch 'rickard/gettimeofday/OTP-12892' into maint-18
* rickard/gettimeofday/OTP-12892:
Add the --enable-gettimeofday-as-os-system-time configure switch
-rw-r--r-- | HOWTO/INSTALL.md | 2 | ||||
-rw-r--r-- | erts/aclocal.m4 | 57 |
2 files changed, 41 insertions, 18 deletions
diff --git a/HOWTO/INSTALL.md b/HOWTO/INSTALL.md index f8900c501b..4c89370691 100644 --- a/HOWTO/INSTALL.md +++ b/HOWTO/INSTALL.md @@ -400,6 +400,8 @@ Some of the available `configure` options are: no automatic dependency handling between applications. If you disable an application that another application depends on, you also have to disable the dependant application. +* `--enable-gettimeofday-as-os-system-time` - Force usage of `gettimeofday()` for + OS system time. * `--enable-dirty-schedulers` - Enable the **experimental** dirty schedulers functionality. Note that the dirty schedulers functionality is experimental, and **not supported**. This functionality **will** be subject to backward diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index 01541aff72..dd5d3979a7 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -2202,7 +2202,7 @@ AC_DEFUN(ERL_TIME_CORRECTION, AC_ARG_WITH(clock-resolution, AS_HELP_STRING([--with-clock-resolution=high|low|default], - [specify wanted clock resolution)])) + [specify wanted clock resolution])) AC_ARG_WITH(clock-gettime-realtime-id, AS_HELP_STRING([--with-clock-gettime-realtime-id=CLOCKID], @@ -2212,6 +2212,14 @@ AC_ARG_WITH(clock-gettime-monotonic-id, AS_HELP_STRING([--with-clock-gettime-monotonic-id=CLOCKID], [specify clock id to use with clock_gettime() for monotonic time)])) +AC_ARG_ENABLE(gettimeofday-as-os-system-time, + AS_HELP_STRING([--enable-gettimeofday-as-os-system-time], + [Force usage of gettimeofday() for OS system time]), +[ case "$enableval" in + yes) force_gettimeofday_os_system_time=yes ;; + *) force_gettimeofday_os_system_time=no ;; + esac ], force_gettimeofday_os_system_time=no) + case "$with_clock_resolution" in ""|no|yes) with_clock_resolution=default;; @@ -2222,6 +2230,17 @@ case "$with_clock_resolution" in ;; esac +if test "$force_gettimeofday_os_system_time" = "yes"; then + + AC_CHECK_FUNCS([gettimeofday]) + if test "$ac_cv_func_gettimeofday" = "yes"; then + AC_DEFINE(OS_SYSTEM_TIME_GETTIMEOFDAY, [1], [Define if you want to implement erts_os_system_time() using gettimeofday()]) + else + AC_MSG_ERROR([No gettimeofday() available]) + fi + +else # $force_gettimeofday_os_system_time != yes + case "$with_clock_gettime_realtime_id" in ""|no) with_clock_gettime_realtime_id=no @@ -2239,23 +2258,6 @@ case "$with_clock_gettime_realtime_id" in ;; esac -case "$with_clock_gettime_monotonic_id" in - ""|no) - with_clock_gettime_monotonic_id=no - ;; - CLOCK_*CPUTIME*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the cputime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_REALTIME*|CLOCK_TAI*) - AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the realtime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) - ;; - CLOCK_*) - ;; - *) - AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_monotonic_id]) - ;; -esac - case "$with_clock_resolution-$with_clock_gettime_realtime_id" in high-no) ERL_WALL_CLOCK(high_resolution);; @@ -2296,6 +2298,25 @@ if test "x$erl_wall_clock_id" != "x"; then AC_DEFINE_UNQUOTED(WALL_CLOCK_ID, [$erl_wall_clock_id], [Define to wall clock id to use]) fi +fi # $force_gettimeofday_os_system_time != yes + +case "$with_clock_gettime_monotonic_id" in + ""|no) + with_clock_gettime_monotonic_id=no + ;; + CLOCK_*CPUTIME*) + AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the cputime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) + ;; + CLOCK_REALTIME*|CLOCK_TAI*) + AC_MSG_ERROR([Invalid clock_gettime() monotonic clock id: Refusing to use the realtime clock id $with_clock_gettime_monotonic_id as monotonic clock id]) + ;; + CLOCK_*) + ;; + *) + AC_MSG_ERROR([Invalid clock_gettime() clock id: $with_clock_gettime_monotonic_id]) + ;; +esac + case "$with_clock_resolution-$with_clock_gettime_monotonic_id" in high-no) ERL_MONOTONIC_CLOCK(high_resolution);; |