[config] Change the way to select the CONFIG_SHELL
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Aug 02 23:43:15 2009 +0200 (2009-08-02)
changeset 14448f6a793dc5b5
parent 1432 76f8feef64c4
child 1445 9f7946c892da
[config] Change the way to select the CONFIG_SHELL

Transform the single boolean option to a 'choice' selection
with two options: "sh" and "ash".

This is needed to later add "bash" as override.
config/global/build-behave.in
scripts/crosstool-NG.sh.in
     1.1 --- a/config/global/build-behave.in	Sat Aug 01 19:18:12 2009 +0200
     1.2 +++ b/config/global/build-behave.in	Sun Aug 02 23:43:15 2009 +0200
     1.3 @@ -44,16 +44,46 @@
     1.4        Use gcc's option -pipe to use pipes rather than temp files when building
     1.5        the toolchain.
     1.6  
     1.7 +choice
     1.8 +    bool
     1.9 +    prompt "Shell to use as CONFIG_SHELL"
    1.10 +    default CONFIG_SHELL_SYSTEM
    1.11 +
    1.12 +config CONFIG_SHELL_SH
    1.13 +    bool
    1.14 +    prompt "sh (the system shell)"
    1.15 +    help
    1.16 +      Use 'sh' as CONFIG_SHELL.
    1.17 +      
    1.18 +      ./configure scripts and Makefiles make intensive use of calling
    1.19 +      sub-shells. This is usually done by calling /bin/sh. /bin/sh ought
    1.20 +      to be an at-least-POSIX-conformant shell (that is, able to interpret
    1.21 +      POSIX shell scripts).
    1.22 +      
    1.23 +      On many (most?) systems, /bin/sh is a symlink to bash. On some other
    1.24 +      systems (eg. Ubuntu, latest Debian), /bin/sh points to dash (or ash).
    1.25 +      bash is a full-featured shell, with many extension to POSIX, but is
    1.26 +      quite slow (see ection BUGS in the bash man page), while dash is
    1.27 +      faster, with very few extensions to POSIX.  On the other hand, some
    1.28 +      ./configure scripts, although written to use /bin/sh, may really
    1.29 +      require to be run by bash.
    1.30 +      
    1.31 +      The default is to use your system's /bin/sh shell. If you want to
    1.32 +      run faster, you can select to use dash. If you have problems with
    1.33 +      either the system shell or when using dash, then you can force to
    1.34 +      use bash.
    1.35 +      
    1.36  config CONFIG_SHELL_ASH
    1.37      bool
    1.38 -    prompt "Use 'ash' as CONFIG_SHELL"
    1.39 -    default n
    1.40 +    prompt "ash"
    1.41      help
    1.42 -      Use /bin/ash as the shell used by ./configure scripts.
    1.43 +      Use 'ash' as CONFIG_SHELL.
    1.44        
    1.45 -      ./configure scripts make intensive use of calling a sub-shell, and the
    1.46 -      traditional bash is slow, whereas ash is faster.
    1.47 -      
    1.48 -      Saying 'y' here should be safe enough, but some components may not
    1.49 -      accept using a shell other than bash (this is most probably true for
    1.50 -      old versions). If you have trouble, say 'n' here and see if it fixes it.
    1.51 +      See help for CONFIG_SHELL_SH, above, for more explanations.
    1.52 +
    1.53 +endchoice
    1.54 +
    1.55 +config CONFIG_SHELL
    1.56 +    string
    1.57 +    default "sh"    if CONFIG_SHELL_SH
    1.58 +    default "ash"   if CONFIG_SHELL_ASH
     2.1 --- a/scripts/crosstool-NG.sh.in	Sat Aug 01 19:18:12 2009 +0200
     2.2 +++ b/scripts/crosstool-NG.sh.in	Sun Aug 02 23:43:15 2009 +0200
     2.3 @@ -63,8 +63,13 @@
     2.4  # What's our shell?
     2.5  # Will be plain /bin/sh on most systems, except if we have /bin/ash and we
     2.6  # _explictly_ required using it
     2.7 -CT_SHELL="/bin/sh"
     2.8 -[ "${CT_CONFIG_SHELL_ASH}" = "y" -a -x "/bin/ash" ] && CT_SHELL="/bin/ash"
     2.9 +case "${CT_CONFIG_SHELL}" in
    2.10 +    sh)     CT_SHELL="/bin/sh";;
    2.11 +    ash)    CT_SHELL="/bin/ash";;
    2.12 +esac
    2.13 +
    2.14 +# Check the user is using an existing SHELL to be used by ./configure and Makefiles
    2.15 +CT_TestOrAbort "The CONFIG_SHELL '${CT_CONFIG_SHELL}' (${CT_SHELL}) is not valid" -f "${CT_SHELL}" -a -x "${CT_SHELL}"
    2.16  
    2.17  # Create the bin-overide early
    2.18  # Contains symlinks to the tools found by ./configure
    2.19 @@ -452,7 +457,8 @@
    2.20  
    2.21      # Set the shell to be used by ./configure scripts and by Makefiles (those
    2.22      # that support it!).
    2.23 -    export CONFIG_SHELL="${CT_SHELL}"
    2.24 +    export CONFIG_SHELL="${CT_SHELL}"   # for ./configure
    2.25 +    export SHELL="${CT_SHELL}"          # for Makefiles
    2.26  
    2.27      # And help make go faster
    2.28      PARALLELMFLAGS=