forked from mirrors/gecko-dev
Bug 1880424 - Move clock_monotonic check to moz.configure r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D201942
This commit is contained in:
parent
f3cfc8bfd7
commit
ac2f2c943a
4 changed files with 45 additions and 49 deletions
44
build/moz.configure/libraries.configure
Normal file
44
build/moz.configure/libraries.configure
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||||
|
# vim: set filetype=python:
|
||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
|
||||||
|
@template
|
||||||
|
def check_clock_monotonic_support(lib=None, when=None):
|
||||||
|
check_msg = "for clock_gettime(CLOCK_MONOTONIC)"
|
||||||
|
flags = []
|
||||||
|
|
||||||
|
if lib is not None:
|
||||||
|
check_msg += f" in {lib}"
|
||||||
|
flags.append(f"-l{lib}")
|
||||||
|
|
||||||
|
check_when = building_with_gnu_cc
|
||||||
|
if when is not None:
|
||||||
|
check_when &= when
|
||||||
|
|
||||||
|
return try_link(
|
||||||
|
includes=["time.h"],
|
||||||
|
body="struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);",
|
||||||
|
check_msg=check_msg,
|
||||||
|
flags=flags,
|
||||||
|
when=check_when,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
have_raw_clock_monotonic_support = check_clock_monotonic_support()
|
||||||
|
have_rt_clock_monotonic_support = check_clock_monotonic_support(
|
||||||
|
lib="rt", when=~have_raw_clock_monotonic_support
|
||||||
|
)
|
||||||
|
|
||||||
|
set_define(
|
||||||
|
"HAVE_CLOCK_MONOTONIC",
|
||||||
|
have_raw_clock_monotonic_support | have_rt_clock_monotonic_support,
|
||||||
|
)
|
||||||
|
set_config(
|
||||||
|
"HAVE_CLOCK_MONOTONIC",
|
||||||
|
have_raw_clock_monotonic_support | have_rt_clock_monotonic_support,
|
||||||
|
)
|
||||||
|
|
||||||
|
set_config("REALTIME_LIBS", ["-lrt"], when=have_rt_clock_monotonic_support)
|
||||||
|
|
@ -601,32 +601,6 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
dnl Checks for library functions.
|
|
||||||
dnl ========================================================
|
|
||||||
|
|
||||||
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
|
|
||||||
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
|
|
||||||
ac_cv_clock_monotonic,
|
|
||||||
[for libs in "" -lrt; do
|
|
||||||
_SAVE_LIBS="$LIBS"
|
|
||||||
LIBS="$LIBS $libs"
|
|
||||||
AC_TRY_LINK([#include <time.h>],
|
|
||||||
[ struct timespec ts;
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts); ],
|
|
||||||
ac_cv_clock_monotonic=$libs
|
|
||||||
LIBS="$_SAVE_LIBS"
|
|
||||||
break,
|
|
||||||
ac_cv_clock_monotonic=no)
|
|
||||||
LIBS="$_SAVE_LIBS"
|
|
||||||
done])
|
|
||||||
if test "$ac_cv_clock_monotonic" != "no"; then
|
|
||||||
HAVE_CLOCK_MONOTONIC=1
|
|
||||||
REALTIME_LIBS=$ac_cv_clock_monotonic
|
|
||||||
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
|
|
||||||
AC_SUBST(HAVE_CLOCK_MONOTONIC)
|
|
||||||
AC_SUBST_LIST(REALTIME_LIBS)
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Checks for math functions.
|
dnl Checks for math functions.
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
AC_CHECK_LIB(m, sin)
|
AC_CHECK_LIB(m, sin)
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,7 @@ include("build/moz.configure/toolchain.configure", when="--enable-compile-enviro
|
||||||
include("build/moz.configure/pkg.configure")
|
include("build/moz.configure/pkg.configure")
|
||||||
include("build/moz.configure/memory.configure", when="--enable-compile-environment")
|
include("build/moz.configure/memory.configure", when="--enable-compile-environment")
|
||||||
include("build/moz.configure/headers.configure", when="--enable-compile-environment")
|
include("build/moz.configure/headers.configure", when="--enable-compile-environment")
|
||||||
|
include("build/moz.configure/libraries.configure", when="--enable-compile-environment")
|
||||||
include("build/moz.configure/warnings.configure", when="--enable-compile-environment")
|
include("build/moz.configure/warnings.configure", when="--enable-compile-environment")
|
||||||
include("build/moz.configure/flags.configure", when="--enable-compile-environment")
|
include("build/moz.configure/flags.configure", when="--enable-compile-environment")
|
||||||
include("build/moz.configure/lto-pgo.configure", when="--enable-compile-environment")
|
include("build/moz.configure/lto-pgo.configure", when="--enable-compile-environment")
|
||||||
|
|
|
||||||
|
|
@ -637,29 +637,6 @@ fi
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
|
||||||
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
|
|
||||||
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
|
|
||||||
ac_cv_clock_monotonic,
|
|
||||||
[for libs in "" -lrt; do
|
|
||||||
_SAVE_LIBS="$LIBS"
|
|
||||||
LIBS="$LIBS $libs"
|
|
||||||
AC_TRY_LINK([#include <time.h>],
|
|
||||||
[ struct timespec ts;
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts); ],
|
|
||||||
ac_cv_clock_monotonic=$libs
|
|
||||||
LIBS="$_SAVE_LIBS"
|
|
||||||
break,
|
|
||||||
ac_cv_clock_monotonic=no)
|
|
||||||
LIBS="$_SAVE_LIBS"
|
|
||||||
done])
|
|
||||||
if test "$ac_cv_clock_monotonic" != "no"; then
|
|
||||||
HAVE_CLOCK_MONOTONIC=1
|
|
||||||
REALTIME_LIBS=$ac_cv_clock_monotonic
|
|
||||||
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
|
|
||||||
AC_SUBST(HAVE_CLOCK_MONOTONIC)
|
|
||||||
AC_SUBST_LIST(REALTIME_LIBS)
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(
|
AC_CACHE_CHECK(
|
||||||
[for res_ninit()],
|
[for res_ninit()],
|
||||||
ac_cv_func_res_ninit,
|
ac_cv_func_res_ninit,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue