Bug 1883720 - (re)Move checks for socket, gethostbyname_r and demangle to moz.configure r=glandium

Actually remove the check for demangle, no supported target need that
check.

Also make library dependencies explicit instead of relying on "$LIBS".

Differential Revision: https://phabricator.services.mozilla.com/D203637
This commit is contained in:
serge-sans-paille 2024-05-15 07:47:56 +00:00
parent 863475a670
commit ceff7deb44
10 changed files with 40 additions and 18 deletions

View file

@ -70,3 +70,16 @@ with only_when(building_with_gnu_cc & ~target_is_darwin):
set_define(
"HAVE_DLADDR", depends(dladdr_check)(lambda check: "1" if check.found else "0")
)
set_config(
"C_R_LIBS",
["-lc_r"],
when=check_symbol_in_lib(
"c_r", symbol="gethostbyname_r", when=building_with_gnu_cc
),
)
set_config(
"SOCKET_LIBS",
["-lsocket"],
when=check_symbol_in_lib("socket", symbol="socket", when=building_with_gnu_cc),
)

View file

@ -15,6 +15,12 @@ AllowCompilerWarnings()
OS_LIBS += CONFIG["DL_LIBS"]
# for gethostbyname_r
OS_LIBS += CONFIG["C_R_LIBS"]
# for socket
OS_LIBS += CONFIG["SOCKET_LIBS"]
DEFINES["_NSPR_BUILD_"] = True
if CONFIG["OS_ARCH"] == "Linux":
OS_LIBS += CONFIG["REALTIME_LIBS"]

View file

@ -6,6 +6,9 @@
include("/ipc/chromium/chromium-config.mozbuild")
# for socket
OS_LIBS += CONFIG["SOCKET_LIBS"]
if CONFIG["OS_TARGET"] != "WINNT":
SOURCES += [
"buffered_stun_socket_unittest.cpp",

View file

@ -13,6 +13,12 @@ if CONFIG["TARGET_KERNEL"] == "WINNT":
if CONFIG['MOZ_SYSTEM_LIBEVENT']:
error('should not reach here if we are using a native libevent')
# for gethostbyname_r
OS_LIBS += CONFIG["C_R_LIBS"]
# for socket
OS_LIBS += CONFIG["SOCKET_LIBS"]
UNIFIED_SOURCES += [
'libevent/buffer.c',
'libevent/bufferevent.c',

View file

@ -442,15 +442,6 @@ AC_LANG_CPLUSPLUS
MOZ_CXX11
dnl Checks for libraries.
dnl ========================================================
AC_CHECK_LIB(c_r, gethostbyname_r)
if test ! "$GNU_CXX"; then
AC_CHECK_LIB(C, demangle)
fi
AC_CHECK_LIB(socket, socket)
dnl ========================================================
dnl = pthread support

View file

@ -8,6 +8,9 @@ EXPORTS.mozilla.net += [
'usrsctp.h',
]
# for socket
OS_LIBS += CONFIG["SOCKET_LIBS"]
UNIFIED_SOURCES += [
'netinet/sctp_asconf.c',
'netinet/sctp_auth.c',

View file

@ -41,6 +41,9 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
]
UNIFIED_SOURCES += ["nsNamedPipeIOLayer.cpp", "nsNamedPipeService.cpp"]
# for socket
OS_LIBS += CONFIG["SOCKET_LIBS"]
FINAL_LIBRARY = "xul"
CONFIGURE_SUBST_FILES += ["neqo/extra-bindgen-flags"]

View file

@ -9,4 +9,7 @@ if CONFIG["OS_ARCH"] == "Linux":
"NetlinkService.cpp",
]
# for socket
OS_LIBS += CONFIG["SOCKET_LIBS"]
FINAL_LIBRARY = "xul"

View file

@ -12,6 +12,9 @@ XPIDL_SOURCES += [
XPIDL_MODULE = "necko_wifi"
# for socket
OS_LIBS += CONFIG["SOCKET_LIBS"]
UNIFIED_SOURCES += [
"nsWifiAccessPoint.cpp",
"nsWifiMonitor.cpp",

View file

@ -459,15 +459,6 @@ MOZ_CXX11
AC_LANG_C
dnl Checks for libraries.
dnl ========================================================
AC_CHECK_LIB(c_r, gethostbyname_r)
if test ! "$GNU_CXX"; then
AC_CHECK_LIB(C, demangle)
fi
AC_CHECK_LIB(socket, socket)
dnl ========================================================
dnl = pthread support