diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2018-12-19 11:05:54 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-02-04 11:06:18 +0100 |
commit | bf63a95b981a9055e5c462cc85732629ce6b98b8 (patch) | |
tree | 49705eb67240351609f0648c2ec2071c9c622881 | |
parent | 36aa3f4d6f9e9da7289ed760cfb1e87600cb6459 (diff) |
make --enable-gdb-index the default for debug builds, if supported
Currently only done on Linux, I'm not sure about the status on other platforms,
feel free to add your platform.
https://lists.freedesktop.org/archives/libreoffice/2018-June/080437.html
https://lists.freedesktop.org/archives/libreoffice/2018-July/080484.html
Change-Id: I5997f54e530c8078250eb7c116cb6bd2604e7925
Reviewed-on: https://gerrit.libreoffice.org/65424
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | configure.ac | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac index f9149ebb9ddd..45e4595ef08b 100644 --- a/configure.ac +++ b/configure.ac @@ -553,6 +553,7 @@ test_cups=yes test_dbus=yes test_fontconfig=yes test_cairo=no +test_gdb_index=no # Default values, as such probably valid just for Linux, set # differently below just for Mac OSX, but at least better than @@ -605,6 +606,7 @@ linux-gnu*|k*bsd*-gnu*) build_gstreamer_0_10=yes test_kde5=yes test_gtk3_kde5=yes + test_gdb_index=yes if test "$enable_fuzzers" != yes; then test_freetype=yes test_fontconfig=yes @@ -1133,9 +1135,9 @@ libo_FUZZ_ARG_ENABLE(split-debug, but requires tools that support it (both build tools and debuggers).])) libo_FUZZ_ARG_ENABLE(gdb-index, - AS_HELP_STRING([--enable-gdb-index], - [Creates debug information in the gdb index format, which makes gdb start faster. - Requires the gold or lld linker.])) + AS_HELP_STRING([--disable-gdb-index], + [Disables creating debug information in the gdb index format, which makes gdb start faster. + The feature requires the gold or lld linker.])) libo_FUZZ_ARG_ENABLE(sal-log, AS_HELP_STRING([--enable-sal-log], @@ -3180,31 +3182,6 @@ printf ("hello world\n"); fi AC_SUBST(USE_LD) -ENABLE_GDB_INDEX= -if test "$enable_gdb_index" = "yes"; then - AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames]) - save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror -ggnu-pubnames" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ AC_MSG_RESULT( yes )],[ AC_MSG_ERROR( no )]) - - AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index]) - ldflags_save=$LDFLAGS - LDFLAGS="$LDFLAGS -Wl,--gdb-index" - AC_LINK_IFELSE([AC_LANG_PROGRAM([ -#include <stdio.h> - ],[ -printf ("hello world\n"); - ])], ENABLE_GDB_INDEX=TRUE, []) - if test "$ENABLE_GDB_INDEX" = "TRUE"; then - AC_MSG_RESULT( yes ) - else - AC_MSG_ERROR( no ) - fi - CFLAGS=$save_CFLAGS - LDFLAGS=$ldflags_save -fi -AC_SUBST(ENABLE_GDB_INDEX) - HAVE_LD_BSYMBOLIC_FUNCTIONS= if test "$GCC" = "yes"; then AC_MSG_CHECKING([for -Bsymbolic-functions linker support]) @@ -3907,6 +3884,51 @@ if test "$enable_split_debug" = yes; then AC_SUBST(HAVE_GCC_SPLIT_DWARF) fi +ENABLE_GDB_INDEX= +if test "$enable_gdb_index" != "no"; then + dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms. + if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then + AC_MSG_CHECKING([whether $CC supports -ggnu-pubnames]) + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror -ggnu-pubnames" + have_ggnu_pubnames= + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=]) + if test "$have_ggnu_pubnames" != "TRUE"; then + if test "$enable_gdb_index" = "yes"; then + AC_MSG_ERROR( no, --enable-gdb-index not supported ) + else + AC_MSG_RESULT( no ) + fi + else + AC_MSG_RESULT( yes ) + AC_MSG_CHECKING([whether $CC supports -Wl,--gdb-index]) + ldflags_save=$LDFLAGS + LDFLAGS="$LDFLAGS -Wl,--gdb-index" + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#include <stdio.h> + ],[ +printf ("hello world\n"); + ])], ENABLE_GDB_INDEX=TRUE, []) + if test "$ENABLE_GDB_INDEX" = "TRUE"; then + AC_MSG_RESULT( yes ) + else + if test "$enable_gdb_index" = "yes"; then + AC_MSG_ERROR( no ) + else + AC_MSG_RESULT( no ) + fi + fi + LDFLAGS=$ldflags_save + fi + CFLAGS=$save_CFLAGS + fi + if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then + AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.]) + add_warning "Linker is not capable of creating gdb index, debugger startup will be slow." + fi +fi +AC_SUBST(ENABLE_GDB_INDEX) + if test "$enable_sal_log" = yes; then ENABLE_SAL_LOG=TRUE fi |