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