configure: do not test for static libs if static link is impossible
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jun 28 00:52:33 2011 +0200 (2011-06-28)
changeset 25283b058d7049bf
parent 2527 a65f56df62de
child 2529 7e191964d8f2
configure: do not test for static libs if static link is impossible

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
configure
     1.1 --- a/configure	Tue Jun 28 00:29:02 2011 +0200
     1.2 +++ b/configure	Tue Jun 28 00:52:33 2011 +0200
     1.3 @@ -118,8 +118,15 @@
     1.4  #     the prog/inc/lib was found
     1.5  #     optional, defaults to none
     1.6  #       eg: kconfig=has_libncurses
     1.7 +# $*: skip=[y|n|]
     1.8 +#     if set to 'y', skip the test, but still register the
     1.9 +#     kconfig and var variables; if 'n' or empty, do the
    1.10 +#     test.
    1.11 +#     optional, default to 'n'
    1.12 +#       eg: skip="${static_link_ko}"
    1.13  check_for() {
    1.14      local lib_exts
    1.15 +    local skip
    1.16      local val
    1.17      local item
    1.18      local where
    1.19 @@ -130,7 +137,7 @@
    1.20      # but declared by the caller (because it needs it)
    1.21      for item in "${@}"; do
    1.22          case "${item}" in
    1.23 -            prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*|lib_exts=*)
    1.24 +            prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*|lib_exts=*|skip=*)
    1.25                  eval ${item%%=*}=\"${item#*=}\"
    1.26                  ;;
    1.27              *)  do_error "check_for: incorrect parameters: '${item}'";;
    1.28 @@ -146,19 +153,25 @@
    1.29          ::) do_error "check_for: [prog|inc|lib] is mandatory";;
    1.30      esac
    1.31  
    1.32 +    if [ -n "${var}" ]; then
    1.33 +        add_to_var_list "${var}"
    1.34 +    fi
    1.35      if [ -n "${kconfig}" ]; then
    1.36          add_to_kconfig_list "${kconfig}"
    1.37      fi
    1.38  
    1.39 +    if [ "${skip}" = "y" ]; then
    1.40 +        return 0
    1.41 +    fi
    1.42 +
    1.43      if [ -n "${prog}" ]; then
    1.44          for item in ${prog}; do
    1.45              printf "Checking for '${item}'... "
    1.46              if [ -n "${var}" ]; then
    1.47                  eval val="\${${var}}"
    1.48                  if [ -n "${val}" ]; then
    1.49 -                    printf "${val} (cached)\n"
    1.50 -                    add_to_var_list "${var}"
    1.51 -                    return 0
    1.52 +                    status="${val} (cached)\n"
    1.53 +                    break
    1.54                  fi
    1.55              fi
    1.56              where="$( which "${item}" 2>/dev/null )"
    1.57 @@ -228,7 +241,6 @@
    1.58  
    1.59      if [ -n "${var}" ]; then
    1.60          eval ${var}='"'"${where}"'"'
    1.61 -        add_to_var_list "${var}"
    1.62      fi
    1.63      if [ -n "${kconfig}" ]; then
    1.64          eval ${kconfig}=y
    1.65 @@ -475,8 +487,10 @@
    1.66          ;;
    1.67  esac
    1.68  if [ "${static_link_ok}" = "y" ]; then
    1.69 +    static_link_ko=""
    1.70      printf "yes\n"
    1.71  else
    1.72 +    static_link_ko="y"
    1.73      printf "no\n"
    1.74      printf " * An optional host feature is missing, some features will be disabled:\n"
    1.75      printf " * - It will not be possible to statically link toolchain's binaries\n"
    1.76 @@ -484,7 +498,10 @@
    1.77  add_to_kconfig_list static_link_ok
    1.78  
    1.79  # Library checks
    1.80 -libs_exts="so dylib a"
    1.81 +libs_exts="so dylib"
    1.82 +if [ "${static_link_ok}" = "y" ]; then
    1.83 +    libs_exts+=" a"
    1.84 +fi
    1.85  
    1.86  ncurses_hdrs="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h"
    1.87  ncurses_libs="libncursesw libncurses libcurses"
    1.88 @@ -501,10 +518,11 @@
    1.89  # The first is because we need one instance of libstdc++ (shared or static)
    1.90  # because it is needed for PPL; the second is because the static version is
    1.91  # required for static-linking, and if missing, the option is removed.
    1.92 -has_or_warn  lib="libstdc++"    \
    1.93 -             lib_exts="a"       \
    1.94 +has_or_warn  lib="libstdc++"                \
    1.95 +             lib_exts="a"                   \
    1.96               err="static 'libstdc++' is needed to statically link the toolchain's executables" \
    1.97 -             kconfig=has_static_libstdcxx
    1.98 +             kconfig=has_static_libstdcxx   \
    1.99 +             skip="${static_link_ko}"
   1.100  
   1.101  has_or_warn  inc="expat.h"              \
   1.102               lib="libexpat"             \
   1.103 @@ -516,10 +534,11 @@
   1.104  # The first is because we need one instance of libexpat (shared or static)
   1.105  # because it is needed for cross-gdb; the second is because the static version
   1.106  # is required for static-linking, and if missing, the option is removed.
   1.107 -has_or_warn  lib="libexpat" \
   1.108 -             lib_exts="a"   \
   1.109 +has_or_warn  lib="libexpat"             \
   1.110 +             lib_exts="a"               \
   1.111               err="static 'expat' is needed to statically link cross-gdb's executables" \
   1.112 -             kconfig=has_static_expat
   1.113 +             kconfig=has_static_expat   \
   1.114 +             skip="${static_link_ko}"
   1.115  
   1.116  for v in 7 6 5 4; do
   1.117      python_incs="${python_incs} python2.${v}/Python.h"