4 printf "\033[31;1m%s\033[m\n" "$@"
8 default_prefix='/usr/local'
9 if echo "$PATH" | tr ':' '\n' | grep -qx "$HOME/.local/bin"; then
10 default_prefix="$HOME/.local"
13 printf '\033[1mChoose where to install Tomo (default: %s):\033[m ' "$default_prefix"
15 if [ -z "$PREFIX" ]; then PREFIX="$default_prefix"; fi
17 if ! echo "$PATH" | tr ':' '\n' | grep -qx "$PREFIX/bin"; then
18 error "Your \$PATH does not include this prefix, so you won't be able to run tomo!" \
19 "Please put this in your .profile or .bashrc: export PATH=\"$PREFIX/bin:\$PATH\""
22 if command -v doas >/dev/null; then
29 printf '\033[1mChoose which C compiler to use by default (default: %s):\033[m ' "$default_cc"
30 read -r DEFAULT_C_COMPILER
31 if [ -z "$DEFAULT_C_COMPILER" ]; then DEFAULT_C_COMPILER="cc"; fi
33 printf '\033[1mDo you want to build the compiler with Link Time Optimization (LTO)?\033[m\n\033[2m(This makes building the Tomo compiler slower, but makes running Tomo programs faster)\033[m\n\033[1m[y/N]\033[m '
35 if [ "$USE_LTO" = "y" ] || [ "$USE_LTO" = "Y" ]; then
36 if $DEFAULT_C_COMPILER -v 2>&1 | grep -q "gcc version"; then
37 LTO="-flto=auto -fno-fat-lto-objects -Wl,-flto";
38 elif $DEFAULT_C_COMPILER -v 2>&1 | grep -q "clang version"; then
45 DEFAULT_C_COMPILER=$DEFAULT_C_COMPILER