Bug 1885580 - Add a MenuGroup component for the menu redesign r=android-reviewers,007
[gecko.git] / build / moz.configure / libraries.configure
blobcac37e0ae54dbb7585738bc4e72d77f35605b2c3
1 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 @template
9 def check_clock_monotonic_support(lib=None, when=None):
10     check_msg = "for clock_gettime(CLOCK_MONOTONIC)"
11     flags = []
13     if lib is not None:
14         check_msg += f" in {lib}"
15         flags.append(f"-l{lib}")
17     check_when = building_with_gnu_cc
18     if when is not None:
19         check_when &= when
21     return try_link(
22         includes=["time.h"],
23         body="struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);",
24         check_msg=check_msg,
25         flags=flags,
26         when=check_when,
27     )
30 have_raw_clock_monotonic_support = check_clock_monotonic_support()
31 have_rt_clock_monotonic_support = check_clock_monotonic_support(
32     lib="rt", when=~have_raw_clock_monotonic_support
35 set_define(
36     "HAVE_CLOCK_MONOTONIC",
37     have_raw_clock_monotonic_support | have_rt_clock_monotonic_support,
39 set_config(
40     "HAVE_CLOCK_MONOTONIC",
41     have_raw_clock_monotonic_support | have_rt_clock_monotonic_support,
44 set_config("REALTIME_LIBS", ["-lrt"], when=have_rt_clock_monotonic_support)
47 have_res_ninit = try_link(
48     includes=["sys/types.h", "netinet/in.h", "arpa/nameser.h", "resolv.h"],
49     body="int foo = res_ninit(&_res);",
50     check_msg="for res_ninit()",
51     flags=depends(when=building_linux)(["-D_BSD_SOURCE=1"]),
52     when=building_with_gnu_cc & ~target_is_netbsd & ~target_is_openbsd,
55 set_define("HAVE_RES_NINIT", have_res_ninit)