[PATCH 4 of 4 v2] configure: do not test for static libs if static link is impossible
Yann E. MORIN
yann.morin.1998@anciens.enib.fr
Tue Jun 28 22:04:00 GMT 2011
configure | 43 +++++++++++++++++++++++++++++++------------
1 files changed, 31 insertions(+), 12 deletions(-)
# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
# Date 1309215153 -7200
# Node ID acd0a5d28a3a941dee8fa472d65dc1bed111a249
# Parent c1a75083d135ef092e9b5711a278fbca49d5b3c8
configure: do not test for static libs if static link is impossible
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -118,8 +118,15 @@
# the prog/inc/lib was found
# optional, defaults to none
# eg: kconfig=has_libncurses
+# $*: skip=[y|n|]
+# if set to 'y', skip the test, but still register the
+# kconfig and var variables; if 'n' or empty, do the
+# test.
+# optional, default to 'n'
+# eg: skip="${static_link_ko}"
check_for() {
local lib_exts
+ local skip
local val
local item
local where
@@ -130,7 +137,7 @@
# but declared by the caller (because it needs it)
for item in "${@}"; do
case "${item}" in
- prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*|lib_exts=*)
+ prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*|lib_exts=*|skip=*)
eval ${item%%=*}=\"${item#*=}\"
;;
*) do_error "check_for: incorrect parameters: '${item}'";;
@@ -146,19 +153,25 @@
::) do_error "check_for: [prog|inc|lib] is mandatory";;
esac
+ if [ -n "${var}" ]; then
+ add_to_var_list "${var}"
+ fi
if [ -n "${kconfig}" ]; then
add_to_kconfig_list "${kconfig}"
fi
+ if [ "${skip}" = "y" ]; then
+ return 0
+ fi
+
if [ -n "${prog}" ]; then
for item in ${prog}; do
printf "Checking for '${item}'... "
if [ -n "${var}" ]; then
eval val="\${${var}}"
if [ -n "${val}" ]; then
- printf "${val} (cached)\n"
- add_to_var_list "${var}"
- return 0
+ status="${val} (cached)\n"
+ break
fi
fi
where="$( which "${item}" 2>/dev/null )"
@@ -228,7 +241,6 @@
if [ -n "${var}" ]; then
eval ${var}='"'"${where}"'"'
- add_to_var_list "${var}"
fi
if [ -n "${kconfig}" ]; then
eval ${kconfig}=y
@@ -480,8 +492,10 @@
;;
esac
if [ "${static_link_ok}" = "y" ]; then
+ static_link_ko=""
printf "yes\n"
else
+ static_link_ko="y"
printf "no\n"
printf " * An optional host feature is missing, some features will be disabled\n"
printf " * It will not be possible to link binaries statically\n"
@@ -489,7 +503,10 @@
add_to_kconfig_list static_link_ok
# Library checks
-libs_exts="so dylib a"
+libs_exts="so dylib"
+if [ "${static_link_ok}" = "y" ]; then
+ libs_exts+=" a"
+fi
ncurses_hdrs="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h"
ncurses_libs="libncursesw libncurses libcurses"
@@ -506,10 +523,11 @@
# The first is because we need one instance of libstdc++ (shared or static)
# because it is needed for PPL; the second is because the static version is
# required for static-linking, and if missing, the option is removed.
-has_or_warn lib="libstdc++" \
- lib_exts="a" \
+has_or_warn lib="libstdc++" \
+ lib_exts="a" \
err="static 'libstdc++' is needed to statically link the toolchain's executables" \
- kconfig=has_static_libstdcxx
+ kconfig=has_static_libstdcxx \
+ skip="${static_link_ko}"
has_or_warn inc="expat.h" \
lib="libexpat" \
@@ -521,10 +539,11 @@
# The first is because we need one instance of libexpat (shared or static)
# because it is needed for cross-gdb; the second is because the static version
# is required for static-linking, and if missing, the option is removed.
-has_or_warn lib="libexpat" \
- lib_exts="a" \
+has_or_warn lib="libexpat" \
+ lib_exts="a" \
err="static 'expat' is needed to statically link cross-gdb's executables" \
- kconfig=has_static_expat
+ kconfig=has_static_expat \
+ skip="${static_link_ko}"
for v in 7 6 5 4; do
python_incs="${python_incs} python2.${v}/Python.h"
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list