mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-12-23 04:35:30 +00:00
configure: support rustc-demangle installations in the sysroot
Currently, `./configure` supports `--with-rustc-demangle=${path_to_crate_root}` as the only mechanism to enable rustc-demangle support. This CL adds support for cases where keeping or synthesizing a full `cargo` build tree is hacky in comparison to simply installing `rustc_demangle.h` in e.g., /usr/include, and putting `librustc_demangle.a` in e.g., `/usr/lib64`. Bug: b:235999011 Change-Id: Id5fe2a24c4b6e33c4df0e10c86ba99c7cf890ab2 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3733672 Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
3e2a341168
commit
90a0d9a9ff
95
configure
vendored
95
configure
vendored
|
@ -785,6 +785,7 @@ enable_tools
|
||||||
enable_system_test_libs
|
enable_system_test_libs
|
||||||
enable_selftest
|
enable_selftest
|
||||||
with_rustc_demangle
|
with_rustc_demangle
|
||||||
|
enable_system_rustc_demangle
|
||||||
with_tests_as_root
|
with_tests_as_root
|
||||||
'
|
'
|
||||||
ac_precious_vars='build_alias
|
ac_precious_vars='build_alias
|
||||||
|
@ -1454,6 +1455,12 @@ Optional Features:
|
||||||
the local copies (default is local)
|
the local copies (default is local)
|
||||||
--enable-selftest Run extra tests with "make check" (may conflict with
|
--enable-selftest Run extra tests with "make check" (may conflict with
|
||||||
optimizations) (default is no)
|
optimizations) (default is no)
|
||||||
|
--enable-system-rustc-demangle
|
||||||
|
Link against the rustc-demangle library to demangle
|
||||||
|
Rust language symbols during symbol dumping (default
|
||||||
|
is no). This assumes that rustc-demangle is
|
||||||
|
installed in your sysroot, and all headers from it
|
||||||
|
are available in your standard include path
|
||||||
|
|
||||||
Optional Packages:
|
Optional Packages:
|
||||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||||
|
@ -7661,14 +7668,98 @@ else
|
||||||
with_rustc_demangle=no
|
with_rustc_demangle=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
RUSTC_DEMANGLE_BASE_CFLAGS="-DHAVE_RUSTC_DEMANGLE"
|
||||||
|
RUSTC_DEMANGLE_BASE_LIBS="-lrustc_demangle -lpthread -ldl"
|
||||||
|
|
||||||
if test "x${with_rustc_demangle}" != xno; then
|
if test "x${with_rustc_demangle}" != xno; then
|
||||||
if ! test -f "${with_rustc_demangle}/Cargo.toml"; then
|
if ! test -f "${with_rustc_demangle}/Cargo.toml"; then
|
||||||
as_fn_error $? "You must pass the path to the rustc-demangle crate for --with-rustc-demangle" "$LINENO" 5
|
as_fn_error $? "You must pass the path to the rustc-demangle crate for --with-rustc-demangle" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
RUSTC_DEMANGLE_CFLAGS="-DHAVE_RUSTC_DEMANGLE -I${with_rustc_demangle}/crates/capi/include"
|
RUSTC_DEMANGLE_CFLAGS="-I${with_rustc_demangle}/crates/capi/include ${RUSTC_DEMANGLE_BASE_CFLAGS}"
|
||||||
RUSTC_DEMANGLE_LIBS="-L${with_rustc_demangle}/target/release -lrustc_demangle -lpthread -ldl"
|
RUSTC_DEMANGLE_LIBS="-L${with_rustc_demangle}/target/release ${RUSTC_DEMANGLE_BASE_LIBS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check whether --enable-system-rustc-demangle was given.
|
||||||
|
if test "${enable_system_rustc_demangle+set}" = set; then :
|
||||||
|
enableval=$enable_system_rustc_demangle;
|
||||||
|
else
|
||||||
|
enable_system_rustc_demangle=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x${enable_system_rustc_demangle}" != xno; then
|
||||||
|
if test "x${with_rustc_demangle}" != xno; then
|
||||||
|
as_fn_error $? "--enable-system-rustc-demangle and --with-rustc-demangle are mutually exclusive." "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUSTC_DEMANGLE_CFLAGS="${RUSTC_DEMANGLE_BASE_CFLAGS}"
|
||||||
|
RUSTC_DEMANGLE_LIBS="${RUSTC_DEMANGLE_BASE_LIBS}"
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rustc_demangle in -lrustc_demangle" >&5
|
||||||
|
$as_echo_n "checking for rustc_demangle in -lrustc_demangle... " >&6; }
|
||||||
|
if ${ac_cv_lib_rustc_demangle_rustc_demangle+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-lrustc_demangle $RUSTC_DEMANGLE_LIBS $LIBS"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any GCC internal prototype to avoid an error.
|
||||||
|
Use char because int might match the return type of a GCC
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
char rustc_demangle ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return rustc_demangle ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_lib_rustc_demangle_rustc_demangle=yes
|
||||||
|
else
|
||||||
|
ac_cv_lib_rustc_demangle_rustc_demangle=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rustc_demangle_rustc_demangle" >&5
|
||||||
|
$as_echo "$ac_cv_lib_rustc_demangle_rustc_demangle" >&6; }
|
||||||
|
if test "x$ac_cv_lib_rustc_demangle_rustc_demangle" = xyes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_LIBRUSTC_DEMANGLE 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
LIBS="-lrustc_demangle $LIBS"
|
||||||
|
|
||||||
|
else
|
||||||
|
as_fn_error $? "librustc_demangle.a must be present when --enable-system-rustc-demangle is specified" "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
for ac_header in rustc_demangle.h
|
||||||
|
do :
|
||||||
|
ac_fn_c_check_header_mongrel "$LINENO" "rustc_demangle.h" "ac_cv_header_rustc_demangle_h" "$ac_includes_default"
|
||||||
|
if test "x$ac_cv_header_rustc_demangle_h" = xyes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_RUSTC_DEMANGLE_H 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
else
|
||||||
|
as_fn_error $? "rustc_demangle.h must be present when --enable-system-rustc-demangle is specified" "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
35
configure.ac
35
configure.ac
|
@ -173,13 +173,44 @@ AC_ARG_WITH(rustc-demangle,
|
||||||
[symbol dumping (default is no)]
|
[symbol dumping (default is no)]
|
||||||
[Pass the path to the crate root.]),,
|
[Pass the path to the crate root.]),,
|
||||||
[with_rustc_demangle=no])
|
[with_rustc_demangle=no])
|
||||||
|
|
||||||
|
RUSTC_DEMANGLE_BASE_CFLAGS="-DHAVE_RUSTC_DEMANGLE"
|
||||||
|
RUSTC_DEMANGLE_BASE_LIBS="-lrustc_demangle -lpthread -ldl"
|
||||||
|
|
||||||
if test "x${with_rustc_demangle}" != xno; then
|
if test "x${with_rustc_demangle}" != xno; then
|
||||||
if ! test -f "${with_rustc_demangle}/Cargo.toml"; then
|
if ! test -f "${with_rustc_demangle}/Cargo.toml"; then
|
||||||
AC_MSG_ERROR(You must pass the path to the rustc-demangle crate for --with-rustc-demangle)
|
AC_MSG_ERROR(You must pass the path to the rustc-demangle crate for --with-rustc-demangle)
|
||||||
fi
|
fi
|
||||||
RUSTC_DEMANGLE_CFLAGS="-DHAVE_RUSTC_DEMANGLE -I${with_rustc_demangle}/crates/capi/include"
|
RUSTC_DEMANGLE_CFLAGS="-I${with_rustc_demangle}/crates/capi/include ${RUSTC_DEMANGLE_BASE_CFLAGS}"
|
||||||
RUSTC_DEMANGLE_LIBS="-L${with_rustc_demangle}/target/release -lrustc_demangle -lpthread -ldl"
|
RUSTC_DEMANGLE_LIBS="-L${with_rustc_demangle}/target/release ${RUSTC_DEMANGLE_BASE_LIBS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(system-rustc-demangle,
|
||||||
|
AS_HELP_STRING([--enable-system-rustc-demangle],
|
||||||
|
[Link against the rustc-demangle library]
|
||||||
|
[to demangle Rust language symbols during]
|
||||||
|
[symbol dumping (default is no). This assumes]
|
||||||
|
[that rustc-demangle is installed in your sysroot,]
|
||||||
|
[and all headers from it are available in your]
|
||||||
|
[standard include path]
|
||||||
|
),,
|
||||||
|
[enable_system_rustc_demangle=no])
|
||||||
|
|
||||||
|
if test "x${enable_system_rustc_demangle}" != xno; then
|
||||||
|
if test "x${with_rustc_demangle}" != xno; then
|
||||||
|
AC_MSG_ERROR([--enable-system-rustc-demangle and --with-rustc-demangle are mutually exclusive.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUSTC_DEMANGLE_CFLAGS="${RUSTC_DEMANGLE_BASE_CFLAGS}"
|
||||||
|
RUSTC_DEMANGLE_LIBS="${RUSTC_DEMANGLE_BASE_LIBS}"
|
||||||
|
|
||||||
|
AC_CHECK_LIB([rustc_demangle], [rustc_demangle], [],
|
||||||
|
[AC_MSG_ERROR(librustc_demangle.a must be present when --enable-system-rustc-demangle is specified)],
|
||||||
|
[$RUSTC_DEMANGLE_LIBS])
|
||||||
|
AC_CHECK_HEADERS(rustc_demangle.h, [],
|
||||||
|
[AC_MSG_ERROR(rustc_demangle.h must be present when --enable-system-rustc-demangle is specified)])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_VAR([RUSTC_DEMANGLE_CFLAGS], [Compiler flags for rustc-demangle])
|
AC_ARG_VAR([RUSTC_DEMANGLE_CFLAGS], [Compiler flags for rustc-demangle])
|
||||||
AC_ARG_VAR([RUSTC_DEMANGLE_LIBS], [Linker flags for rustc-demangle])
|
AC_ARG_VAR([RUSTC_DEMANGLE_LIBS], [Linker flags for rustc-demangle])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue