debug/cross-gdb: check host dependencies
author"Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
Wed Jun 08 15:47:43 2011 +0200 (2011-06-08)
changeset 25089e2761e59a75
parent 2507 a5856225d851
child 2509 45a4393fa357
debug/cross-gdb: check host dependencies

Cross-gdb depends on expat and python. If either is missing, cross-gdb will
build successfully, but lacking some features.

Especially, if expat is missing, cross-gdb will be unable to parse the target
description, which may lead to runtime malfunctions and the following GDB
warning:
"Can not parse XML target description; XML support was disabled at compile time"

Hence, expat should be considered mandatory.

On the other hand, the features missing without python are not critical, so
python should not be considered mandatory.

This patch does the following:
- At configure time, warn the user if either expat or python is missing.
- In menuconfig, disable the static build options regarding cross-gdb if no
static version of expat is available, and disable cross-gdb if expat is
missing.

Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
[yann.morin.1998@anciens.enib.fr: add comment for impossible static cross-gdb]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/debug/gdb.in.cross
configure
scripts/build/debug/300-gdb.sh
     1.1 --- a/config/debug/gdb.in.cross	Wed Jun 08 15:47:03 2011 +0200
     1.2 +++ b/config/debug/gdb.in.cross	Wed Jun 08 15:47:43 2011 +0200
     1.3 @@ -3,10 +3,18 @@
     1.4  config STATIC_TOOLCHAIN
     1.5      select GDB_CROSS_STATIC if GDB_CROSS
     1.6  
     1.7 +comment "Cross-gdb - disabled (requires expat; re-run ./configure to enable)"
     1.8 +    depends on !CONFIGURE_has_expat
     1.9 +
    1.10 +comment "Static cross-gdb - disabled (requires static expat; re-run ./configure to enable)"
    1.11 +    depends on STATIC_TOOLCHAIN && !CONFIGURE_has_static_expat
    1.12 +
    1.13  config GDB_CROSS
    1.14      bool
    1.15      prompt "Cross-gdb"
    1.16      default y
    1.17 +    depends on CONFIGURE_has_expat
    1.18 +    depends on !STATIC_TOOLCHAIN || CONFIGURE_has_static_expat
    1.19      select GDB_GDBSERVER if ! BARE_METAL
    1.20      help
    1.21        Build and install a cross-gdb for the target, to run on host.
    1.22 @@ -16,6 +24,7 @@
    1.23  config GDB_CROSS_STATIC
    1.24      bool
    1.25      prompt "Build a static cross gdb"
    1.26 +    depends on CONFIGURE_has_static_expat
    1.27      help
    1.28        A static cross gdb can be usefull if you debug on a machine that is
    1.29        not the one that is used to compile the toolchain.
     2.1 --- a/configure	Wed Jun 08 15:47:03 2011 +0200
     2.2 +++ b/configure	Wed Jun 08 15:47:43 2011 +0200
     2.3 @@ -462,6 +462,34 @@
     2.4               err="static 'libstdc++' is needed to statically link the toolchain's executables" \
     2.5               kconfig=has_static_libstdcxx
     2.6  
     2.7 +expat_libs="$( for x in so dylib a; do \
     2.8 +                   printf "libexpat.$x "; \
     2.9 +               done \
    2.10 +             )"
    2.11 +has_or_warn  inc="expat.h" \
    2.12 +             lib="${expat_libs}" \
    2.13 +             err="The 'expat' header file and library are needed to link cross-gdb's executables" \
    2.14 +             kconfig=has_expat
    2.15 +
    2.16 +# Yes, we may be checking twice for libexpat.a
    2.17 +# The first is because we need one instance of libexpat (shared or static)
    2.18 +# because it is needed for cross-gdb; the second is because the static version
    2.19 +# is required for static-linking, and if missing, the option is removed.
    2.20 +has_or_warn  lib="libexpat.a" \
    2.21 +             err="static 'expat' is needed to statically link cross-gdb's executables" \
    2.22 +             kconfig=has_static_expat
    2.23 +
    2.24 +for v in 7 6 5 4; do
    2.25 +    python_incs="${python_incs}$( printf "python2.$v/Python.h " )"
    2.26 +    python_libs="${python_libs}$( for x in so dylib a; do \
    2.27 +                                      printf "libpython2.$v.$x "; \
    2.28 +                                  done \
    2.29 +                                )"
    2.30 +done
    2.31 +has_or_warn  inc="${python_incs}" \
    2.32 +             lib="${python_libs}" \
    2.33 +             err="The 'python' header file and library are needed for some features of cross-gdb"
    2.34 +
    2.35  #---------------------------------------------------------------------
    2.36  # Compute the version string
    2.37  
     3.1 --- a/scripts/build/debug/300-gdb.sh	Wed Jun 08 15:47:03 2011 +0200
     3.2 +++ b/scripts/build/debug/300-gdb.sh	Wed Jun 08 15:47:43 2011 +0200
     3.3 @@ -139,6 +139,7 @@
     3.4              --prefix="${CT_PREFIX_DIR}"                 \
     3.5              --with-build-sysroot="${CT_SYSROOT_DIR}"    \
     3.6              --with-sysroot="${CT_SYSROOT_DIR}"          \
     3.7 +            --with-expat=yes                            \
     3.8              --disable-werror                            \
     3.9              "${cross_extra_config[@]}"
    3.10