Commit eac8ebc4 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1747499 - Move pthread_cond_timedwait_monotonic_np check to python...

Bug 1747499 - Move pthread_cond_timedwait_monotonic_np check to python configure. r=firefox-build-system-reviewers,mhentges

Differential Revision: https://phabricator.services.mozilla.com/D134641
parent a862a3a0
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -12,22 +12,15 @@ option(
)


c_warning_flag = dependable("-Werror")


@depends("--enable-warnings-as-errors", c_warning_flag)
def warnings_as_errors(warnings_as_errors, c_warning_flag):
@depends("--enable-warnings-as-errors")
def warnings_as_errors(warnings_as_errors):
    if not warnings_as_errors:
        return ""

    return c_warning_flag
    return "-Werror"


set_config("WARNINGS_AS_ERRORS", warnings_as_errors)
# We have a peculiar setup in old-configure.in where some compilation tests
# depend on enabling warnings-as-errors even if it's disabled for Firefox
# compilation.  We therefore need this assignment.
add_old_configure_assignment("WARNINGS_AS_ERRORS", c_warning_flag)


# GCC/Clang warnings:
+0 −16
Original line number Diff line number Diff line
@@ -913,22 +913,6 @@ if test "$ac_cv_clock_monotonic" != "no"; then
    AC_SUBST_LIST(REALTIME_LIBS)
fi

dnl Turn on warnings-as-errors to prevent implicit declaration of
dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
dnl inadvertently pass even if the function does not really exist.
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
               ac_cv_pthread_cond_timedwait_monotonic_np,
               AC_TRY_LINK([#include <pthread.h>],
                           [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
                           ac_cv_pthread_cond_timewait_monotonic_np=yes,
                           ac_cv_pthread_cond_timewait_monotonic_np=no))
if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
    AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
fi
CFLAGS=$_SAVE_CFLAGS

AC_CACHE_CHECK(
    [for res_ninit()],
    ac_cv_func_res_ninit,
+16 −0
Original line number Diff line number Diff line
@@ -2952,3 +2952,19 @@ with only_when(compile_environment):
            check_msg="for sa_len in struct sockaddr",
        ),
    )


# Check for pthread_cond_timedwait_monotonic_np
# ==============================================================
with only_when(compile_environment):
    set_define(
        "HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC",
        c_compiler.try_compile(
            includes=["pthread.h"],
            body="pthread_cond_timedwait_monotonic_np(0, 0, 0);",
            # -Werror to catch any "implicit declaration" warning that means the function
            # is not supported.
            flags=["-Werror"],
            check_msg="for pthread_cond_timedwait_monotonic_np",
        ),
    )