Skip to content

Instantly share code, notes, and snippets.

@yyuu
Created June 12, 2013 14:24
Show Gist options
  • Select an option

  • Save yyuu/5765731 to your computer and use it in GitHub Desktop.

Select an option

Save yyuu/5765731 to your computer and use it in GitHub Desktop.
verify if there is library function defined (like autoconf's AC_CHECK_LIB)
has_broken_mac_readline() {
# MacOSX 10.4 has a broken readline.
# https://github.com/yyuu/pyenv/issues/23
local retval=1
local conftest="$BUILD_PATH/has_broken_mac_readline.c"
if [ "$(uname -s)" = "Darwin" ]; then
cat <<EOF > "$conftest"
#ifdef __cplusplus
extern "C"
#endif
char rl_gnu_readline_p ();
int main() { return rl_gnu_readline_p (); return 0; }
EOF
{ "$CC" -o "/dev/null" $CFLAGS $CPPFLAGS $LDFLAGS "$conftest" -lreadline
} || retval=0
rm -f "$conftest"
fi
return "$retval"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment