mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1883615 - Move libdl checks to moz.configure and make libdl dependencies explicit r=glandium
The -ldl flag was previously set globally, it's now set for the libs that use it. Also rationalize the difference between HAVE_DLOPEN and HAVE_DLFCN_H. Differential Revision: https://phabricator.services.mozilla.com/D203594
This commit is contained in:
parent
f310391803
commit
b9f78f0cc2
@ -53,3 +53,21 @@ have_res_ninit = try_link(
|
||||
)
|
||||
|
||||
set_define("HAVE_RES_NINIT", have_res_ninit)
|
||||
|
||||
# We don't want to link with libdl even if it's present on OS X, since
|
||||
# it's not used and not part of the default installation.
|
||||
# We don't want to link against libm or libpthread on Darwin since
|
||||
# they both are just symlinks to libSystem and explicitly linking
|
||||
# against libSystem causes issues when debugging (see bug 299601).
|
||||
with only_when(building_with_gnu_cc):
|
||||
dladdr_check = check_symbol_in_libs([None, "dl"], symbol="dladdr")
|
||||
set_define(
|
||||
"HAVE_DLADDR", depends(dladdr_check)(lambda check: "1" if check.found else "0")
|
||||
)
|
||||
|
||||
with only_when(~target_is_darwin):
|
||||
check_header("dlfcn.h")
|
||||
dlopen_check = check_symbol_in_libs(["dl", None], symbol="dlopen")
|
||||
set_config(
|
||||
"DL_LIBS", ["-ldl"], when=depends(dlopen_check)(lambda check: check.lib)
|
||||
)
|
||||
|
2
config/external/nspr/pr/moz.build
vendored
2
config/external/nspr/pr/moz.build
vendored
@ -13,6 +13,8 @@ else:
|
||||
# TODO: fix NSPR warnings and remove this
|
||||
AllowCompilerWarnings()
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
DEFINES["_NSPR_BUILD_"] = True
|
||||
if CONFIG["OS_ARCH"] == "Linux":
|
||||
OS_LIBS += CONFIG["REALTIME_LIBS"]
|
||||
|
@ -446,27 +446,6 @@ dnl Checks for libraries.
|
||||
dnl ========================================================
|
||||
AC_CHECK_LIB(c_r, gethostbyname_r)
|
||||
|
||||
dnl We don't want to link with libdl even if it's present on OS X, since
|
||||
dnl it's not used and not part of the default installation. OS/2 has dlfcn
|
||||
dnl in libc.
|
||||
dnl We don't want to link against libm or libpthread on Darwin since
|
||||
dnl they both are just symlinks to libSystem and explicitly linking
|
||||
dnl against libSystem causes issues when debugging (see bug 299601).
|
||||
case $target in
|
||||
*-darwin*)
|
||||
;;
|
||||
*)
|
||||
AC_SEARCH_LIBS(dlopen, dl,
|
||||
MOZ_CHECK_HEADER(dlfcn.h,
|
||||
AC_DEFINE(HAVE_DLOPEN)))
|
||||
;;
|
||||
esac
|
||||
|
||||
_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -D_GNU_SOURCE"
|
||||
AC_CHECK_FUNCS(dladdr)
|
||||
CFLAGS="$_SAVE_CFLAGS"
|
||||
|
||||
if test ! "$GNU_CXX"; then
|
||||
AC_CHECK_LIB(C, demangle)
|
||||
fi
|
||||
|
@ -8,4 +8,6 @@ SOURCES += [
|
||||
"mozva.c",
|
||||
]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
Library("mozva")
|
||||
|
@ -5524,7 +5524,7 @@ static void replace_malloc_init_funcs(malloc_table_t* table) {
|
||||
#include "malloc_decls.h"
|
||||
// ***************************************************************************
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
#ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
|
@ -82,6 +82,8 @@ DEFINES["IMPL_MFBT"] = True
|
||||
if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
|
||||
OS_LIBS += ["atomic"]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
DisableStlWrapping()
|
||||
|
||||
include("/mozglue/build/replace_malloc.mozbuild")
|
||||
|
@ -22,4 +22,6 @@ if CONFIG["MOZ_LINKER"]:
|
||||
"/mozglue/linker",
|
||||
]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
FINAL_LIBRARY = "mozglue"
|
||||
|
@ -33,7 +33,7 @@ using namespace mozilla;
|
||||
# define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_DLOPEN) || defined(XP_DARWIN)
|
||||
#if defined(HAVE_DLFCN_H) || defined(XP_DARWIN)
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
|
@ -463,27 +463,6 @@ dnl Checks for libraries.
|
||||
dnl ========================================================
|
||||
AC_CHECK_LIB(c_r, gethostbyname_r)
|
||||
|
||||
dnl We don't want to link with libdl even if it's present on OS X, since
|
||||
dnl it's not used and not part of the default installation. OS/2 has dlfcn
|
||||
dnl in libc.
|
||||
dnl We don't want to link against libm or libpthread on Darwin since
|
||||
dnl they both are just symlinks to libSystem and explicitly linking
|
||||
dnl against libSystem causes issues when debugging (see bug 299601).
|
||||
case $target in
|
||||
*-darwin*)
|
||||
;;
|
||||
*)
|
||||
AC_SEARCH_LIBS(dlopen, dl,
|
||||
MOZ_CHECK_HEADER(dlfcn.h,
|
||||
AC_DEFINE(HAVE_DLOPEN)))
|
||||
;;
|
||||
esac
|
||||
|
||||
_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -D_GNU_SOURCE"
|
||||
AC_CHECK_FUNCS(dladdr)
|
||||
CFLAGS="$_SAVE_CFLAGS"
|
||||
|
||||
if test ! "$GNU_CXX"; then
|
||||
AC_CHECK_LIB(C, demangle)
|
||||
fi
|
||||
|
@ -6,4 +6,6 @@
|
||||
|
||||
DIRS += ["dynamic-library"]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
RustLibrary("builtins-static")
|
||||
|
@ -19,6 +19,8 @@ else:
|
||||
"stub.c",
|
||||
]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
if CONFIG["OS_TARGET"] == "Android":
|
||||
OS_LIBS += ["m"]
|
||||
|
||||
|
@ -18,6 +18,8 @@ USE_LIBS += [
|
||||
"nspr",
|
||||
]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
"Sandbox.h",
|
||||
"SandboxInfo.h",
|
||||
|
2
third_party/sqlite3/src/moz.build
vendored
2
third_party/sqlite3/src/moz.build
vendored
@ -27,6 +27,8 @@ SOURCES += [
|
||||
'sqlite3.c',
|
||||
]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
# -DSQLITE_SECURE_DELETE=1 will cause SQLITE to 0-fill delete data so we
|
||||
# don't have to vacuum to make sure the data is not visible in the file.
|
||||
# -DSQLITE_DEFAULT_PAGE_SIZE=32768 and SQLITE_MAX_DEFAULT_PAGE_SIZE=32768
|
||||
|
@ -22,5 +22,7 @@ CXXFLAGS += CONFIG["MOZ_PANGO_CFLAGS"]
|
||||
OS_LIBS += CONFIG["MOZ_X11_LIBS"]
|
||||
OS_LIBS += CONFIG["MOZ_GTK3_LIBS"]
|
||||
|
||||
OS_LIBS += CONFIG["DL_LIBS"]
|
||||
|
||||
NO_PGO = True
|
||||
DisableStlWrapping()
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef HAVE_DLOPEN
|
||||
#ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user