Do not invoke use_homebrew_readline twice

This commit is contained in:
Yamashita Yuu 2014-01-17 21:09:52 +09:00
parent 385d3337ef
commit badc8255ab

View File

@ -913,28 +913,37 @@ use_homebrew_yaml() {
fi fi
} }
has_broken_mac_readline() { configured_with_readline_dir() {
if [ "$(uname -s)" = "Darwin" ] && ! use_homebrew_readline; then # Mac OS X 10.4 has broken readline.
# MacOSX 10.4 has a broken readline.
# https://github.com/yyuu/pyenv/issues/23 # https://github.com/yyuu/pyenv/issues/23
local retval=1 local arg flag
local conftest="$BUILD_PATH/has_broken_mac_readline.h" for arg in ${CONFIGURE_OPTS} ${PYTHON_CONFIGURE_OPTS} "${PYTHON_CONFIGURE_OPTS_ARRAY[@]}"; do
echo "#include <readline/rlconf.h>" > "$conftest" if [[ "$arg" == "CPPFLAGS="* ]]; then
"${CPP:-cpp}" $CPPFLAGS "$conftest" 1>/dev/null 2>&1 || retval=0 for flag in ${CPPFLAGS} ${arg##CPPFLAGS=}; do
rm -f "$conftest" if [[ "$flag" == "-I"* ]] && [ -e "${flag##-I}/readline/rlconf.h" ]; then
return "$retval" return 0
else
return 1
fi fi
done
fi
done
return 1
}
has_broken_mac_readline() {
[ "$(uname -s)" = "Darwin" ] &&
! configured_with_readline_dir &&
! use_homebrew_readline
} }
use_homebrew_readline() { use_homebrew_readline() {
if ! configured_with_readline_dir; then
local libdir="$(brew --prefix readline 2>/dev/null || true)" local libdir="$(brew --prefix readline 2>/dev/null || true)"
if [ -d "$libdir" ]; then if [ -d "$libdir" ]; then
package_option python configure CPPFLAGS="-I$libdir/include" LDFLAGS="-L$libdir/lib" package_option python configure CPPFLAGS="-I$libdir/include" LDFLAGS="-L$libdir/lib"
else else
return 1 return 1
fi fi
fi
} }
has_broken_mac_openssl() { has_broken_mac_openssl() {