From a1106cbc853c8a966a74a4c1b97bf51e2340921a Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Fri, 17 May 2024 07:35:09 +0000 Subject: [PATCH] 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 --- build/moz.configure/libraries.configure | 14 ++++++++++++++ config/external/nspr/pr/moz.build | 6 ++++++ dom/media/webrtc/transport/test/moz.build | 3 +++ ipc/chromium/src/third_party/moz.build | 6 ++++++ js/src/old-configure.in | 9 --------- netwerk/sctp/src/moz.build | 3 +++ netwerk/socket/moz.build | 3 +++ netwerk/system/netlink/moz.build | 3 +++ netwerk/wifi/moz.build | 3 +++ old-configure.in | 9 --------- 10 files changed, 41 insertions(+), 18 deletions(-) diff --git a/build/moz.configure/libraries.configure b/build/moz.configure/libraries.configure index c5703211d6e6..792a90a8bf7d 100644 --- a/build/moz.configure/libraries.configure +++ b/build/moz.configure/libraries.configure @@ -71,3 +71,17 @@ with only_when(building_with_gnu_cc): set_config( "DL_LIBS", ["-ldl"], when=depends(dlopen_check)(lambda check: check.lib) ) + + +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), +) diff --git a/config/external/nspr/pr/moz.build b/config/external/nspr/pr/moz.build index f330a541ca26..3889cd5ca3fd 100644 --- a/config/external/nspr/pr/moz.build +++ b/config/external/nspr/pr/moz.build @@ -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"] diff --git a/dom/media/webrtc/transport/test/moz.build b/dom/media/webrtc/transport/test/moz.build index 3213525abd33..a457b28bb6eb 100644 --- a/dom/media/webrtc/transport/test/moz.build +++ b/dom/media/webrtc/transport/test/moz.build @@ -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", diff --git a/ipc/chromium/src/third_party/moz.build b/ipc/chromium/src/third_party/moz.build index 4a7dfd3fd18c..aa654504af5c 100644 --- a/ipc/chromium/src/third_party/moz.build +++ b/ipc/chromium/src/third_party/moz.build @@ -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', diff --git a/js/src/old-configure.in b/js/src/old-configure.in index e1861f3c4f22..bc9678a97e59 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -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 diff --git a/netwerk/sctp/src/moz.build b/netwerk/sctp/src/moz.build index 9fa964127686..45503a6e9433 100644 --- a/netwerk/sctp/src/moz.build +++ b/netwerk/sctp/src/moz.build @@ -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', diff --git a/netwerk/socket/moz.build b/netwerk/socket/moz.build index d8ce8d0b2bb1..bb7e2fc885e8 100644 --- a/netwerk/socket/moz.build +++ b/netwerk/socket/moz.build @@ -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"] diff --git a/netwerk/system/netlink/moz.build b/netwerk/system/netlink/moz.build index 6882a2112664..d9de47f94376 100644 --- a/netwerk/system/netlink/moz.build +++ b/netwerk/system/netlink/moz.build @@ -9,4 +9,7 @@ if CONFIG["OS_ARCH"] == "Linux": "NetlinkService.cpp", ] +# for socket +OS_LIBS += CONFIG["SOCKET_LIBS"] + FINAL_LIBRARY = "xul" diff --git a/netwerk/wifi/moz.build b/netwerk/wifi/moz.build index 75a9384c0987..07d309ed39dd 100644 --- a/netwerk/wifi/moz.build +++ b/netwerk/wifi/moz.build @@ -12,6 +12,9 @@ XPIDL_SOURCES += [ XPIDL_MODULE = "necko_wifi" +# for socket +OS_LIBS += CONFIG["SOCKET_LIBS"] + UNIFIED_SOURCES += [ "nsWifiAccessPoint.cpp", "nsWifiMonitor.cpp", diff --git a/old-configure.in b/old-configure.in index f3c08f327c82..f17f55f9abc4 100644 --- a/old-configure.in +++ b/old-configure.in @@ -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