1.1 --- a/configure Mon Jun 27 21:03:40 2011 +0200
1.2 +++ b/configure Tue Jun 28 00:29:02 2011 +0200
1.3 @@ -104,6 +104,10 @@
1.4 # for each 'prog', test if $(prog --version) matches 'regexp'
1.5 # optional
1.6 # eg: ver='^GNU bash, version [34]\.'
1.7 +# $*: lib_exts=<extension[ extension...]>
1.8 +# the list of allowed library extension
1.9 +# mandatory
1.10 +# eg: lib_exts="so dylib" lib_exts="so dylib a"
1.11 # $*: err=<error_message>
1.12 # the error message to print if tool is missing
1.13 # optional, defaults to: '${prog}: none found'
1.14 @@ -115,19 +119,21 @@
1.15 # optional, defaults to none
1.16 # eg: kconfig=has_libncurses
1.17 check_for() {
1.18 + local lib_exts
1.19 local val
1.20 local item
1.21 local where
1.22 local status
1.23 + local ext
1.24
1.25 # Note: prog/inc/lib and var/kconfig/ver/err are set here,
1.26 # but declared by the caller (because it needs it)
1.27 for item in "${@}"; do
1.28 case "${item}" in
1.29 - prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*)
1.30 + prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*|lib_exts=*)
1.31 eval ${item%%=*}=\"${item#*=}\"
1.32 ;;
1.33 - *) do_error "check_for: incorrect parameters: '$@'";;
1.34 + *) do_error "check_for: incorrect parameters: '${item}'";;
1.35 esac
1.36 done
1.37
1.38 @@ -198,15 +204,20 @@
1.39 fi
1.40
1.41 if [ -n "${lib}" ]; then
1.42 + if [ -z "${lib_exts}" ]; then
1.43 + do_error "check_for: no library extension specified for '${lib}'"
1.44 + fi
1.45 for item in ${lib}; do
1.46 - printf "Checking for '${item}'... "
1.47 - where="$( gcc -print-file-name="${item}" )"
1.48 - if [ "${where}" != "${item}" ]; then
1.49 - where="$( readlink "${where}" )"
1.50 - status=yes
1.51 - break;
1.52 - fi
1.53 - printf "no\n"
1.54 + for ext in ${lib_exts}; do
1.55 + printf "Checking for '${item}.${ext}'... "
1.56 + where="$( gcc -print-file-name="${item}.${ext}" )"
1.57 + if [ "${where}" != "${item}.${ext}" ]; then
1.58 + where="$( readlink "${where}" )"
1.59 + status=yes
1.60 + break 2;
1.61 + fi
1.62 + printf "no\n"
1.63 + done
1.64 done
1.65 if [ -z "${status}" ]; then
1.66 return 1
1.67 @@ -473,38 +484,31 @@
1.68 add_to_kconfig_list static_link_ok
1.69
1.70 # Library checks
1.71 +libs_exts="so dylib a"
1.72 +
1.73 ncurses_hdrs="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h"
1.74 -ncurses_libs="$( for l in ncursesw ncurses curses; do \
1.75 - for x in so a dylib; do \
1.76 - printf "lib$l.$x "; \
1.77 - done; \
1.78 - done \
1.79 - )"
1.80 +ncurses_libs="libncursesw libncurses libcurses"
1.81 has_or_abort lib="${ncurses_libs}" \
1.82 + lib_exts="${libs_exts}" \
1.83 inc="${ncurses_hdrs}" \
1.84 err="The 'ncurses' library is needed fo the menuconfig frontend"
1.85
1.86 -stdcxx_libs="$( for x in so dylib a; do \
1.87 - printf "libstdc++.$x "; \
1.88 - done \
1.89 - )"
1.90 -has_or_abort lib="${stdcxx_libs}" \
1.91 +has_or_abort lib="libstdc++" \
1.92 + lib_exts="${libs_exts}" \
1.93 err="The 'libstdc++' library is needed to build gcc"
1.94
1.95 # Yes, we may be checking twice for libstdc++.a
1.96 # The first is because we need one instance of libstdc++ (shared or static)
1.97 # because it is needed for PPL; the second is because the static version is
1.98 # required for static-linking, and if missing, the option is removed.
1.99 -has_or_warn lib="libstdc++.a" \
1.100 +has_or_warn lib="libstdc++" \
1.101 + lib_exts="a" \
1.102 err="static 'libstdc++' is needed to statically link the toolchain's executables" \
1.103 kconfig=has_static_libstdcxx
1.104
1.105 -expat_libs="$( for x in so dylib a; do \
1.106 - printf "libexpat.$x "; \
1.107 - done \
1.108 - )"
1.109 -has_or_warn inc="expat.h" \
1.110 - lib="${expat_libs}" \
1.111 +has_or_warn inc="expat.h" \
1.112 + lib="libexpat" \
1.113 + lib_exts="${libs_exts}" \
1.114 err="The 'expat' header file and library are needed to link cross-gdb's executables" \
1.115 kconfig=has_expat
1.116
1.117 @@ -512,19 +516,18 @@
1.118 # The first is because we need one instance of libexpat (shared or static)
1.119 # because it is needed for cross-gdb; the second is because the static version
1.120 # is required for static-linking, and if missing, the option is removed.
1.121 -has_or_warn lib="libexpat.a" \
1.122 +has_or_warn lib="libexpat" \
1.123 + lib_exts="a" \
1.124 err="static 'expat' is needed to statically link cross-gdb's executables" \
1.125 kconfig=has_static_expat
1.126
1.127 for v in 7 6 5 4; do
1.128 - python_incs="${python_incs}$( printf "python2.$v/Python.h " )"
1.129 - python_libs="${python_libs}$( for x in so dylib a; do \
1.130 - printf "libpython2.$v.$x "; \
1.131 - done \
1.132 - )"
1.133 + python_incs="${python_incs} python2.${v}/Python.h"
1.134 + python_libs="${python_libs} libpython2.${v}"
1.135 done
1.136 -has_or_warn inc="${python_incs}" \
1.137 - lib="${python_libs}" \
1.138 +has_or_warn inc="${python_incs}" \
1.139 + lib="${python_libs}" \
1.140 + lib_exts="${libs_exts}" \
1.141 err="The 'python' header file and library are needed for some features of cross-gdb"
1.142
1.143 #---------------------------------------------------------------------