# Companion libraries config options
# Those libraries are required for different versions of gcc,
# and can be used by binutils and gdb (maybe others as well).

menu "Companion libraries"

comment "FIXME: check real dependencies!!!"

config COMPLIBS
    bool
    default n

config WRAPPER_NEEDED
    bool
    default n

config GMP
    bool
    select COMPLIBS
    help
      gcc 4.3.0 and above requires GMP to build some frontends, and some
      other components can use them as well.
      
      This will be automatically selected if you choose gcc>=4.3.0, but you
      can say 'Y' here if you want to build this library for the other
      components (that don't select them by default).
      
      The packages that can use GMP and MPFR are:
        - binutils
        - gcc
        - gdb

config MPFR
    bool
    select GMP
    select COMPLIBS
    help
      gcc 4.3.0 and above requires MPFR to build some frontends, and some
      other components can use them as well.
      
      This will be automatically selected if you choose gcc>=4.3.0, but you
      can say 'Y' here if you want to build this library for the other
      components (that don't select them by default).
      
      The packages that can use GMP and MPFR are:
        - binutils
        - gcc
        - gdb

config PPL
    bool
    select GMP
    select MPFR
    select COMPLIBS
    help
      gcc-4.4.0 and above requires PPL to build some parts of the optimiser
      (the GRAPHITE loop optimisation, to be precise).
      
      This will be automatically selected if you choose gcc>=4.4.0, but you
      can say 'Y' here, although it is unknown yet if any other component
      can use it.

config CLOOG
    bool
    select GMP
    select MPFR
    select PPL
    select COMPLIBS
    help
      gcc-4.4.0 and above requires CLooG/PPL to build some parts of the
      optimiser (the GRAPHITE loop optimisation, to be precise).
      
      This will be automatically selected if you choose gcc>=4.4.0, but you
      can say 'Y' here, although it is unknown yet if any other component
      can use it.

config MPC
    bool
    select GMP
    select MPFR
    select PPL
    select CLOOG
    select COMPLIBS
    help
      gcc-4.4.0 and above can also optionally use MPC to enable additional
      optimisations on complex numbers. Although MPC is optional,
      crosstool-NG requires it and uses it to build gcc >= 4.4.0.
      
      This will be automatically selected if you choose gcc>=4.4.0, but you
      can say 'Y' here, although it is unknown yet if any other component
      can use it.

config LIBELF
    bool
    select COMPLIBS
    help
      gcc-4.5.0 and above can also use libelf to enable some optimisation
      (LTO, Link-Time Optimisation, to be precise).  Although libelf is
      optional, crosstool-NG requires it and uses it to build gcc >= 4.5.0.
      
      This will be automatically selected if you choose gcc>=4.5.0, but you
      can say 'Y' here, although it is unknown yet if any other component
      can use it.

config GMP_TARGET
    bool

config MPFR_TARGET
    bool
    select GMP_TARGET

config PPL_TARGET
    bool
    select GMP_TARGET
    select MPFR_TARGET

config CLOOG_TARGET
    bool
    select GMP_TARGET
    select MPFR_TARGET
    select PPL_TARGET

config MPC_TARGET
    bool
    select GMP_TARGET
    select MPFR_TARGET
    select PPL_TARGET
    select CLOOG_TARGET

config LIBELF_TARGET
    bool

if GMP || GMP_TARGET
comment "GMP version needed to build for target"
    depends on !GMP
source "config/companion_libs/gmp.in"
endif
if MPFR || MPFR_TARGET
comment "MPFR version needed to build for target"
    depends on !MPFR
source "config/companion_libs/mpfr.in"
endif
if PPL || PPL_TARGET
comment "PPL version needed to build for target"
    depends on !PPL
source "config/companion_libs/ppl.in"
endif
if CLOOG || CLOOG_TARGET
comment "CLOOG version needed to build for target"
    depends on !CLOOG
source "config/companion_libs/cloog.in"
endif
if MPC || MPC_TARGET
comment "MPC version needed to build for target"
    depends on !MPC
source "config/companion_libs/mpc.in"
endif
if LIBELF || LIBELF_TARGET
comment "libelf version needed to build for target"
    depends on !LIBELF
source "config/companion_libs/libelf.in"
endif

config FOO
    bool

if COMPLIBS

comment "Companion libraries common options"

config COMPLIBS_CHECK
    bool
    prompt "Check the companion libraries builds (!!! READ HELP!!!)"
    default n
    help
      It is highly recommended to check the newly built companion libraries.
      Unfortunately, this is a very intensive task, and takes a loooong time.
      
      Checking the newly built companion libraries is thus disabled by default,
      but it is suggested that you check them at least once on your machine,
      and if they work, disable the check on subsequent builds.
      
      If you suspect that one (or more) of your companion libraries is the
      cause for incorrectly generated code, you should answer 'Y' here.
      Note however that this will take a really long time. For example,
      building PPL on my machine takes roughly 1'40", while checking it takes
      about 1h40'...

config COMPLIBS_SHARED
    bool
    prompt "Build shared companion libraries"
    default n
    depends on COMPLIBS
    select WRAPPER_NEEDED
    help
      By default, the companion libraries will be build static. If you want to
      build shared libraries, then you can say 'Y' here, but a wrapper will be
      needed (see docs/overview.txt,section "Tools wrapper").
      
      It is highly recommended that you keep static libraries.

choice
    bool
    prompt "|  Install tools wrapper as:"
    depends on WRAPPER_NEEDED
    default TOOLS_WRAPPER_SHELL

config TOOLS_WRAPPER_SCRIPT
    bool
    prompt "shell script"
    help
      If your host has a shell, then you should say 'Y' here, to use
      a (very very simple) shell script as wrapper.
      
      See docs/overview.txt, section "Tools wrapper".

config TOOLS_WRAPPER_EXEC
    bool
    prompt "executable"
    help
      If your host lacks a shell, then you should say 'Y' here, to use
      an executable.
      
      See docs/overview.txt, section "Tools wrapper".

endchoice

config TOOLS_WRAPPER
    string
    default "script" if TOOLS_WRAPPER_SCRIPT
    default "exec"   if TOOLS_WRAPPER_EXEC

endif # COMPLIBS

endmenu
